Skip to content

Commit 122743b

Browse files
committed
add automatic compat generator + more compat start
1 parent 0485996 commit 122743b

File tree

282 files changed

+4388
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

282 files changed

+4388
-2
lines changed

generator.py

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
from beet import JsonFile
2+
import os
3+
4+
# Run this in the main project directory to generate files in ./src!
5+
# To add new mods/planks, just use the dictionary below:
6+
# the key is the mod name, and the value is a list of plank names.
7+
8+
compat_generated = {
9+
"betterend": [
10+
"dragon_tree",
11+
"end_lotus",
12+
"helix_tree",
13+
"jellyshroom",
14+
"lacugrove",
15+
"lucernia",
16+
"mossy_glowshroom",
17+
"pythadendron",
18+
"tenanea",
19+
"umbrella_tree"
20+
],
21+
"betternether": [
22+
"anchor_tree",
23+
"mushroom_fir",
24+
"nether_mushroom",
25+
"nether_reed",
26+
"nether_sakura",
27+
"rubeus",
28+
"stalagnate",
29+
"wart_planks",
30+
"willow_planks"
31+
],
32+
"biomesoplenty": [
33+
"dead",
34+
"empyreal",
35+
"fir",
36+
"hellbark",
37+
"jacaranda",
38+
"magic",
39+
"mahogany",
40+
"maple",
41+
"palm",
42+
"pine",
43+
"redwood",
44+
"umbran",
45+
"willow"
46+
],
47+
"cinderscapes": [
48+
"scorched",
49+
"umbral"
50+
],
51+
"terrestria": [
52+
"cypress",
53+
"hemlock",
54+
"japanese_maple",
55+
"rainbow_eucalyptus",
56+
"redwood",
57+
"rubber",
58+
"sakura",
59+
"willow",
60+
"yucca"
61+
],
62+
"traverse": [
63+
"fir"
64+
],
65+
"wilderwild": [
66+
"baobab",
67+
"cypress",
68+
"palm"
69+
],
70+
}
71+
72+
73+
def save(file: JsonFile, path):
74+
if not os.path.exists(os.path.dirname(path)):
75+
os.makedirs(os.path.dirname(path))
76+
file.dump(origin="./", path=path)
77+
78+
79+
def add_treated_plank(m, n):
80+
p = f"{n}_planks"
81+
t = f"treated_{p}"
82+
83+
# recipe
84+
file = {
85+
"type": "minecraft:crafting_shaped",
86+
"category": "building",
87+
"group": "rounded:treated_planks",
88+
"key": {
89+
"#": {
90+
"item": f"{m}:{p}"
91+
},
92+
"X": {
93+
"item": "minecraft:honeycomb"
94+
}
95+
},
96+
"pattern": [
97+
"###",
98+
"#X#",
99+
"###"
100+
],
101+
"result": {
102+
"count": 8,
103+
"id": f"rounded:compat/{m}/{t}"
104+
},
105+
"fabric:load_conditions": [
106+
{
107+
"condition": "fabric:all_mods_loaded",
108+
"values": [
109+
f"{m}"
110+
]
111+
}
112+
]
113+
}
114+
save(JsonFile(file), f"src/main/resources/data/rounded/recipe/compat/{m}/{t}")
115+
116+
# recipe advancement
117+
file = {
118+
"parent": "minecraft:recipes/root",
119+
"criteria": {
120+
"has_log": {
121+
"conditions": {
122+
"items": [
123+
{
124+
"items": "minecraft:honeycomb"
125+
}
126+
]
127+
},
128+
"trigger": "minecraft:inventory_changed"
129+
},
130+
"has_the_recipe": {
131+
"conditions": {
132+
"recipe": f"rounded:compat/{m}/{t}"
133+
},
134+
"trigger": "minecraft:recipe_unlocked"
135+
}
136+
},
137+
"requirements": [
138+
[
139+
"has_the_recipe",
140+
"has_log"
141+
]
142+
],
143+
"rewards": {
144+
"recipes": [
145+
f"rounded:compat/{m}/{t}"
146+
]
147+
},
148+
"fabric:load_conditions": [
149+
{
150+
"condition": "fabric:all_mods_loaded",
151+
"values": [
152+
f"{m}"
153+
]
154+
}
155+
]
156+
}
157+
save(JsonFile(file), f"src/main/resources/data/rounded/advancement/recipes/building_blocks/compat/{m}/{t}")
158+
159+
# item tag
160+
file = JsonFile(source_path="src/main/resources/data/rounded/tags/item/treated_planks.json").data
161+
print(file)
162+
file["values"].append(
163+
{
164+
"required": False,
165+
"id": f"rounded:compat/{m}/{t}"
166+
}
167+
)
168+
JsonFile(file).dump(origin="./", path="src/main/resources/data/rounded/tags/item/treated_planks.json")
169+
170+
# blockstate
171+
file = {
172+
"variants": {
173+
"": {
174+
"model": f"rounded:block/compat/{m}/{t}"
175+
}
176+
}
177+
}
178+
save(JsonFile(file), f"src/client/resources/assets/rounded/blockstates/compat/{m}/{t}")
179+
180+
# block model
181+
file = {
182+
"parent": "minecraft:block/cube_all",
183+
"textures": {
184+
"all": f"rounded:block/compat/{m}/{t}"
185+
}
186+
}
187+
save(JsonFile(file), f"src/client/resources/assets/rounded/models/block/compat/{m}/{t}")
188+
189+
# item model
190+
file = {
191+
"parent": f"rounded:block/compat/{m}/{t}"
192+
}
193+
save(JsonFile(file), f"src/client/resources/assets/rounded/models/item/compat/{m}/{t}")
194+
195+
# language key
196+
# TODO: add automatic ripping for other languages, if they are present
197+
# both in rounded and in the source mod
198+
file = JsonFile(source_path="src/client/resources/assets/rounded/lang/en_us.json").data
199+
file[f"block.rounded.compat.{m}.{t}"] = f"{t.replace("_", " ").title()}"
200+
JsonFile(file).dump(origin="./", path="src/client/resources/assets/rounded/lang/en_us.json")
201+
202+
203+
for i in compat_generated.keys():
204+
for j in compat_generated[i]:
205+
add_treated_plank(i, j)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ yarn_mappings=1.21+build.2
1010
loader_version=0.15.11
1111

1212
# Mod Properties
13-
mod_version=1.0.3
13+
mod_version=1.0.4
1414
maven_group=com.lumiscosity.rounded
1515
archives_base_name=rounded
1616

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "rounded:block/compat/betterend/treated_end_lotus_planks"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "rounded:block/compat/betterend/treated_helix_tree_planks"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "rounded:block/compat/betterend/treated_jellyshroom_planks"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "rounded:block/compat/betterend/treated_lacugrove_planks"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "rounded:block/compat/betterend/treated_lucernia_planks"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "rounded:block/compat/betterend/treated_mossy_glowshroom_planks"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "rounded:block/compat/betterend/treated_pythadendron_planks"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "rounded:block/compat/betterend/treated_tenanea_planks"
5+
}
6+
}
7+
}

0 commit comments

Comments
 (0)