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
|
@Override
|
||||||
public int hashIngredients()
|
public int hashIngredients()
|
||||||
{
|
{
|
||||||
int hash = StackUtils.hashItemStack(itemStack) << 8 | gasType.getID();
|
return StackUtils.hashItemStack(itemStack) << 8 | gasType.getID();
|
||||||
return hash;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean testEquality(AdvancedMachineInput other)
|
public boolean testEquality(AdvancedMachineInput other)
|
||||||
{
|
{
|
||||||
|
if(!isValid())
|
||||||
|
{
|
||||||
|
return !other.isValid();
|
||||||
|
}
|
||||||
return StackUtils.equalsWildcardWithNBT(itemStack, other.itemStack) && gasType.getID() == other.gasType.getID();
|
return StackUtils.equalsWildcardWithNBT(itemStack, other.itemStack) && gasType.getID() == other.gasType.getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,8 +147,12 @@ public class ChemicalPairInput extends MachineInput<ChemicalPairInput>
|
||||||
@Override
|
@Override
|
||||||
public boolean testEquality(ChemicalPairInput other)
|
public boolean testEquality(ChemicalPairInput other)
|
||||||
{
|
{
|
||||||
return (other.leftGas.hashCode() == leftGas.hashCode() && other.rightGas.hashCode() == rightGas.hashCode())
|
if(!isValid())
|
||||||
|| (other.leftGas.hashCode() == rightGas.hashCode() && other.rightGas.hashCode() == leftGas.hashCode());
|
{
|
||||||
|
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
|
@Override
|
||||||
|
|
|
@ -43,6 +43,10 @@ public class FluidInput extends MachineInput<FluidInput>
|
||||||
@Override
|
@Override
|
||||||
public boolean testEquality(FluidInput other)
|
public boolean testEquality(FluidInput other)
|
||||||
{
|
{
|
||||||
|
if(!isValid())
|
||||||
|
{
|
||||||
|
return !other.isValid();
|
||||||
|
}
|
||||||
return ingredient.equals(other.ingredient);
|
return ingredient.equals(other.ingredient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,10 @@ public class GasInput extends MachineInput<GasInput>
|
||||||
@Override
|
@Override
|
||||||
public boolean testEquality(GasInput other)
|
public boolean testEquality(GasInput other)
|
||||||
{
|
{
|
||||||
|
if(!isValid())
|
||||||
|
{
|
||||||
|
return !other.isValid();
|
||||||
|
}
|
||||||
return other.ingredient.hashCode() == ingredient.hashCode();
|
return other.ingredient.hashCode() == ingredient.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,10 @@ public class InfusionInput extends MachineInput<InfusionInput>
|
||||||
@Override
|
@Override
|
||||||
public boolean testEquality(InfusionInput other)
|
public boolean testEquality(InfusionInput other)
|
||||||
{
|
{
|
||||||
|
if(!isValid())
|
||||||
|
{
|
||||||
|
return !other.isValid();
|
||||||
|
}
|
||||||
return infuse.type == other.infuse.type && StackUtils.equalsWildcardWithNBT(inputStack, other.inputStack);
|
return infuse.type == other.infuse.type && StackUtils.equalsWildcardWithNBT(inputStack, other.inputStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue