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

@ -221,7 +221,7 @@ public class TileIronAlloyFurnace extends TileLegacyMachineBase
itemstack = recipeType.getOutput(0);
break;
}
if (itemstack != ItemStack.EMPTY) {
if (!itemstack.isEmpty()) {
break;
}
}

View file

@ -135,7 +135,7 @@ public class TileIronFurnace extends TileLegacyMachineBase
if (this.getStackInSlot(this.input1) == ItemStack.EMPTY)
return false;
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.getStackInSlot(this.input1));
if (itemstack == ItemStack.EMPTY)
if (itemstack.isEmpty())
return false;
if (this.getStackInSlot(this.output) == ItemStack.EMPTY)
return true;
@ -151,7 +151,7 @@ public class TileIronFurnace extends TileLegacyMachineBase
public ItemStack getResultFor(final ItemStack stack) {
final ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack);
if (result != ItemStack.EMPTY) {
if (!result.isEmpty()) {
return result.copy();
}
return ItemStack.EMPTY;

View file

@ -76,7 +76,7 @@ public class TileTechStorageBase extends TileLegacyMachineBase
}
}
if (this.storedItem != ItemStack.EMPTY) {
if (!this.storedItem.isEmpty()) {
if (this.getStackInSlot(1) == ItemStack.EMPTY) {
ItemStack delivered = this.storedItem.copy();
@ -127,7 +127,7 @@ public class TileTechStorageBase extends TileLegacyMachineBase
storedItem = new ItemStack((NBTTagCompound) tagCompound.getTag("storedStack"));
}
if (storedItem != ItemStack.EMPTY) {
if (!storedItem.isEmpty()) {
storedItem.setCount(tagCompound.getInteger("storedQuantity"));
}
}
@ -140,7 +140,7 @@ public class TileTechStorageBase extends TileLegacyMachineBase
}
public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
if (storedItem != ItemStack.EMPTY) {
if (!storedItem.isEmpty()) {
tagCompound.setTag("storedStack", storedItem.writeToNBT(new NBTTagCompound()));
tagCompound.setInteger("storedQuantity", storedItem.getCount());
} else {
@ -237,7 +237,7 @@ public class TileTechStorageBase extends TileLegacyMachineBase
if (isRealTile) {
int size = 0;
String name = "of nothing";
if (storedItem != ItemStack.EMPTY) {
if (!storedItem.isEmpty()) {
name = storedItem.getDisplayName();
size += storedItem.getCount();
}

View file

@ -287,7 +287,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor implements IInv
}
public boolean canFitStack(final ItemStack stack, final int slot, final boolean oreDic) {// Checks to see if it can fit the stack
if (stack == ItemStack.EMPTY) {
if (stack.isEmpty()) {
return true;
}
if (this.inventory.getStackInSlot(slot) == ItemStack.EMPTY) {

View file

@ -146,7 +146,7 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
public boolean canAddOutput(final int slot, final int amount) {
final ItemStack stack = this.getStackInSlot(slot);
return stack == ItemStack.EMPTY || this.getInventoryStackLimit() - stack.getCount() >= amount;
return stack.isEmpty() || this.getInventoryStackLimit() - stack.getCount() >= amount;
}
@Override

View file

@ -113,7 +113,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
return false;
}
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.getStackInSlot(this.input1));
if (itemstack == ItemStack.EMPTY)
if (itemstack.isEmpty())
return false;
if (this.getStackInSlot(this.output) == ItemStack.EMPTY)
return true;
@ -129,7 +129,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
public ItemStack getResultFor(final ItemStack stack) {
final ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack);
if (result != ItemStack.EMPTY) {
if (!result.isEmpty()) {
return result.copy();
}
return ItemStack.EMPTY;