From 13d538468780a295add6c15f28487b7469bb73d8 Mon Sep 17 00:00:00 2001 From: Shadow1590 <60554355+Shadow1590@users.noreply.github.com> Date: Sat, 7 Dec 2024 18:02:23 +0100 Subject: [PATCH] Fix reach ring (#64) Co-authored-by: Shadow1590 <> --- .../common/item/equipment/bauble/ItemBauble.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemBauble.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemBauble.java index 2ad0612aca..56ced61791 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemBauble.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemBauble.java @@ -39,6 +39,7 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAttachable, IPhantomInkable, IRunicArmor { private static final String TAG_HASHCODE = "playerHashcode"; + private static final String TAG_HASHCODE_CLIENT = "playerHashcodeClient"; private static final String TAG_BAUBLE_UUID_MOST = "baubleUUIDMost"; private static final String TAG_BAUBLE_UUID_LEAST = "baubleUUIDLeast"; private static final String TAG_COSMETIC_ITEM = "cosmeticItem"; @@ -122,9 +123,9 @@ public boolean canUnequip(ItemStack stack, EntityLivingBase player) { @Override public void onWornTick(ItemStack stack, EntityLivingBase player) { - if(getLastPlayerHashcode(stack) != player.hashCode()) { + if(getLastPlayerHashcode(stack, player.worldObj.isRemote) != player.hashCode()) { onEquippedOrLoadedIntoWorld(stack, player); - setLastPlayerHashcode(stack, player.hashCode()); + setLastPlayerHashcode(stack, player.hashCode(), player.worldObj.isRemote); } } @@ -138,7 +139,7 @@ public void onEquipped(ItemStack stack, EntityLivingBase player) { ((EntityPlayer) player).addStat(ModAchievements.baubleWear, 1); onEquippedOrLoadedIntoWorld(stack, player); - setLastPlayerHashcode(stack, player.hashCode()); + setLastPlayerHashcode(stack, player.hashCode(), player.worldObj.isRemote); } } @@ -195,12 +196,12 @@ public static UUID getBaubleUUID(ItemStack stack) { return new UUID(most, least); } - public static int getLastPlayerHashcode(ItemStack stack) { - return ItemNBTHelper.getInt(stack, TAG_HASHCODE, 0); + public static int getLastPlayerHashcode(ItemStack stack, boolean remote) { + return ItemNBTHelper.getInt(stack, remote ? TAG_HASHCODE_CLIENT : TAG_HASHCODE, 0); } - public static void setLastPlayerHashcode(ItemStack stack, int hash) { - ItemNBTHelper.setInt(stack, TAG_HASHCODE, hash); + public static void setLastPlayerHashcode(ItemStack stack, int hash, boolean remote) { + ItemNBTHelper.setInt(stack, remote ? TAG_HASHCODE_CLIENT : TAG_HASHCODE, hash); } @Override