From 2d3dda245a2d782ab8ba031083528fb077286af9 Mon Sep 17 00:00:00 2001 From: Ben Spiers Date: Mon, 4 Aug 2014 01:08:49 +0100 Subject: [PATCH] Get all registered fluids to show up in Portable tanks in NEI. --- .../java/mekanism/common/block/BlockMachine.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/mekanism/common/block/BlockMachine.java b/src/main/java/mekanism/common/block/BlockMachine.java index 0ef75b0a1..08ec81bbe 100644 --- a/src/main/java/mekanism/common/block/BlockMachine.java +++ b/src/main/java/mekanism/common/block/BlockMachine.java @@ -23,6 +23,7 @@ import mekanism.common.IUpgradeTile; import mekanism.common.ItemAttacher; import mekanism.common.Mekanism; import mekanism.common.MekanismBlocks; +import mekanism.common.item.ItemBlockMachine; import mekanism.common.network.PacketElectricChest.ElectricChestMessage; import mekanism.common.network.PacketElectricChest.ElectricChestPacketType; import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage; @@ -83,7 +84,9 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import buildcraft.api.tools.IToolWrench; import cpw.mods.fml.common.ModAPIManager; @@ -633,6 +636,19 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer list.add(stack); } } + else if(type == MachineType.PORTABLE_TANK) { + list.add(new ItemStack(item, 1, type.meta)); + + ItemBlockMachine itemMachine = (ItemBlockMachine)item; + + for(Fluid f : FluidRegistry.getRegisteredFluids().values()) + { + ItemStack filled = new ItemStack(item, 1, type.meta); + itemMachine.setFluidStack(new FluidStack(f, itemMachine.getCapacity(filled)), filled); + itemMachine.setPrevScale(filled, 1); + list.add(filled); + } + } else { list.add(new ItemStack(item, 1, type.meta)); }