Fix some issues with the fluid handling of items

This commit is contained in:
modmuss50 2019-08-18 14:22:45 +01:00
parent 3eec5bcb5b
commit d585b298fb

View file

@ -26,6 +26,7 @@ package techreborn.utils;
import io.github.prospector.silk.fluid.FluidInstance; import io.github.prospector.silk.fluid.FluidInstance;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -33,7 +34,6 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import reborncore.common.fluid.container.GenericFluidContainer; import reborncore.common.fluid.container.GenericFluidContainer;
import net.minecraft.fluid.Fluid;
import reborncore.common.fluid.container.ItemFluidInfo; import reborncore.common.fluid.container.ItemFluidInfo;
import reborncore.mixin.extensions.FluidBlockExtensions; import reborncore.mixin.extensions.FluidBlockExtensions;
@ -58,6 +58,7 @@ public class FluidUtils {
ItemStack inputStack = inventory.getInvStack(inputSlot); ItemStack inputStack = inventory.getInvStack(inputSlot);
ItemStack outputStack = inventory.getInvStack(outputSlot); ItemStack outputStack = inventory.getInvStack(outputSlot);
if(!(inputStack.getItem() instanceof ItemFluidInfo)) return false;
if (outputStack.getCount() >= outputStack.getMaxCount()) return false; if (outputStack.getCount() >= outputStack.getMaxCount()) return false;
if (FluidUtils.isContainerEmpty(inputStack)) return false; if (FluidUtils.isContainerEmpty(inputStack)) return false;
@ -94,6 +95,7 @@ public class FluidUtils {
ItemStack inputStack = inventory.getInvStack(inputSlot); ItemStack inputStack = inventory.getInvStack(inputSlot);
ItemStack outputStack = inventory.getInvStack(outputSlot); ItemStack outputStack = inventory.getInvStack(outputSlot);
if(!(inputStack.getItem() instanceof ItemFluidInfo)) return false;
if (!FluidUtils.isContainerEmpty(inputStack)) return false; if (!FluidUtils.isContainerEmpty(inputStack)) return false;
ItemFluidInfo itemFluidInfo = (ItemFluidInfo) inputStack.getItem(); ItemFluidInfo itemFluidInfo = (ItemFluidInfo) inputStack.getItem();