mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 21:09:45 +00:00
Fix some null ItemStack issues
This commit is contained in:
1 parent
c00ddbc50a
commit
41a1e375b7
6 files changed
+13
-11
No files matched your search
@@ -10,7 +10,7 @@ import net.minecraft.util.NonNullList;
|
||||
|
||||
public class AdvancedMachineInput extends MachineInput<AdvancedMachineInput>
|
||||
{
|
||||
public ItemStack itemStack;
|
||||
public ItemStack itemStack = ItemStack.EMPTY;
|
||||
|
||||
public Gas gasType;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class ItemStackInput extends MachineInput<ItemStackInput>
|
||||
{
|
||||
public ItemStack ingredient;
|
||||
public ItemStack ingredient = ItemStack.EMPTY;
|
||||
|
||||
public ItemStackInput(ItemStack stack)
|
||||
{
|
||||
@@ -33,7 +33,7 @@ public class ItemStackInput extends MachineInput<ItemStackInput>
|
||||
@Override
|
||||
public boolean isValid()
|
||||
{
|
||||
return ingredient != null;
|
||||
return !ingredient.isEmpty();
|
||||
}
|
||||
|
||||
public ItemStackInput wildCopy()
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraftforge.fluids.FluidTank;
|
||||
*/
|
||||
public class PressurizedInput extends MachineInput<PressurizedInput>
|
||||
{
|
||||
private ItemStack theSolid;
|
||||
private ItemStack theSolid = ItemStack.EMPTY;
|
||||
private FluidStack theFluid;
|
||||
private GasStack theGas;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PressurizedInput extends MachineInput<PressurizedInput>
|
||||
@Override
|
||||
public boolean isValid()
|
||||
{
|
||||
return theSolid != null && theFluid != null && theGas != null;
|
||||
return !theSolid.isEmpty() && theFluid != null && theGas != null;
|
||||
}
|
||||
|
||||
public boolean use(NonNullList<ItemStack> inventory, int index, FluidTank fluidTank, GasTank gasTank, boolean deplete)
|
||||
|
||||
@@ -12,9 +12,9 @@ public class ChanceOutput extends MachineOutput<ChanceOutput>
|
||||
{
|
||||
private static Random rand = new Random();
|
||||
|
||||
public ItemStack primaryOutput;
|
||||
public ItemStack primaryOutput = ItemStack.EMPTY;
|
||||
|
||||
public ItemStack secondaryOutput;
|
||||
public ItemStack secondaryOutput = ItemStack.EMPTY;
|
||||
|
||||
public double secondaryChance;
|
||||
|
||||
@@ -47,12 +47,12 @@ public class ChanceOutput extends MachineOutput<ChanceOutput>
|
||||
|
||||
public boolean hasPrimary()
|
||||
{
|
||||
return primaryOutput != null;
|
||||
return !primaryOutput.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasSecondary()
|
||||
{
|
||||
return secondaryOutput != null;
|
||||
return !secondaryOutput.isEmpty();
|
||||
}
|
||||
|
||||
public boolean applyOutputs(NonNullList<ItemStack> inventory, int primaryIndex, int secondaryIndex, boolean doEmit)
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.util.NonNullList;
|
||||
|
||||
public class ItemStackOutput extends MachineOutput<ItemStackOutput>
|
||||
{
|
||||
public ItemStack output;
|
||||
public ItemStack output = ItemStack.EMPTY;
|
||||
|
||||
public ItemStackOutput(ItemStack stack)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.util.NonNullList;
|
||||
|
||||
public class PressurizedOutput extends MachineOutput<PressurizedOutput>
|
||||
{
|
||||
private ItemStack itemOutput;
|
||||
private ItemStack itemOutput = ItemStack.EMPTY;
|
||||
private GasStack gasOutput;
|
||||
|
||||
public PressurizedOutput(ItemStack item, GasStack gas)
|
||||
@@ -63,8 +63,10 @@ public class PressurizedOutput extends MachineOutput<PressurizedOutput>
|
||||
fillTank(tank);
|
||||
addProducts(inventory, index);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user