Fix some potential NPE problems.
This commit is contained in:
parent
bafdb18756
commit
32b3a5b0ac
5 changed files with 23 additions and 4 deletions
|
@ -61,13 +61,16 @@ public class AdvancedMachineInput extends MachineInput<AdvancedMachineInput>
|
|||
@Override
|
||||
public int hashIngredients()
|
||||
{
|
||||
int hash = StackUtils.hashItemStack(itemStack) << 8 | gasType.getID();
|
||||
return hash;
|
||||
return StackUtils.hashItemStack(itemStack) << 8 | gasType.getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testEquality(AdvancedMachineInput other)
|
||||
{
|
||||
if(!isValid())
|
||||
{
|
||||
return !other.isValid();
|
||||
}
|
||||
return StackUtils.equalsWildcardWithNBT(itemStack, other.itemStack) && gasType.getID() == other.gasType.getID();
|
||||
}
|
||||
|
||||
|
|
|
@ -147,8 +147,12 @@ public class ChemicalPairInput extends MachineInput<ChemicalPairInput>
|
|||
@Override
|
||||
public boolean testEquality(ChemicalPairInput other)
|
||||
{
|
||||
return (other.leftGas.hashCode() == leftGas.hashCode() && other.rightGas.hashCode() == rightGas.hashCode())
|
||||
|| (other.leftGas.hashCode() == rightGas.hashCode() && other.rightGas.hashCode() == leftGas.hashCode());
|
||||
if(!isValid())
|
||||
{
|
||||
return !other.isValid();
|
||||
}
|
||||
return (other.leftGas.hashCode() == leftGas.hashCode() && other.rightGas.hashCode() == rightGas.hashCode())
|
||||
|| (other.leftGas.hashCode() == rightGas.hashCode() && other.rightGas.hashCode() == leftGas.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,6 +43,10 @@ public class FluidInput extends MachineInput<FluidInput>
|
|||
@Override
|
||||
public boolean testEquality(FluidInput other)
|
||||
{
|
||||
if(!isValid())
|
||||
{
|
||||
return !other.isValid();
|
||||
}
|
||||
return ingredient.equals(other.ingredient);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,10 @@ public class GasInput extends MachineInput<GasInput>
|
|||
@Override
|
||||
public boolean testEquality(GasInput other)
|
||||
{
|
||||
if(!isValid())
|
||||
{
|
||||
return !other.isValid();
|
||||
}
|
||||
return other.ingredient.hashCode() == ingredient.hashCode();
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,10 @@ public class InfusionInput extends MachineInput<InfusionInput>
|
|||
@Override
|
||||
public boolean testEquality(InfusionInput other)
|
||||
{
|
||||
if(!isValid())
|
||||
{
|
||||
return !other.isValid();
|
||||
}
|
||||
return infuse.type == other.infuse.type && StackUtils.equalsWildcardWithNBT(inputStack, other.inputStack);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue