From d4cac93bb013d0e6627131659f2b6ada622607e6 Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+youngonionmc@users.noreply.github.com> Date: Sun, 13 Oct 2024 16:15:41 -0400 Subject: [PATCH] Fix NPE caused by filter not loading properly on cover (#2176) --- .../com/gregtechceu/gtceu/common/cover/FluidFilterCover.java | 4 ++-- .../com/gregtechceu/gtceu/common/cover/ItemFilterCover.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java index 4f92dfc6e9..5f83105138 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java @@ -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); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java index 3017d3ae3a..577a43102d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java @@ -102,7 +102,7 @@ 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); } @@ -110,7 +110,7 @@ public FilteredItemTransferWrapper(IItemHandlerModifiable delegate) { @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);