Added fluids
This commit is contained in:
parent
b8e8c64094
commit
69b15a2796
3 changed files with 53 additions and 7 deletions
|
@ -13,6 +13,7 @@ import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraftforge.common.Configuration;
|
import net.minecraftforge.common.Configuration;
|
||||||
import net.minecraftforge.fluids.BlockFluidFinite;
|
import net.minecraftforge.fluids.BlockFluidFinite;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
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;
|
||||||
import dark.fluid.common.item.ItemParts.Parts;
|
import dark.fluid.common.item.ItemParts.Parts;
|
||||||
import dark.fluid.common.item.ItemTools;
|
import dark.fluid.common.item.ItemTools;
|
||||||
|
import dark.fluid.common.machines.BlockFluid;
|
||||||
import dark.fluid.common.machines.BlockReleaseValve;
|
import dark.fluid.common.machines.BlockReleaseValve;
|
||||||
import dark.fluid.common.machines.BlockSink;
|
import dark.fluid.common.machines.BlockSink;
|
||||||
import dark.fluid.common.machines.BlockTank;
|
import dark.fluid.common.machines.BlockTank;
|
||||||
|
@ -176,10 +178,18 @@ public class FluidMech extends ModPrefab
|
||||||
}
|
}
|
||||||
/* CONFIGS */
|
/* CONFIGS */
|
||||||
CONFIGURATION.load();
|
CONFIGURATION.load();
|
||||||
|
if (FluidMech.CONFIGURATION.get("general", "EnableWasteFluid", true).getBoolean(true))
|
||||||
/* LIQUID DIRECTORY CALL */
|
{
|
||||||
Fluid waste = new Fluid("waste").setBlockID(FluidMech.CONFIGURATION.getBlock("WasteLiquid", BLOCK_ID_PREFIX++).getInt());
|
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 */
|
/* BLOCK DECLARATION -- CONFIG LOADER */
|
||||||
FMRecipeLoader.blockGenPipe = new BlockPipe(BLOCK_ID_PREFIX++, "GenericPipe");
|
FMRecipeLoader.blockGenPipe = new BlockPipe(BLOCK_ID_PREFIX++, "GenericPipe");
|
||||||
FMRecipeLoader.blockMachine = new BlockPumpMachine(BLOCK_ID_PREFIX++);
|
FMRecipeLoader.blockMachine = new BlockPumpMachine(BLOCK_ID_PREFIX++);
|
||||||
|
@ -187,7 +197,6 @@ public class FluidMech extends ModPrefab
|
||||||
FMRecipeLoader.blockGenerator = new BlockGenerator(BLOCK_ID_PREFIX++);
|
FMRecipeLoader.blockGenerator = new BlockGenerator(BLOCK_ID_PREFIX++);
|
||||||
FMRecipeLoader.blockReleaseValve = new BlockReleaseValve(BLOCK_ID_PREFIX++);
|
FMRecipeLoader.blockReleaseValve = new BlockReleaseValve(BLOCK_ID_PREFIX++);
|
||||||
FMRecipeLoader.blockTank = new BlockTank(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.blockSink = new BlockSink(BLOCK_ID_PREFIX++);
|
||||||
FMRecipeLoader.blockDrain = new BlockDrain(BLOCK_ID_PREFIX++);
|
FMRecipeLoader.blockDrain = new BlockDrain(BLOCK_ID_PREFIX++);
|
||||||
FMRecipeLoader.blockConPump = new BlockConstructionPump(BLOCK_ID_PREFIX++);
|
FMRecipeLoader.blockConPump = new BlockConstructionPump(BLOCK_ID_PREFIX++);
|
||||||
|
|
36
src/minecraft/dark/fluid/common/machines/BlockFluid.java
Normal file
36
src/minecraft/dark/fluid/common/machines/BlockFluid.java
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import universalelectricity.prefab.network.IPacketReceiver;
|
import universalelectricity.prefab.network.IPacketReceiver;
|
||||||
import universalelectricity.prefab.network.PacketManager;
|
import universalelectricity.prefab.network.PacketManager;
|
||||||
|
@ -48,7 +49,7 @@ public class TileEntitySink extends TileEntityFluidStorage implements IPacketRec
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stack = new FluidStack(0, 0);
|
stack = new FluidStack(FluidRegistry.WATER, 0);
|
||||||
return PacketManager.getPacket(FluidMech.CHANNEL, this, stack.writeToNBT(new NBTTagCompound()));
|
return PacketManager.getPacket(FluidMech.CHANNEL, this, stack.writeToNBT(new NBTTagCompound()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue