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 and krossgg committed Oct 14, 2024
1 parent 04d7d63 commit d4cac93
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(IFluidHandlerModifiable delegate) {

@Override
public int fill(FluidStack resource, FluidAction action) {
if (!fluidFilter.test(resource))
if (!getFluidFilter().test(resource))
return 0;
return super.fill(resource, action);
}

@Override
public FluidStack drain(FluidStack resource, FluidAction action) {
if (!fluidFilter.test(resource))
if (!getFluidFilter().test(resource))
return FluidStack.EMPTY;
return super.drain(resource, action);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ public FilteredItemTransferWrapper(IItemHandlerModifiable delegate) {

@Override
public @NotNull ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) {
if (filterMode != ItemFilterMode.FILTER_EXTRACT && !itemFilter.test(stack))
if (filterMode != ItemFilterMode.FILTER_EXTRACT && !getItemFilter().test(stack))
return stack;
return super.insertItem(slot, stack, simulate);
}

@Override
public @NotNull ItemStack extractItem(int slot, int amount, boolean simulate) {
ItemStack result = super.extractItem(slot, amount, true);
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);
Expand Down

0 comments on commit d4cac93

Please sign in to comment.