Skip to content

Commit a0e7d40

Browse files
authored
Update to 1.21.4 (Gamemode4Dev#1077)
* Add 1.21.4 to test workflow matrix * Update versions and pack formats * Remove unnecessary short_grass backwards compatibility * Remove reliance on tall_flowers block tag * Use 1.21.3 for auto crafting script * Use 1.21.3 for standard crafting script * Exclude pale_oak in double doors * Upgrade custom model data mecha rules to 1.21.4 * Fix custom model data values that are not using string references * Exclude 3 item tags that were removed in 1.21.4 * Also exclude item tags from check_item_tags mcfunction * Rename furnace NBT fields * Backport furnace fields * Update backwards plugin to account for overlay files * Rename all instances of overlay_48 to backport_48 * Backport custom model data syntax * Remove debug message * Update biome extensions lib * Add overlay info to biome extensions * Move pale garden json files to "since_61" overlay * Allow dangerous dungeons to spawn in the pale garden * Update base tags with new blocks and entities * Modernize podzol rooting soil * Fix plantable block tag in 1.21.1 * Enable pale oak and resin in standard crafting * Fix some bugs introduced in the 1.20.5/1.21 update * Add pale oak boat support to vecto shamir * Modernize soul glass by using components in the blasting recipe * Simplify some holding_item predicates
1 parent 7a89373 commit a0e7d40

File tree

1,896 files changed

+18368
-703
lines changed

Some content is hidden

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

1,896 files changed

+18368
-703
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ jobs:
112112
fabric_server_url: https://meta.fabricmc.net/v2/versions/loader/1.21.3/0.16.7/1.0.1/server/jar
113113
fabric_api_url: https://cdn.modrinth.com/data/P7dR8mSH/versions/dhD4I4lJ/fabric-api-0.106.1%2B1.21.3.jar
114114
packtest_url: https://cdn.modrinth.com/data/XsKUhp45/versions/wjOUK14F/packtest-1.9-mc1.21.2.jar
115+
- version: '1.21.4'
116+
fabric_server_url: https://meta.fabricmc.net/v2/versions/loader/1.21.4-rc1/0.16.9/1.0.1/server/jar
117+
fabric_api_url: https://cdn.modrinth.com/data/P7dR8mSH/versions/X7o8njVT/fabric-api-0.110.2%2B1.21.4.jar
118+
packtest_url: https://cdn.modrinth.com/data/XsKUhp45/versions/owHaqexZ/packtest-1.10-beta1-mc1.21.4.jar
115119
name: 'test-${{ matrix.version }}'
116120
runs-on: ubuntu-24.04
117121
steps:

base/data/gm4/advancement/intro_song/welcome_toast.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
"icon": {
44
"id": "minecraft:command_block",
55
"components": {
6-
"minecraft:custom_model_data": 3420001
6+
"minecraft:custom_model_data": {
7+
"floats": [
8+
3420001
9+
]
10+
}
711
}
812
},
913
"title": {

base/data/gm4/tags/block/foliage.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"values": [
33
"#minecraft:small_flowers",
4-
"#minecraft:tall_flowers",
4+
"minecraft:sunflower",
5+
"minecraft:lilac",
6+
"minecraft:peony",
7+
"minecraft:rose_bush",
8+
"minecraft:pitcher_plant",
59
"minecraft:azalea",
610
"minecraft:flowering_azalea",
711
"minecraft:big_dripleaf",
@@ -14,13 +18,14 @@
1418
"minecraft:dead_bush",
1519
"minecraft:fern",
1620
"minecraft:glow_lichen",
17-
{ "id": "minecraft:grass", "required": false },
18-
{ "id": "minecraft:short_grass", "required": false },
21+
"minecraft:short_grass",
1922
"minecraft:hanging_roots",
2023
"minecraft:large_fern",
2124
"minecraft:mangrove_propagule",
2225
"minecraft:moss_carpet",
2326
"minecraft:nether_sprouts",
27+
{ "id": "minecraft:pale_hanging_moss", "required": false },
28+
{ "id": "minecraft:pale_moss_carpet", "required": false },
2429
"minecraft:pink_petals",
2530
"minecraft:red_mushroom",
2631
"minecraft:small_dripleaf",

base/data/gm4/tags/block/full_collision.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"minecraft:chiseled_polished_blackstone",
5555
"minecraft:chiseled_quartz_block",
5656
"minecraft:chiseled_red_sandstone",
57+
{ "id": "minecraft:chiseled_resin_bricks", "required": false },
5758
"minecraft:chiseled_sandstone",
5859
"minecraft:chiseled_stone_bricks",
5960
"minecraft:chiseled_tuff",
@@ -74,6 +75,7 @@
7475
"minecraft:cracked_stone_bricks",
7576
"minecraft:crafter",
7677
"minecraft:crafting_table",
78+
{ "id": "minecraft:creaking_heart", "required": false },
7779
"minecraft:crimson_nylium",
7880
"minecraft:crying_obsidian",
7981
"minecraft:cut_copper",
@@ -255,6 +257,8 @@
255257
"minecraft:redstone_ore",
256258
"minecraft:reinforced_deepslate",
257259
"minecraft:repeating_command_block",
260+
{ "id": "minecraft:resin_block", "required": false },
261+
{ "id": "minecraft:resin_bricks", "required": false },
258262
"minecraft:respawn_anchor",
259263
"minecraft:sand",
260264
"minecraft:sandstone",

base/data/gm4/tags/block/no_collision.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
"#minecraft:rails",
1414
"#minecraft:signs",
1515
"#minecraft:small_flowers",
16-
"#minecraft:tall_flowers",
16+
"minecraft:sunflower",
17+
"minecraft:lilac",
18+
"minecraft:peony",
19+
"minecraft:rose_bush",
20+
"minecraft:pitcher_plant",
1721
"#minecraft:wall_corals",
1822
"minecraft:acacia_sapling",
1923
"minecraft:attached_melon_stem",
@@ -48,8 +52,7 @@
4852
"minecraft:fern",
4953
"minecraft:frogspawn",
5054
"minecraft:glow_lichen",
51-
{ "id": "minecraft:grass", "required": false },
52-
{ "id": "minecraft:short_grass", "required": false },
55+
"minecraft:short_grass",
5356
"minecraft:hanging_roots",
5457
"minecraft:jungle_sapling",
5558
"minecraft:ladder",
@@ -61,6 +64,8 @@
6164
"minecraft:nether_sprouts",
6265
"minecraft:nether_wart",
6366
"minecraft:oak_sapling",
67+
{ "id": "minecraft:pale_hanging_moss", "required": false },
68+
{ "id": "minecraft:pale_oak_sapling", "required": false },
6469
"minecraft:pink_petals",
6570
"minecraft:powder_snow",
6671
"minecraft:red_mushroom",

base/data/gm4/tags/block/replaceable.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"minecraft:dead_bush",
88
"minecraft:fern",
99
"minecraft:glow_lichen",
10-
{ "id": "minecraft:grass", "required": false },
11-
{ "id": "minecraft:short_grass", "required": false },
10+
"minecraft:short_grass",
1211
"minecraft:hanging_roots",
1312
"minecraft:large_fern",
1413
"minecraft:lava",
1514
"minecraft:light",
1615
"minecraft:nether_sprouts",
16+
{ "id": "minecraft:resin_clump", "required": false },
1717
"minecraft:sculk_vein",
1818
"minecraft:seagrass",
1919
"minecraft:snow",

base/data/gm4/tags/block/waterloggable.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"minecraft:pointed_dripstone",
6060
"minecraft:purple_stained_glass_pane",
6161
"minecraft:red_stained_glass_pane",
62+
{ "id": "minecraft:resin_clump", "required": false },
6263
"minecraft:scaffolding",
6364
"minecraft:sculk_sensor",
6465
"minecraft:sculk_vein",

base/data/gm4/tags/entity_type/neutral_hostile.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"values": [
33
"minecraft:cave_spider",
4+
{ "id": "minecraft:creaking", "required": false },
45
"minecraft:drowned",
56
"minecraft:enderman",
67
"minecraft:piglin",

gm4/plugins/backwards.py

Lines changed: 118 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,58 @@
11
import re
22
import logging
3-
from typing import Any
4-
from beet import Context, TextFileBase, Recipe
3+
from typing import Any, Tuple, Callable
4+
from beet import Context, Pack, TextFileBase, Recipe, Function, NamespaceFile
5+
from beet.core.utils import SupportedFormats
56

67
logger = logging.getLogger("gm4.backwards")
78

89
# Generates overlays to support older versions
910
def beet_default(ctx: Context):
1011
yield
1112

12-
rewrite_attributes(ctx)
13-
rewrite_recipes(ctx)
13+
# backporting to 1.21.3 (57)
14+
backport(ctx.data, 57, rewrite_furnace_nbt)
15+
backport(ctx.data, 57, rewrite_custom_model_data)
16+
17+
# backporting to 1.21.1 (48)
18+
backport(ctx.data, 48, rewrite_attributes)
19+
backport(ctx.data, 48, rewrite_recipe)
20+
21+
22+
FURNACE_RENAMES = {
23+
"cooking_time_spent": "CookTime",
24+
"cooking_total_time": "CookTimeTotal",
25+
"lit_time_remaining": "BurnTime",
26+
"lit_total_time": None,
27+
}
28+
29+
def rewrite_furnace_nbt(id: str, resource: NamespaceFile):
30+
if not isinstance(resource, Function):
31+
return None
32+
text = resource.text
33+
for src_field, overlay_field in FURNACE_RENAMES.items():
34+
if overlay_field is None:
35+
if re.match("\\b" + src_field + "\\b", text):
36+
logger.error(f"Cannot backport furnace field {src_field} in function {id}")
37+
else:
38+
text = re.sub("\\b" + src_field + "\\b", overlay_field, text)
39+
if text == resource.text:
40+
return None
41+
overlay = resource.copy()
42+
overlay.text = text
43+
return overlay
44+
45+
46+
def rewrite_custom_model_data(id: str, resource: NamespaceFile):
47+
if not isinstance(resource, TextFileBase):
48+
return None
49+
text = resource.text
50+
text = re.sub(r"\{\s*[\"']?floats[\"']?\s*:\s*\[\s*(\d+)[Ff]?\s*\]\s*\}", r"\1", text)
51+
if text == resource.text:
52+
return None
53+
overlay = resource.copy()
54+
overlay.text = text
55+
return overlay
1456

1557

1658
ATTRIBUTES_RENAMES = {
@@ -49,63 +91,87 @@ def beet_default(ctx: Context):
4991
}
5092

5193
# Removes the generic. and other prefixes from attribute IDs
52-
def rewrite_attributes(ctx: Context):
53-
for id, resource in ctx.data.all():
54-
if isinstance(resource, TextFileBase):
55-
resource.source_stop
56-
overlay_text = resource.text
57-
for src_attribute, overlay_attribute in ATTRIBUTES_RENAMES.items():
58-
overlay_text = re.sub("\\b" + src_attribute + "\\b", overlay_attribute, overlay_text)
59-
if overlay_text != resource.text:
60-
overlay_resource = resource.copy()
61-
overlay_resource.text = overlay_text
62-
overlay = ctx.data.overlays["overlay_48"]
63-
overlay.supported_formats = { "min_inclusive": 48, "max_inclusive": 48 }
64-
overlay[id] = overlay_resource
94+
def rewrite_attributes(id: str, resource: NamespaceFile):
95+
if not isinstance(resource, TextFileBase):
96+
return None
97+
text = resource.text
98+
for src_attribute, overlay_attribute in ATTRIBUTES_RENAMES.items():
99+
text = re.sub("\\b" + src_attribute + "\\b", overlay_attribute, text)
100+
if text == resource.text:
101+
return None
102+
overlay = resource.copy()
103+
overlay.text = text
104+
return overlay
65105

66106

67107
# Rewrites the recipe ingredients to the old {"item": "..."} format
68-
def rewrite_recipes(ctx: Context):
108+
def rewrite_recipe(id: str, resource: NamespaceFile):
109+
if not isinstance(resource, Recipe):
110+
return None
69111

70112
def rewrite_ingredient(ingr: str | list[str]) -> Any:
71113
if isinstance(ingr, list):
72114
return [rewrite_ingredient(item) for item in ingr]
73115
if ingr.startswith("#"):
74116
return { "tag": ingr[1:] }
75117
return { "item": ingr }
76-
77-
def rewrite_recipe(id: str, resource: Recipe):
78-
# If an overlay already exists for this recipe, us the contents of that
79-
# TODO: generalize this for all rewrite functions and handle multiple overlays
80-
for overlay in ctx.data.overlays.values():
81-
if id in overlay.recipes:
82-
resource = overlay.recipes[id]
83-
break
84-
85-
overlay_resource = resource.copy()
86-
data = overlay_resource.data
87-
88-
if "crafting_transmute" in data["type"]:
89-
logger.warning(f"Cannot backport crafting_transmute recipe {id}")
90-
return
91-
92-
if "base" in data:
93-
data["base"] = rewrite_ingredient(data["base"])
94-
if "addition" in data:
95-
data["addition"] = rewrite_ingredient(data["addition"])
96-
if "ingredient" in data:
97-
data["ingredient"] = rewrite_ingredient(data["ingredient"])
98-
if "ingredients" in data:
99-
data["ingredients"] = [rewrite_ingredient(ingr) for ingr in data["ingredients"]]
100-
if "key" in data:
101-
data["key"] = {k: rewrite_ingredient(ingr) for k, ingr in data["key"].items()}
102-
103-
overlay = ctx.data.overlays["overlay_48"]
104-
overlay.supported_formats = { "min_inclusive": 48, "max_inclusive": 48 }
105-
overlay[id] = overlay_resource
106-
107-
for id, resource in ctx.data.recipes.items():
118+
119+
overlay = resource.copy()
120+
data = overlay.data
121+
122+
if "crafting_transmute" in data["type"]:
123+
logger.warning(f"Cannot backport crafting_transmute recipe {id}")
124+
return None
125+
126+
if "base" in data:
127+
data["base"] = rewrite_ingredient(data["base"])
128+
if "addition" in data:
129+
data["addition"] = rewrite_ingredient(data["addition"])
130+
if "ingredient" in data:
131+
data["ingredient"] = rewrite_ingredient(data["ingredient"])
132+
if "ingredients" in data:
133+
data["ingredients"] = [rewrite_ingredient(ingr) for ingr in data["ingredients"]]
134+
if "key" in data:
135+
data["key"] = {k: rewrite_ingredient(ingr) for k, ingr in data["key"].items()}
136+
137+
return overlay
138+
139+
140+
def backport(pack: Pack[Any], format: int, run: Callable[[str, NamespaceFile], NamespaceFile | None]):
141+
resources: dict[Tuple[type[NamespaceFile], str], NamespaceFile] = dict()
142+
143+
for file_type in pack.resolve_scope_map().values():
144+
proxy = pack[file_type]
145+
for path in proxy.keys():
146+
resources[(file_type, path)] = proxy[path]
147+
148+
for overlay in pack.overlays.values():
149+
overlay_formats = overlay.supported_formats or overlay.pack_format
150+
if check_formats(overlay_formats, format):
151+
for file_type in overlay.resolve_scope_map().values():
152+
proxy = overlay[file_type]
153+
for path in proxy.keys():
154+
resources[(file_type, path)] = proxy[path]
155+
156+
for (file_type, path), resource in resources.items():
108157
try:
109-
rewrite_recipe(id, resource)
158+
new_resource = run(path, resource)
110159
except BaseException as e:
111-
logger.error(f"Failed to backport recipe {id}: {e}")
160+
e.add_note(f"Failed to backport[{run.__name__}] {file_type.snake_name} {path}")
161+
raise e
162+
if new_resource:
163+
overlay = pack.overlays[f"backport_{format}"]
164+
overlay.supported_formats = { "min_inclusive": 0, "max_inclusive": format }
165+
overlay[path] = new_resource
166+
167+
168+
def check_formats(supported: SupportedFormats, format: int):
169+
match supported:
170+
case int(value):
171+
return value == format
172+
case [min, max]:
173+
return min <= format <= max
174+
case { "min_inclusive": min, "max_inclusive": max }:
175+
return min <= format <= max
176+
case _:
177+
raise ValueError(f"Unknown supported)formats structure {supported}")

gm4/plugins/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
parent_logger = logging.getLogger("gm4.manifest")
2323

24-
SUPPORTED_GAME_VERSIONS = ["1.21", "1.21.1", "1.21.2", "1.21.3"]
24+
SUPPORTED_GAME_VERSIONS = ["1.21", "1.21.1", "1.21.2", "1.21.3", "1.21.4"]
2525

2626
# config models for beet.yaml metas
2727
CreditsModel = dict[str, list[str]]

0 commit comments

Comments
 (0)