Skip to content

Commit

Permalink
add automatic compat generator + more compat start
Browse files Browse the repository at this point in the history
  • Loading branch information
lumiscosity committed Jul 17, 2024
1 parent 0485996 commit 122743b
Show file tree
Hide file tree
Showing 282 changed files with 4,388 additions and 2 deletions.
205 changes: 205 additions & 0 deletions generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
from beet import JsonFile
import os

# Run this in the main project directory to generate files in ./src!
# To add new mods/planks, just use the dictionary below:
# the key is the mod name, and the value is a list of plank names.

compat_generated = {
"betterend": [
"dragon_tree",
"end_lotus",
"helix_tree",
"jellyshroom",
"lacugrove",
"lucernia",
"mossy_glowshroom",
"pythadendron",
"tenanea",
"umbrella_tree"
],
"betternether": [
"anchor_tree",
"mushroom_fir",
"nether_mushroom",
"nether_reed",
"nether_sakura",
"rubeus",
"stalagnate",
"wart_planks",
"willow_planks"
],
"biomesoplenty": [
"dead",
"empyreal",
"fir",
"hellbark",
"jacaranda",
"magic",
"mahogany",
"maple",
"palm",
"pine",
"redwood",
"umbran",
"willow"
],
"cinderscapes": [
"scorched",
"umbral"
],
"terrestria": [
"cypress",
"hemlock",
"japanese_maple",
"rainbow_eucalyptus",
"redwood",
"rubber",
"sakura",
"willow",
"yucca"
],
"traverse": [
"fir"
],
"wilderwild": [
"baobab",
"cypress",
"palm"
],
}


def save(file: JsonFile, path):
if not os.path.exists(os.path.dirname(path)):
os.makedirs(os.path.dirname(path))
file.dump(origin="./", path=path)


def add_treated_plank(m, n):
p = f"{n}_planks"
t = f"treated_{p}"

# recipe
file = {
"type": "minecraft:crafting_shaped",
"category": "building",
"group": "rounded:treated_planks",
"key": {
"#": {
"item": f"{m}:{p}"
},
"X": {
"item": "minecraft:honeycomb"
}
},
"pattern": [
"###",
"#X#",
"###"
],
"result": {
"count": 8,
"id": f"rounded:compat/{m}/{t}"
},
"fabric:load_conditions": [
{
"condition": "fabric:all_mods_loaded",
"values": [
f"{m}"
]
}
]
}
save(JsonFile(file), f"src/main/resources/data/rounded/recipe/compat/{m}/{t}")

# recipe advancement
file = {
"parent": "minecraft:recipes/root",
"criteria": {
"has_log": {
"conditions": {
"items": [
{
"items": "minecraft:honeycomb"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": f"rounded:compat/{m}/{t}"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_log"
]
],
"rewards": {
"recipes": [
f"rounded:compat/{m}/{t}"
]
},
"fabric:load_conditions": [
{
"condition": "fabric:all_mods_loaded",
"values": [
f"{m}"
]
}
]
}
save(JsonFile(file), f"src/main/resources/data/rounded/advancement/recipes/building_blocks/compat/{m}/{t}")

# item tag
file = JsonFile(source_path="src/main/resources/data/rounded/tags/item/treated_planks.json").data
print(file)
file["values"].append(
{
"required": False,
"id": f"rounded:compat/{m}/{t}"
}
)
JsonFile(file).dump(origin="./", path="src/main/resources/data/rounded/tags/item/treated_planks.json")

# blockstate
file = {
"variants": {
"": {
"model": f"rounded:block/compat/{m}/{t}"
}
}
}
save(JsonFile(file), f"src/client/resources/assets/rounded/blockstates/compat/{m}/{t}")

# block model
file = {
"parent": "minecraft:block/cube_all",
"textures": {
"all": f"rounded:block/compat/{m}/{t}"
}
}
save(JsonFile(file), f"src/client/resources/assets/rounded/models/block/compat/{m}/{t}")

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

# language key
# TODO: add automatic ripping for other languages, if they are present
# both in rounded and in the source mod
file = JsonFile(source_path="src/client/resources/assets/rounded/lang/en_us.json").data
file[f"block.rounded.compat.{m}.{t}"] = f"{t.replace("_", " ").title()}"
JsonFile(file).dump(origin="./", path="src/client/resources/assets/rounded/lang/en_us.json")


for i in compat_generated.keys():
for j in compat_generated[i]:
add_treated_plank(i, j)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ yarn_mappings=1.21+build.2
loader_version=0.15.11

# Mod Properties
mod_version=1.0.3
mod_version=1.0.4
maven_group=com.lumiscosity.rounded
archives_base_name=rounded

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betterend/treated_end_lotus_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betterend/treated_helix_tree_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betterend/treated_jellyshroom_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betterend/treated_lacugrove_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betterend/treated_lucernia_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betterend/treated_mossy_glowshroom_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betterend/treated_pythadendron_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betterend/treated_tenanea_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betterend/treated_umbrella_tree_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betternether/treated_anchor_tree_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betternether/treated_mushroom_fir_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betternether/treated_nether_mushroom_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betternether/treated_nether_reed_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betternether/treated_nether_sakura_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betternether/treated_rubeus_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betternether/treated_stalagnate_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betternether/treated_wart_planks_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/betternether/treated_willow_planks_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/biomesoplenty/treated_dead_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/biomesoplenty/treated_empyreal_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/biomesoplenty/treated_fir_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/biomesoplenty/treated_hellbark_planks"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "rounded:block/compat/biomesoplenty/treated_jacaranda_planks"
}
}
}
Loading

0 comments on commit 122743b

Please sign in to comment.