Equals does not equal not equals

- Fix inverted fluid comparison from a recent PR
This commit is contained in:
simibubi 2024-07-15 12:58:38 +02:00
parent 7bd602a33f
commit 4b3dcc32ab
2 changed files with 15 additions and 9 deletions

View file

@ -49,6 +49,14 @@ public class FluidHelper {
public static boolean isLava(Fluid fluid) {
return convertToStill(fluid) == Fluids.LAVA;
}
public static boolean isSame(FluidStack fluidStack, FluidStack fluidStack2) {
return fluidStack.getFluid() == fluidStack2.getFluid();
}
public static boolean isSame(FluidStack fluidStack, Fluid fluid) {
return fluidStack.getFluid() == fluid;
}
@SuppressWarnings("deprecation")
public static boolean isTag(Fluid fluid, TagKey<Fluid> tag) {

View file

@ -152,7 +152,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
@Override
protected boolean testInternal(FluidStack t) {
if (t.getFluid() != fluid)
if (!FluidHelper.isSame(t, fluid))
return false;
if (tagToMatch.isEmpty())
return true;
@ -200,16 +200,14 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
protected TagKey<Fluid> tag;
@SuppressWarnings("deprecation")
@Override
protected boolean testInternal(FluidStack t) {
if (tag == null) {
for (FluidStack accepted : getMatchingFluidStacks())
if (accepted.getFluid() != t.getFluid())
return true;
return false;
}
return t.getFluid().is(tag);
if (tag != null)
return FluidHelper.isTag(t, tag);
for (FluidStack accepted : getMatchingFluidStacks())
if (FluidHelper.isSame(accepted, t))
return true;
return false;
}
@Override