Skip to content

Commit 789196b

Browse files
misodeTheThanathor
andauthored
Update to 1.21 (Gamemode4Dev#1004)
* Update version numbers and pack format * Rename legacy folders * Update beet and mecha * Update attribute commands * Update packtest to v1.8-beta3 * Fix attribute modifiers in JSON * Update to gm4_combat_expanded:dynamic * Update attribute NBT in commands * Move tests to singular name folder * Fix template directives pointing to singular folder name * Gamemode predicate is a list now * Update looting_enchant -> enchanted_count_increase * Fix enchant_randomly enchantments -> options * Fix random_chance_with_looting * Update enchant_with_levels * Fix enchantment predicates * campfire damage type was split from in_fire * Use new #air block tag Keeping the #gm4:air tag for now, because some in-world nbt may still refer to it * Remove some trailing spaces * fix attribute names (Gamemode4Dev#1005) * Fix some issues found by spyglass * Configure for spyglass v4 * Fix double doors: use singular template folders * Disable combat expanded --------- Co-authored-by: Thanathor <[email protected]>
1 parent 8846e97 commit 789196b

File tree

5,188 files changed

+1566
-1575
lines changed

Some content is hidden

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

5,188 files changed

+1566
-1575
lines changed

.github/workflows/main.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77
workflow_dispatch:
88

99
env:
10-
VERSION: '1.20.5'
10+
VERSION: '1.21'
1111
COMMIT_MSG: ${{ github.event.head_commit.message }}
12-
TEST_FABRIC_SERVER: https://meta.fabricmc.net/v2/versions/loader/1.20.6/0.15.10/1.0.1/server/jar
13-
TEST_FABRIC_API: https://cdn.modrinth.com/data/P7dR8mSH/versions/kAQqRNrK/fabric-api-0.97.8%2B1.20.6.jar
14-
TEST_PACKTEST: https://cdn.modrinth.com/data/XsKUhp45/versions/UnZw9eUD/packtest-1.7-mc1.20.5.jar
12+
TEST_FABRIC_SERVER: https://meta.fabricmc.net/v2/versions/loader/1.21/0.15.11/1.0.1/server/jar
13+
TEST_FABRIC_API: https://cdn.modrinth.com/data/P7dR8mSH/versions/HXzEJYgV/fabric-api-0.100.1%2B1.21.jar
14+
TEST_PACKTEST: https://cdn.modrinth.com/data/XsKUhp45/versions/sQSunYHv/packtest-1.8-beta3-mc1.21.jar
1515

1616
jobs:
1717
build:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ __pycache__/
1414
### Beet ###
1515
out/
1616
release/
17+
.beet_cache/

.vscode/settings.json

-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
{
2-
"datapack.env.cmdVersion": "1.20.3",
3-
"datapack.env.dataVersion": "1.20.3",
4-
"datapack.lint.stringQuote": ["hint", true],
5-
"datapack.lint.nbtStringQuoteType": ["hint", "prefer double"],
62
"files.insertFinalNewline": true,
73
"files.trimFinalNewlines": true
84
}

base/data/gm4/tags/blocks/no_collision.json renamed to base/data/gm4/tags/block/no_collision.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"values": [
3-
"#gm4:air",
3+
"#minecraft:air",
44
"#gm4:water",
55
"#minecraft:banners",
66
"#minecraft:buttons",

base/data/gm4/tags/blocks/replaceable.json renamed to base/data/gm4/tags/block/replaceable.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"values": [
3-
"#gm4:air",
3+
"#minecraft:air",
44
"#minecraft:fire",
55
"minecraft:bubble_column",
66
"minecraft:crimson_roots",

docs/making-a-module.md

+1-1

gm4/plugins/manifest.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

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

23-
SUPPORTED_GAME_VERSIONS = ["1.20.5", "1.20.6"]
23+
SUPPORTED_GAME_VERSIONS = ["1.21"]
2424

2525
# config models for beet.yaml metas
2626
CreditsModel = dict[str, list[str]]
@@ -144,7 +144,7 @@ def create(ctx: Context):
144144
ctx.cache["gm4_manifest"].json = manifest.dict()
145145

146146
# Read in the previous manifest, if found
147-
version = os.getenv("VERSION", "1.20.5")
147+
version = os.getenv("VERSION", "1.21")
148148
release_dir = Path('release') / version
149149
manifest_file = release_dir / "meta.json"
150150

@@ -214,7 +214,7 @@ def update_patch(ctx: Context):
214214

215215
def write_meta(ctx: Context):
216216
"""Write the updated meta.json file."""
217-
version = os.getenv("VERSION", "1.20.5")
217+
version = os.getenv("VERSION", "1.21")
218218
release_dir = Path('release') / version
219219
os.makedirs(release_dir, exist_ok=True)
220220

@@ -263,7 +263,7 @@ def write_credits(ctx: Context):
263263

264264
def write_updates(ctx: Context):
265265
"""Writes the module update commands to this module's init function."""
266-
init = ctx.data.functions.get(f"{ctx.project_id}:init", None)
266+
init = ctx.data.function.get(f"{ctx.project_id}:init", None)
267267
if init is None:
268268
return
269269

gm4/plugins/module.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ def default_pack_icon(ctx: Context):
88

99
def gm4_root_advancement(ctx: Context):
1010
"""Adds the root display advancement gm4:root, if the module has any display advancements"""
11-
if len(ctx.data["gm4"].advancements.keys()) > 0:
12-
ctx.data.advancements["gm4:root"] = Advancement(
11+
if len(ctx.data["gm4"].advancement.keys()) > 0:
12+
ctx.data.advancement["gm4:root"] = Advancement(
1313
{
1414
"display": {
1515
"icon": {

gm4/plugins/output.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
def beet_default(ctx: Context):
2121
"""Saves the datapack to the ./out folder in it's exit phase.
2222
Should be first in pipeline to properly wrap all other plugins cleanup phases"""
23-
version = os.getenv("VERSION", "1.20.5")
23+
version = os.getenv("VERSION", "1.21")
2424
out_dir = Path("out")
2525

2626
yield # wait for exit phase, after other plugins cleanup
@@ -32,7 +32,7 @@ def beet_default(ctx: Context):
3232

3333
def resource_pack(ctx: Context):
3434
"""Saves the resourcepack to the ./out folder."""
35-
version = os.getenv("VERSION", "1.20.5")
35+
version = os.getenv("VERSION", "1.21")
3636
out_dir = Path("out")
3737

3838
ctx.assets.save(
@@ -42,7 +42,7 @@ def resource_pack(ctx: Context):
4242

4343
def release_resource_pack(ctx: Context):
4444
"""Saves the resourcepack to the ./out folder."""
45-
version = os.getenv("VERSION", "1.20.5")
45+
version = os.getenv("VERSION", "1.21")
4646
release_dir = Path("release") / version
4747

4848
yield
@@ -81,7 +81,7 @@ def release(ctx: Context):
8181
`BEET_SMITHED_TOKEN` environment variable is set, will try to publish a
8282
new version to Smithed if it doesn't already exist.
8383
"""
84-
version_dir = os.getenv("VERSION", "1.20.5")
84+
version_dir = os.getenv("VERSION", "1.21")
8585
release_dir = Path("release") / version_dir
8686

8787
corrected_project_id = stem if (stem:=ctx.directory.stem).startswith("lib") else ctx.project_id
@@ -197,7 +197,7 @@ def publish_smithed(ctx: Context, config: ManifestConfig, file_name: str):
197197
"""Attempts to publish pack to smithed"""
198198
auth_token = os.getenv(SMITHED_AUTH_KEY, None)
199199
logger = parent_logger.getChild(f"smithed.{ctx.project_id}")
200-
mc_version_dir = os.getenv("VERSION", "1.20.5")
200+
mc_version_dir = os.getenv("VERSION", "1.21")
201201
manifest = ManifestCacheModel.parse_obj(ctx.cache["gm4_manifest"].json)
202202
project_id = stem if (stem:=ctx.directory.stem).startswith("lib") else ctx.project_id
203203

@@ -297,7 +297,7 @@ def clear_release(ctx: Context):
297297
1. Deleted modules no longer stick around in the current version
298298
2. Changes to the build system (such as renamed files/folders) are properly reflected
299299
"""
300-
version = os.getenv("VERSION", "1.20.5")
300+
version = os.getenv("VERSION", "1.21")
301301
release_dir = Path("release") / version
302302
shutil.rmtree(release_dir, ignore_errors=True)
303303
os.makedirs(release_dir, exist_ok=True)

gm4/plugins/prefabs.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ def structure_deep_rename(ctx: Context, find_namespace: str, repl_namespace: str
3939
}))
4040

4141
# rename structure-file references
42-
for s in ctx.data.structures:
43-
blocks = ctx.data.structures[s].data["blocks"].snbt() # type: ignore ; nbtlib typing missing
42+
for s in ctx.data.structure:
43+
blocks = ctx.data.structure[s].data["blocks"].snbt() # type: ignore ; nbtlib typing missing
4444
updated_blocks_data = re.sub(f"{find_namespace}:([a-z0-9_/]+)", f"{repl_namespace}:\\1", blocks) # type: ignore ; nbtlib typing missing
45-
ctx.data.structures[s].serializer = repro_structure_to_bytes
46-
ctx.data.structures[s].data["blocks"] = nbtlib.parse_nbt(updated_blocks_data) # type: ignore ; nbtlib typing missing
45+
ctx.data.structure[s].serializer = repro_structure_to_bytes
46+
ctx.data.structure[s].data["blocks"] = nbtlib.parse_nbt(updated_blocks_data) # type: ignore ; nbtlib typing missing

gm4/plugins/test.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ def load_tests(ctx: Context):
1010
class TestFile(TextFile):
1111
"""Class representing an test function."""
1212

13-
scope: ClassVar[Tuple[str, ...]] = ("tests",)
13+
scope: ClassVar[Tuple[str, ...]] = ("test",)
1414
extension: ClassVar[str] = ".mcfunction"
1515

1616

1717
def strip_tests(ctx: Context):
18-
for structure in ctx.data.structures.match("*:test_*", "*:tests/*"):
19-
del ctx.data.structures[structure]
20-
for predicate in ctx.data.predicates.match("*:test_*", "*:tests/*"):
21-
del ctx.data.predicates[predicate]
18+
for structure in ctx.data.structure.match("*:test_*", "*:test/*"):
19+
del ctx.data.structure[structure]
20+
for predicate in ctx.data.predicate.match("*:test_*", "*:test/*"):
21+
del ctx.data.predicate[predicate]
2222

2323

2424
def skip_mecha_lint(ctx: Context):

gm4/plugins/upgrade_paths.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def beet_default(ctx: Context, opts: UpgradePathsConfig):
2222
score_holder = ctx.project_id.removeprefix('gm4_')
2323
newest_version_with_upgrades = 0.0
2424
for ns, direc in map(lambda a: a.split(':'), upgrade_paths_dirs):
25-
upgrade_paths_tree = ctx.data[ns].functions.generate_tree(direc)
25+
upgrade_paths_tree = ctx.data[ns].function.generate_tree(direc)
2626
if upgrade_paths_tree:
2727
newest_version_with_upgrades = max(newest_version_with_upgrades, max(map(float, upgrade_paths_tree.keys())))
2828
for path in upgrade_paths_tree.keys():
@@ -42,6 +42,6 @@ def lib(ctx: Context):
4242
if ver.patch is None:
4343
ver.patch = 0 # when beet-dev is run, pipeline has no patch number record, but dev builds should still allow int conversion
4444
ver_int = ver.int_rep()
45-
ctx.data.functions[f'{ctx.project_id}:load'].append(f'execute unless score {score_holder} gm4_earliest_version matches ..{ver_int} run scoreboard players set {score_holder} gm4_earliest_version {ver_int}')
45+
ctx.data.function[f'{ctx.project_id}:load'].append(f'execute unless score {score_holder} gm4_earliest_version matches ..{ver_int} run scoreboard players set {score_holder} gm4_earliest_version {ver_int}')
4646

4747
beet_default(ctx)

gm4/plugins/versioning.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def modules(ctx: Context, opts: VersioningConfig):
7373
namespaced_function = f"{ctx.project_id}:{function}" if ":" not in function else function
7474
lines.append(f"execute unless score {ctx.project_id} load.status matches {module_ver.major} run schedule clear {namespaced_function}")
7575

76-
ctx.data.functions[f"{ctx.project_id}:load"] = Function(lines)
76+
ctx.data.function[f"{ctx.project_id}:load"] = Function(lines)
7777

7878
# load.json tag
7979
ctx.data.function_tags["load:load"] = FunctionTag({
@@ -84,7 +84,7 @@ def modules(ctx: Context, opts: VersioningConfig):
8484

8585
# inject module load success checks (load.status 1..) into technical and display advancements
8686
# advancements get score checks injected into every criteria
87-
versioned_advancements(ctx, Version("X.X.X"), [a for a in ctx.data.advancements.keys() if not a=="gm4:root"], False)
87+
versioned_advancements(ctx, Version("X.X.X"), [a for a in ctx.data.advancement.keys() if not a=="gm4:root"], False)
8888

8989
@configurable("gm4.versioning", validator=VersioningConfig)
9090
def libraries(ctx: Context, opts: VersioningConfig):
@@ -120,7 +120,7 @@ def libraries(ctx: Context, opts: VersioningConfig):
120120
lines.append(dep_check_line + f"{ctx.project_id}_minor load.status {lib_ver.minor}")
121121
lines.append(dep_check_line + f"{ctx.project_id} load.status {lib_ver.major}")
122122

123-
ctx.data.functions[f"{ctx.project_id}:enumerate"] = Function(lines)
123+
ctx.data.function[f"{ctx.project_id}:enumerate"] = Function(lines)
124124

125125
# resolve_load.mcfunction
126126
lines = [f"execute if score {ctx.project_id} load.status matches {lib_ver.major} if score {ctx.project_id}_minor load.status matches {lib_ver.minor} run function {ctx.project_id}:load"]
@@ -129,7 +129,7 @@ def libraries(ctx: Context, opts: VersioningConfig):
129129
lines.append(f"execute unless score {ctx.project_id} load.status matches {lib_ver.major} run schedule clear {ctx.project_id}:{func}")
130130
lines.append(f"execute unless score {ctx.project_id}_minor load.status matches {lib_ver.minor} run schedule clear {ctx.project_id}:{func}")
131131

132-
ctx.data.functions[f"{ctx.project_id}:resolve_load"] = Function(lines)
132+
ctx.data.function[f"{ctx.project_id}:resolve_load"] = Function(lines)
133133

134134
# load/tags {{ lib name }}.json
135135
ctx.data.function_tags[f"load:{ctx.project_id}"] = FunctionTag({
@@ -175,7 +175,7 @@ def libraries(ctx: Context, opts: VersioningConfig):
175175
))
176176

177177
# stamp version number and module bring packaged into into load.mcfunction
178-
handle = ctx.data.functions[f"{ctx.project_id}:load"]
178+
handle = ctx.data.function[f"{ctx.project_id}:load"]
179179
handle.append([
180180
"\n",
181181
f"data modify storage gm4:log versions append value {{id:\"{ctx.project_id}\",module:\"{ctx.project_id.replace('gm4', 'lib')}\",version:\"{ctx.project_version}\",from:\"{ctx.cache['currently_building'].json.get('name', 'standalone')}\"}}"
@@ -199,15 +199,15 @@ def base(ctx: Context, opts: VersioningConfig):
199199
f"execute unless score gm4 load.status matches {ver.major}.. run scoreboard players set gm4_minor load.status {ver.minor}",
200200
f"execute unless score gm4 load.status matches {ver.major}.. run scoreboard players set gm4 load.status {ver.major}"
201201
]
202-
ctx.data.functions[f"gm4:enumerate"] = Function(lines)
202+
ctx.data.function[f"gm4:enumerate"] = Function(lines)
203203

204204
# resolve_load.mcfunction
205205
lines = f"execute if score gm4 load.status matches {ver.major} if score gm4_minor load.status matches {ver.minor} run function gm4:load"
206-
ctx.data.functions[f"gm4:resolve_load"] = Function(lines)
206+
ctx.data.function[f"gm4:resolve_load"] = Function(lines)
207207

208208
# resolve_post_load.mcfunction
209209
lines = f"execute if score gm4 load.status matches {ver.major} if score gm4_minor load.status matches {ver.minor} run function gm4:post_load"
210-
ctx.data.functions[f"gm4:resolve_post_load"] = Function(lines)
210+
ctx.data.function[f"gm4:resolve_post_load"] = Function(lines)
211211

212212
versioned_advancements(ctx, ver, opts.extra_version_injections.advancements, strict=True) #type:ignore
213213

@@ -266,9 +266,9 @@ def versioned_advancements(ctx: Context, ver: Version, targets: list[str], stric
266266

267267
for entry in targets:
268268
if ":" in entry:
269-
handle = ctx.data.advancements[entry]
269+
handle = ctx.data.advancement[entry]
270270
else:
271-
handle = ctx.data.advancements[f"{ctx.project_id}:{entry}"]
271+
handle = ctx.data.advancement[f"{ctx.project_id}:{entry}"]
272272
for criteria in handle.data["criteria"].values():
273273
player_conditions = criteria.setdefault("conditions", {}).setdefault("player", [])
274274
if type(player_conditions) is dict:

gm4/plugins/write_mcmeta.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ def beet_default(ctx: Context):
77
"""Writes the pack.mcmeta based on the module name and version."""
88
yield # wait for exit phase
99

10-
version = os.getenv("VERSION", "1.20.5")
10+
version = os.getenv("VERSION", "1.21")
1111
manifest = ManifestCacheModel.parse_obj(ctx.cache["gm4_manifest"].json)
1212
manifest_entry = {v.id:v for v in (manifest.modules|manifest.libraries).values()}.get(ctx.project_id, NoneAttribute())
1313

14-
# manually set as beet's `latest` is not available for 1.20.5 at this time.
15-
ctx.data.pack_format = 41
16-
ctx.assets.pack_format = 32
14+
ctx.data.pack_format = 48
15+
ctx.assets.pack_format = 34
1716

1817
for pack in ctx.packs:
1918
pack.description = [

0 commit comments

Comments
 (0)