Skip to content

Commit

Permalink
fix filters
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Jul 21, 2024
1 parent 5586f56 commit e07ec4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,15 @@ public boolean test(FluidStack stack) {
return fingerprint.equals(testFingerprint);
}

// If the filter does not have nbt values, a tag or a fingerprint, just test if the items are the same
if (fluid != Fluids.EMPTY) {
if (tag == null && nbt == null && fingerprint.isEmpty())
return stack.getFluid().isSame(fluid);
if (fluid != Fluids.EMPTY && !stack.getFluid().isSame(fluid)) {
return false;
}
if (tag != null && !stack.getFluid().is(tag))
if (tag != null && !stack.getFluid().is(tag)) {
return false;
if (nbt != null && !stack.getOrCreateTag().equals(nbt) && (fluid == Fluids.EMPTY || stack.getFluid().isSame(fluid)))
}
if (nbt != null && !stack.getOrCreateTag().equals(nbt)) {
return false;

}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,15 @@ public boolean test(ItemStack stack) {
return fingerprint.equals(testFingerprint);
}

// If the filter does not have nbt values, a tag or a fingerprint, just test if the items are the same
if (item != Items.AIR) {
if (tag == null && nbt == null && fingerprint.isEmpty())
return stack.is(item);
if (item != Items.AIR && !stack.is(item)) {
return false;
}
if (tag != null && !stack.is(tag))
if (tag != null && !stack.is(tag)) {
return false;
if (nbt != null && !stack.getOrCreateTag().equals(nbt) && (item == Items.AIR || stack.is(item)))
}
if (nbt != null && !stack.getOrCreateTag().equals(nbt)) {
return false;

}
return true;
}

Expand Down

0 comments on commit e07ec4b

Please sign in to comment.