Fix incorrect usage of item stack checking
I have no idea how they worked without issue for this long :D
This commit is contained in:
parent
96d78c11a8
commit
d4a43d24a1
10 changed files with 21 additions and 21 deletions
|
@ -37,7 +37,7 @@ public class ClientEventHandler {
|
|||
@SubscribeEvent
|
||||
public static void renderPlayer(RenderPlayerEvent.Pre event) {
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
Item chestslot = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) != ItemStack.EMPTY
|
||||
Item chestslot = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty()
|
||||
? player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() : null;
|
||||
if (chestslot != null && chestslot == ModItems.CLOAKING_DEVICE) {
|
||||
event.setCanceled(true);
|
||||
|
|
|
@ -87,7 +87,7 @@ public class TechRebornDevCommand extends CommandBase {
|
|||
}
|
||||
} else if ("getname".equals(args[0])) {
|
||||
EntityPlayer player = (EntityPlayer) sender;
|
||||
if (player.getHeldItem(EnumHand.MAIN_HAND) != ItemStack.EMPTY) {
|
||||
if (!player.getHeldItem(EnumHand.MAIN_HAND).isEmpty()) {
|
||||
sender.sendMessage(new TextComponentString(player.getHeldItem(EnumHand.MAIN_HAND).getItem().getRegistryName() + ":" + player.getHeldItem(EnumHand.MAIN_HAND).getItemDamage()));
|
||||
} else {
|
||||
sender.sendMessage(new TextComponentString("hold an item!"));
|
||||
|
|
|
@ -41,7 +41,7 @@ public class TRTickHandler {
|
|||
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent e) {
|
||||
EntityPlayer player = e.player;
|
||||
Item chestslot = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) != ItemStack.EMPTY
|
||||
Item chestslot = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty()
|
||||
? player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() : null;
|
||||
|
||||
if (previouslyWearing != chestslot && previouslyWearing == ModItems.CLOAKING_DEVICE && player.isInvisible()
|
||||
|
|
|
@ -71,7 +71,7 @@ public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo {
|
|||
IEnergyStorage capEnergy = itemStack.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
if (player.inventory.getStackInSlot(i) != ItemStack.EMPTY) {
|
||||
if (!player.inventory.getStackInSlot(i).isEmpty()) {
|
||||
ItemStack item = player.inventory.getStackInSlot(i);
|
||||
if (!item.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
||||
continue;
|
||||
|
|
|
@ -144,7 +144,7 @@ public class TileTechStorageBase extends TileLegacyMachineBase
|
|||
if (!getStackInSlot(1).isEmpty()) {
|
||||
outputStack = getStackInSlot(1);
|
||||
}
|
||||
if (getStackInSlot(0) != ItemStack.EMPTY
|
||||
if (!getStackInSlot(0).isEmpty()
|
||||
&& (storedItem.getCount() + outputStack.getCount()) < maxCapacity) {
|
||||
ItemStack inputStack = getStackInSlot(0);
|
||||
if (getStoredItemType().isEmpty()
|
||||
|
@ -167,7 +167,7 @@ public class TileTechStorageBase extends TileLegacyMachineBase
|
|||
}
|
||||
|
||||
if (!storedItem.isEmpty()) {
|
||||
if (outputStack == ItemStack.EMPTY) {
|
||||
if (outputStack.isEmpty()) {
|
||||
|
||||
ItemStack delivered = storedItem.copy();
|
||||
delivered.setCount(Math.min(storedItem.getCount(), delivered.getMaxStackSize()));
|
||||
|
@ -257,7 +257,7 @@ public class TileTechStorageBase extends TileLegacyMachineBase
|
|||
name = storedItem.getDisplayName();
|
||||
size += storedItem.getCount();
|
||||
}
|
||||
if (getStackInSlot(1) != ItemStack.EMPTY) {
|
||||
if (!getStackInSlot(1).isEmpty()) {
|
||||
name = getStackInSlot(1).getDisplayName();
|
||||
size += getStackInSlot(1).getCount();
|
||||
}
|
||||
|
|
|
@ -136,12 +136,12 @@ public class TileIronAlloyFurnace extends TileLegacyMachineBase
|
|||
--this.burnTime;
|
||||
}
|
||||
if (!this.world.isRemote) {
|
||||
if (this.burnTime != 0 || this.getStackInSlot(this.input1) != ItemStack.EMPTY && this.getStackInSlot(this.fuel) != ItemStack.EMPTY) {
|
||||
if (this.burnTime != 0 || !this.getStackInSlot(this.input1).isEmpty()&& !this.getStackInSlot(this.fuel).isEmpty()) {
|
||||
if (this.burnTime == 0 && this.canSmelt()) {
|
||||
this.currentItemBurnTime = this.burnTime = TileIronAlloyFurnace.getItemBurnTime(this.getStackInSlot(this.fuel));
|
||||
if (this.burnTime > 0) {
|
||||
flag1 = true;
|
||||
if (this.getStackInSlot(this.fuel) != ItemStack.EMPTY) {
|
||||
if (!this.getStackInSlot(this.fuel).isEmpty()) {
|
||||
this.decrStackSize(this.fuel, 1);
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ public class TileIronAlloyFurnace extends TileLegacyMachineBase
|
|||
}
|
||||
|
||||
private boolean canSmelt() {
|
||||
if (this.getStackInSlot(this.input1) == ItemStack.EMPTY || this.getStackInSlot(this.input2) == ItemStack.EMPTY) {
|
||||
if (this.getStackInSlot(this.input1).isEmpty() || this.getStackInSlot(this.input2).isEmpty()) {
|
||||
return false;
|
||||
} else {
|
||||
ItemStack itemstack = null;
|
||||
|
@ -204,7 +204,7 @@ public class TileIronAlloyFurnace extends TileLegacyMachineBase
|
|||
|
||||
if (itemstack == null)
|
||||
return false;
|
||||
if (this.getStackInSlot(this.output) == ItemStack.EMPTY)
|
||||
if (this.getStackInSlot(this.output).isEmpty())
|
||||
return true;
|
||||
if (!this.getStackInSlot(this.output).isItemEqual(itemstack))
|
||||
return false;
|
||||
|
@ -237,7 +237,7 @@ public class TileIronAlloyFurnace extends TileLegacyMachineBase
|
|||
}
|
||||
}
|
||||
|
||||
if (this.getStackInSlot(this.output) == ItemStack.EMPTY) {
|
||||
if (this.getStackInSlot(this.output).isEmpty()) {
|
||||
this.setInventorySlotContents(this.output, itemstack.copy());
|
||||
} else if (this.getStackInSlot(this.output).getItem() == itemstack.getItem()) {
|
||||
this.decrStackSize(this.output, -itemstack.getCount());
|
||||
|
|
|
@ -115,7 +115,7 @@ public class TileIronFurnace extends TileLegacyMachineBase
|
|||
if (this.canSmelt()) {
|
||||
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.getStackInSlot(this.input1));
|
||||
|
||||
if (this.getStackInSlot(this.output) == ItemStack.EMPTY) {
|
||||
if (this.getStackInSlot(this.output).isEmpty()) {
|
||||
this.setInventorySlotContents(this.output, itemstack.copy());
|
||||
} else if (this.getStackInSlot(this.output).isItemEqual(itemstack)) {
|
||||
this.getStackInSlot(this.output).grow(itemstack.getCount());
|
||||
|
@ -129,12 +129,12 @@ public class TileIronFurnace extends TileLegacyMachineBase
|
|||
}
|
||||
|
||||
public boolean canSmelt() {
|
||||
if (this.getStackInSlot(this.input1) == ItemStack.EMPTY)
|
||||
if (this.getStackInSlot(this.input1).isEmpty())
|
||||
return false;
|
||||
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.getStackInSlot(this.input1));
|
||||
if (itemstack.isEmpty())
|
||||
return false;
|
||||
if (this.getStackInSlot(this.output) == ItemStack.EMPTY)
|
||||
if (this.getStackInSlot(this.output).isEmpty())
|
||||
return true;
|
||||
if (!this.getStackInSlot(this.output).isItemEqual(itemstack))
|
||||
return false;
|
||||
|
|
|
@ -71,7 +71,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
if (canSmelt()) {
|
||||
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1));
|
||||
|
||||
if (getStackInSlot(output) == ItemStack.EMPTY) {
|
||||
if (getStackInSlot(output).isEmpty()) {
|
||||
setInventorySlotContents(output, itemstack.copy());
|
||||
} else if (getStackInSlot(output).isItemEqual(itemstack)) {
|
||||
getStackInSlot(output).grow(itemstack.getCount());
|
||||
|
@ -85,14 +85,14 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
public boolean canSmelt() {
|
||||
if (getStackInSlot(input1) == ItemStack.EMPTY) {
|
||||
if (getStackInSlot(input1).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1));
|
||||
if (itemstack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (getStackInSlot(output) == ItemStack.EMPTY) {
|
||||
if (getStackInSlot(output).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (!getStackInSlot(output).isItemEqual(itemstack)) {
|
||||
|
|
|
@ -90,11 +90,11 @@ public class TileRecycler extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
public boolean canRecycle() {
|
||||
return getStackInSlot(0) != ItemStack.EMPTY && hasSlotGotSpace(1);
|
||||
return !getStackInSlot(0) .isEmpty() && hasSlotGotSpace(1);
|
||||
}
|
||||
|
||||
public boolean hasSlotGotSpace(int slot) {
|
||||
if (getStackInSlot(slot) == ItemStack.EMPTY) {
|
||||
if (getStackInSlot(slot).isEmpty()) {
|
||||
return true;
|
||||
} else if (getStackInSlot(slot).getCount() < getStackInSlot(slot).getMaxStackSize()) {
|
||||
return true;
|
||||
|
|
|
@ -136,7 +136,7 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
currentRecipeOutput = RollingMachineRecipe.instance.findMatchingRecipeOutput(craftMatrix, world);
|
||||
if (!currentRecipeOutput.isEmpty()) {
|
||||
boolean hasCrafted = false;
|
||||
if (inventory.getStackInSlot(outputSlot) == ItemStack.EMPTY) {
|
||||
if (inventory.getStackInSlot(outputSlot).isEmpty()) {
|
||||
inventory.setInventorySlotContents(outputSlot, currentRecipeOutput);
|
||||
tickTime = 0;
|
||||
hasCrafted = true;
|
||||
|
|
Loading…
Reference in a new issue