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
src/main/java/techreborn/tiles
|
@ -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…
Add table
Add a link
Reference in a new issue