diff --git a/src/main/java/techreborn/tiles/TileThermalGenerator.java b/src/main/java/techreborn/tiles/TileThermalGenerator.java index c814b3ada..70d3df5f8 100644 --- a/src/main/java/techreborn/tiles/TileThermalGenerator.java +++ b/src/main/java/techreborn/tiles/TileThermalGenerator.java @@ -103,7 +103,7 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, { if (fluid != null) { - if (FluidRegistry.getFluidName(fluid.getID()).contentEquals("lava")) + if (fluid == FluidRegistry.LAVA) { return true; } diff --git a/src/main/java/techreborn/util/FluidUtils.java b/src/main/java/techreborn/util/FluidUtils.java index 64c009a96..657e16dc5 100644 --- a/src/main/java/techreborn/util/FluidUtils.java +++ b/src/main/java/techreborn/util/FluidUtils.java @@ -11,24 +11,16 @@ import net.minecraftforge.fluids.IFluidHandler; public class FluidUtils { public static boolean drainContainers(IFluidHandler fluidHandler, - IInventory inv, int inputSlot, int outputSlot) - { + IInventory inv, int inputSlot, int outputSlot) { ItemStack input = inv.getStackInSlot(inputSlot); ItemStack output = inv.getStackInSlot(outputSlot); - if (input != null) - { + if (input != null) { FluidStack fluidInContainer = getFluidStackInContainer(input); ItemStack emptyItem = input.getItem().getContainerItem(input); - if (fluidInContainer != null - && (emptyItem == null || output == null || (output.stackSize < output - .getMaxStackSize() && ItemUtils.isItemEqual(output, - emptyItem, true, true)))) - { - int used = fluidHandler.fill(ForgeDirection.UNKNOWN, - fluidInContainer, false); - if (used >= fluidInContainer.amount) - { + if (fluidInContainer != null && (emptyItem == null || output == null || (output.stackSize < output.getMaxStackSize() && ItemUtils.isItemEqual(output, emptyItem, true, true)))) { + int used = fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, false); + if (used >= fluidInContainer.amount && fluidHandler.canFill(ForgeDirection.UP, fluidInContainer.getFluid())) { fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, true); if (emptyItem != null) @@ -45,21 +37,15 @@ public class FluidUtils { } public static boolean fillContainers(IFluidHandler fluidHandler, - IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) - { + IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) { ItemStack input = inv.getStackInSlot(inputSlot); ItemStack output = inv.getStackInSlot(outputSlot); ItemStack filled = getFilledContainer(fluidToFill, input); - if (filled != null - && (output == null || (output.stackSize < output - .getMaxStackSize() && ItemUtils.isItemEqual(filled, - output, true, true)))) - { + if (filled != null && (output == null || (output.stackSize < output.getMaxStackSize() && ItemUtils.isItemEqual(filled, output, true, true)))) { FluidStack fluidInContainer = getFluidStackInContainer(filled); FluidStack drain = fluidHandler.drain(ForgeDirection.UNKNOWN, fluidInContainer, false); - if (drain != null && drain.amount == fluidInContainer.amount) - { + if (drain != null && drain.amount == fluidInContainer.amount) { fluidHandler.drain(ForgeDirection.UNKNOWN, fluidInContainer, true); if (output == null) @@ -73,13 +59,11 @@ public class FluidUtils { return false; } - public static FluidStack getFluidStackInContainer(ItemStack stack) - { + public static FluidStack getFluidStackInContainer(ItemStack stack) { return FluidContainerRegistry.getFluidForFilledItem(stack); } - public static ItemStack getFilledContainer(Fluid fluid, ItemStack empty) - { + public static ItemStack getFilledContainer(Fluid fluid, ItemStack empty) { if (fluid == null || empty == null) return null; return FluidContainerRegistry.fillFluidContainer(new FluidStack(fluid,