Found some more null itemstacks

This commit is contained in:
modmuss50 2017-06-13 11:26:08 +01:00
parent c3c0a0421d
commit df62000513
No known key found for this signature in database
GPG key ID: 203A5ED4D3E48BEA
4 changed files with 12 additions and 9 deletions

View file

@ -126,7 +126,7 @@ public class RollingMachineRecipe {
}
}
return null;
return ItemStack.EMPTY;
}
public HashMap<ResourceLocation, IRecipe> getRecipeList() {

View file

@ -154,7 +154,7 @@ public class TileIronFurnace extends TileLegacyMachineBase
if (result != ItemStack.EMPTY) {
return result.copy();
}
return null;
return ItemStack.EMPTY;
}
public void updateState() {

View file

@ -44,6 +44,8 @@ import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
import javax.annotation.Nonnull;
//TODO add tick and power bars.
@RebornRegistry(modID = ModInfo.MOD_ID)
@ -65,6 +67,7 @@ public class TileRollingMachine extends TilePowerAcceptor
public Inventory inventory = new Inventory(3, "TileRollingMachine", 64, this);
public boolean isRunning;
public int tickTime;
@Nonnull
public ItemStack currentRecipe;
private int outputSlot;
@ -104,10 +107,10 @@ public class TileRollingMachine extends TilePowerAcceptor
this.charge(2);
if (!this.world.isRemote) {
this.currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(this.craftMatrix, this.world);
if (this.currentRecipe != null && this.canMake()) {
if (!this.currentRecipe.isEmpty() && this.canMake()) {
if (this.tickTime >= this.runTime) {
this.currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(this.craftMatrix, this.world);
if (this.currentRecipe != null) {
if (!this.currentRecipe.isEmpty()) {
boolean hasCrafted = false;
if (this.inventory.getStackInSlot(outputSlot) == ItemStack.EMPTY) {
this.inventory.setInventorySlotContents(outputSlot, this.currentRecipe);
@ -127,23 +130,23 @@ public class TileRollingMachine extends TilePowerAcceptor
for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) {
this.craftMatrix.decrStackSize(i, 1);
}
this.currentRecipe = null;
this.currentRecipe = ItemStack.EMPTY;
}
}
}
}
if (this.currentRecipe != null) {
if (!this.currentRecipe.isEmpty()) {
if (this.canUseEnergy(energyPerTick) && this.tickTime < this.runTime) {
this.useEnergy(energyPerTick);
this.tickTime++;
}
}
if (this.currentRecipe == null) {
if (this.currentRecipe.isEmpty()) {
this.tickTime = -1;
}
} else {
this.currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(this.craftMatrix, this.world);
if (this.currentRecipe != null) {
if (!this.currentRecipe.isEmpty()) {
this.inventory.setInventorySlotContents(1, this.currentRecipe);
} else {
this.inventory.setInventorySlotContents(1, ItemStack.EMPTY);

View file

@ -132,7 +132,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
if (result != ItemStack.EMPTY) {
return result.copy();
}
return null;
return ItemStack.EMPTY;
}
public void updateState() {