Skip to content

Commit

Permalink
Fix reach ring (#64)
Browse files Browse the repository at this point in the history
Co-authored-by: Shadow1590 <>
  • Loading branch information
Shadow1590 authored Dec 7, 2024
1 parent 909cc50 commit 13d5384
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 13d5384

Please sign in to comment.