From 67ddaaab6fdd6b55784f99df19ffcc1f6d50a34f Mon Sep 17 00:00:00 2001 From: KAMKEEL <28842281+KAMKEEL@users.noreply.github.com> Date: Tue, 11 Aug 2026 06:29:18 -0400 Subject: [PATCH] Keep entity hash consistent with equals, and campfire interaction handled ScriptEntity.hashCode included tempData while equals compares only the entity, so two wrappers of the same entity hashed differently - and tempData is mutable and swapped wholesale by copyTempData, so an entry's hash could change while it sat in a map. BlockCampfire.onBlockActivated went from returning true to false, which lets the held item be used or placed on top of the interaction. Restored. --- src/main/java/noppes/npcs/blocks/BlockCampfire.java | 4 ++-- src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/noppes/npcs/blocks/BlockCampfire.java b/src/main/java/noppes/npcs/blocks/BlockCampfire.java index 4b209ec80..01cb42cc4 100644 --- a/src/main/java/noppes/npcs/blocks/BlockCampfire.java +++ b/src/main/java/noppes/npcs/blocks/BlockCampfire.java @@ -39,7 +39,7 @@ public class BlockCampfire extends BlockLightable { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { ItemStack item = player.inventory.getCurrentItem(); if (item == null) - return false; + return true; if ((item.getItem() == Items.flint || item.getItem() == Items.flint_and_steel) && unlitBlock() == this) { super.onBlockActivated(world, x, y, z, player, par6, par7, par8, par9); @@ -55,7 +55,7 @@ public class BlockCampfire extends BlockLightable { super.onBlockActivated(world, x, y, z, player, par6, par7, par8, par9); } - return false; + return true; } @Override diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java b/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java index 9115dc170..d1b8a60ae 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java @@ -982,7 +982,10 @@ public class ScriptEntity implements IEntity { @Override public int hashCode() { - return Objects.hash(entity, tempData); + // Must key on exactly what equals compares. tempData is mutable and swapped wholesale by + // copyTempData, so including it would give two wrappers of the same entity different + // hashes - and would change an entry's hash while it sat in a map. + return Objects.hashCode(entity); } public void updateEntity() {