Replace all emptiness checks == ItemStack.Empty with .isEmpty() (#1247)

Fixes #1157 and probably a few other things.
This commit is contained in:
David Vierra 2017-08-25 08:08:15 -10:00 committed by Modmuss50
parent df808760ad
commit a016a6dd49
24 changed files with 41 additions and 39 deletions

View file

@ -61,7 +61,7 @@ public class ItemFrequencyTransmitter extends ItemTR {
World worldIn,
@Nullable
EntityLivingBase entityIn) {
if (stack != ItemStack.EMPTY && stack.hasTagCompound() && stack.getTagCompound() != null && stack.getTagCompound().hasKey("x") && stack.getTagCompound().hasKey("y") && stack.getTagCompound().hasKey("z") && stack.getTagCompound().hasKey("dim")) {
if (!stack.isEmpty() && stack.hasTagCompound() && stack.getTagCompound() != null && stack.getTagCompound().hasKey("x") && stack.getTagCompound().hasKey("y") && stack.getTagCompound().hasKey("z") && stack.getTagCompound().hasKey("dim")) {
return 1.0F;
}
return 0.0F;

View file

@ -63,7 +63,7 @@ public class ItemBattery extends ItemTR implements IEnergyItemInfo, IEnergyInter
World worldIn,
@Nullable
EntityLivingBase entityIn) {
if (stack != ItemStack.EMPTY && PoweredItem.getEnergy(stack) == 0.0) {
if (!stack.isEmpty() && PoweredItem.getEnergy(stack) == 0.0) {
return 1.0F;
}
return 0.0F;

View file

@ -74,7 +74,7 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, IEnergyInt
World worldIn,
@Nullable
EntityLivingBase entityIn) {
if (stack != ItemStack.EMPTY && PoweredItem.canUseEnergy(cost, stack) && entityIn != null && entityIn.getHeldItemMainhand().equals(stack)) {
if (!stack.isEmpty() && PoweredItem.canUseEnergy(cost, stack) && entityIn != null && entityIn.getHeldItemMainhand().equals(stack)) {
return 1.0F;
}
return 0.0F;

View file

@ -102,7 +102,7 @@ public class ItemCloakingDevice extends ItemTR implements IEnergyItemInfo, IEner
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
ItemStack itemstack1 = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
if (itemstack1 == ItemStack.EMPTY) {
if (itemstack1.isEmpty()) {
player.setItemStackToSlot(EntityEquipmentSlot.CHEST, itemStack.copy());
itemStack.setCount(0);
}

View file

@ -74,7 +74,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo, IEnergy
World worldIn,
@Nullable
EntityLivingBase entityIn) {
if (stack != ItemStack.EMPTY && stack.hasTagCompound() && stack.getTagCompound().hasKey("isActive") && stack.getTagCompound().getBoolean("isActive")) {
if (!stack.isEmpty() && stack.hasTagCompound() && stack.getTagCompound().hasKey("isActive") && stack.getTagCompound().getBoolean("isActive")) {
if (PoweredItem.getMaxPower(stack) - PoweredItem.getEnergy(stack) >= 0.9 * PoweredItem.getMaxPower(stack))
return 0.5F;
return 1.0F;