From 71a734b0ce748f212bd7b5f09da5698d6b9d6e52 Mon Sep 17 00:00:00 2001 From: Matyrobbrt <65940752+Matyrobbrt@users.noreply.github.com> Date: Sat, 28 Dec 2024 16:12:44 +0200 Subject: [PATCH] Fix index in `ItemHandlerCopySlot#setStackCopy` (#1805) --- .../net/neoforged/neoforge/items/ItemHandlerCopySlot.java | 2 +- .../data_maps/loot_table/effect_grant.json | 4 ---- .../java/net/neoforged/neoforge/debug/data/DataMapTests.java | 4 +++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/neoforged/neoforge/items/ItemHandlerCopySlot.java b/src/main/java/net/neoforged/neoforge/items/ItemHandlerCopySlot.java index 0f7ad24653c..735c036df07 100644 --- a/src/main/java/net/neoforged/neoforge/items/ItemHandlerCopySlot.java +++ b/src/main/java/net/neoforged/neoforge/items/ItemHandlerCopySlot.java @@ -38,7 +38,7 @@ protected ItemStack getStackCopy() { @Override protected void setStackCopy(ItemStack stack) { - ((IItemHandlerModifiable) slotItemHandler.getItemHandler()).setStackInSlot(index, stack); + ((IItemHandlerModifiable) slotItemHandler.getItemHandler()).setStackInSlot(slotItemHandler.index, stack); } @Override diff --git a/tests/src/generated/resources/data/neotests_reloadable_reg_data_maps/data_maps/loot_table/effect_grant.json b/tests/src/generated/resources/data/neotests_reloadable_reg_data_maps/data_maps/loot_table/effect_grant.json index c716281c920..ff7693fcb25 100644 --- a/tests/src/generated/resources/data/neotests_reloadable_reg_data_maps/data_maps/loot_table/effect_grant.json +++ b/tests/src/generated/resources/data/neotests_reloadable_reg_data_maps/data_maps/loot_table/effect_grant.json @@ -3,10 +3,6 @@ "minecraft:blocks/copper_block": { "duration": 100, "id": "minecraft:nausea", - "neoforge:cures": [ - "protected_by_totem", - "milk" - ], "show_icon": true } } diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/data/DataMapTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/data/DataMapTests.java index 8d0f52f2db6..1a6c79b64d4 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/data/DataMapTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/data/DataMapTests.java @@ -317,8 +317,10 @@ static void reloadableRegDataMaps(final DynamicTest test, final RegistrationHelp reg.addProvider(event -> new DataMapProvider(event.getGenerator().getPackOutput(), event.getLookupProvider()) { @Override protected void gather() { + var effect = new MobEffectInstance(MobEffects.CONFUSION, 100); + effect.getCures().clear(); // Cures use a hash set (not linked) meaning that their serialization is not deterministic builder(effectGrant) - .add(Blocks.COPPER_BLOCK.getLootTable(), new MobEffectInstance(MobEffects.CONFUSION, 100), false); + .add(Blocks.COPPER_BLOCK.getLootTable(), effect, false); } });