From 0468701d356ee581f7c59e36f64e40a4773a4853 Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Sun, 13 Oct 2024 14:15:41 -0600 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 757c6b378d..9e15898822 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(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); } 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 b6b8274d64..41f53297fc 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java @@ -103,7 +103,7 @@ 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); } @@ -111,7 +111,7 @@ public FilteredItemTransferWrapper(IItemTransfer delegate) { @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);