Don't swing pocket computers on changes

See #2528. We still swing on open/close, but reboots and equips/unequips
don't cause a swing.
This commit is contained in:
Jonathan Coates committed 2026-11-11 10:59:10 +00:00
1 parent 807ab862b6
commit e4bf24ef4a
1 file changed
+15
@@ -4,6 +4,7 @@
package dan200.computercraft.shared.pocket.items;
import dan200.computercraft.annotations.FabricOverride;
import dan200.computercraft.annotations.ForgeOverride;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.pocket.IPocketUpgrade;
@@ -229,6 +230,20 @@ public class PocketComputerItem extends Item implements IComputerItem, IColoured
return ComputerCraftAPI.MOD_ID;
}
@ForgeOverride
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
return slotChanged
|| oldStack.getItem() != newStack.getItem()
|| oldStack.getCount() != newStack.getCount()
|| getComputerID(oldStack) != getComputerID(newStack);
}
@FabricOverride
public boolean allowNbtUpdateAnimation(Player player, InteractionHand hand, ItemStack oldStack, ItemStack newStack) {
return shouldCauseReequipAnimation(oldStack, newStack, false);
}
/**
* Get (or create) the pocket brain and turn it on, ready for the player to interact with.
*