more changes of the last

Still working on moving everything over to my new system. So far i've
got it mostly done for the tank and pipe though i have no way to test
them yet.

I would list the change but meh its break time, i'm tired and the code
says everything

Things that are still broken
*Lang file
*release Valve
*pipe
*Tank
*Some crafting
This commit is contained in:
Rseifert 2013-01-05 15:05:53 -05:00
parent 30c461bbea
commit b9833f6327
44 changed files with 743 additions and 1175 deletions

View file

@ -21,8 +21,4 @@ public interface IPressure
* @return * @return
*/ */
public boolean canPressureToo(LiquidData type, ForgeDirection dir); public boolean canPressureToo(LiquidData type, ForgeDirection dir);
/**
* gets the LiquidData linked to the TE
*/
public LiquidData getLiquidType();
} }

View file

@ -3,7 +3,7 @@ package liquidmechanics.api.helpers;
import liquidmechanics.common.handlers.LiquidData; import liquidmechanics.common.handlers.LiquidData;
import liquidmechanics.common.handlers.LiquidHandler; import liquidmechanics.common.handlers.LiquidHandler;
public enum Colors public enum PipeColor
{ {
BLACK, RED, GREEN, BROWN, BLUE, PURPLE, CYAN, SILVER, GREY, PINK, LIME, YELLOW, LIGHTBLUE, MAGENTA, ORANGE, NONE; BLACK, RED, GREEN, BROWN, BLUE, PURPLE, CYAN, SILVER, GREY, PINK, LIME, YELLOW, LIGHTBLUE, MAGENTA, ORANGE, NONE;
@ -24,7 +24,7 @@ public enum Colors
/** /**
* gets a color based on liquid Data * gets a color based on liquid Data
*/ */
public static Colors get(LiquidData data) public static PipeColor get(LiquidData data)
{ {
if (data == LiquidHandler.lava) { return RED; } if (data == LiquidHandler.lava) { return RED; }
if (data == LiquidHandler.steam) { return ORANGE; } if (data == LiquidHandler.steam) { return ORANGE; }
@ -34,11 +34,11 @@ public enum Colors
/** /**
* gets a color based on number(0-15) * gets a color based on number(0-15)
*/ */
public static Colors get(int num) public static PipeColor get(int num)
{ {
if(num < Colors.values().length) if(num < PipeColor.values().length)
{ {
return Colors.values()[num]; return PipeColor.values()[num];
} }
return NONE; return NONE;
} }

View file

@ -1,130 +0,0 @@
package liquidmechanics.api.helpers;
import liquidmechanics.common.handlers.LiquidData;
import liquidmechanics.common.handlers.LiquidHandler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.core.vector.Vector3;
public class TankHelper
{
/**
* Used to find all tileEntities sounding the location you will have to filter for selective
* tileEntities
*
* @param world - the world being searched threw
* @param x
* @param y
* @param z
* @return an array of up to 6 tileEntities
*/
public static TileEntity[] getSurroundings(World world, int x, int y, int z)
{
TileEntity[] list = new TileEntity[] { null, null, null, null, null, null };
for (int i = 0; i < 6; i++)
{
ForgeDirection d = ForgeDirection.getOrientation(i);
TileEntity aEntity = world.getBlockTileEntity(x + d.offsetX, y + d.offsetY, z + d.offsetZ);
if (aEntity instanceof TileEntity)
{
list[i] = aEntity;
}
}
return list;
}
/**
*
* @param world - world
* @param center - location of center of trade
* @param tank - liquid tank to be drained/filled
* @return ammount removed from tank
*/
public static int shareLiquid(World world, Vector3 center, LiquidStack resource)
{
if (resource == null)
return 0;
LiquidStack liquid = resource.copy();
TileEntity[] connected = TankHelper.getSurroundings(world, center.intX(), center.intY(), center.intZ());
LiquidData type = LiquidHandler.get(liquid);
ForgeDirection firstTrade = ForgeDirection.UP;
if (!type.getCanFloat())
firstTrade = ForgeDirection.DOWN;
for (int i = 0; i < 6; i++)
{
ForgeDirection dir = ForgeDirection.getOrientation(i);
if (connected[i] instanceof ITankContainer)
{
ITankContainer cont = ((ITankContainer) connected[i]);
ILiquidTank[] tanks = cont.getTanks(dir);
boolean validTank = false;
for (int t = 0; t < tanks.length; t++)
{
if (tanks[t].getLiquid() != null && LiquidHandler.isEqual(tanks[t].getLiquid(), liquid))
{
validTank = true;
break;
}
}
if (!validTank)
connected[i] = null;
}
else
{
connected[i] = null;
}
}
int filled = 0;
if (connected[firstTrade.ordinal()] instanceof ITankContainer && liquid != null && liquid.amount <= 0)
{
int f = ((ITankContainer) connected[firstTrade.ordinal()]).fill(firstTrade, liquid, true);
liquid.amount -= f;
filled += f;
}
if (connected[firstTrade.getOpposite().ordinal()] instanceof ITankContainer && liquid != null && liquid.amount <= 0)
{
int f = ((ITankContainer) connected[firstTrade.getOpposite().ordinal()]).fill(firstTrade, liquid, true);
liquid.amount -= f;
filled += f;
}
for (int i = 2; i < 6; i++)
{
ForgeDirection dir = ForgeDirection.getOrientation(i);
if (liquid == null || liquid.amount <= 0)
break;
if (connected[i] instanceof ITankContainer)
{
int f = ((ITankContainer) connected[i]).fill(dir, liquid, true);
liquid.amount -= f;
filled += f;
}
}
return filled;
}
/**
*
* @param entity - entity in question
* @return 1-4 if corner 0 if not a corner you have to figure out which is which depending on
* what your using this for 1 should be north east 2 south east
*/
public static int corner(TileEntity entity)
{
TileEntity[] en = getSurroundings(entity.worldObj, entity.xCoord, entity.yCoord, entity.zCoord);
if (en[4] != null && en[2] != null && en[5] == null && en[3] == null) { return 3; }
if (en[2] != null && en[5] != null && en[3] == null && en[4] == null) { return 4; }
if (en[5] != null && en[3] != null && en[4] == null && en[2] == null) { return 1; }
if (en[3] != null && en[4] != null && en[2] == null && en[5] == null) { return 2; }
return 0;
}
}

View file

@ -0,0 +1,56 @@
package liquidmechanics.api.helpers;
import liquidmechanics.common.handlers.LiquidData;
import liquidmechanics.common.handlers.LiquidHandler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.core.vector.Vector3;
public class connectionHelper
{
/**
* Used to find all tileEntities sounding the location you will have to filter for selective
* tileEntities
*
* @param world - the world being searched threw
* @param x
* @param y
* @param z
* @return an array of up to 6 tileEntities
*/
public static TileEntity[] getSurroundings(World world, int x, int y, int z)
{
TileEntity[] list = new TileEntity[] { null, null, null, null, null, null };
for (int i = 0; i < 6; i++)
{
ForgeDirection d = ForgeDirection.getOrientation(i);
TileEntity aEntity = world.getBlockTileEntity(x + d.offsetX, y + d.offsetY, z + d.offsetZ);
if (aEntity instanceof TileEntity)
{
list[i] = aEntity;
}
}
return list;
}
/**
* Used to find which of 4 Corners this block is in a group of blocks
* 0 = not a corner
* 1-4 = a corner of some direction
*/
public static int corner(TileEntity entity)
{
TileEntity[] en = getSurroundings(entity.worldObj, entity.xCoord, entity.yCoord, entity.zCoord);
if (en[4] != null && en[2] != null && en[5] == null && en[3] == null) { return 3; }
if (en[2] != null && en[5] != null && en[3] == null && en[4] == null) { return 4; }
if (en[5] != null && en[3] != null && en[4] == null && en[2] == null) { return 1; }
if (en[3] != null && en[4] != null && en[2] == null && en[5] == null) { return 2; }
return 0;
}
}

View file

@ -1,7 +1,6 @@
package liquidmechanics.client; package liquidmechanics.client;
import liquidmechanics.client.render.BlockRenderHelper; import liquidmechanics.client.render.BlockRenderHelper;
import liquidmechanics.client.render.ItemRenderHelper;
import liquidmechanics.client.render.RenderGearRod; import liquidmechanics.client.render.RenderGearRod;
import liquidmechanics.client.render.RenderGenerator; import liquidmechanics.client.render.RenderGenerator;
import liquidmechanics.client.render.RenderPipe; import liquidmechanics.client.render.RenderPipe;
@ -36,8 +35,6 @@ public class ClientProxy extends CommonProxy
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGenerator.class, new RenderGenerator()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGenerator.class, new RenderGenerator());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTank.class, new RenderTank()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTank.class, new RenderTank());
RenderingRegistry.registerBlockHandler(new BlockRenderHelper()); RenderingRegistry.registerBlockHandler(new BlockRenderHelper());
MinecraftForgeClient.registerItemRenderer(LiquidMechanics.itemPipes.shiftedIndex, new ItemRenderHelper());
MinecraftForgeClient.registerItemRenderer(LiquidMechanics.itemTank.shiftedIndex, new ItemRenderHelper());
} }
@Override @Override

View file

@ -1,122 +0,0 @@
package liquidmechanics.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelPipe extends ModelBase
{
// fields
ModelRenderer Middle;
ModelRenderer Right;
ModelRenderer Left;
ModelRenderer Back;
ModelRenderer Front;
ModelRenderer Top;
ModelRenderer Bottom;
public ModelPipe()
{
textureWidth = 64;
textureHeight = 32;
Middle = new ModelRenderer(this, 0, 0);
Middle.addBox(-1F, -1F, -1F, 4, 4, 4);
Middle.setRotationPoint(-1F, 15F, -1F);
Middle.setTextureSize(64, 32);
Middle.mirror = true;
setRotation(Middle, 0F, 0F, 0F);
Right = new ModelRenderer(this, 21, 0);
Right.addBox(0F, 0F, 0F, 6, 4, 4);
Right.setRotationPoint(2F, 14F, -2F);
Right.setTextureSize(64, 32);
Right.mirror = true;
setRotation(Right, 0F, 0F, 0F);
Left = new ModelRenderer(this, 21, 0);
Left.addBox(0F, 0F, 0F, 6, 4, 4);
Left.setRotationPoint(-8F, 14F, -2F);
Left.setTextureSize(64, 32);
Left.mirror = true;
setRotation(Left, 0F, 0F, 0F);
Back = new ModelRenderer(this, 0, 11);
Back.addBox(0F, 0F, 0F, 4, 4, 6);
Back.setRotationPoint(-2F, 14F, 2F);
Back.setTextureSize(64, 32);
Back.mirror = true;
setRotation(Back, 0F, 0F, 0F);
Front = new ModelRenderer(this, 0, 11);
Front.addBox(0F, 0F, 0F, 4, 4, 6);
Front.setRotationPoint(-2F, 14F, -8F);
Front.setTextureSize(64, 32);
Front.mirror = true;
setRotation(Front, 0F, 0F, 0F);
Top = new ModelRenderer(this, 21, 11);
Top.addBox(0F, 0F, 0F, 4, 6, 4);
Top.setRotationPoint(-2F, 8F, -2F);
Top.setTextureSize(64, 32);
Top.mirror = true;
setRotation(Top, 0F, 0F, 0F);
Bottom = new ModelRenderer(this, 21, 11);
Bottom.addBox(0F, 0F, 0F, 4, 6, 4);
Bottom.setRotationPoint(-2F, 18F, -2F);
Bottom.setTextureSize(64, 32);
Bottom.mirror = true;
setRotation(Bottom, 0F, 0F, 0F);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
this.renderMiddle();
this.renderBottom();
this.renderTop();
this.renderLeft();
this.renderRight();
this.renderBack();
this.renderFront();
}
public void renderMiddle()
{
Middle.render(0.0625F);
}
public void renderBottom()
{
Bottom.render(0.0625F);
}
public void renderTop()
{
Top.render(0.0625F);
}
public void renderLeft()
{
Left.render(0.0625F);
}
public void renderRight()
{
Right.render(0.0625F);
}
public void renderBack()
{
Back.render(0.0625F);
}
public void renderFront()
{
Front.render(0.0625F);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -2,6 +2,8 @@ package liquidmechanics.client.render;
import liquidmechanics.client.model.ModelGearRod; import liquidmechanics.client.model.ModelGearRod;
import liquidmechanics.client.model.ModelGenerator; import liquidmechanics.client.model.ModelGenerator;
import liquidmechanics.client.model.ModelLargePipe;
import liquidmechanics.client.model.ModelLiquidTank;
import liquidmechanics.client.model.ModelPump; import liquidmechanics.client.model.ModelPump;
import liquidmechanics.common.LiquidMechanics; import liquidmechanics.common.LiquidMechanics;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -21,6 +23,8 @@ public class BlockRenderHelper implements ISimpleBlockRenderingHandler
private ModelPump modelPump = new ModelPump(); private ModelPump modelPump = new ModelPump();
private ModelGearRod modelRod = new ModelGearRod(); private ModelGearRod modelRod = new ModelGearRod();
private ModelGenerator modelGen = new ModelGenerator(); private ModelGenerator modelGen = new ModelGenerator();
private ModelLargePipe SixPipe = new ModelLargePipe();
private ModelLiquidTank tank = new ModelLiquidTank();
@Override @Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
@ -39,7 +43,17 @@ public class BlockRenderHelper implements ISimpleBlockRenderingHandler
} }
if (block.blockID == LiquidMechanics.blockPipe.blockID) if (block.blockID == LiquidMechanics.blockPipe.blockID)
{ {
this.renderPipeItem(renderer, metadata);
}
if (block.blockID == LiquidMechanics.blockTank.blockID)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) 0.0F, (float) 1.1F, (float) 0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderTank.getTankTexture(metadata)));
tank.renderMain(0.0625F);
tank.renderMeter(null, 0.0625F);
GL11.glPopMatrix();
} }
if (block.blockID == LiquidMechanics.blockRod.blockID) if (block.blockID == LiquidMechanics.blockRod.blockID)
{ {
@ -61,6 +75,22 @@ public class BlockRenderHelper implements ISimpleBlockRenderingHandler
} }
} }
public void renderPipeItem(RenderBlocks renderer, int meta)
{
GL11.glPushMatrix();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderPipe.getPipeTexture(meta)));
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
SixPipe.renderRight();
SixPipe.renderLeft();
SixPipe.renderMiddle();
GL11.glPopMatrix();
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{ {
return false; return false;

View file

@ -1,116 +0,0 @@
package liquidmechanics.client.render;
import liquidmechanics.client.model.ModelLargePipe;
import liquidmechanics.client.model.ModelLiquidTank;
import liquidmechanics.common.LiquidMechanics;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
/**
* special tanks to Mekanism github
*/
public class ItemRenderHelper implements IItemRenderer
{
static final ModelLiquidTank model = new ModelLiquidTank();
static final ModelLargePipe SixPipe = new ModelLargePipe();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
if (item.itemID == LiquidMechanics.itemPipes.shiftedIndex)
{
this.renderPipeItem((RenderBlocks) data[0], item.getItemDamage(), type == ItemRenderType.EQUIPPED);
}
if (item.itemID == LiquidMechanics.itemTank.shiftedIndex)
{
this.rendertankItem((RenderBlocks) data[0], item.getItemDamage(), type == ItemRenderType.EQUIPPED);
}
}
public void renderPipeItem(RenderBlocks renderer, int meta, boolean equ)
{
GL11.glPushMatrix();
String file = LiquidMechanics.RESOURCE_PATH + "pipes/";
switch (meta)
{
case 0:
file += "SixSteamPipe.png";
break;
case 1:
file += "SixWaterPipe.png";
break;
case 2:
file += "SixLavaPipe.png";
break;
case 3:
file += "SixOilPipe.png";
break;
default:
file += "DefaultPipe.png";
break;
}
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(file));
if (!equ)
{
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
SixPipe.renderRight();
SixPipe.renderLeft();
SixPipe.renderMiddle();
}
else
{
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
SixPipe.renderFront();
SixPipe.renderBack();
SixPipe.renderMiddle();
}
GL11.glPopMatrix();
}
public void rendertankItem(RenderBlocks renderer, int meta, boolean equ)
{
GL11.glPushMatrix();
String file = LiquidMechanics.RESOURCE_PATH + "tanks/";
switch (meta)
{
default:
file += "LiquidTank.png";
break;
}
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(file));
if (!equ)
{
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
}
else
{
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
}
model.renderMain(0.0625F);
model.renderMeter(null, 0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -1,10 +1,7 @@
package liquidmechanics.client.render; package liquidmechanics.client.render;
import liquidmechanics.client.model.ModelLargePipe; import liquidmechanics.client.model.ModelLargePipe;
import liquidmechanics.client.model.ModelPipe;
import liquidmechanics.common.LiquidMechanics; import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.handlers.LiquidData;
import liquidmechanics.common.handlers.LiquidHandler;
import liquidmechanics.common.tileentity.TileEntityPipe; import liquidmechanics.common.tileentity.TileEntityPipe;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -13,14 +10,11 @@ import org.lwjgl.opengl.GL11;
public class RenderPipe extends TileEntitySpecialRenderer public class RenderPipe extends TileEntitySpecialRenderer
{ {
private LiquidData type = LiquidHandler.water;
private ModelPipe fourPipe;
private ModelLargePipe SixPipe; private ModelLargePipe SixPipe;
private TileEntity[] ents = new TileEntity[6]; private TileEntity[] ents = new TileEntity[6];
public RenderPipe() public RenderPipe()
{ {
fourPipe = new ModelPipe();
SixPipe = new ModelLargePipe(); SixPipe = new ModelLargePipe();
} }
@ -30,35 +24,42 @@ public class RenderPipe extends TileEntitySpecialRenderer
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F); GL11.glScalef(1.0F, -1F, -1F);
int meta = 0;
if (te instanceof TileEntityPipe) if (te instanceof TileEntityPipe)
{ {
type = ((TileEntityPipe) te).getType(); meta = te.getBlockMetadata();
ents = ((TileEntityPipe) te).connectedBlocks; ents = ((TileEntityPipe) te).connectedBlocks;
} }
this.render(type, ents); this.render(meta, ents);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
public static String getPipeTexture(int meta)
public void render(LiquidData type2, TileEntity[] ents)
{ {
switch(meta)
if (type2 == LiquidHandler.water)
{ {
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pipes/SixWaterPipe.png"); 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";
} }
else if (type2 == LiquidHandler.lava)
{
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pipes/SixLavaPipe.png");
} }
else if (type2 == LiquidHandler.steam) public void render(int meta, TileEntity[] ents)
{ {
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pipes/SixSteamPipe.png"); bindTextureByName(this.getPipeTexture(meta));
}
else
{
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pipes/SixOilPipe.png");
}
if (ents[0] != null) if (ents[0] != null)
SixPipe.renderBottom(); SixPipe.renderBottom();
if (ents[1] != null) if (ents[1] != null)

View file

@ -1,6 +1,6 @@
package liquidmechanics.client.render; package liquidmechanics.client.render;
import liquidmechanics.api.helpers.TankHelper; import liquidmechanics.api.helpers.connectionHelper;
import liquidmechanics.client.model.ModelLiquidTank; import liquidmechanics.client.model.ModelLiquidTank;
import liquidmechanics.client.model.ModelLiquidTankCorner; import liquidmechanics.client.model.ModelLiquidTankCorner;
import liquidmechanics.common.LiquidMechanics; import liquidmechanics.common.LiquidMechanics;
@ -28,19 +28,17 @@ public class RenderTank extends TileEntitySpecialRenderer
public void renderAModelAt(TileEntityTank te, double d, double d1, double d2, float f) public void renderAModelAt(TileEntityTank te, double d, double d1, double d2, float f)
{ {
type = te.getType(); int meta = te.getBlockMetadata();
if (te.tank.getLiquid() != null) pos = Math.min((te.volume / LiquidContainerRegistry.BUCKET_VOLUME), 4);
pos = Math.min((te.tank.getLiquid().amount / LiquidContainerRegistry.BUCKET_VOLUME), 4);
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F); GL11.glScalef(1.0F, -1F, -1F);
if (TankHelper.corner(te) > 0)
if (connectionHelper.corner(te) > 0)
{ {
if (type == LiquidHandler.water) bindTextureByName(this.getCornerTexture(meta));
{ int corner = connectionHelper.corner(te);
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "tanks/LiquidTankCornerWater.png");
}
int corner = TankHelper.corner(te);
switch (corner) switch (corner)
{ {
case 2: case 2:
@ -60,20 +58,105 @@ public class RenderTank extends TileEntitySpecialRenderer
} }
else else
{ {
switch (LiquidHandler.getMeta(type)) bindTextureByName(this.getTankTexture(meta));
{
// case 0:
// bindTextureByName(BasicPipesMain.textureFile+"/pipes/SixSteamPipe.png");break;
default:bindTextureByName(LiquidMechanics.RESOURCE_PATH + "tanks/LiquidTank" + pos + ".png");break;
}
model.renderMain(0.0625F); model.renderMain(0.0625F);
bindTextureByName(this.getGuageTexture(meta, pos));
model.renderMeter(te, 0.0625F); model.renderMeter(te, 0.0625F);
} }
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
public static String getTankTexture(int meta)
{
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;
}
return LiquidMechanics.RESOURCE_PATH + "tanks/" + type + "Tank.png";
}
public static String getGuageTexture(int meta, int pos)
{
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;
}
return LiquidMechanics.RESOURCE_PATH + "tanks/guage/" + pos + type + ".png";
}
public static String getCornerTexture(int meta)
{
String type = "";
switch (meta)
{
case 0:
case 1:
case 2:
case 3:
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;
}
return LiquidMechanics.RESOURCE_PATH + "tanks/Corner" + type + "png";
}
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{ {

View file

@ -2,18 +2,17 @@ package liquidmechanics.common;
import java.io.File; import java.io.File;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.common.block.BlockGenerator; import liquidmechanics.common.block.BlockGenerator;
import liquidmechanics.common.block.BlockLiquidMachine; import liquidmechanics.common.block.BlockLiquidMachine;
import liquidmechanics.common.block.BlockPipe; import liquidmechanics.common.block.BlockPipe;
import liquidmechanics.common.block.BlockReleaseValve; import liquidmechanics.common.block.BlockReleaseValve;
import liquidmechanics.common.block.BlockRod; import liquidmechanics.common.block.BlockRod;
import liquidmechanics.common.block.BlockSteam; import liquidmechanics.common.block.BlockTank;
import liquidmechanics.common.handlers.LiquidHandler; import liquidmechanics.common.handlers.LiquidHandler;
import liquidmechanics.common.item.ItemGuage; import liquidmechanics.common.item.ItemGuage;
import liquidmechanics.common.item.ItemParts; import liquidmechanics.common.item.ItemParts;
import liquidmechanics.common.item.ItemParts.Parts; 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.TileEntityGenerator;
import liquidmechanics.common.tileentity.TileEntityPipe; import liquidmechanics.common.tileentity.TileEntityPipe;
import liquidmechanics.common.tileentity.TileEntityPump; import liquidmechanics.common.tileentity.TileEntityPump;
@ -25,8 +24,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.CraftingManager;
import net.minecraftforge.common.Configuration; import net.minecraftforge.common.Configuration;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack; import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
@ -69,7 +66,7 @@ public class LiquidMechanics extends DummyModContainer
public static final String ITEM_TEXTURE_FILE = RESOURCE_PATH + "items.png"; public static final String ITEM_TEXTURE_FILE = RESOURCE_PATH + "items.png";
public static final String LANGUAGE_PATH = RESOURCE_PATH + "lang/"; public static final String LANGUAGE_PATH = RESOURCE_PATH + "lang/";
private static final String[] LANGUAGES_SUPPORTED = new String[] { "en_US"}; private static final String[] LANGUAGES_SUPPORTED = new String[] { "en_US" };
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir() + "/UniversalElectricity/", NAME + ".cfg")); public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir() + "/UniversalElectricity/", NAME + ".cfg"));
@ -78,19 +75,17 @@ public class LiquidMechanics extends DummyModContainer
public final static int ITEM_ID_PREFIX = 13200; public final static int ITEM_ID_PREFIX = 13200;
public static Block blockPipe; public static Block blockPipe;
public static Block blockTank;
public static Block blockMachine; public static Block blockMachine;
public static Block blockRod; public static Block blockRod;
public static Block blockGenerator; public static Block blockGenerator;
public static Block blockReleaseValve; public static Block blockReleaseValve;
public static Block blockSteamBlock;
public static LiquidStack liquidSteam; public static LiquidStack liquidSteam;
public static Item itemParts; public static Item itemParts;
public static Item itemPipes; // public static Item itemPipes;
public static Item itemGauge; public static Item itemGauge;
public static Item itemOilBucket;
public static Item itemTank;
@SidedProxy(clientSide = "liquidmechanics.client.ClientProxy", serverSide = "liquidmechanics.common.CommonProxy") @SidedProxy(clientSide = "liquidmechanics.client.ClientProxy", serverSide = "liquidmechanics.common.CommonProxy")
public static CommonProxy proxy; public static CommonProxy proxy;
@ -111,31 +106,27 @@ public class LiquidMechanics extends DummyModContainer
blockRod = new BlockRod(this.CONFIGURATION.getBlock("Mechanical Rod", BLOCK_ID_PREFIX + 3).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())); 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())); 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());
// Liquid Blocks
blockSteamBlock = new BlockSteam(this.CONFIGURATION.getBlock("SteamBlock", LIQUID_ID_PREFIX).getInt());
// Items // Items
itemParts = new ItemParts(this.CONFIGURATION.getItem("Parts", ITEM_ID_PREFIX).getInt()); itemParts = new ItemParts(this.CONFIGURATION.getItem("Parts", ITEM_ID_PREFIX).getInt());
itemPipes = new ItemPipe(this.CONFIGURATION.getItem("PipeItem", ITEM_ID_PREFIX + 1).getInt()); // itemPipes = new ItemPipe(this.CONFIGURATION.getItem("PipeItem",
// ITEM_ID_PREFIX + 1).getInt());
// Valve item // Valve item
itemGauge = new ItemGuage(this.CONFIGURATION.getItem("PipeGuage", ITEM_ID_PREFIX + 3).getInt()); itemGauge = new ItemGuage(this.CONFIGURATION.getItem("PipeGuage", ITEM_ID_PREFIX + 3).getInt());
itemTank = new ItemTank(this.CONFIGURATION.getItem("TankItem", ITEM_ID_PREFIX + 5).getInt());
// Liquid Registry // Liquid Registry
liquidSteam = LiquidDictionary.getOrCreateLiquid("Steam", new LiquidStack(blockSteamBlock, LiquidContainerRegistry.BUCKET_VOLUME));
CONFIGURATION.save(); CONFIGURATION.save();
proxy.preInit(); proxy.preInit();
// block registry // block registry
GameRegistry.registerBlock(blockPipe, "lmPipe"); GameRegistry.registerBlock(blockPipe, "lmPipe");
GameRegistry.registerBlock(blockReleaseValve,"eValve"); GameRegistry.registerBlock(blockReleaseValve, "eValve");
GameRegistry.registerBlock(blockRod, "mechRod"); GameRegistry.registerBlock(blockRod, "mechRod");
GameRegistry.registerBlock(blockGenerator, "lmGen"); GameRegistry.registerBlock(blockGenerator, "lmGen");
GameRegistry.registerBlock(blockMachine, "lmMachines"); GameRegistry.registerBlock(blockMachine, "lmMachines");
GameRegistry.registerBlock(blockSteamBlock, "lmSteam"); GameRegistry.registerBlock(blockTank, "lmTank");
} }
@Init @Init
@ -151,14 +142,13 @@ public class LiquidMechanics extends DummyModContainer
GameRegistry.registerTileEntity(TileEntityGenerator.class, "lmGen"); GameRegistry.registerTileEntity(TileEntityGenerator.class, "lmGen");
System.out.println("Fluid Mechanics Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages."); System.out.println("Fluid Mechanics Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages.");
} }
@PostInit @PostInit
public void PostInit(FMLPostInitializationEvent event) public void PostInit(FMLPostInitializationEvent event)
{ {
proxy.postInit(); proxy.postInit();
TabLiquidMechanics.setItemStack(new ItemStack(itemPipes, 1, 1)); TabLiquidMechanics.setItemStack(new ItemStack(blockPipe, 1, 4));
// generator // generator
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(this.blockGenerator, 1), new Object[] { CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(this.blockGenerator, 1), new Object[] {
"@T@", "OVO", "@T@", "@T@", "OVO", "@T@",
@ -213,23 +203,20 @@ public class LiquidMechanics extends DummyModContainer
'@', new ItemStack(itemParts, 1, Parts.Iron.ordinal()) }); '@', new ItemStack(itemParts, 1, Parts.Iron.ordinal()) });
// Iron Pipe // Iron Pipe
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1, 0), new Object[] { GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 1, 15), new Object[] {
new ItemStack(itemParts, 1, Parts.Iron.ordinal()), new ItemStack(itemParts, 1, Parts.Iron.ordinal()),
new ItemStack(itemParts, 1, Parts.Seal.ordinal()) }); new ItemStack(itemParts, 1, Parts.Seal.ordinal()) });
// steam tank // steam tank
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, 0), new Object[] { GameRegistry.addShapelessRecipe(new ItemStack(blockTank, 1, PipeColor.ORANGE.ordinal()), new Object[] {
new ItemStack(itemParts, 1, Parts.Tank.ordinal()), new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
new ItemStack(itemParts, 1, Parts.Seal.ordinal()), new ItemStack(itemParts, 1, Parts.Seal.ordinal()),
new ItemStack(Item.dyePowder, 1, 15) }); new ItemStack(Item.dyePowder, 1, PipeColor.ORANGE.ordinal()) });
// lava tank // lava tank
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1, 2), new Object[] { GameRegistry.addRecipe(new ItemStack(blockTank, 1, PipeColor.RED.ordinal()), new Object[] {
new ItemStack(itemParts, 1, Parts.Tank.ordinal()), " @ ", "@T@", " @ ",
Block.obsidian, 'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
Block.obsidian, '@', Block.obsidian, });
Block.obsidian,
Block.obsidian });
// pump // pump
GameRegistry.addRecipe(new ItemStack(blockMachine, 1, 0), new Object[] { GameRegistry.addRecipe(new ItemStack(blockMachine, 1, 0), new Object[] {
@ -239,18 +226,14 @@ public class LiquidMechanics extends DummyModContainer
'P', new ItemStack(Block.pistonBase), 'P', new ItemStack(Block.pistonBase),
'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()) }); 'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()) });
// eVavles // release valve
for (int i = 0; i < LiquidHandler.allowedLiquids.size() - 1; i++) GameRegistry.addRecipe(new ItemStack(blockMachine, 1), new Object[] {
{ "RPR", "PVP", "RPR", " P ",
GameRegistry.addRecipe(new ItemStack(blockMachine, 1, i), new Object[] { 'P', new ItemStack(blockPipe, 1, 15),
" P ", "PVP", " P ", 'V', new ItemStack(itemParts, 1, Parts.Valve.ordinal()),
'P', new ItemStack(itemPipes, 1, i), 'R', Item.redstone });
'V', new ItemStack(itemParts, 1, Parts.Valve.ordinal()), });
}
// reg ore directory for parts
//reg ore directory for parts
OreDictionary.registerOre("bronzeTube", new ItemStack(itemParts, 1, Parts.Bronze.ordinal())); OreDictionary.registerOre("bronzeTube", new ItemStack(itemParts, 1, Parts.Bronze.ordinal()));
OreDictionary.registerOre("ironTube", new ItemStack(itemParts, 1, Parts.Iron.ordinal())); OreDictionary.registerOre("ironTube", new ItemStack(itemParts, 1, Parts.Iron.ordinal()));
OreDictionary.registerOre("netherTube", new ItemStack(itemParts, 1, Parts.Nether.ordinal())); OreDictionary.registerOre("netherTube", new ItemStack(itemParts, 1, Parts.Nether.ordinal()));
@ -260,7 +243,8 @@ public class LiquidMechanics extends DummyModContainer
OreDictionary.registerOre("valvePart", new ItemStack(itemParts, 1, Parts.Valve.ordinal())); OreDictionary.registerOre("valvePart", new ItemStack(itemParts, 1, Parts.Valve.ordinal()));
OreDictionary.registerOre("bronzeTube", new ItemStack(itemParts, 1, Parts.Bronze.ordinal())); OreDictionary.registerOre("bronzeTube", new ItemStack(itemParts, 1, Parts.Bronze.ordinal()));
OreDictionary.registerOre("unfinishedTank", new ItemStack(itemParts, 1, Parts.Tank.ordinal())); OreDictionary.registerOre("unfinishedTank", new ItemStack(itemParts, 1, Parts.Tank.ordinal()));
//add Default Liquids to current list, done last to let other mods use there liquid data first if used // add Default Liquids to current list, done last to let other mods use
// there liquid data first if used
LiquidHandler.addDefaultLiquids(); LiquidHandler.addDefaultLiquids();
} }
} }

View file

@ -28,11 +28,17 @@ public class BlockLiquidMachine extends BlockMachine
public BlockLiquidMachine(int id) public BlockLiquidMachine(int id)
{ {
super("lmMachines", id, Material.iron, TabLiquidMechanics.INSTANCE); super("lmMachines", id, Material.iron, TabLiquidMechanics.INSTANCE);
this.blockIndexInTexture = 26;
this.setHardness(1f); this.setHardness(1f);
this.setResistance(5f); this.setResistance(5f);
} }
public void onBlockAdded(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if(MetaGroup.getGrouping(meta) == 1)
{
world.setBlockAndMetadata(x, y, z, LiquidMechanics.blockTank.blockID, 15);
}
}
@Override @Override
public boolean isOpaqueCube() public boolean isOpaqueCube()
{ {
@ -45,75 +51,6 @@ public class BlockLiquidMachine extends BlockMachine
return false; return false;
} }
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
{
ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null)
{
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(current);
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity instanceof TileEntityTank)
{
TileEntityTank tank = (TileEntityTank) tileEntity;
// Handle filled containers
if (liquid != null)
{
int filled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
if (filled != 0 && !entityplayer.capabilities.isCreativeMode)
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
return true;
// Handle empty containers
}
else
{
LiquidStack stack = tank.tank.getLiquid();
if (stack != null)
{
ItemStack liquidItem = LiquidContainerRegistry.fillLiquidContainer(stack, current);
liquid = LiquidContainerRegistry.getLiquidForFilledItem(liquidItem);
if (liquid != null)
{
if (!entityplayer.capabilities.isCreativeMode)
{
if (current.stackSize > 1)
{
if (!entityplayer.inventory.addItemStackToInventory(liquidItem)) return false;
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
}
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
}
}
tank.tank.drain(liquid.amount, true);
return true;
}
}
}
}
}
return false;
}
@Override @Override
public int getRenderType() public int getRenderType()
{ {
@ -137,7 +74,7 @@ public class BlockLiquidMachine extends BlockMachine
{ {
new ItemStack(LiquidMechanics.blockMachine, 1, 0); new ItemStack(LiquidMechanics.blockMachine, 1, 0);
} }
if (ent instanceof TileEntityTank) { return new ItemStack(LiquidMechanics.itemTank, 1, LiquidHandler.getMeta(((TileEntityTank) ent).type)); }
return null; return null;
} }
@ -147,10 +84,8 @@ public class BlockLiquidMachine extends BlockMachine
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
TileEntity ent = world.getBlockTileEntity(x, y, z); TileEntity ent = world.getBlockTileEntity(x, y, z);
if (MetaGroup.getGrouping(meta) != 1)
{
world.setBlockMetadata(x, y, z, angle + MetaGroup.getGroupStartMeta(MetaGroup.getGrouping(meta))); world.setBlockMetadata(x, y, z, angle + MetaGroup.getGroupStartMeta(MetaGroup.getGrouping(meta)));
}
if (ent instanceof TileEntityAdvanced) if (ent instanceof TileEntityAdvanced)
{ {
((TileEntityAdvanced) world.getBlockTileEntity(x, y, z)).initiate(); ((TileEntityAdvanced) world.getBlockTileEntity(x, y, z)).initiate();
@ -171,7 +106,7 @@ public class BlockLiquidMachine extends BlockMachine
} }
else if (meta >= 4) else if (meta >= 4)
{ {
return new TileEntityTank();
} }
else else
{ {

View file

@ -2,7 +2,11 @@ package liquidmechanics.common.block;
import java.util.Random; import java.util.Random;
import universalelectricity.prefab.BlockMachine;
import liquidmechanics.client.render.BlockRenderHelper;
import liquidmechanics.common.LiquidMechanics; import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.TabLiquidMechanics;
import liquidmechanics.common.handlers.LiquidHandler; import liquidmechanics.common.handlers.LiquidHandler;
import liquidmechanics.common.tileentity.TileEntityPipe; import liquidmechanics.common.tileentity.TileEntityPipe;
@ -14,12 +18,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockPipe extends BlockContainer public class BlockPipe extends BlockMachine
{ {
public BlockPipe(int id) public BlockPipe(int id)
{ {
super(id, Material.iron); super("Pipe",id, Material.iron,TabLiquidMechanics.INSTANCE);
this.setBlockName("Pipe");
this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F); this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F);
this.setHardness(1f); this.setHardness(1f);
this.setResistance(3f); this.setResistance(3f);
@ -40,19 +43,7 @@ public class BlockPipe extends BlockContainer
@Override @Override
public int getRenderType() public int getRenderType()
{ {
return -1; return BlockRenderHelper.renderID;
}
@Override
public int idDropped(int par1, Random par2Random, int par3)
{
return 0;
}
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
} }
/** /**
@ -82,43 +73,13 @@ public class BlockPipe extends BlockContainer
@Override @Override
public TileEntity createNewTileEntity(World var1) public TileEntity createNewTileEntity(World var1)
{ {
// TODO Auto-generated method stub
return new TileEntityPipe(); return new TileEntityPipe();
} }
@Override @Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{ {
TileEntity ent = world.getBlockTileEntity(x, y, z); int meta = world.getBlockMetadata(x, y, z);
int meta = 0; return new ItemStack(LiquidMechanics.blockPipe, 1, meta);
if (ent instanceof TileEntityPipe)
{
TileEntityPipe pipe = (TileEntityPipe) ent;
meta = LiquidHandler.getMeta(pipe.type);
}
return new ItemStack(LiquidMechanics.itemPipes, 1, 0);
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6)
{
super.breakBlock(world, x, y, z, par5, par6);
TileEntity ent = world.getBlockTileEntity(x, y, z);
Random furnaceRand = new Random();
if (ent instanceof TileEntityPipe)
{
TileEntityPipe pipe = (TileEntityPipe) ent;
int meta = LiquidHandler.getMeta(pipe.type);
float var8 = furnaceRand.nextFloat() * 0.8F + 0.1F;
float var9 = furnaceRand.nextFloat() * 0.8F + 0.1F;
float var10 = furnaceRand.nextFloat() * 0.8F + 0.1F;
EntityItem var12 = new EntityItem(world, (double) ((float) x + var8), (double) ((float) y + var9), (double) ((float) z + var10), new ItemStack(LiquidMechanics.itemPipes, 1, meta));
float var13 = 0.05F;
var12.motionX = (double) ((float) furnaceRand.nextGaussian() * var13);
var12.motionY = (double) ((float) furnaceRand.nextGaussian() * var13 + 0.2F);
var12.motionZ = (double) ((float) furnaceRand.nextGaussian() * var13);
world.spawnEntityInWorld(var12);
}
} }
} }

View file

@ -1,35 +0,0 @@
package liquidmechanics.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.liquids.ILiquid;
public class BlockSteam extends Block implements ILiquid
{
public static int blockID;
public BlockSteam(int par1)
{
super(par1, Material.air);
blockID = par1;
}
@Override
public int stillLiquidId()
{
return blockID;
}
@Override
public boolean isMetaSensitive()
{
return false;
}
@Override
public int stillLiquidMeta()
{
return 0;
}
}

View file

@ -0,0 +1,137 @@
package liquidmechanics.common.block;
import liquidmechanics.client.render.BlockRenderHelper;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.TabLiquidMechanics;
import liquidmechanics.common.handlers.LiquidHandler;
import liquidmechanics.common.tileentity.TileEntityPump;
import liquidmechanics.common.tileentity.TileEntityTank;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import universalelectricity.prefab.BlockMachine;
public class BlockTank extends BlockMachine
{
public BlockTank(int id)
{
super("lmTank", id, Material.rock, TabLiquidMechanics.INSTANCE);
this.setHardness(1f);
this.setResistance(5f);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.renderID;
}
@Override
public int damageDropped(int meta)
{
return meta;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
{
ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null)
{
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(current);
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity instanceof TileEntityTank)
{
TileEntityTank tank = (TileEntityTank) tileEntity;
// Handle filled containers
if (liquid != null)
{
int filled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
if (filled != 0 && !entityplayer.capabilities.isCreativeMode)
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
return true;
// Handle empty containers
}
else
{
LiquidStack stack = tank.tank.getLiquid();
if (stack != null)
{
ItemStack liquidItem = LiquidContainerRegistry.fillLiquidContainer(stack, current);
liquid = LiquidContainerRegistry.getLiquidForFilledItem(liquidItem);
if (liquid != null)
{
if (!entityplayer.capabilities.isCreativeMode)
{
if (current.stackSize > 1)
{
if (!entityplayer.inventory.addItemStackToInventory(liquidItem)) return false;
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
}
}
else
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
}
}
tank.tank.drain(liquid.amount, true);
return true;
}
}
}
}
}
return false;
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEntityTank();
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
return new ItemStack(this, 1, meta);
}
}

View file

@ -1,6 +1,6 @@
package liquidmechanics.common.handlers; package liquidmechanics.common.handlers;
import liquidmechanics.api.helpers.Colors; import liquidmechanics.api.helpers.PipeColor;
import net.minecraftforge.liquids.LiquidStack; import net.minecraftforge.liquids.LiquidStack;
public class LiquidData public class LiquidData
@ -9,9 +9,9 @@ public class LiquidData
private int defaultPressure; private int defaultPressure;
private LiquidStack sampleStack; private LiquidStack sampleStack;
private String name; private String name;
private Colors color; private PipeColor color;
public LiquidData(String name, LiquidStack stack,Colors color, boolean gas, int dPressure) public LiquidData(String name, LiquidStack stack,PipeColor color, boolean gas, int dPressure)
{ {
this.sampleStack = stack; this.sampleStack = stack;
this.isAGas = gas; this.isAGas = gas;
@ -38,10 +38,10 @@ public class LiquidData
{ {
return isAGas; return isAGas;
} }
public Colors getColor() public PipeColor getColor()
{ {
if (color != null) { return color; } if (color != null) { return color; }
return Colors.NONE; return PipeColor.NONE;
} }
} }

View file

@ -3,7 +3,7 @@ package liquidmechanics.common.handlers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import liquidmechanics.api.helpers.Colors; import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.common.LiquidMechanics; import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.tileentity.TileEntityPipe; import liquidmechanics.common.tileentity.TileEntityPipe;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -30,13 +30,11 @@ public class LiquidHandler
*/ */
public static void addDefaultLiquids() public static void addDefaultLiquids()
{ {
steam = new LiquidData("Steam", LiquidDictionary.getOrCreateLiquid("Steam", new LiquidStack(LiquidMechanics.blockSteamBlock, 1)),Colors.ORANGE, true, 100); water = new LiquidData("water", LiquidDictionary.getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, 1)), PipeColor.BLUE, false, 32);
allowedLiquids.add(steam);
water = new LiquidData("water", LiquidDictionary.getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, 1)),Colors.BLUE, false, 32);
allowedLiquids.add(water); allowedLiquids.add(water);
lava = new LiquidData("Lava", LiquidDictionary.getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, 1)),Colors.RED, false, 20); lava = new LiquidData("Lava", LiquidDictionary.getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, 1)), PipeColor.RED, false, 20);
allowedLiquids.add(lava); allowedLiquids.add(lava);
air = new LiquidData("Air", LiquidDictionary.getOrCreateLiquid("Air", new LiquidStack(0, 1)),Colors.NONE, false, 0); air = new LiquidData("Air", LiquidDictionary.getOrCreateLiquid("Air", new LiquidStack(0, 1)), PipeColor.NONE, false, 0);
allowedLiquids.add(air); allowedLiquids.add(air);
} }
@ -45,7 +43,22 @@ public class LiquidHandler
{ {
// TODO use this to add new liquid types to the data list // TODO use this to add new liquid types to the data list
// or something along the lines of IDing liquids for use // or something along the lines of IDing liquids for use
if (event.Name.equalsIgnoreCase("methane"))
{
this.allowedLiquids.add(new LiquidData("methane", event.Liquid, PipeColor.LIME, true, 100));
}
else if (event.Name.equalsIgnoreCase("oil"))
{
this.allowedLiquids.add(new LiquidData("oil", event.Liquid, PipeColor.BLACK, true, 30));
}
else if (event.Name.equalsIgnoreCase("fuel"))
{
this.allowedLiquids.add(new LiquidData("fuel", event.Liquid, PipeColor.YELLOW, true, 50));
}
else if (event.Name.equalsIgnoreCase("steam"))
{
this.steam =new LiquidData("steam", event.Liquid, PipeColor.ORANGE, true, 100);
}
} }
/** /**
@ -77,7 +90,7 @@ public class LiquidHandler
*/ */
public static LiquidStack getStack(LiquidData type, int vol) public static LiquidStack getStack(LiquidData type, int vol)
{ {
if(type == null) return null; if (type == null) return null;
return new LiquidStack(type.getStack().itemID, vol, type.getStack().itemMeta); return new LiquidStack(type.getStack().itemID, vol, type.getStack().itemMeta);
} }
@ -127,6 +140,7 @@ public class LiquidHandler
if (type.getStack().itemID == stack.itemID && type.getStack().itemMeta == stack.itemMeta) { return true; } if (type.getStack().itemID == stack.itemID && type.getStack().itemMeta == stack.itemMeta) { return true; }
return false; return false;
} }
public static boolean isEqual(LiquidStack stack, LiquidStack type) public static boolean isEqual(LiquidStack stack, LiquidStack type)
{ {
if (stack == null || type == null) if (stack == null || type == null)
@ -134,6 +148,7 @@ public class LiquidHandler
if (type.itemID == stack.itemID && type.itemMeta == stack.itemMeta) { return true; } if (type.itemID == stack.itemID && type.itemMeta == stack.itemMeta) { return true; }
return false; return false;
} }
public static ItemStack consumeItem(ItemStack stack) public static ItemStack consumeItem(ItemStack stack)
{ {
if (stack.stackSize == 1) if (stack.stackSize == 1)

View file

@ -1,20 +0,0 @@
package liquidmechanics.common.handlers;
import net.minecraftforge.liquids.LiquidDictionary.LiquidRegisterEvent;
/**
* WIP unknown if this can actual work fully
* @author Rseifert
*
*/
public class PipeCreator
{
/**
* used to create a new pipe type
*/
public static void createNewPipe(LiquidRegisterEvent event)
{
}
}

View file

@ -1,19 +1,18 @@
package liquidmechanics.common.handlers; package liquidmechanics.common.handlers;
import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.common.tileentity.TileEntityPipe; import liquidmechanics.common.tileentity.TileEntityPipe;
/** /**
* used to keep track of a pipe, its meta, and if Universal * used to keep track of a pipe, its meta, and if Universal
*/ */
public class PipeInstance public class PipeInstance
{ {
public int color; public PipeColor color;
public TileEntityPipe pipe; public TileEntityPipe pipe;
public boolean any; //colors
public PipeInstance(PipeColor cc, TileEntityPipe pipe)
public PipeInstance(int color, TileEntityPipe pipe, boolean any)
{ {
this.color = color; this.color = cc;
this.pipe = pipe; this.pipe = pipe;
this.any = any;
} }
} }

View file

@ -1,8 +1,9 @@
package liquidmechanics.common.handlers; package liquidmechanics.common.handlers;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import liquidmechanics.api.helpers.Colors; import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.common.tileentity.TileEntityPipe; import liquidmechanics.common.tileentity.TileEntityPipe;
import liquidmechanics.common.tileentity.TileEntityTank;
/** /**
* used to help convert older system to newer systems. * used to help convert older system to newer systems.
@ -15,14 +16,28 @@ public class UpdateConverter
Boolean converted25 = nbt.getBoolean("converted025"); Boolean converted25 = nbt.getBoolean("converted025");
if (!converted24) if (!converted24)
{ {
pipe.setColor(Colors.get(LiquidHandler.getFromMeta(nbt.getInteger("type")))); pipe.setColor(PipeColor.get(LiquidHandler.getFromMeta(nbt.getInteger("type"))));
} }
else if (converted24 && !converted25) else if (converted24 && !converted25)
{ {
pipe.setColor(Colors.get(LiquidHandler.get(nbt.getString("name")))); pipe.setColor(PipeColor.get(LiquidHandler.get(nbt.getString("name"))));
}
nbt.setBoolean("converted", true);
nbt.setBoolean("converted025", true);
}
public static void convert(TileEntityTank pipe, NBTTagCompound nbt)
{
Boolean converted24 = nbt.getBoolean("converted");
Boolean converted25 = nbt.getBoolean("converted025");
if (!converted24)
{
pipe.setColor(PipeColor.get(LiquidHandler.getFromMeta(nbt.getInteger("type"))));
}
else if (converted24 && !converted25)
{
pipe.setColor(PipeColor.get(LiquidHandler.get(nbt.getString("name"))));
} }
nbt.setBoolean("converted", true); nbt.setBoolean("converted", true);
nbt.setBoolean("converted025", true); nbt.setBoolean("converted025", true);
} }
} }

View file

@ -1,135 +0,0 @@
package liquidmechanics.common.item;
import java.util.List;
import liquidmechanics.api.helpers.Colors;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.TabLiquidMechanics;
import liquidmechanics.common.handlers.LiquidHandler;
import liquidmechanics.common.tileentity.TileEntityPipe;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class ItemPipe extends Item
{
int index = 32;
private int spawnID;
public ItemPipe(int id)
{
super(id);
this.setMaxDamage(0);
this.setIconIndex(10);
this.setItemName("itemPipe");
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
}
@Override
public int getIconFromDamage(int par1)
{
return par1 + index;
}
@Override
public String getItemNameIS(ItemStack itemstack)
{
return "pipe";
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < LiquidHandler.allowedLiquids.size() - 1; i++)
{
par3List.add(new ItemStack(this, 1, i));
}
}
public String getTextureFile()
{
return LiquidMechanics.ITEM_TEXTURE_FILE;
}
@Override
public String getItemName()
{
return "Pipes";
}
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World par3World, int x, int y, int z, int par7, float par8, float par9, float par10)
{
int blockID = par3World.getBlockId(x, y, z);
spawnID = LiquidMechanics.blockPipe.blockID;
if (blockID == Block.snow.blockID)
{
par7 = 1;
}
else if (blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID && blockID != Block.deadBush.blockID)
{
if (par7 == 0)
{
--y;
}
if (par7 == 1)
{
++y;
}
if (par7 == 2)
{
--z;
}
if (par7 == 3)
{
++z;
}
if (par7 == 4)
{
--x;
}
if (par7 == 5)
{
++x;
}
}
if (LiquidMechanics.blockPipe.canPlaceBlockAt(par3World, x, y, z))
{
Block var9 = Block.blocksList[this.spawnID];
par3World.editingBlocks = true;
if (par3World.setBlockWithNotify(x, y, z, var9.blockID))
{
if (par3World.getBlockId(x, y, z) == var9.blockID)
{
Block.blocksList[this.spawnID].onBlockAdded(par3World, x, y, z);
Block.blocksList[this.spawnID].onBlockPlacedBy(par3World, x, y, z, player);
TileEntity blockEntity = par3World.getBlockTileEntity(x, y, z);
if (blockEntity instanceof TileEntityPipe)
{
TileEntityPipe pipeEntity = (TileEntityPipe) blockEntity;
par3World.setBlockMetadataWithNotify(x,y,z,Colors.NONE.ordinal());
}
}
--itemstack.stackSize;
par3World.editingBlocks = false;
return true;
}
}
par3World.editingBlocks = false;
return false;
}
}

View file

@ -1,138 +0,0 @@
package liquidmechanics.common.item;
import java.util.List;
import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.TabLiquidMechanics;
import liquidmechanics.common.handlers.LiquidData;
import liquidmechanics.common.handlers.LiquidHandler;
import liquidmechanics.common.tileentity.TileEntityTank;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class ItemTank extends Item
{
int index = 64;// 64 + 2 rows alloted to pipes
private int spawnID;
public ItemTank(int id)
{
super(id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setIconIndex(10);
this.setItemName("itemTank");
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
}
@Override
public int getIconFromDamage(int par1)
{
return par1 + index;
}
@Override
public String getItemNameIS(ItemStack itemstack)
{
return "Tank";
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < LiquidHandler.allowedLiquids.size() -1; i++)
{
par3List.add(new ItemStack(this, 1, i));
}
}
public String getTextureFile()
{
return LiquidMechanics.ITEM_TEXTURE_FILE;
}
@Override
public String getItemName()
{
return "Pipes";
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
int blockID = par3World.getBlockId(par4, par5, par6);
spawnID = LiquidMechanics.blockMachine.blockID;
if (blockID == Block.snow.blockID)
{
par7 = 1;
}
else if (blockID != Block.vine.blockID && blockID != Block.tallGrass.blockID && blockID != Block.deadBush.blockID)
{
if (par7 == 0)
{
--par5;
}
if (par7 == 1)
{
++par5;
}
if (par7 == 2)
{
--par6;
}
if (par7 == 3)
{
++par6;
}
if (par7 == 4)
{
--par4;
}
if (par7 == 5)
{
++par4;
}
}
if (LiquidMechanics.blockPipe.canPlaceBlockAt(par3World, par4, par5, par6))
{
Block var9 = Block.blocksList[this.spawnID];
par3World.editingBlocks = true;
if (par3World.setBlockAndMetadataWithNotify(par4, par5, par6, var9.blockID, 5))
{
if (par3World.getBlockId(par4, par5, par6) == var9.blockID)
{
Block.blocksList[this.spawnID].onBlockAdded(par3World, par4, par5, par6);
Block.blocksList[this.spawnID].onBlockPlacedBy(par3World, par4, par5, par6, par2EntityPlayer);
TileEntity blockEntity = par3World.getBlockTileEntity(par4, par5, par6);
if (blockEntity instanceof TileEntityTank)
{
TileEntityTank pipeEntity = (TileEntityTank) blockEntity;
LiquidData dm = LiquidHandler.getFromMeta(par1ItemStack.getItemDamage());
pipeEntity.setType(dm);
pipeEntity.converted = true;
}
}
--par1ItemStack.stackSize;
par3World.editingBlocks = false;
return true;
}
}
par3World.editingBlocks = false;
return false;
}
}

View file

@ -4,7 +4,7 @@ import java.util.EnumSet;
import liquidmechanics.api.IForce; import liquidmechanics.api.IForce;
import liquidmechanics.api.IReadOut; import liquidmechanics.api.IReadOut;
import liquidmechanics.api.helpers.TankHelper; import liquidmechanics.api.helpers.connectionHelper;
import liquidmechanics.common.LiquidMechanics; import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.MetaGroup; import liquidmechanics.common.MetaGroup;
import liquidmechanics.common.block.BlockGenerator; import liquidmechanics.common.block.BlockGenerator;
@ -76,7 +76,7 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
this.genAmmount = Math.abs(force / this.getVoltage()); this.genAmmount = Math.abs(force / this.getVoltage());
// wire count update // wire count update
int wireCount = 0; int wireCount = 0;
TileEntity[] ents = TankHelper.getSurroundings(worldObj, xCoord, yCoord, zCoord); TileEntity[] ents = connectionHelper.getSurroundings(worldObj, xCoord, yCoord, zCoord);
this.wires = new IConductor[6]; this.wires = new IConductor[6];
for (int i = 0; i < ents.length; i++) for (int i = 0; i < ents.length; i++)
{ {

View file

@ -2,8 +2,8 @@ package liquidmechanics.common.tileentity;
import liquidmechanics.api.IReadOut; import liquidmechanics.api.IReadOut;
import liquidmechanics.api.IPressure; import liquidmechanics.api.IPressure;
import liquidmechanics.api.helpers.Colors; import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.api.helpers.TankHelper; import liquidmechanics.api.helpers.connectionHelper;
import liquidmechanics.common.LiquidMechanics; import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.handlers.LiquidData; import liquidmechanics.common.handlers.LiquidData;
import liquidmechanics.common.handlers.LiquidHandler; import liquidmechanics.common.handlers.LiquidHandler;
@ -28,7 +28,7 @@ import com.google.common.io.ByteArrayDataInput;
public class TileEntityPipe extends TileEntity implements ITankContainer, IPacketReceiver, IReadOut public class TileEntityPipe extends TileEntity implements ITankContainer, IPacketReceiver, IReadOut
{ {
private Colors color = Colors.NONE; private PipeColor color = PipeColor.NONE;
private int count = 40; private int count = 40;
private int count2, presure = 0; private int count2, presure = 0;
@ -47,7 +47,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
{ {
count = 0; count = 0;
this.validataConnections(); this.validataConnections();
this.color = Colors.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); this.color = PipeColor.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
if (!worldObj.isRemote) if (!worldObj.isRemote)
{ {
this.updatePressure(); this.updatePressure();
@ -97,7 +97,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
/** /**
* gets the current color mark of the pipe * gets the current color mark of the pipe
*/ */
public Colors getColor() public PipeColor getColor()
{ {
return this.color; return this.color;
} }
@ -105,18 +105,19 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
/** /**
* sets the current color mark of the pipe * sets the current color mark of the pipe
*/ */
public void setColor(Colors cc) public void setColor(PipeColor cc)
{ {
this.color = cc; this.color = cc;
} }
/** /**
* sets the current color mark of the pipe * sets the current color mark of the pipe
*/ */
public void setColor(int i) public void setColor(int i)
{ {
if (i < Colors.values().length) if (i < PipeColor.values().length)
{ {
this.color = Colors.values()[i]; this.color = PipeColor.values()[i];
} }
} }
@ -145,7 +146,8 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
{ {
super.readFromNBT(nbt); super.readFromNBT(nbt);
UpdateConverter.convert(this, nbt); UpdateConverter.convert(this, nbt);
LiquidStack stack = LiquidStack.loadLiquidStackFromNBT(nbt); NBTTagCompound stored = nbt.getCompoundTag("stored");
LiquidStack stack = LiquidStack.loadLiquidStackFromNBT(stored);
this.stored.setLiquid(stack); this.stored.setLiquid(stack);
} }
@ -158,7 +160,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
super.writeToNBT(nbt); super.writeToNBT(nbt);
if (stored.getLiquid() != null) if (stored.getLiquid() != null)
{ {
stored.getLiquid().writeToNBT(nbt); nbt.setCompoundTag("stored", stored.getLiquid().writeToNBT(nbt));
} }
} }
@ -216,20 +218,28 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IPacke
*/ */
public void validataConnections() public void validataConnections()
{ {
this.connectedBlocks = TankHelper.getSurroundings(worldObj, xCoord, yCoord, zCoord); this.connectedBlocks = connectionHelper.getSurroundings(worldObj, xCoord, yCoord, zCoord);
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
ForgeDirection dir = ForgeDirection.getOrientation(i);
TileEntity ent = connectedBlocks[i]; TileEntity ent = connectedBlocks[i];
if (ent instanceof ITankContainer) if (ent instanceof ITankContainer)
{ {
if (ent instanceof TileEntityPipe) if (ent instanceof TileEntityPipe && color != ((TileEntityPipe) ent).getColor())
{ {
connectedBlocks[i] = null;
}
if(ent instanceof TileEntityTank && color != ((TileEntityTank)ent).getColor())
{
connectedBlocks[i] = null;
} }
} }
else if (ent instanceof IPressure) else if (ent instanceof IPressure)
{ {
if (!((IPressure) ent).canPressureToo(color.getLiquidData(), dir))
{
connectedBlocks[i] = null;
}
} }
else else
{ {

View file

@ -358,10 +358,4 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
return false; return false;
} }
@Override
public LiquidData getLiquidType()
{
return this.type;
}
} }

View file

@ -1,11 +1,14 @@
package liquidmechanics.common.tileentity; package liquidmechanics.common.tileentity;
import java.nio.channels.Pipe;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import liquidmechanics.api.IPressure; import liquidmechanics.api.IPressure;
import liquidmechanics.api.IReadOut; import liquidmechanics.api.IReadOut;
import liquidmechanics.api.helpers.TankHelper; import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.api.helpers.connectionHelper;
import liquidmechanics.common.block.BlockReleaseValve; import liquidmechanics.common.block.BlockReleaseValve;
import liquidmechanics.common.handlers.LiquidData; import liquidmechanics.common.handlers.LiquidData;
import liquidmechanics.common.handlers.LiquidHandler; import liquidmechanics.common.handlers.LiquidHandler;
@ -25,8 +28,7 @@ import universalelectricity.prefab.implement.IRedstoneReceptor;
public class TileEntityReleaseValve extends TileEntity implements IPressure, IReadOut, IRedstoneReceptor, IInventory public class TileEntityReleaseValve extends TileEntity implements IPressure, IReadOut, IRedstoneReceptor, IInventory
{ {
public LiquidData type = LiquidHandler.air; public boolean[] allowed = new boolean[PipeColor.values().length];
public TileEntity[] connected = new TileEntity[6]; public TileEntity[] connected = new TileEntity[6];
private List<PipeInstance> output = new ArrayList<PipeInstance>(); private List<PipeInstance> output = new ArrayList<PipeInstance>();
@ -36,7 +38,6 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
public boolean isPowered = false; public boolean isPowered = false;
public boolean converted = false; public boolean converted = false;
public boolean isRestricted = false;
private ItemStack[] inventory = new ItemStack[0]; private ItemStack[] inventory = new ItemStack[0];
@ -48,10 +49,80 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
if (!this.worldObj.isRemote && ticks++ == 10) if (!this.worldObj.isRemote && ticks++ == 10)
{ {
BlockReleaseValve.checkForPower(worldObj, xCoord, yCoord, zCoord); BlockReleaseValve.checkForPower(worldObj, xCoord, yCoord, zCoord);
validateNBuildList(); validateNBuildList();
//start the draining process
if (this.input.size() > 0 && this.output.size() > 0)
{
Iterator itr = input.iterator();
// testing out Iterators :p
while (itr.hasNext())
{
Object element = itr.next();
if (element instanceof ILiquidTank)
{
ILiquidTank tank = (ILiquidTank) element;
if (tank.getLiquid() != null && tank.getLiquid().amount < tank.getCapacity())
{
TileEntityPipe pipe = this.findValidPipe(tank.getLiquid());
if (pipe != null)
{
int drain = pipe.stored.fill(tank.getLiquid(), true);
tank.drain(drain, true);
break;
} }
} }
}
}
}
}
}
/**
* used to find a valid pipe for filling of the liquid type
*/
public TileEntityPipe findValidPipe(LiquidStack stack)
{
LiquidData data = LiquidHandler.get(stack);
if (data != LiquidHandler.air)
{
for (PipeInstance pipe : output)
{
if (pipe.color == data.getColor() && (pipe.pipe.stored.getLiquid() == null || pipe.pipe.stored.getLiquid().amount < pipe.pipe.stored.getCapacity())) { return pipe.pipe; }
}
}
return null;
}
/**
* sees if it can connect to a pipe of some color
*/
public boolean canConnect(PipeColor cc)
{
for (int i = 0; i < this.allowed.length; i++)
{
if (allowed[i] && i == cc.ordinal()) { return true; }
}
return false;
}
/**
* if any of allowed list is true
*
* @return true
*/
public boolean isRestricted()
{
for (int i = 0; i < this.allowed.length; i++)
{
if (allowed[i]) { return true; }
}
return false;
}
public boolean canAcceptLiquid(LiquidStack stack)
{
return canConnect(PipeColor.get(LiquidHandler.get(stack)));
}
/** /**
* Collects info about the surrounding 6 tiles and orders them into * Collects info about the surrounding 6 tiles and orders them into
@ -60,7 +131,7 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
public void validateNBuildList() public void validateNBuildList()
{ {
// cleanup // cleanup
this.connected = TankHelper.getSurroundings(worldObj, xCoord, yCoord, zCoord); this.connected = connectionHelper.getSurroundings(worldObj, xCoord, yCoord, zCoord);
this.input.clear(); this.input.clear();
this.output.clear(); this.output.clear();
// read surroundings // read surroundings
@ -71,7 +142,7 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
if (ent instanceof TileEntityPipe) if (ent instanceof TileEntityPipe)
{ {
TileEntityPipe pipe = (TileEntityPipe) ent; TileEntityPipe pipe = (TileEntityPipe) ent;
if (this.isRestricted && pipe.type != this.type) if (this.isRestricted() && this.canConnect(pipe.getColor()))
{ {
connected[i] = null; connected[i] = null;
} }
@ -81,7 +152,7 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
} }
else else
{ {
this.output.add(new PipeInstance(LiquidHandler.getMeta(pipe.type), pipe, pipe.isUniversal)); this.output.add(new PipeInstance(pipe.getColor(), pipe));
} }
} }
else if (ent instanceof ITankContainer) else if (ent instanceof ITankContainer)
@ -93,9 +164,9 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
if (ll != null && ll.amount > 0 && ll.amount < tanks[t].getCapacity()) if (ll != null && ll.amount > 0 && ll.amount < tanks[t].getCapacity())
{ {
// if restricted check for type match // if restricted check for type match
if (this.isRestricted) if (this.isRestricted())
{ {
if (LiquidHandler.isEqual(ll, this.type)) if (this.canAcceptLiquid(ll))
{ {
this.input.add(tanks[t]); this.input.add(tanks[t]);
} }
@ -114,45 +185,34 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
} }
} }
/**
* removes liquid from a tank and fills it to a pipe
*
* @param pipe
* - pipe being filled
* @param drainee
* - LiquidTank being drained
*/
public void drainTo(TileEntityPipe pipe, LiquidTank drainee)
{
}
@Override @Override
public int presureOutput(LiquidData type, ForgeDirection dir) public int presureOutput(LiquidData type, ForgeDirection dir)
{ {
if (type == this.type) { return LiquidData.getPressure(type); } if (type == null) return 0;
if (this.canConnect(type.getColor())) { return type.getPressure(); }
return 0; return 0;
} }
@Override @Override
public boolean canPressureToo(LiquidData type, ForgeDirection dir) public boolean canPressureToo(LiquidData type, ForgeDirection dir)
{ {
if (type == this.type) if (type == null) return false;
return true; if (this.canConnect(type.getColor())) return true;
return false; return false;
} }
@Override @Override
public String getMeterReading(EntityPlayer user, ForgeDirection side) public String getMeterReading(EntityPlayer user, ForgeDirection side)
{ {
if (type == null) return "Error: No Type"; // TODO maybe debug on # of connected units of input/output
String output = ""; String output = "";
if (this.isRestricted) if (this.isRestricted())
{ {
output +="Outputting: "+ LiquidData.getName(type)+" ||"; output += "Output: Restricted and";
}else }
else
{ {
output += " Outputting: All ||"; output += " Output: UnRestricted and";
} }
if (!this.isPowered) if (!this.isPowered)
{ {
@ -169,8 +229,10 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
public void readFromNBT(NBTTagCompound nbt) public void readFromNBT(NBTTagCompound nbt)
{ {
super.readFromNBT(nbt); super.readFromNBT(nbt);
this.type = LiquidHandler.get(nbt.getString("name")); for (int i = 0; i < this.allowed.length; i++)
this.isRestricted = nbt.getBoolean("restricted"); {
allowed[i] = nbt.getBoolean("allowed" + i);
}
} }
/** /**
@ -180,14 +242,10 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
public void writeToNBT(NBTTagCompound nbt) public void writeToNBT(NBTTagCompound nbt)
{ {
super.writeToNBT(nbt); super.writeToNBT(nbt);
nbt.setBoolean("restricted", this.isRestricted); for (int i = 0; i < this.allowed.length; i++)
nbt.setString("name", LiquidData.getName(type));
}
public void setType(LiquidData dm)
{ {
this.type = dm; nbt.setBoolean("allowed" + i, allowed[i]);
}
} }
@Override @Override
@ -315,10 +373,4 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
} }
@Override
public LiquidData getLiquidType()
{
return this.type;
}
} }

View file

@ -1,11 +1,15 @@
package liquidmechanics.common.tileentity; package liquidmechanics.common.tileentity;
import javax.swing.colorchooser.ColorSelectionModel;
import liquidmechanics.api.IReadOut; import liquidmechanics.api.IReadOut;
import liquidmechanics.api.IPressure; import liquidmechanics.api.IPressure;
import liquidmechanics.api.helpers.TankHelper; import liquidmechanics.api.helpers.PipeColor;
import liquidmechanics.api.helpers.connectionHelper;
import liquidmechanics.common.LiquidMechanics; import liquidmechanics.common.LiquidMechanics;
import liquidmechanics.common.handlers.LiquidData; import liquidmechanics.common.handlers.LiquidData;
import liquidmechanics.common.handlers.LiquidHandler; import liquidmechanics.common.handlers.LiquidHandler;
import liquidmechanics.common.handlers.UpdateConverter;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager; import net.minecraft.network.INetworkManager;
@ -24,37 +28,50 @@ import universalelectricity.prefab.network.PacketManager;
import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataInput;
public class TileEntityTank extends TileEntity implements IPacketReceiver, IReadOut, IPressure,ITankContainer public class TileEntityTank extends TileEntity implements IPacketReceiver, IReadOut, IPressure, ITankContainer
{ {
public TileEntity[] cc = { null, null, null, null, null, null }; public TileEntity[] cc = { null, null, null, null, null, null };
public LiquidData type = LiquidHandler.air; public LiquidData type = LiquidHandler.air;
private PipeColor color = PipeColor.NONE;
public static final int LMax = 4; public static final int LMax = 4;
private int count = 0; private int count, count2 = 0;
private int count2 = 0;
public boolean converted = false; public int volume;
public int pVolume = 0;
private boolean doUpdate = true; private boolean doUpdate = true;
public LiquidTank tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * LMax); public LiquidTank tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * LMax);
public void updateEntity() public void updateEntity()
{ {
if (tank.getLiquid() == null) if (tank.getLiquid() == null && type != LiquidHandler.air)
{ {
tank.setLiquid(LiquidHandler.getStack(this.type, 1)); tank.setLiquid(LiquidHandler.getStack(this.type, 1));
} }
LiquidStack liquid = tank.getLiquid(); LiquidStack liquid = tank.getLiquid();
if (++count >= 20 && liquid != null) if (++count >= 20 && liquid != null)
{ {
count = 0; count = 0;
this.cc = TankHelper.getSurroundings(worldObj, xCoord, yCoord, zCoord); this.cc = connectionHelper.getSurroundings(worldObj, xCoord, yCoord, zCoord);
if (!worldObj.isRemote) if (!worldObj.isRemote)
{ {
this.type = color.getLiquidData();
this.tradeDown(); this.tradeDown();
this.tradeArround(); this.tradeArround();
volume = liquid.amount;
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, new Object[] { LiquidData.getName(type), liquid.amount }); if (volume != pVolume)
{
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, new Object[] { volume });
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 20); PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 20);
}
pVolume = volume;
} }
} }
@ -63,47 +80,28 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
@Override @Override
public String getMeterReading(EntityPlayer user, ForgeDirection side) public String getMeterReading(EntityPlayer user, ForgeDirection side)
{ {
if (type == null) return "Error: No Type"; if (volume == 0) { return "empty"; }
String output = ""; return (volume / LiquidContainerRegistry.BUCKET_VOLUME) + "/" + (tank.getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME) + " " + type.getName();
LiquidStack stack = tank.getLiquid();
if (stack != null)
output += (stack.amount / LiquidContainerRegistry.BUCKET_VOLUME) + " " + LiquidData.getName(type);
if (stack != null)
return output;
return "0/4 " + LiquidData.getName(type);
} }
@Override @Override
public void readFromNBT(NBTTagCompound nbt) public void readFromNBT(NBTTagCompound nbt)
{ {
super.readFromNBT(nbt); super.readFromNBT(nbt);
this.converted = nbt.getBoolean("converted"); UpdateConverter.convert(this, nbt);
if (!converted) NBTTagCompound stored = nbt.getCompoundTag("stored");
{ LiquidStack stack = LiquidStack.loadLiquidStackFromNBT(stored);
int t = nbt.getInteger("type"); this.tank.setLiquid(stack);
this.type = LiquidHandler.getFromMeta(t);
this.converted = true;
}
else
{
this.type = LiquidHandler.get(nbt.getString("name"));
}
if (this.type == null) type = LiquidHandler.air;
int vol = nbt.getInteger("liquid");
this.tank.setLiquid(LiquidHandler.getStack(type, vol));
} }
@Override @Override
public void writeToNBT(NBTTagCompound nbt) public void writeToNBT(NBTTagCompound nbt)
{ {
super.writeToNBT(nbt); super.writeToNBT(nbt);
nbt.setBoolean("converted", this.converted); if (tank.getLiquid() != null)
int s = 0; {
if (tank.getLiquid() != null) s = tank.getLiquid().amount; nbt.setCompoundTag("stored", tank.getLiquid().writeToNBT(nbt));
nbt.setInteger("liquid", s); }
nbt.setString("name", LiquidData.getName(type));
} }
@Override @Override
@ -111,8 +109,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
{ {
try try
{ {
this.type = LiquidHandler.get(data.readUTF()); this.volume = data.readInt();
this.tank.setLiquid(LiquidHandler.getStack(this.type, data.readInt()));
} }
catch (Exception e) catch (Exception e)
{ {
@ -152,7 +149,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
if (this.isFull()) if (this.isFull())
{ {
int change = 1; int change = 1;
if (LiquidData.getCanFloat(LiquidHandler.get(resource))) if (LiquidHandler.get(resource).getCanFloat())
change = -1; change = -1;
TileEntity tank = worldObj.getBlockTileEntity(xCoord, yCoord + change, zCoord); 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).tank.fill(resource, doFill); }
@ -249,10 +246,10 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
{ {
if (type == this.type) if (type == this.type)
{ {
if (LiquidData.getCanFloat(type) && dir == ForgeDirection.DOWN) if (type.getCanFloat() && dir == ForgeDirection.DOWN)
return LiquidData.getPressure(type); return type.getPressure();
if (!LiquidData.getCanFloat(type) && dir == ForgeDirection.UP) if (!type.getCanFloat() && dir == ForgeDirection.UP)
return LiquidData.getPressure(type); return type.getPressure();
} }
return 0; return 0;
} }
@ -262,9 +259,9 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
{ {
if (type == this.type) if (type == this.type)
{ {
if (LiquidData.getCanFloat(type) && dir == ForgeDirection.DOWN) if (type.getCanFloat() && dir == ForgeDirection.DOWN)
return true; return true;
if (!LiquidData.getCanFloat(type) && dir == ForgeDirection.UP) if (!type.getCanFloat() && dir == ForgeDirection.UP)
return true; return true;
} }
return false; return false;
@ -293,12 +290,12 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
{ {
if (this.tank.getLiquid() == null || this.tank.getLiquid().amount <= 0) if (this.tank.getLiquid() == null || this.tank.getLiquid().amount <= 0)
return; return;
TileEntity[] ents = TankHelper.getSurroundings(worldObj, xCoord, yCoord, zCoord); TileEntity[] ents = connectionHelper.getSurroundings(worldObj, xCoord, yCoord, zCoord);
int commonVol = this.tank.getLiquid().amount; int commonVol = this.tank.getLiquid().amount;
int tanks = 1; int tanks = 1;
for (int i = 2; i < 6; i++) for (int i = 2; i < 6; i++)
{ {
if (ents[i] instanceof TileEntityTank && ((TileEntityTank) ents[i]).type == this.type) if (ents[i] instanceof TileEntityTank && ((TileEntityTank) ents[i]).color == this.color)
{ {
tanks++; tanks++;
if (((TileEntityTank) ents[i]).tank.getLiquid() != null) if (((TileEntityTank) ents[i]).tank.getLiquid() != null)
@ -313,7 +310,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
if (this.tank.getLiquid() == null || this.tank.getLiquid().amount <= equalVol) if (this.tank.getLiquid() == null || this.tank.getLiquid().amount <= equalVol)
break; break;
if (ents[i] instanceof TileEntityTank && ((TileEntityTank) ents[i]).type == this.type && !((TileEntityTank) ents[i]).isFull()) if (ents[i] instanceof TileEntityTank && ((TileEntityTank) ents[i]).color == this.color && !((TileEntityTank) ents[i]).isFull())
{ {
LiquidStack stack = ((TileEntityTank) ents[i]).tank.getLiquid(); LiquidStack stack = ((TileEntityTank) ents[i]).tank.getLiquid();
LiquidStack filling = this.tank.getLiquid(); LiquidStack filling = this.tank.getLiquid();
@ -336,9 +333,14 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
} }
} }
@Override public void setColor(PipeColor pipeColor)
public LiquidData getLiquidType()
{ {
return this.type; this.color = pipeColor;
}
public PipeColor getColor()
{
return color;
} }
} }

View file

@ -7,7 +7,8 @@ tile.lmMachines.0.name=Pump
tile.lmMachines.4.name=Condensor tile.lmMachines.4.name=Condensor
tile.MechanicRod.name=Geared Rod tile.MechanicRod.name=Geared Rod
tile.eValve.name=Release Valve tile.eValve.name=Release Valve
tile.lmTank.name = Tank
tile.lmPipe.name = Pipe
# Items # Items
item.lmTool.0.name=Pipe Guage item.lmTool.0.name=Pipe Guage
@ -24,7 +25,3 @@ item.itemPipe.0.name=Steam Pipe
item.itemPipe.1.name=Water Pipe item.itemPipe.1.name=Water Pipe
item.itemPipe.2.name=Lava Pipe item.itemPipe.2.name=Lava Pipe
item.itemTank.0.name=Steam Tank
item.itemTank.1.name=Water Tank
item.itemTank.2.name=Lava Tank

View file

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 426 B

View file

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B