more Changes

*added Name to the color Enum
*added a new liquid call Waste liquid
*added effect for mixing liquids in pipes
*stored+filling=outcome
*lava+water = obby
*water+lava=cobble
*other+other=waste liquid
*Improve pipe render and create 14 new pipe textures
*Improved Tank render and creates some new textures
*Fixed lang file for all Blocks, items still don't work
*Fixed save issue using Compent Tags to save liquids
*Fixed Universal Pipe working with pumps
*Removed: Some crafting recipes plus fixed others
*Removed: Item version of pipe,tank, though a similar version is used
just for naming as a BlockItem
*Bug: Tanks don't work at all
This commit is contained in:
Rseifert 2013-01-06 00:13:09 -05:00
parent b9833f6327
commit 183dc35c47
50 changed files with 469 additions and 278 deletions

View file

@ -4,23 +4,47 @@ import liquidmechanics.common.handlers.LiquidData;
import liquidmechanics.common.handlers.LiquidHandler;
public enum PipeColor
{
BLACK, RED, GREEN, BROWN, BLUE, PURPLE, CYAN, SILVER, GREY, PINK, LIME, YELLOW, LIGHTBLUE, MAGENTA, ORANGE, NONE;
/**
* get the liquidData linked with this color
*/
{
BLACK("Black"),
RED("Red"),
GREEN("Green"),
BROWN("Brown"),
BLUE("Blue"),
PURPLE("Purple"),
CYAN("Cyan"),
SILVER("Silver"),
GREY("Grey"),
PINK("Pink"),
LIME("Lime"),
YELLOW("Yellow"),
LIGHTBLUE("LightBlue"),
MAGENTA("Magenta"),
ORANGE("Orange"),
NONE("");
String name;
PipeColor(String name)
{
this.name = name;
}
public String getName()
{
return this.name;
}
/**
* get the liquidData linked with this color
*/
public LiquidData getLiquidData()
{
for(LiquidData data: LiquidHandler.allowedLiquids)
for (LiquidData data : LiquidHandler.allowedLiquids)
{
if(data.getColor() == this)
{
return data;
}
if (data.getColor() == this) { return data; }
}
return LiquidHandler.air;
return LiquidHandler.unkown;
}
/**
* gets a color based on liquid Data
*/
@ -31,15 +55,13 @@ public enum PipeColor
if (data == LiquidHandler.water) { return BLUE; }
return NONE;
}
/**
* gets a color based on number(0-15)
*/
public static PipeColor get(int num)
{
if(num < PipeColor.values().length)
{
return PipeColor.values()[num];
}
if (num < PipeColor.values().length) { return PipeColor.values()[num]; }
return NONE;
}
}

View file

@ -1,5 +1,6 @@
package liquidmechanics.client.render;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.client.model.ModelLargePipe;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.tileentity.TileEntityPipe;
@ -36,26 +37,7 @@ public class RenderPipe extends TileEntitySpecialRenderer
}
public static String getPipeTexture(int meta)
{
switch(meta)
{
case 0:
case 1:return LiquidMechanics.RESOURCE_PATH + "pipes/SixLavaPipe.png";
case 2:
case 3:
case 4:return LiquidMechanics.RESOURCE_PATH + "pipes/SixWaterPipe.png";
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:return LiquidMechanics.RESOURCE_PATH + "pipes/SixSteamPipe.png";
case 15:
default:return LiquidMechanics.RESOURCE_PATH + "pipes/SixOilPipe.png";
}
return LiquidMechanics.RESOURCE_PATH + "pipes/"+PipeColor.get(meta).getName()+"Pipe.png";
}
public void render(int meta, TileEntity[] ents)
{

View file

@ -15,7 +15,7 @@ import org.lwjgl.opengl.GL11;
public class RenderTank extends TileEntitySpecialRenderer
{
private LiquidData type = LiquidHandler.air;
private LiquidData type = LiquidHandler.unkown;
private ModelLiquidTank model;
private ModelLiquidTankCorner modelC;
private int pos = 0;
@ -71,26 +71,10 @@ public class RenderTank extends TileEntitySpecialRenderer
{
String type = "";
switch (meta)
{
case 0:
case 1:
case 2:
case 3:
case 4:// default
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
default:
type = "";
break;
{
case 1:type = "Red";break;
case 14:type = "Orange";break;
default:type = "";break;
}
return LiquidMechanics.RESOURCE_PATH + "tanks/" + type + "Tank.png";
@ -102,22 +86,8 @@ public class RenderTank extends TileEntitySpecialRenderer
String type = "";
switch (meta)
{
case 0:
case 1:
case 2:
case 3:
case 4:// default
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 1:type = "Lava";break;
case 12:type = "Fuel";break;
default:
type = "";
break;
@ -131,24 +101,12 @@ public class RenderTank extends TileEntitySpecialRenderer
String type = "";
switch (meta)
{
case 0:
case 1:
case 2:
case 3:
type = "Red";
break;
case 4:
type = "Water";
break;
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
default:
type = "";
break;

View file

@ -4,15 +4,19 @@ import java.io.File;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.common.block.BlockGenerator;
import liquidmechanics.common.block.BlockLiquidMachine;
import liquidmechanics.common.block.BlockPumpMachine;
import liquidmechanics.common.block.BlockPipe;
import liquidmechanics.common.block.BlockReleaseValve;
import liquidmechanics.common.block.BlockRod;
import liquidmechanics.common.block.BlockTank;
import liquidmechanics.common.block.BlockWasteLiquid;
import liquidmechanics.common.handlers.LiquidHandler;
import liquidmechanics.common.item.ItemGuage;
import liquidmechanics.common.item.ItemLiquidMachine;
import liquidmechanics.common.item.ItemParts;
import liquidmechanics.common.item.ItemParts.Parts;
import liquidmechanics.common.item.ItemPipe;
import liquidmechanics.common.item.ItemTank;
import liquidmechanics.common.tileentity.TileEntityGenerator;
import liquidmechanics.common.tileentity.TileEntityPipe;
import liquidmechanics.common.tileentity.TileEntityPump;
@ -80,6 +84,8 @@ public class LiquidMechanics extends DummyModContainer
public static Block blockRod;
public static Block blockGenerator;
public static Block blockReleaseValve;
public static Block blockWasteLiquid;
public static LiquidStack liquidSteam;
@ -102,11 +108,13 @@ public class LiquidMechanics extends DummyModContainer
// Blocks
blockPipe = new BlockPipe(this.CONFIGURATION.getBlock("Pipes", BLOCK_ID_PREFIX).getInt());
blockMachine = new BlockLiquidMachine(this.CONFIGURATION.getBlock("Machines", BLOCK_ID_PREFIX + 1).getInt());
blockMachine = new BlockPumpMachine(this.CONFIGURATION.getBlock("Machines", BLOCK_ID_PREFIX + 1).getInt());
blockRod = new BlockRod(this.CONFIGURATION.getBlock("Mechanical Rod", BLOCK_ID_PREFIX + 3).getInt());
blockGenerator = new BlockGenerator((this.CONFIGURATION.getBlock("Generator", BLOCK_ID_PREFIX + 4).getInt()));
blockReleaseValve = new BlockReleaseValve((this.CONFIGURATION.getBlock("Release Valve", BLOCK_ID_PREFIX + 5).getInt()));
blockTank = new BlockTank(this.CONFIGURATION.getBlock("Tank", BLOCK_ID_PREFIX + 6).getInt());
// Items
itemParts = new ItemParts(this.CONFIGURATION.getItem("Parts", ITEM_ID_PREFIX).getInt());
// itemPipes = new ItemPipe(this.CONFIGURATION.getItem("PipeItem",
@ -116,17 +124,18 @@ public class LiquidMechanics extends DummyModContainer
itemGauge = new ItemGuage(this.CONFIGURATION.getItem("PipeGuage", ITEM_ID_PREFIX + 3).getInt());
// Liquid Registry
blockWasteLiquid = new BlockWasteLiquid(this.CONFIGURATION.getBlock("WasteLiquid", LIQUID_ID_PREFIX).getInt());
CONFIGURATION.save();
proxy.preInit();
// block registry
GameRegistry.registerBlock(blockPipe, "lmPipe");
GameRegistry.registerBlock(blockPipe, ItemPipe.class, "lmPipe");
GameRegistry.registerBlock(blockReleaseValve, "eValve");
GameRegistry.registerBlock(blockRod, "mechRod");
GameRegistry.registerBlock(blockGenerator, "lmGen");
GameRegistry.registerBlock(blockMachine, "lmMachines");
GameRegistry.registerBlock(blockTank, "lmTank");
GameRegistry.registerBlock(blockMachine, ItemLiquidMachine.class, "lmMachines");
GameRegistry.registerBlock(blockTank,ItemTank.class, "lmTank");
}
@Init

View file

@ -1,30 +1,27 @@
package liquidmechanics.common.block;
import java.util.Random;
import universalelectricity.prefab.BlockMachine;
import java.util.List;
import liquidmechanics.client.render.BlockRenderHelper;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.TabLiquidMechanics;
import liquidmechanics.common.handlers.LiquidHandler;
import liquidmechanics.common.tileentity.TileEntityPipe;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import universalelectricity.prefab.BlockMachine;
public class BlockPipe extends BlockMachine
{
{
public BlockPipe(int id)
{
super("Pipe",id, Material.iron,TabLiquidMechanics.INSTANCE);
super("Pipe", id, Material.iron, TabLiquidMechanics.INSTANCE);
this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F);
this.setHardness(1f);
this.setBlockName("lmPipe");
this.setResistance(3f);
}
@ -82,4 +79,13 @@ public class BlockPipe extends BlockMachine
int meta = world.getBlockMetadata(x, y, z);
return new ItemStack(LiquidMechanics.blockPipe, 1, meta);
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < 16; i++)
{
par3List.add(new ItemStack(par1, 1, i));
}
}
}

View file

@ -1,5 +1,7 @@
package liquidmechanics.common.block;
import java.util.List;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.prefab.tile.TileEntityAdvanced;
import liquidmechanics.client.render.BlockRenderHelper;
@ -11,6 +13,7 @@ import liquidmechanics.common.tileentity.TileEntityPump;
import liquidmechanics.common.tileentity.TileEntityTank;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -22,10 +25,10 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
public class BlockLiquidMachine extends BlockMachine
public class BlockPumpMachine extends BlockMachine
{
public BlockLiquidMachine(int id)
public BlockPumpMachine(int id)
{
super("lmMachines", id, Material.iron, TabLiquidMechanics.INSTANCE);
this.setHardness(1f);
@ -114,4 +117,9 @@ public class BlockLiquidMachine extends BlockMachine
}
return null;
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(par1, 1, 0));
}
}

View file

@ -1,5 +1,7 @@
package liquidmechanics.common.block;
import java.util.List;
import liquidmechanics.client.render.BlockRenderHelper;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.TabLiquidMechanics;
@ -134,4 +136,11 @@ public class BlockTank extends BlockMachine
return new ItemStack(this, 1, meta);
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(par1, 1, 1));
par3List.add(new ItemStack(par1, 1, 4));
par3List.add(new ItemStack(par1, 1, 15));
}
}

View file

@ -0,0 +1,33 @@
package liquidmechanics.common.block;
import net.minecraft.block.BlockFluid;
import net.minecraft.block.material.Material;
import net.minecraftforge.liquids.ILiquid;
public class BlockWasteLiquid extends BlockFluid implements ILiquid
{
//TODO turn into a lava type liquid with chance of corrupting connected water blocks
public BlockWasteLiquid(int par1)
{
super(par1, Material.water);
}
@Override
public int stillLiquidId()
{
return this.blockID;
}
@Override
public boolean isMetaSensitive()
{
return false;
}
@Override
public int stillLiquidMeta()
{
return this.blockID;
}
}

View file

@ -21,7 +21,8 @@ public class LiquidHandler
public static LiquidData steam;
public static LiquidData water;
public static LiquidData lava;
public static LiquidData air;
public static LiquidData unkown;
public static LiquidData waste;
// public static LiquidData oil; TODO add
// public static LiquidData fuel;
@ -29,13 +30,15 @@ public class LiquidHandler
* Called to add the default liquids to the allowed list
*/
public static void addDefaultLiquids()
{
{
water = new LiquidData("water", LiquidDictionary.getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, 1)), PipeColor.BLUE, false, 32);
allowedLiquids.add(water);
lava = new LiquidData("Lava", LiquidDictionary.getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, 1)), PipeColor.RED, false, 20);
allowedLiquids.add(lava);
air = new LiquidData("Air", LiquidDictionary.getOrCreateLiquid("Air", new LiquidStack(0, 1)), PipeColor.NONE, false, 0);
allowedLiquids.add(air);
unkown = new LiquidData("Unknown", LiquidDictionary.getOrCreateLiquid("Unknown", new LiquidStack(20, 1)), PipeColor.NONE, false, 0);
allowedLiquids.add(unkown);
waste = new LiquidData("Waste", LiquidDictionary.getOrCreateLiquid("Waste", new LiquidStack(LiquidMechanics.blockWasteLiquid, 1)), PipeColor.BROWN, false, 40);
allowedLiquids.add(waste);
}
@ForgeSubscribe
@ -49,7 +52,7 @@ public class LiquidHandler
}
else if (event.Name.equalsIgnoreCase("oil"))
{
this.allowedLiquids.add(new LiquidData("oil", event.Liquid, PipeColor.BLACK, true, 30));
this.allowedLiquids.add(new LiquidData("oil", event.Liquid, PipeColor.BLACK, true, 50));
}
else if (event.Name.equalsIgnoreCase("fuel"))
{
@ -57,7 +60,7 @@ public class LiquidHandler
}
else if (event.Name.equalsIgnoreCase("steam"))
{
this.steam =new LiquidData("steam", event.Liquid, PipeColor.ORANGE, true, 100);
this.steam = new LiquidData("steam", event.Liquid, PipeColor.ORANGE, true, 100);
}
}
@ -73,7 +76,7 @@ public class LiquidHandler
{
if (data.getName().equalsIgnoreCase(name)) { return data; }
}
return air;
return unkown;
}
public static LiquidData get(LiquidStack stack)
@ -82,7 +85,7 @@ public class LiquidHandler
{
if (isEqual(stack, data)) { return data; }
}
return air;
return unkown;
}
/**
@ -113,7 +116,7 @@ public class LiquidHandler
case 2:
return lava;
}
return air;
return unkown;
}
@ -123,7 +126,7 @@ public class LiquidHandler
{
if (data.getStack().itemID == id) { return data; }
}
return air;
return unkown;
}
/**
@ -135,17 +138,16 @@ public class LiquidHandler
*/
public static boolean isEqual(LiquidStack stack, LiquidData type)
{
if (stack == null || type == null)
return false;
if (stack == null || type == null) { return false; }
if (type.getStack().itemID == stack.itemID && type.getStack().itemMeta == stack.itemMeta) { return true; }
return false;
}
public static boolean isEqual(LiquidStack stack, LiquidStack type)
public static boolean isEqual(LiquidStack stack, LiquidStack stack2)
{
if (stack == null || type == null)
if (stack == null || stack2 == null)
return false;
if (type.itemID == stack.itemID && type.itemMeta == stack.itemMeta) { return true; }
if (stack2.itemID == stack.itemID && stack2.itemMeta == stack.itemMeta) { return true; }
return false;
}

View file

@ -49,7 +49,7 @@ public class ItemGuage extends Item
@Override
public String getItemName()
{
return "guage";
return "lmTools";
}
@Override
@ -75,14 +75,9 @@ public class ItemGuage extends Item
return false;
}
public String getItemNameIS(ItemStack par1ItemStack)
{
int var3 = par1ItemStack.getItemDamage();
switch (var3)
{
case 0:
return "PipeGuage";
}
return this.getItemName();
}
@Override
public String getItemNameIS(ItemStack itemstack) {
return this.getItemName() + "." + itemstack.getItemDamage();
}
}

View file

@ -0,0 +1,34 @@
package liquidmechanics.common.item;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemLiquidMachine extends ItemBlock
{
public ItemLiquidMachine(int id)
{
super(id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override
public int getMetadata(int damage)
{
return damage;
}
@Override
public String getItemNameIS(ItemStack par1ItemStack)
{
return Block.blocksList[this.getBlockID()].getBlockName() + "." + (par1ItemStack.getItemDamage());
}
@Override
public String getItemName()
{
return Block.blocksList[this.getBlockID()].getBlockName() + ".0";
}
}

View file

@ -15,56 +15,65 @@ import net.minecraft.item.ItemStack;
* @author Rs
*
*/
public class ItemParts extends Item {
public enum Parts {
Bronze("Bronze Tube", 0), Iron("Iron Tube", 1), Obby("Obby Tube", 2), Nether(
"Nether Tube", 3), Seal("Leather Seal", 16), SlimeSeal("Slime Seal", 17), Tank(
"Unfinished Tank", 18), Valve("Valve", 19);
public String name;
public int itemIndex;
public class ItemParts extends Item
{
public enum Parts
{
Bronze("Bronze Tube", 0),
Iron("Iron Tube", 1),
Obby("Obby Tube", 2),
Nether("Nether Tube", 3),
Seal("Leather Seal", 16),
SlimeSeal("Slime Seal", 17),
Tank("Unfinished Tank", 18),
Valve("Valve", 19);
public String name;
public int itemIndex;
private Parts(String name, int itemIndex) {
this.name = name;
this.itemIndex = itemIndex;
}
}
private Parts(String name, int itemIndex)
{
this.name = name;
this.itemIndex = itemIndex;
}
}
public ItemParts(int par1) {
super(par1);
this.setItemName("parts");
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setMaxStackSize(64);
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
this.setTextureFile(LiquidMechanics.ITEM_TEXTURE_FILE);
}
public ItemParts(int par1)
{
super(par1);
this.setItemName("lmParts");
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setMaxStackSize(64);
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
this.setTextureFile(LiquidMechanics.ITEM_TEXTURE_FILE);
}
@Override
public int getIconFromDamage(int par1) {
if (par1 < Parts.values().length) {
return Parts.values()[par1].itemIndex;
}
return par1;
}
@Override
public int getIconFromDamage(int par1)
{
if (par1 < Parts.values().length) { return Parts.values()[par1].itemIndex; }
return par1;
}
@Override
public String getItemNameIS(ItemStack itemstack) {
if (itemstack.getItemDamage() < Parts.values().length) {
return Parts.values()[itemstack.getItemDamage()].name;
}
return "unkown";
}
@Override
public String getItemNameIS(ItemStack itemstack)
{
return this.getItemName()+"." + itemstack.getItemDamage();
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs,
List par3List) {
for (int i = 0; i < Parts.values().length; i++) {
par3List.add(new ItemStack(this, 1, i));
}
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < Parts.values().length; i++)
{
par3List.add(new ItemStack(this, 1, i));
}
}
@Override
public String getItemName() {
return "parts";
}
@Override
public String getItemName()
{
return "lmParts";
}
}

View file

@ -0,0 +1,34 @@
package liquidmechanics.common.item;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemPipe extends ItemBlock
{
public ItemPipe(int id)
{
super(id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override
public int getMetadata(int damage)
{
return damage;
}
@Override
public String getItemNameIS(ItemStack par1ItemStack)
{
return Block.blocksList[this.getBlockID()].getBlockName() + "." + (par1ItemStack.getItemDamage());
}
@Override
public String getItemName()
{
return Block.blocksList[this.getBlockID()].getBlockName() + ".0";
}
}

View file

@ -0,0 +1,34 @@
package liquidmechanics.common.item;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemTank extends ItemBlock
{
public ItemTank(int id)
{
super(id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override
public int getMetadata(int damage)
{
return damage;
}
@Override
public String getItemNameIS(ItemStack par1ItemStack)
{
return Block.blocksList[this.getBlockID()].getBlockName() + "." + (par1ItemStack.getItemDamage());
}
@Override
public String getItemName()
{
return Block.blocksList[this.getBlockID()].getBlockName() + ".0";
}
}

View file

@ -8,6 +8,7 @@ import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.handlers.LiquidData;
import liquidmechanics.common.handlers.LiquidHandler;
import liquidmechanics.common.handlers.UpdateConverter;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
@ -26,7 +27,7 @@ import universalelectricity.prefab.network.PacketManager;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityPipe extends TileEntity implements ITankContainer, IPacketReceiver, IReadOut
public class TileEntityPipe extends TileEntity implements ITankContainer, IReadOut
{
private PipeColor color = PipeColor.NONE;
@ -43,51 +44,43 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
@Override
public void updateEntity()
{
if (++count >= 40)
this.validataConnections();
this.color = PipeColor.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
if (!worldObj.isRemote && ++count >= 40)
{
count = 0;
this.validataConnections();
this.color = PipeColor.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
if (!worldObj.isRemote)
this.updatePressure();
LiquidStack stack = stored.getLiquid();
if (stack != null && stack.amount >= 0)
{
this.updatePressure();
if (count2-- <= 0)
{
count2 = 5;
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, color.ordinal());
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 60);
}
LiquidStack stack = stored.getLiquid();
if (stack != null && stack.amount >= 0)
for (int i = 0; i < 6; i++)
{
for (int i = 0; i < 6; i++)
ForgeDirection dir = ForgeDirection.getOrientation(i);
int moved = 0;
if (connectedBlocks[i] instanceof ITankContainer)
{
ForgeDirection dir = ForgeDirection.getOrientation(i);
int moved = 0;
if (connectedBlocks[i] instanceof ITankContainer)
if (connectedBlocks[i] instanceof TileEntityPipe)
{
if (connectedBlocks[i] instanceof TileEntityPipe)
if (((TileEntityPipe) connectedBlocks[i]).presure < this.presure)
{
if (((TileEntityPipe) connectedBlocks[i]).presure < this.presure)
{
moved = ((TileEntityPipe) connectedBlocks[i]).stored.fill(stack, true);
}
moved = ((TileEntityPipe) connectedBlocks[i]).stored.fill(stack, true);
}
}
else
{
moved = ((ITankContainer) connectedBlocks[i]).fill(dir.getOpposite(), stack, true);
}
}
stored.drain(moved, true);
// FMLLog.warning("Moved "+moved+ " "+ i);
if (stack.amount <= 0)
else
{
break;
moved = ((ITankContainer) connectedBlocks[i]).fill(dir.getOpposite(), stack, true);
}
}
stored.drain(moved, true);
// FMLLog.warning("Moved "+moved+ " "+ i);
if (stack == null || stack.amount <= 0)
{
break;
}
}
}
}
@ -121,23 +114,6 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
}
}
// ---------------------
// data
// --------------------
@Override
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput data)
{
try
{
this.setColor(data.readInt());
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Reads a tile entity from NBT.
*/
@ -146,9 +122,9 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
{
super.readFromNBT(nbt);
UpdateConverter.convert(this, nbt);
NBTTagCompound stored = nbt.getCompoundTag("stored");
LiquidStack stack = LiquidStack.loadLiquidStackFromNBT(stored);
this.stored.setLiquid(stack);
LiquidStack liquid = new LiquidStack(0, 0, 0);
liquid.readFromNBT(nbt.getCompoundTag("stored"));
stored.setLiquid(liquid);
}
/**
@ -160,22 +136,47 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
super.writeToNBT(nbt);
if (stored.getLiquid() != null)
{
nbt.setCompoundTag("stored", stored.getLiquid().writeToNBT(nbt));
nbt.setTag("stored", stored.getLiquid().writeToNBT(new NBTTagCompound()));
}
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
{
return "ReadOut not setup";
LiquidStack stack = this.stored.getLiquid();
if (stack != null) { return (stack.amount / LiquidContainerRegistry.BUCKET_VOLUME) + "/" + (this.stored.getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME) + " " + LiquidHandler.get(stack).getName() + " @ " + this.presure + "p"; }
return "Empty";
}
@Override
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
{
if (resource == null) { return 0; }
LiquidStack stack = stored.getLiquid();
if (stack == null) stored.setLiquid(LiquidHandler.getStack(color.getLiquidData(), 1));
if (stack != null && LiquidHandler.isEqual(resource, color.getLiquidData())) return fill(0, resource, doFill);
if (color != PipeColor.NONE)
{
if (color != PipeColor.get(LiquidHandler.get(resource)) || !LiquidHandler.isEqual(stack, resource))
{
this.causeMix(stack, resource);
}
else
{
this.fill(0, resource, doFill);
}
}
else
{
if (stack != null && !LiquidHandler.isEqual(stack, resource))
{
this.causeMix(stack, resource);
}
else
{
this.fill(0, resource, doFill);
}
}
return 0;
}
@ -189,16 +190,41 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
return stored.fill(resource, doFill);
}
public int causeMix(LiquidStack stored, LiquidStack fill)
{
if (stored == null || fill == null) { return 0; }
// water flowing into lava creates obby
if (LiquidHandler.isEqual(stored, LiquidHandler.lava) && LiquidHandler.isEqual(fill, LiquidHandler.water))
{
worldObj.setBlockWithNotify(xCoord, yCoord, zCoord, Block.obsidian.blockID);
return fill.amount;
}// lava flowing into water creates cobble
else if (LiquidHandler.isEqual(stored, LiquidHandler.water) && LiquidHandler.isEqual(fill, LiquidHandler.lava))
{
worldObj.setBlockWithNotify(xCoord, yCoord, zCoord, Block.cobblestone.blockID);
return fill.amount;
}
else
// anything else creates waste liquid
{
int f = this.stored.fill(new LiquidStack(stored.itemID, fill.amount, stored.itemMeta), true);
int s = this.stored.getLiquid().amount;
LiquidStack stack = LiquidHandler.getStack(LiquidHandler.waste, s);
this.stored.setLiquid(stack);
return f;
}
}
@Override
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
return drain(0, maxDrain, doDrain);
return null;
}
@Override
public LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain)
{
return stored.drain(maxDrain, doDrain);
return null;
}
@Override
@ -225,13 +251,16 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
TileEntity ent = connectedBlocks[i];
if (ent instanceof ITankContainer)
{
if (ent instanceof TileEntityPipe && color != ((TileEntityPipe) ent).getColor())
if (this.color != PipeColor.NONE)
{
connectedBlocks[i] = null;
}
if(ent instanceof TileEntityTank && color != ((TileEntityTank)ent).getColor())
{
connectedBlocks[i] = null;
if (ent instanceof TileEntityPipe && color != ((TileEntityPipe) ent).getColor())
{
connectedBlocks[i] = null;
}
else if (ent instanceof TileEntityTank && color != ((TileEntityTank) ent).getColor())
{
connectedBlocks[i] = null;
}
}
}
else if (ent instanceof IPressure)

View file

@ -43,7 +43,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
private boolean converted = false;
public LiquidData type = LiquidHandler.air;
public LiquidData type = LiquidHandler.unkown;
public LiquidTank tank = new LiquidTank(wMax);
@Override
@ -96,7 +96,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
LiquidData bellow = LiquidHandler.getFromBlockID(bBlock);
if (bellow != null)
{
if (this.type != bellow && bellow != LiquidHandler.air)
if (this.type != bellow && bellow != LiquidHandler.unkown)
{
this.tank.setLiquid(LiquidHandler.getStack(bellow, 0));
this.type = bellow;
@ -199,7 +199,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
return false;
if (this.isDisabled())
return false;
if ((LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == null || LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == LiquidHandler.air))
if ((LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == null || LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == LiquidHandler.unkown))
return false;
return true;
}
@ -266,7 +266,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
{
this.type = LiquidHandler.get(nbt.getString("name"));
}
if (this.type == null) type = LiquidHandler.air;
if (this.type == null) type = LiquidHandler.unkown;
int stored = nbt.getInteger("liquid");
this.tank.setLiquid(LiquidHandler.getStack(this.type, stored));
@ -345,15 +345,15 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
@Override
public int presureOutput(LiquidData type, ForgeDirection dir)
{
if (type == this.type)
return type.getPressure();
if (type == this.type || type == LiquidHandler.unkown)
return this.type.getPressure();
return 0;
}
@Override
public boolean canPressureToo(LiquidData type, ForgeDirection dir)
{
if (type == this.type)
if (type == this.type || type == LiquidHandler.unkown)
return true;
return false;
}

View file

@ -83,7 +83,7 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
public TileEntityPipe findValidPipe(LiquidStack stack)
{
LiquidData data = LiquidHandler.get(stack);
if (data != LiquidHandler.air)
if (data != LiquidHandler.unkown)
{
for (PipeInstance pipe : output)
{

View file

@ -32,7 +32,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
{
public TileEntity[] cc = { null, null, null, null, null, null };
public LiquidData type = LiquidHandler.air;
public LiquidData type = LiquidHandler.unkown;
private PipeColor color = PipeColor.NONE;
@ -41,20 +41,19 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
public int volume;
public int pVolume = 0;
private boolean doUpdate = true;
public LiquidTank tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * LMax);
public void updateEntity()
{
if (tank.getLiquid() == null && type != LiquidHandler.air)
if (tank.getLiquid() == null && type != LiquidHandler.unkown)
{
tank.setLiquid(LiquidHandler.getStack(this.type, 1));
}
LiquidStack liquid = tank.getLiquid();
if (++count >= 20 && liquid != null)
this.color = PipeColor.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
if (++count >= 40 && liquid != null)
{
count = 0;
this.cc = connectionHelper.getSurroundings(worldObj, xCoord, yCoord, zCoord);
@ -80,7 +79,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
{
if (volume == 0) { return "empty"; }
if (volume == 0) { return "Empty"; }
return (volume / LiquidContainerRegistry.BUCKET_VOLUME) + "/" + (tank.getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME) + " " + type.getName();
}
@ -89,9 +88,9 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
{
super.readFromNBT(nbt);
UpdateConverter.convert(this, nbt);
NBTTagCompound stored = nbt.getCompoundTag("stored");
LiquidStack stack = LiquidStack.loadLiquidStackFromNBT(stored);
this.tank.setLiquid(stack);
LiquidStack liquid = new LiquidStack(0, 0, 0);
liquid.readFromNBT(nbt.getCompoundTag("stored"));
tank.setLiquid(liquid);
}
@Override
@ -100,7 +99,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
super.writeToNBT(nbt);
if (tank.getLiquid() != null)
{
nbt.setCompoundTag("stored", tank.getLiquid().writeToNBT(nbt));
nbt.setTag("stored", tank.getLiquid().writeToNBT(new NBTTagCompound()));
}
}
@ -136,8 +135,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
@Override
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
{
if (!LiquidHandler.isEqual(resource, type))
return 0;
if (resource == null || !LiquidHandler.isEqual(resource, type)) { return 0; }
return this.fill(0, resource, doFill);
}
@ -150,11 +148,12 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
{
int change = 1;
if (LiquidHandler.get(resource).getCanFloat())
{
change = -1;
}
TileEntity tank = worldObj.getBlockTileEntity(xCoord, yCoord + change, zCoord);
if (tank instanceof TileEntityTank) { return ((TileEntityTank) tank).tank.fill(resource, doFill); }
if (tank instanceof TileEntityTank) { return ((TileEntityTank) tank).fill(0,resource, doFill); }
}
this.doUpdate = true;
return this.tank.fill(resource, doFill);
}

View file

@ -4,24 +4,52 @@
# Blocks
tile.Generator.name=Generator
tile.lmMachines.0.name=Pump
tile.lmMachines.4.name=Condensor
tile.MechanicRod.name=Geared Rod
tile.eValve.name=Release Valve
tile.lmTank.name = Tank
tile.lmPipe.name = Pipe
tile.lmPipe.0.name =Oil Pipe
tile.lmPipe.1.name =Lava Pipe
tile.lmPipe.2.name =Green Pipe
tile.lmPipe.3.name =waste Pipe
tile.lmPipe.4.name =Water Pipe
tile.lmPipe.5.name =Purple Pipe
tile.lmPipe.6.name =Cyan Pipe
tile.lmPipe.7.name =Silver Pipe
tile.lmPipe.8.name =Grey Pipe
tile.lmPipe.9.name =Pink Pipe
tile.lmPipe.10.name =Lime Pipe
tile.lmPipe.11.name =Fuel Pipe
tile.lmPipe.12.name =LightBlue Pipe
tile.lmPipe.13.name =Magenta Pipe
tile.lmPipe.14.name =Orange Pipe
tile.lmPipe.15.name =Generic Pipe
tile.lmTank.0.name =Oil Tank
tile.lmTank.1.name =Lava Tank
tile.lmTank.2.name =Green Tank
tile.lmTank.3.name =Waste Tank
tile.lmTank.4.name =Water Tank
tile.lmTank.5.name =Purple Tank
tile.lmTank.6.name =Cyan Tank
tile.lmTank.7.name =Silver Tank
tile.lmTank.8.name =Grey Tank
tile.lmTank.9.name =Pink Tank
tile.lmTank.10.name =Lime Tank
tile.lmTank.11.name =Fuel Tank
tile.lmTank.12.name =LightBlue Tank
tile.lmTank.13.name =Magenta Tank
tile.lmTank.14.name =Steam Tank
tile.lmTank.15.name =Generic Tank
# Items
item.lmTool.0.name=Pipe Guage
item.lmTools.0.name=Pipe Guage
item.parts.0.name=Bronze Tube
item.parts.1.name=Iron Tube
item.parts.2.name=Obby Tube
item.parts.3.name=Nether Tube
item.parts.4.name=Leather Seal
item.parts.5.name=Slime Seal
item.parts.6.name=Unfinished Tank
item.parts.7.name=Valve
item.itemPipe.0.name=Steam Pipe
item.itemPipe.1.name=Water Pipe
item.itemPipe.2.name=Lava Pipe
item.lmParts.0.name=Bronze Tube
item.lmParts.1.name=Iron Tube
item.lmParts.2.name=Obby Tube
item.lmParts.3.name=Nether Tube
item.lmParts.4.name=Leather Seal
item.lmParts.5.name=Slime Seal
item.lmParts.6.name=Unfinished Tank
item.lmParts.7.name=Valve

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

View file

Before

Width:  |  Height:  |  Size: 791 B

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

View file

Before

Width:  |  Height:  |  Size: 796 B

After

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,003 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,003 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B