From d585b298fb748c16f9d0129acbf96d5b17ddfb04 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 18 Aug 2019 14:22:45 +0100 Subject: [PATCH] Fix some issues with the fluid handling of items --- src/main/java/techreborn/utils/FluidUtils.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/techreborn/utils/FluidUtils.java b/src/main/java/techreborn/utils/FluidUtils.java index 48d292882..e6312f82b 100644 --- a/src/main/java/techreborn/utils/FluidUtils.java +++ b/src/main/java/techreborn/utils/FluidUtils.java @@ -26,6 +26,7 @@ package techreborn.utils; import io.github.prospector.silk.fluid.FluidInstance; import net.minecraft.block.Block; +import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; @@ -33,7 +34,6 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.registry.Registry; import org.checkerframework.checker.nullness.qual.NonNull; import reborncore.common.fluid.container.GenericFluidContainer; -import net.minecraft.fluid.Fluid; import reborncore.common.fluid.container.ItemFluidInfo; import reborncore.mixin.extensions.FluidBlockExtensions; @@ -58,6 +58,7 @@ public class FluidUtils { ItemStack inputStack = inventory.getInvStack(inputSlot); ItemStack outputStack = inventory.getInvStack(outputSlot); + if(!(inputStack.getItem() instanceof ItemFluidInfo)) return false; if (outputStack.getCount() >= outputStack.getMaxCount()) return false; if (FluidUtils.isContainerEmpty(inputStack)) return false; @@ -93,7 +94,8 @@ public class FluidUtils { public static boolean fillContainers(GenericFluidContainer source, Inventory inventory, int inputSlot, int outputSlot, Fluid fluidToFill) { ItemStack inputStack = inventory.getInvStack(inputSlot); ItemStack outputStack = inventory.getInvStack(outputSlot); - + + if(!(inputStack.getItem() instanceof ItemFluidInfo)) return false; if (!FluidUtils.isContainerEmpty(inputStack)) return false; ItemFluidInfo itemFluidInfo = (ItemFluidInfo) inputStack.getItem();