Fixed separate NPE with the Sigil of Holding.

Added possible fix to an Incense glitch.
This commit is contained in:
WayofTime 2016-06-07 21:11:21 -04:00
parent eccf747a09
commit 150ed4c6a9
2 changed files with 3 additions and 3 deletions

View file

@ -77,7 +77,7 @@ public class ItemSacrificialDagger extends Item implements IMeshProvider
@Override @Override
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft) public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft)
{ {
if (entityLiving instanceof EntityPlayer) if (entityLiving instanceof EntityPlayer && !entityLiving.worldObj.isRemote)
PlayerSacrificeHelper.sacrificePlayerHealth((EntityPlayer) entityLiving); PlayerSacrificeHelper.sacrificePlayerHealth((EntityPlayer) entityLiving);
} }

View file

@ -40,7 +40,7 @@ public class InventoryHolding extends ItemInventory
{ {
ItemStack itemStack = entityPlayer.inventory.getStackInSlot(i); ItemStack itemStack = entityPlayer.inventory.getStackInSlot(i);
if (hasUUID(itemStack)) if (itemStack != null && hasUUID(itemStack))
{ {
if (itemStack.getTagCompound().getLong(Constants.NBT.MOST_SIG) == parentStackUUID.getMostSignificantBits() && itemStack.getTagCompound().getLong(Constants.NBT.LEAST_SIG) == parentStackUUID.getLeastSignificantBits()) if (itemStack.getTagCompound().getLong(Constants.NBT.MOST_SIG) == parentStackUUID.getMostSignificantBits() && itemStack.getTagCompound().getLong(Constants.NBT.LEAST_SIG) == parentStackUUID.getLeastSignificantBits())
{ {
@ -84,7 +84,7 @@ public class InventoryHolding extends ItemInventory
public static boolean hasUUID(ItemStack itemStack) public static boolean hasUUID(ItemStack itemStack)
{ {
return itemStack.getTagCompound().hasKey(Constants.NBT.MOST_SIG) && itemStack.getTagCompound().hasKey(Constants.NBT.LEAST_SIG); return itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey(Constants.NBT.MOST_SIG) && itemStack.getTagCompound().hasKey(Constants.NBT.LEAST_SIG);
} }
public static void setUUID(ItemStack itemStack) public static void setUUID(ItemStack itemStack)