From afa3f46206c71726411a46c90b3c86d4ded57132 Mon Sep 17 00:00:00 2001 From: Tracktark <41553228+Tracktark@users.noreply.github.com> Date: Thu, 25 Jul 2024 01:00:47 +0200 Subject: [PATCH] fix: update beet.contrib.installation_advancement to work in 1.20.5+ (#445) --- beet/contrib/installation_advancement.py | 8 ++++---- examples/installation_advancement/beet.json | 6 ++++-- .../data/global/advancement/mcbeet.json | 8 ++++++-- .../data/global/advancement/root.json | 2 +- .../data/mcbeet/advancement/example/installed.json | 8 ++++++-- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/beet/contrib/installation_advancement.py b/beet/contrib/installation_advancement.py index 9042e771..5709f1fa 100644 --- a/beet/contrib/installation_advancement.py +++ b/beet/contrib/installation_advancement.py @@ -19,7 +19,7 @@ class InstallationAdvancementOptions(PluginOptions): - icon: JsonDict = {"item": "minecraft:apple"} + icon: JsonDict = {"id": "minecraft:apple"} author_namespace: Optional[str] = None author_description: str = "" author_skull_owner: Optional[str] = None @@ -66,7 +66,7 @@ def create_root_advancement(): "display": { "title": "Installed Datapacks", "description": "", - "icon": {"item": "minecraft:knowledge_book"}, + "icon": {"id": "minecraft:knowledge_book"}, "background": "minecraft:textures/block/gray_concrete.png", "show_toast": False, "announce_to_chat": False, @@ -87,8 +87,8 @@ def create_author_advancement( "title": author, "description": author_description, "icon": { - "item": "minecraft:player_head", - "nbt": f"{{'SkullOwner': '{skull_owner}'}}", + "id": "minecraft:player_head", + "components": {"minecraft:profile": {"name": skull_owner}}, }, "show_toast": False, "announce_to_chat": False, diff --git a/examples/installation_advancement/beet.json b/examples/installation_advancement/beet.json index bbc0b378..183decf1 100644 --- a/examples/installation_advancement/beet.json +++ b/examples/installation_advancement/beet.json @@ -6,8 +6,10 @@ "meta": { "installation_advancement": { "icon": { - "item": "minecraft:red_mushroom", - "nbt": "{Enchantments:[{}]}" + "id": "minecraft:red_mushroom", + "components": { + "enchantments": {"protection": 1} + } }, "author_description": "Organization behind the beet project" } diff --git a/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/global/advancement/mcbeet.json b/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/global/advancement/mcbeet.json index e117e675..24f9c5ab 100644 --- a/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/global/advancement/mcbeet.json +++ b/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/global/advancement/mcbeet.json @@ -3,8 +3,12 @@ "title": "mcbeet", "description": "Organization behind the beet project", "icon": { - "item": "minecraft:player_head", - "nbt": "{'SkullOwner': 'mcbeet'}" + "id": "minecraft:player_head", + "components": { + "minecraft:profile": { + "name": "mcbeet" + } + } }, "show_toast": false, "announce_to_chat": false diff --git a/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/global/advancement/root.json b/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/global/advancement/root.json index 6de742b6..d8874dce 100644 --- a/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/global/advancement/root.json +++ b/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/global/advancement/root.json @@ -3,7 +3,7 @@ "title": "Installed Datapacks", "description": "", "icon": { - "item": "minecraft:knowledge_book" + "id": "minecraft:knowledge_book" }, "background": "minecraft:textures/block/gray_concrete.png", "show_toast": false, diff --git a/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/mcbeet/advancement/example/installed.json b/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/mcbeet/advancement/example/installed.json index 8c378257..aef5f5cf 100644 --- a/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/mcbeet/advancement/example/installed.json +++ b/tests/snapshots/examples__build_installation_advancement__0.data_pack/data/mcbeet/advancement/example/installed.json @@ -3,8 +3,12 @@ "title": "Example", "description": "An example project", "icon": { - "item": "minecraft:red_mushroom", - "nbt": "{Enchantments:[{}]}" + "id": "minecraft:red_mushroom", + "components": { + "enchantments": { + "protection": 1 + } + } }, "announce_to_chat": false, "show_toast": false