diff --git a/src/minecraft/dark/fluid/common/FluidMech.java b/src/minecraft/dark/fluid/common/FluidMech.java index 86cf39126..038bd6733 100644 --- a/src/minecraft/dark/fluid/common/FluidMech.java +++ b/src/minecraft/dark/fluid/common/FluidMech.java @@ -13,6 +13,7 @@ import net.minecraft.item.crafting.CraftingManager; import net.minecraftforge.common.Configuration; import net.minecraftforge.fluids.BlockFluidFinite; import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; @@ -40,6 +41,7 @@ import dark.core.ModPrefab; import dark.fluid.common.item.ItemParts; import dark.fluid.common.item.ItemParts.Parts; import dark.fluid.common.item.ItemTools; +import dark.fluid.common.machines.BlockFluid; import dark.fluid.common.machines.BlockReleaseValve; import dark.fluid.common.machines.BlockSink; import dark.fluid.common.machines.BlockTank; @@ -170,16 +172,24 @@ public class FluidMech extends ModPrefab @Override public void loadConfig() { - if(recipeLoader == null) + if (recipeLoader == null) { recipeLoader = new FMRecipeLoader(); } /* CONFIGS */ CONFIGURATION.load(); - - /* LIQUID DIRECTORY CALL */ - Fluid waste = new Fluid("waste").setBlockID(FluidMech.CONFIGURATION.getBlock("WasteLiquid", BLOCK_ID_PREFIX++).getInt()); - + if (FluidMech.CONFIGURATION.get("general", "EnableWasteFluid", true).getBoolean(true)) + { + Fluid waste = new Fluid("waste"); + FMRecipeLoader.blockWasteLiquid = new BlockFluid(waste, BLOCK_ID_PREFIX++); + FluidRegistry.registerFluid(waste); + } + if (FluidMech.CONFIGURATION.get("general", "EnableOilFluid", true).getBoolean(true)) + { + Fluid waste = new Fluid("oil"); + FMRecipeLoader.blockWasteLiquid = new BlockFluid(waste, BLOCK_ID_PREFIX++); + FluidRegistry.registerFluid(waste); + } /* BLOCK DECLARATION -- CONFIG LOADER */ FMRecipeLoader.blockGenPipe = new BlockPipe(BLOCK_ID_PREFIX++, "GenericPipe"); FMRecipeLoader.blockMachine = new BlockPumpMachine(BLOCK_ID_PREFIX++); @@ -187,7 +197,6 @@ public class FluidMech extends ModPrefab FMRecipeLoader.blockGenerator = new BlockGenerator(BLOCK_ID_PREFIX++); FMRecipeLoader.blockReleaseValve = new BlockReleaseValve(BLOCK_ID_PREFIX++); FMRecipeLoader.blockTank = new BlockTank(BLOCK_ID_PREFIX++); - FMRecipeLoader.blockWasteLiquid = new BlockFluidFinite(waste.getBlockID(), waste, Material.water); FMRecipeLoader.blockSink = new BlockSink(BLOCK_ID_PREFIX++); FMRecipeLoader.blockDrain = new BlockDrain(BLOCK_ID_PREFIX++); FMRecipeLoader.blockConPump = new BlockConstructionPump(BLOCK_ID_PREFIX++); diff --git a/src/minecraft/dark/fluid/common/machines/BlockFluid.java b/src/minecraft/dark/fluid/common/machines/BlockFluid.java new file mode 100644 index 000000000..9b8298304 --- /dev/null +++ b/src/minecraft/dark/fluid/common/machines/BlockFluid.java @@ -0,0 +1,36 @@ +package dark.fluid.common.machines; + +import dark.fluid.common.FluidMech; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.util.Icon; +import net.minecraftforge.fluids.BlockFluidFinite; +import net.minecraftforge.fluids.Fluid; + +public class BlockFluid extends BlockFluidFinite +{ + Icon flowing; + Icon still; + Fluid fluid; + + public BlockFluid(Fluid fluid, int id) + { + super(FluidMech.CONFIGURATION.getBlock(fluid.getName(), id).getInt(), fluid, Material.water); + this.fluid = fluid; + } + + @Override + public void registerIcons(IconRegister par1IconRegister) + { + this.flowing = par1IconRegister.registerIcon(FluidMech.instance.PREFIX + this.getUnlocalizedName().replace("tile.", "") + "_flowing"); + this.still = par1IconRegister.registerIcon(FluidMech.instance.PREFIX + this.getUnlocalizedName().replace("tile.", "") + "_still"); + fluid.setIcons(still, flowing); + } + + @Override + public Icon getIcon(int par1, int par2) + { + return still; + } + +} diff --git a/src/minecraft/dark/fluid/common/machines/TileEntitySink.java b/src/minecraft/dark/fluid/common/machines/TileEntitySink.java index bf71e6eb2..417afbbd0 100644 --- a/src/minecraft/dark/fluid/common/machines/TileEntitySink.java +++ b/src/minecraft/dark/fluid/common/machines/TileEntitySink.java @@ -8,6 +8,7 @@ import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.network.PacketManager; @@ -48,7 +49,7 @@ public class TileEntitySink extends TileEntityFluidStorage implements IPacketRec } else { - stack = new FluidStack(0, 0); + stack = new FluidStack(FluidRegistry.WATER, 0); return PacketManager.getPacket(FluidMech.CHANNEL, this, stack.writeToNBT(new NBTTagCompound())); } }