Skip to content

Commit

Permalink
Fix NPE caused by filter not loading properly on cover (#2176)
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungOnionMC authored Oct 13, 2024
1 parent dd8c206 commit 0468701
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ public FilteredFluidTransferWrapper(IFluidTransfer delegate) {

@Override
public long fill(int tank, FluidStack resource, boolean simulate, boolean notifyChanges) {
if (!fluidFilter.test(resource))
if (!getFluidFilter().test(resource))
return 0;
return super.fill(tank, resource, simulate, notifyChanges);
}

@Override
public FluidStack drain(int tank, FluidStack resource, boolean simulate, boolean notifyChanges) {
if (!fluidFilter.test(resource))
if (!getFluidFilter().test(resource))
return FluidStack.empty();
return super.drain(tank, resource, simulate, notifyChanges);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ public FilteredItemTransferWrapper(IItemTransfer delegate) {
@Override
public @NotNull ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate,
boolean notifyChanges) {
if (filterMode != ItemFilterMode.FILTER_EXTRACT && !itemFilter.test(stack))
if (filterMode != ItemFilterMode.FILTER_EXTRACT && !getItemFilter().test(stack))
return stack;
return super.insertItem(slot, stack, simulate, notifyChanges);
}

@Override
public @NotNull ItemStack extractItem(int slot, int amount, boolean simulate, boolean notifyChanges) {
ItemStack result = super.extractItem(slot, amount, true, notifyChanges);
if (result.isEmpty() || (filterMode != ItemFilterMode.FILTER_INSERT && !itemFilter.test(result))) {
if (result.isEmpty() || (filterMode != ItemFilterMode.FILTER_INSERT && !getItemFilter().test(result))) {
return ItemStack.EMPTY;
}
return simulate ? result : super.extractItem(slot, amount, false, notifyChanges);
Expand Down

0 comments on commit 0468701

Please sign in to comment.