diff --git a/src/minecraft/dark/fluid/client/render/RenderSink.java b/src/minecraft/dark/fluid/client/render/RenderSink.java index 266728bf7..184be7709 100644 --- a/src/minecraft/dark/fluid/client/render/RenderSink.java +++ b/src/minecraft/dark/fluid/client/render/RenderSink.java @@ -1,6 +1,5 @@ package dark.fluid.client.render; -import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; diff --git a/src/minecraft/dark/fluid/common/FluidMech.java b/src/minecraft/dark/fluid/common/FluidMech.java index 6e6fb7b85..2d42901f6 100644 --- a/src/minecraft/dark/fluid/common/FluidMech.java +++ b/src/minecraft/dark/fluid/common/FluidMech.java @@ -6,11 +6,11 @@ import java.util.logging.Logger; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraftforge.common.Configuration; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fluids.BlockFluidFinite; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.oredict.OreDictionary; @@ -36,7 +36,6 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import dark.core.api.ColorCode; -import dark.core.hydraulic.helpers.FluidRestrictionHandler; import dark.fluid.common.item.ItemParts; import dark.fluid.common.item.ItemParts.Parts; import dark.fluid.common.item.ItemTools; @@ -146,7 +145,7 @@ public class FluidMech extends DummyModContainer /* UPDATE NOTIFIER */ Modstats.instance().getReporter().registerMod(this); - MinecraftForge.EVENT_BUS.register(new FluidRestrictionHandler()); + /* CONFIGS */ CONFIGURATION.load(); @@ -246,8 +245,6 @@ public class FluidMech extends DummyModContainer /* LOGGER */ FMLog.info("Finalizing..."); proxy.postInit(); - /* TAB ITEM SET */ - TabFluidMech.setItemStack(new ItemStack(blockPipe, 1, 4)); /* /******** RECIPES ************* */ @@ -328,4 +325,13 @@ public class FluidMech extends DummyModContainer FMLog.info("Done Loading"); } + + public static final CreativeTabs TabFluidMech = new CreativeTabs("Fluid Mechanics") + { + + public ItemStack getIconItemStack() + { + return new ItemStack(blockPipe, 1, 4); + } + }; } diff --git a/src/minecraft/dark/fluid/common/TabFluidMech.java b/src/minecraft/dark/fluid/common/TabFluidMech.java deleted file mode 100644 index 1d386d94c..000000000 --- a/src/minecraft/dark/fluid/common/TabFluidMech.java +++ /dev/null @@ -1,35 +0,0 @@ -package dark.fluid.common; - -import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.ItemStack; - -public class TabFluidMech extends CreativeTabs -{ - public static final TabFluidMech INSTANCE = new TabFluidMech(); - private static ItemStack itemStack; - - public TabFluidMech() - { - super(CreativeTabs.getNextID(), "FluidMechanics"); - } - - public static void setItemStack(ItemStack newItemStack) - { - if (itemStack == null) - { - itemStack = newItemStack; - } - } - - @Override - public ItemStack getIconItemStack() - { - if (itemStack == null) - { - return new ItemStack(Block.blocksList[this.getTabIconItemIndex()]); - } - - return itemStack; - } -} diff --git a/src/minecraft/dark/fluid/common/item/ItemBasic.java b/src/minecraft/dark/fluid/common/item/ItemBasic.java index 0627e8664..ef5f88047 100644 --- a/src/minecraft/dark/fluid/common/item/ItemBasic.java +++ b/src/minecraft/dark/fluid/common/item/ItemBasic.java @@ -10,7 +10,6 @@ import net.minecraft.util.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import dark.fluid.common.FluidMech; -import dark.fluid.common.TabFluidMech; public class ItemBasic extends Item { @@ -20,7 +19,7 @@ public class ItemBasic extends Item { super(id); this.setUnlocalizedName(name); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); } @SideOnly(Side.CLIENT) diff --git a/src/minecraft/dark/fluid/common/item/ItemParts.java b/src/minecraft/dark/fluid/common/item/ItemParts.java index 2a9fd09e8..eb95004c0 100644 --- a/src/minecraft/dark/fluid/common/item/ItemParts.java +++ b/src/minecraft/dark/fluid/common/item/ItemParts.java @@ -2,9 +2,10 @@ package dark.fluid.common.item; import java.util.List; +import dark.fluid.common.FluidMech; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; -import dark.fluid.common.TabFluidMech; /** A metadata item containing parts of various machines in Liquid Mechanics Mod. * @@ -36,7 +37,7 @@ public class ItemParts extends ItemBasic this.setHasSubtypes(true); this.setMaxDamage(0); this.setMaxStackSize(64); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); } @Override diff --git a/src/minecraft/dark/fluid/common/item/ItemTools.java b/src/minecraft/dark/fluid/common/item/ItemTools.java index 62484f222..890f98308 100644 --- a/src/minecraft/dark/fluid/common/item/ItemTools.java +++ b/src/minecraft/dark/fluid/common/item/ItemTools.java @@ -11,7 +11,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import dark.core.api.IToolReadOut; import dark.core.api.IToolReadOut.EnumTools; -import dark.fluid.common.TabFluidMech; +import dark.fluid.common.FluidMech; public class ItemTools extends ItemBasic { @@ -22,7 +22,7 @@ public class ItemTools extends ItemBasic super("lmTool", id); this.setMaxDamage(0); this.setHasSubtypes(true); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); this.setMaxStackSize(1); } diff --git a/src/minecraft/dark/fluid/common/machines/BlockReleaseValve.java b/src/minecraft/dark/fluid/common/machines/BlockReleaseValve.java index dcc53b0ac..7408d5e60 100644 --- a/src/minecraft/dark/fluid/common/machines/BlockReleaseValve.java +++ b/src/minecraft/dark/fluid/common/machines/BlockReleaseValve.java @@ -9,7 +9,6 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import dark.fluid.common.FluidMech; -import dark.fluid.common.TabFluidMech; import dark.library.machine.BlockMachine; public class BlockReleaseValve extends BlockMachine @@ -17,7 +16,7 @@ public class BlockReleaseValve extends BlockMachine public BlockReleaseValve(int par1) { super(par1, Material.iron); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); this.setUnlocalizedName("eValve"); this.setHardness(1f); this.setResistance(5f); diff --git a/src/minecraft/dark/fluid/common/machines/BlockSink.java b/src/minecraft/dark/fluid/common/machines/BlockSink.java index ff7c94ba2..3da438d99 100644 --- a/src/minecraft/dark/fluid/common/machines/BlockSink.java +++ b/src/minecraft/dark/fluid/common/machines/BlockSink.java @@ -10,7 +10,7 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import universalelectricity.prefab.tile.TileEntityAdvanced; import dark.fluid.client.render.BlockRenderHelper; -import dark.fluid.common.TabFluidMech; +import dark.fluid.common.FluidMech; import dark.helpers.MetaGroup; import dark.library.machine.BlockMachine; @@ -20,7 +20,7 @@ public class BlockSink extends BlockMachine { super(par1, Material.iron); this.setUnlocalizedName("lmSink"); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); this.setResistance(4f); this.setHardness(4f); } diff --git a/src/minecraft/dark/fluid/common/machines/BlockTank.java b/src/minecraft/dark/fluid/common/machines/BlockTank.java index 137c0312d..2ba721b27 100644 --- a/src/minecraft/dark/fluid/common/machines/BlockTank.java +++ b/src/minecraft/dark/fluid/common/machines/BlockTank.java @@ -17,7 +17,7 @@ import dark.core.api.INetworkPart; import dark.core.hydraulic.helpers.FluidHelper; import dark.core.hydraulic.helpers.FluidRestrictionHandler; import dark.fluid.client.render.BlockRenderHelper; -import dark.fluid.common.TabFluidMech; +import dark.fluid.common.FluidMech; import dark.library.machine.AutoCraftingManager; import dark.library.machine.BlockMachine; @@ -27,7 +27,7 @@ public class BlockTank extends BlockMachine public BlockTank(int id) { super(id, Material.rock); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); this.setUnlocalizedName("lmTank"); this.setHardness(1f); this.setResistance(5f); diff --git a/src/minecraft/dark/fluid/common/machines/TileEntityTank.java b/src/minecraft/dark/fluid/common/machines/TileEntityTank.java index 08ed13e79..55fb6c006 100644 --- a/src/minecraft/dark/fluid/common/machines/TileEntityTank.java +++ b/src/minecraft/dark/fluid/common/machines/TileEntityTank.java @@ -53,12 +53,7 @@ public class TileEntityTank extends TileEntityFluidStorage implements IFluidHand /* NETWORK INSTANCE THAT THIS PIPE USES */ private NetworkFluidContainers fluidNetwork; - - @Override - public void initiate() - { - this.refresh(); - } + private int refreshRate = 1; @Override public void updateEntity() @@ -66,13 +61,20 @@ public class TileEntityTank extends TileEntityFluidStorage implements IFluidHand super.updateEntity(); if (!worldObj.isRemote) { - if (ticks % ((int) random.nextInt(5) * 40 + 20) == 0) + if (ticks % refreshRate == 0) { + this.refreshRate = ((int) random.nextInt(5) * 40) + 20; this.refresh(); } } } + @Override + public void initiate() + { + this.refresh(); + } + @Override public void invalidate() { diff --git a/src/minecraft/dark/fluid/common/pipes/BlockPipe.java b/src/minecraft/dark/fluid/common/pipes/BlockPipe.java index cfd6eb931..9c98efb6e 100644 --- a/src/minecraft/dark/fluid/common/pipes/BlockPipe.java +++ b/src/minecraft/dark/fluid/common/pipes/BlockPipe.java @@ -14,7 +14,6 @@ import net.minecraftforge.fluids.IFluidTank; import dark.core.hydraulic.helpers.FluidRestrictionHandler; import dark.fluid.api.INetworkPipe; import dark.fluid.common.FluidMech; -import dark.fluid.common.TabFluidMech; import dark.library.machine.BlockMachine; public class BlockPipe extends BlockMachine @@ -24,7 +23,7 @@ public class BlockPipe extends BlockMachine super(id, Material.iron); this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F); this.setHardness(1f); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); this.setUnlocalizedName("lmPipe"); this.setResistance(3f); diff --git a/src/minecraft/dark/fluid/common/prefab/TileEntityFluidStorage.java b/src/minecraft/dark/fluid/common/prefab/TileEntityFluidStorage.java index aa6ff68eb..c413180d4 100644 --- a/src/minecraft/dark/fluid/common/prefab/TileEntityFluidStorage.java +++ b/src/minecraft/dark/fluid/common/prefab/TileEntityFluidStorage.java @@ -77,7 +77,7 @@ public abstract class TileEntityFluidStorage extends TileEntityFluidDevice imple { if (this.tank != null) { - return new FluidTankInfo[] { new FluidTankInfo(this.tank.getFluid(), this.tank.getCapacity()) }; + return new FluidTankInfo[] { new FluidTankInfo(this.tank) }; } return new FluidTankInfo[1]; } @@ -118,11 +118,7 @@ public abstract class TileEntityFluidStorage extends TileEntityFluidDevice imple /** Is the internal tank full */ public boolean isFull() { - if (this.tank.getFluid() == null || this.tank.getFluid().amount < this.tank.getCapacity()) - { - return false; - } - return true; + return this.tank.getFluid() != null && this.tank.getFluid().amount >= this.tank.getCapacity(); } /** gets the liquidStack stored in the internal tank */ diff --git a/src/minecraft/dark/fluid/common/pump/BlockConstructionPump.java b/src/minecraft/dark/fluid/common/pump/BlockConstructionPump.java index 2844dcc01..a86ad8674 100644 --- a/src/minecraft/dark/fluid/common/pump/BlockConstructionPump.java +++ b/src/minecraft/dark/fluid/common/pump/BlockConstructionPump.java @@ -18,7 +18,6 @@ import net.minecraftforge.common.ForgeDirection; import dark.core.network.fluid.HydraulicNetworkHelper; import dark.fluid.client.render.BlockRenderHelper; import dark.fluid.common.FluidMech; -import dark.fluid.common.TabFluidMech; import dark.library.machine.BlockMachine; public class BlockConstructionPump extends BlockMachine @@ -30,7 +29,7 @@ public class BlockConstructionPump extends BlockMachine { super(id, Material.iron); this.setUnlocalizedName("lmConPump"); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); this.setHardness(1f); this.setResistance(5f); diff --git a/src/minecraft/dark/fluid/common/pump/BlockDrain.java b/src/minecraft/dark/fluid/common/pump/BlockDrain.java index 5fcb47d60..cb0af591f 100644 --- a/src/minecraft/dark/fluid/common/pump/BlockDrain.java +++ b/src/minecraft/dark/fluid/common/pump/BlockDrain.java @@ -13,7 +13,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import dark.fluid.common.FluidMech; -import dark.fluid.common.TabFluidMech; import dark.library.machine.BlockMachine; public class BlockDrain extends BlockMachine @@ -25,7 +24,7 @@ public class BlockDrain extends BlockMachine public BlockDrain(int id) { super(id, Material.iron); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); this.setUnlocalizedName("lmDrain"); } diff --git a/src/minecraft/dark/fluid/common/pump/BlockPumpMachine.java b/src/minecraft/dark/fluid/common/pump/BlockPumpMachine.java index c34c93e81..66806c23a 100644 --- a/src/minecraft/dark/fluid/common/pump/BlockPumpMachine.java +++ b/src/minecraft/dark/fluid/common/pump/BlockPumpMachine.java @@ -13,7 +13,6 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import dark.fluid.client.render.BlockRenderHelper; import dark.fluid.common.FluidMech; -import dark.fluid.common.TabFluidMech; import dark.helpers.MetaGroup; import dark.library.machine.BlockMachine; @@ -24,7 +23,7 @@ public class BlockPumpMachine extends BlockMachine { super(id, Material.iron); this.setUnlocalizedName("lmMachines"); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); this.setHardness(1f); this.setResistance(5f); } diff --git a/src/minecraft/dark/mech/common/machines/BlockGenerator.java b/src/minecraft/dark/mech/common/machines/BlockGenerator.java index a4019c8f7..c727631de 100644 --- a/src/minecraft/dark/mech/common/machines/BlockGenerator.java +++ b/src/minecraft/dark/mech/common/machines/BlockGenerator.java @@ -11,7 +11,6 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import dark.fluid.client.render.BlockRenderHelper; import dark.fluid.common.FluidMech; -import dark.fluid.common.TabFluidMech; import dark.library.machine.BlockMachine; public class BlockGenerator extends BlockMachine @@ -21,7 +20,7 @@ public class BlockGenerator extends BlockMachine { super(id, Material.iron); this.setUnlocalizedName("lmGen"); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); this.setHardness(1f); this.setResistance(5f); } diff --git a/src/minecraft/dark/mech/common/machines/BlockRod.java b/src/minecraft/dark/mech/common/machines/BlockRod.java index a87a94904..0193ab0c8 100644 --- a/src/minecraft/dark/mech/common/machines/BlockRod.java +++ b/src/minecraft/dark/mech/common/machines/BlockRod.java @@ -10,7 +10,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import dark.fluid.client.render.BlockRenderHelper; import dark.fluid.common.FluidMech; -import dark.fluid.common.TabFluidMech; import dark.library.machine.BlockMachine; public class BlockRod extends BlockMachine @@ -19,7 +18,7 @@ public class BlockRod extends BlockMachine public BlockRod(int par1) { super(par1, Material.iron); - this.setCreativeTab(TabFluidMech.INSTANCE); + this.setCreativeTab(FluidMech.TabFluidMech); this.setUnlocalizedName("MechanicRod"); this.setHardness(1f); this.setResistance(5f);