From 0d4cb2e687c791df3f145135b4d169ab87071b7f Mon Sep 17 00:00:00 2001 From: kayjaydee Date: Fri, 24 Apr 2026 16:34:37 +0200 Subject: [PATCH] fix(04-bugfix): wire wand via RootInteraction asset (NPE on click) Root cause: Item.Interactions map value codec is RootInteraction.CHILD_ASSET_CODEC (expects a String asset id referencing an asset under Item/RootInteractions/), not an inline Interaction object. Previous JSON used "Primary": { "Type": "GravityFlipWand" } which silently loaded a RootInteraction asset with no interactionIds -> operations[] empty -> InteractionManager.serverTick NPE on operation.getWaitForDataFrom() when the click chain ticked. Fix: - New Interaction asset Server/Item/Interactions/gravityflip_wand_click.json ({"Type": "GravityFlipWand"}) matching our registered Interaction subtype. - New RootInteraction asset Server/Item/RootInteractions/gravityflip_wand_root.json wrapping the interaction id in its Interactions[] list (required by RootInteraction CODEC, see RootInteraction.build() -> OperationsBuilder). - Item JSON now references the RootInteraction by id: "Interactions": { "Primary": "gravityflip_wand_root", "Secondary": "gravityflip_wand_root" } matching vanilla Weapon_Wand_Wood.json pattern ("Primary": "Wand_Primary"). Binding (Interaction.CODEC.register("GravityFlipWand", ...)) is unchanged and correct -- subtype registration on the Interaction AssetCodecMapCodec, consistent with InstancesPlugin/ExitInstanceInteraction pattern. --- .../Server/Item/Interactions/gravityflip_wand_click.json | 3 +++ .../resources/Server/Item/Items/gravityflip_wand.json | 8 ++------ .../Item/RootInteractions/gravityflip_wand_root.json | 5 +++++ 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/Server/Item/Interactions/gravityflip_wand_click.json create mode 100644 src/main/resources/Server/Item/RootInteractions/gravityflip_wand_root.json diff --git a/src/main/resources/Server/Item/Interactions/gravityflip_wand_click.json b/src/main/resources/Server/Item/Interactions/gravityflip_wand_click.json new file mode 100644 index 0000000..17e8d4f --- /dev/null +++ b/src/main/resources/Server/Item/Interactions/gravityflip_wand_click.json @@ -0,0 +1,3 @@ +{ + "Type": "GravityFlipWand" +} diff --git a/src/main/resources/Server/Item/Items/gravityflip_wand.json b/src/main/resources/Server/Item/Items/gravityflip_wand.json index bb4b152..8035786 100644 --- a/src/main/resources/Server/Item/Items/gravityflip_wand.json +++ b/src/main/resources/Server/Item/Items/gravityflip_wand.json @@ -16,12 +16,8 @@ "Compatible": true }, "Interactions": { - "Primary": { - "Type": "GravityFlipWand" - }, - "Secondary": { - "Type": "GravityFlipWand" - } + "Primary": "gravityflip_wand_root", + "Secondary": "gravityflip_wand_root" }, "IconProperties": { "Scale": 0.6, diff --git a/src/main/resources/Server/Item/RootInteractions/gravityflip_wand_root.json b/src/main/resources/Server/Item/RootInteractions/gravityflip_wand_root.json new file mode 100644 index 0000000..81f89d1 --- /dev/null +++ b/src/main/resources/Server/Item/RootInteractions/gravityflip_wand_root.json @@ -0,0 +1,5 @@ +{ + "Interactions": [ + "gravityflip_wand_click" + ] +}