Skip to content

Commit

Permalink
compat
Browse files Browse the repository at this point in the history
  • Loading branch information
lumiscosity committed Jul 19, 2024
1 parent 5b9f470 commit 3d3fc65
Show file tree
Hide file tree
Showing 302 changed files with 1,982 additions and 316 deletions.
86 changes: 69 additions & 17 deletions generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"nether_sakura",
"rubeus",
"stalagnate",
"wart_planks",
"willow_planks"
"wart",
"willow"
],
"biomesoplenty": [
"dead",
Expand Down Expand Up @@ -57,7 +57,7 @@
"rubber",
"sakura",
"willow",
"yucca"
"yucca_palm"
],
"traverse": [
"fir"
Expand All @@ -69,6 +69,12 @@
],
}

# some mods return empty block settings, so we force them to use oak plank data instead:
naughty_mod_corner = [
"terrestria",
"traverse",
"wilderwild"
]

def save(file: JsonFile, path):
if not os.path.exists(os.path.dirname(path)):
Expand Down Expand Up @@ -111,7 +117,7 @@ def add_treated_plank(m, n):
}
]
}
save(JsonFile(file), f"src/main/resources/data/rounded/recipes/compat/{m}/{t}")
save(JsonFile(file), f"src/main/resources/data/rounded/recipes/compat/{m}/{t}.json")

# recipe advancement
file = {
Expand Down Expand Up @@ -154,19 +160,56 @@ def add_treated_plank(m, n):
}
]
}
save(JsonFile(file), f"src/main/resources/data/rounded/advancements/recipes/building_blocks/compat/{m}/{t}")
save(JsonFile(file), f"src/main/resources/data/rounded/advancements/recipes/building_blocks/compat/{m}/{t}.json")

# item tag
file = JsonFile(source_path="src/main/resources/data/rounded/tags/items/treated_planks.json").data
# loot table
file = {
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": f"rounded:compat/{m}/{t}"
}
],
"rolls": 1.0
}
],
"random_sequence": f"rounded:blocks/compat/{m}/{t}",
"fabric:load_conditions": [
{
"condition": "fabric:all_mods_loaded",
"values": [
f"{m}"
]
}
]
}
save(JsonFile(file), f"src/main/resources/data/rounded/loot_tables/blocks/compat/{m}/{t}.json")

# tags
tag = {
"required": False,
"id": f"rounded:compat/{m}/{t}"
}

file = JsonFile(source_path="src/main/resources/data/rounded/tags/items/treated_planks.json").data
if tag not in file["values"]:
file["values"].append(tag)
JsonFile(file).dump(origin="./", path="src/main/resources/data/rounded/tags/items/treated_planks.json")

file = JsonFile(source_path="src/main/resources/data/minecraft/tags/blocks/mineable/axe.json").data
if tag not in file["values"]:
file["values"].append(tag)
JsonFile(file).dump(origin="./", path="src/main/resources/data/minecraft/tags/blocks/mineable/axe.json")

# blockstate
file = {
"variants": {
Expand All @@ -175,7 +218,7 @@ def add_treated_plank(m, n):
}
}
}
save(JsonFile(file), f"src/client/resources/assets/rounded/blockstates/compat/{m}/{t}")
save(JsonFile(file), f"src/client/resources/assets/rounded/blockstates/compat/{m}/{t}.json")

# block model
file = {
Expand All @@ -184,13 +227,13 @@ def add_treated_plank(m, n):
"all": f"rounded:block/compat/{m}/{t}"
}
}
save(JsonFile(file), f"src/client/resources/assets/rounded/models/block/compat/{m}/{t}")
save(JsonFile(file), f"src/client/resources/assets/rounded/models/block/compat/{m}/{t}.json")

# item model
file = {
"parent": f"rounded:block/compat/{m}/{t}"
}
save(JsonFile(file), f"src/client/resources/assets/rounded/models/item/compat/{m}/{t}")
save(JsonFile(file), f"src/client/resources/assets/rounded/models/item/compat/{m}/{t}.json")

# language key
# TODO: add automatic ripping for other languages, if they are present
Expand Down Expand Up @@ -219,13 +262,22 @@ def add_treated_plank_code(m, l):
p = f"{i}_planks"
t = f"treated_{p}"

file += f"""
public static final Block {t.upper()} = new Block(
AbstractBlock.Settings.copy(Registries.BLOCK.get(Identifier.of("{m}", "{p}")))
);
public static final Item {t.upper()}_ITEM = new BlockItem({t.upper()}, new Item.Settings());
"""
if m in naughty_mod_corner:
file += f"""
public static final Block {t.upper()} = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("minecraft", "oak_planks")))
);
public static final Item {t.upper()}_ITEM = new BlockItem({t.upper()}, new Item.Settings());
"""
else:
file += f"""
public static final Block {t.upper()} = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("{m}", "{p}")))
);
public static final Item {t.upper()}_ITEM = new BlockItem({t.upper()}, new Item.Settings());
"""

file += " public static void register() {"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betternether/treated_wart_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betternether/treated_willow_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/terrestria/treated_yucca_palm_planks"
}
}
}
5 changes: 4 additions & 1 deletion src/client/resources/assets/rounded/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@
"block.rounded.compat.traverse.treated_fir_planks": "Treated Fir Planks",
"block.rounded.compat.wilderwild.treated_baobab_planks": "Treated Baobab Planks",
"block.rounded.compat.wilderwild.treated_cypress_planks": "Treated Cypress Planks",
"block.rounded.compat.wilderwild.treated_palm_planks": "Treated Palm Planks"
"block.rounded.compat.wilderwild.treated_palm_planks": "Treated Palm Planks",
"block.rounded.compat.betternether.treated_wart_planks": "Treated Wart Planks",
"block.rounded.compat.betternether.treated_willow_planks": "Treated Willow Planks",
"block.rounded.compat.terrestria.treated_yucca_palm_planks": "Treated Yucca Palm Planks"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "rounded:block/compat/betternether/treated_wart_planks"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "rounded:block/compat/betternether/treated_willow_planks"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "rounded:block/compat/terrestria/treated_yucca_palm_planks"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "rounded:block/compat/betternether/treated_wart_planks"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "rounded:block/compat/betternether/treated_willow_planks"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "rounded:block/compat/terrestria/treated_yucca_palm_planks"
}
120 changes: 60 additions & 60 deletions src/main/java/com/lumiscosity/rounded/compat/BetterendCompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,66 @@
import static com.lumiscosity.rounded.blocks.RegisterBlocks.register_treated_plank;

public class BetterendCompat {
public static final Block TREATED_DRAGON_TREE_PLANKS = new Block(
AbstractBlock.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "dragon_tree_planks")))
);
public static final Item TREATED_DRAGON_TREE_PLANKS_ITEM = new BlockItem(TREATED_DRAGON_TREE_PLANKS, new Item.Settings());


public static final Block TREATED_END_LOTUS_PLANKS = new Block(
AbstractBlock.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "end_lotus_planks")))
);
public static final Item TREATED_END_LOTUS_PLANKS_ITEM = new BlockItem(TREATED_END_LOTUS_PLANKS, new Item.Settings());


public static final Block TREATED_HELIX_TREE_PLANKS = new Block(
AbstractBlock.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "helix_tree_planks")))
);
public static final Item TREATED_HELIX_TREE_PLANKS_ITEM = new BlockItem(TREATED_HELIX_TREE_PLANKS, new Item.Settings());


public static final Block TREATED_JELLYSHROOM_PLANKS = new Block(
AbstractBlock.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "jellyshroom_planks")))
);
public static final Item TREATED_JELLYSHROOM_PLANKS_ITEM = new BlockItem(TREATED_JELLYSHROOM_PLANKS, new Item.Settings());


public static final Block TREATED_LACUGROVE_PLANKS = new Block(
AbstractBlock.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "lacugrove_planks")))
);
public static final Item TREATED_LACUGROVE_PLANKS_ITEM = new BlockItem(TREATED_LACUGROVE_PLANKS, new Item.Settings());


public static final Block TREATED_LUCERNIA_PLANKS = new Block(
AbstractBlock.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "lucernia_planks")))
);
public static final Item TREATED_LUCERNIA_PLANKS_ITEM = new BlockItem(TREATED_LUCERNIA_PLANKS, new Item.Settings());


public static final Block TREATED_MOSSY_GLOWSHROOM_PLANKS = new Block(
AbstractBlock.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "mossy_glowshroom_planks")))
);
public static final Item TREATED_MOSSY_GLOWSHROOM_PLANKS_ITEM = new BlockItem(TREATED_MOSSY_GLOWSHROOM_PLANKS, new Item.Settings());


public static final Block TREATED_PYTHADENDRON_PLANKS = new Block(
AbstractBlock.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "pythadendron_planks")))
);
public static final Item TREATED_PYTHADENDRON_PLANKS_ITEM = new BlockItem(TREATED_PYTHADENDRON_PLANKS, new Item.Settings());


public static final Block TREATED_TENANEA_PLANKS = new Block(
AbstractBlock.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "tenanea_planks")))
);
public static final Item TREATED_TENANEA_PLANKS_ITEM = new BlockItem(TREATED_TENANEA_PLANKS, new Item.Settings());


public static final Block TREATED_UMBRELLA_TREE_PLANKS = new Block(
AbstractBlock.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "umbrella_tree_planks")))
);
public static final Item TREATED_UMBRELLA_TREE_PLANKS_ITEM = new BlockItem(TREATED_UMBRELLA_TREE_PLANKS, new Item.Settings());

public static void register() { register_treated_plank("compat/betterend/treated_dragon_tree_planks", TREATED_DRAGON_TREE_PLANKS, TREATED_DRAGON_TREE_PLANKS_ITEM, "betterend", "dragon_tree");
public static final Block TREATED_DRAGON_TREE_PLANKS = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "dragon_tree_planks")))
);
public static final Item TREATED_DRAGON_TREE_PLANKS_ITEM = new BlockItem(TREATED_DRAGON_TREE_PLANKS, new Item.Settings());
public static final Block TREATED_END_LOTUS_PLANKS = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "end_lotus_planks")))
);
public static final Item TREATED_END_LOTUS_PLANKS_ITEM = new BlockItem(TREATED_END_LOTUS_PLANKS, new Item.Settings());
public static final Block TREATED_HELIX_TREE_PLANKS = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "helix_tree_planks")))
);
public static final Item TREATED_HELIX_TREE_PLANKS_ITEM = new BlockItem(TREATED_HELIX_TREE_PLANKS, new Item.Settings());
public static final Block TREATED_JELLYSHROOM_PLANKS = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "jellyshroom_planks")))
);
public static final Item TREATED_JELLYSHROOM_PLANKS_ITEM = new BlockItem(TREATED_JELLYSHROOM_PLANKS, new Item.Settings());
public static final Block TREATED_LACUGROVE_PLANKS = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "lacugrove_planks")))
);
public static final Item TREATED_LACUGROVE_PLANKS_ITEM = new BlockItem(TREATED_LACUGROVE_PLANKS, new Item.Settings());
public static final Block TREATED_LUCERNIA_PLANKS = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "lucernia_planks")))
);
public static final Item TREATED_LUCERNIA_PLANKS_ITEM = new BlockItem(TREATED_LUCERNIA_PLANKS, new Item.Settings());
public static final Block TREATED_MOSSY_GLOWSHROOM_PLANKS = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "mossy_glowshroom_planks")))
);
public static final Item TREATED_MOSSY_GLOWSHROOM_PLANKS_ITEM = new BlockItem(TREATED_MOSSY_GLOWSHROOM_PLANKS, new Item.Settings());
public static final Block TREATED_PYTHADENDRON_PLANKS = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "pythadendron_planks")))
);
public static final Item TREATED_PYTHADENDRON_PLANKS_ITEM = new BlockItem(TREATED_PYTHADENDRON_PLANKS, new Item.Settings());
public static final Block TREATED_TENANEA_PLANKS = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "tenanea_planks")))
);
public static final Item TREATED_TENANEA_PLANKS_ITEM = new BlockItem(TREATED_TENANEA_PLANKS, new Item.Settings());
public static final Block TREATED_UMBRELLA_TREE_PLANKS = new Block(
Block.Settings.copy(Registries.BLOCK.get(Identifier.of("betterend", "umbrella_tree_planks")))
);
public static final Item TREATED_UMBRELLA_TREE_PLANKS_ITEM = new BlockItem(TREATED_UMBRELLA_TREE_PLANKS, new Item.Settings());
public static void register() { register_treated_plank("compat/betterend/treated_dragon_tree_planks", TREATED_DRAGON_TREE_PLANKS, TREATED_DRAGON_TREE_PLANKS_ITEM, "betterend", "dragon_tree");
register_treated_plank("compat/betterend/treated_end_lotus_planks", TREATED_END_LOTUS_PLANKS, TREATED_END_LOTUS_PLANKS_ITEM, "betterend", "end_lotus");
register_treated_plank("compat/betterend/treated_helix_tree_planks", TREATED_HELIX_TREE_PLANKS, TREATED_HELIX_TREE_PLANKS_ITEM, "betterend", "helix_tree");
register_treated_plank("compat/betterend/treated_jellyshroom_planks", TREATED_JELLYSHROOM_PLANKS, TREATED_JELLYSHROOM_PLANKS_ITEM, "betterend", "jellyshroom");
Expand Down
Loading

0 comments on commit 3d3fc65

Please sign in to comment.