Changed the pump

*Set a new model for the water pump
*removed other liquid types from the pump, will change this back later
*removed the pumps liquid storage ablity, it will now directly pump
water to a container behind it
*changed wire connection to two side
*changed pipe connections to one side
*fixed infinite water glitch were you could pump a flowing block
This commit is contained in:
Rseifert 2013-01-22 17:18:55 -05:00
parent eb923b84db
commit f47c3b528c
18 changed files with 373 additions and 319 deletions

View file

@ -1,4 +1,4 @@
// Date: 9/3/2012 6:12:15 PM
// Date: 1/22/2013 9:59:56 AM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
@ -12,129 +12,281 @@ import net.minecraft.entity.Entity;
public class ModelPump extends ModelBase
{
// fields
ModelRenderer Main;
ModelRenderer sidePort;
ModelRenderer FrontPort;
ModelRenderer pivit;
ModelRenderer crank;
ModelRenderer Rope;
ModelRenderer pivit2;
ModelRenderer Piston;
ModelRenderer pPlate;
ModelRenderer Rope2;
ModelRenderer BackPort;
// fields
ModelRenderer Body;
ModelRenderer pipecc1;
ModelRenderer pipecc3;
ModelRenderer wheelcenter;
ModelRenderer wheelcenter2;
ModelRenderer joint;
ModelRenderer wheelcc0;
ModelRenderer wheelcc1;
ModelRenderer wheelcc2;
ModelRenderer wheelcc3;
ModelRenderer wheelcc4;
ModelRenderer wheelcc5;
ModelRenderer wheelcc6;
ModelRenderer wheelcc7;
ModelRenderer wheelBrace;
ModelRenderer piston_top;
ModelRenderer piston;
ModelRenderer wheelBrace2;
ModelRenderer joint2;
ModelRenderer w2;
ModelRenderer w22;
ModelRenderer w2cc;
ModelRenderer w2cc1;
ModelRenderer w2cc2;
ModelRenderer w2cc3;
ModelRenderer w2cc4;
ModelRenderer w2cc5;
ModelRenderer w2cc6;
ModelRenderer w2cc7;
ModelRenderer side7;
ModelRenderer side8;
public ModelPump()
{
textureWidth = 128;
textureHeight = 128;
public ModelPump()
{
textureWidth = 128;
textureHeight = 128;
Main = new ModelRenderer(this, 0, 0);
Main.addBox(-5F, 0F, -5F, 10, 13, 10);
Main.setRotationPoint(1F, 11F, 0F);
Main.setTextureSize(128, 128);
Main.mirror = true;
setRotation(Main, 0F, 0F, 0F);
sidePort = new ModelRenderer(this, 0, 76);
sidePort.addBox(-6F, -3F, -3F, 6, 6, 6);
sidePort.setRotationPoint(8F, 16F, 0F);
sidePort.setTextureSize(128, 128);
sidePort.mirror = true;
setRotation(sidePort, 0F, 0F, 0F);
FrontPort = new ModelRenderer(this, 0, 63);
FrontPort.addBox(-3F, -3F, 0F, 6, 6, 6);
FrontPort.setRotationPoint(0F, 16F, -8F);
FrontPort.setTextureSize(128, 128);
FrontPort.mirror = true;
setRotation(FrontPort, 0F, 0F, 0F);
pivit = new ModelRenderer(this, 0, 40);
pivit.addBox(-1F, 0F, -1F, 2, 3, 1);
pivit.setRotationPoint(0F, 8F, 1F);
pivit.setTextureSize(128, 128);
pivit.mirror = true;
setRotation(pivit, 0F, 0F, 0F);
crank = new ModelRenderer(this, 48, 0);
crank.addBox(-8F, 0F, -1F, 14, 2, 1);
crank.setRotationPoint(0F, 7F, 0F);
crank.setTextureSize(128, 128);
crank.mirror = true;
setRotation(crank, 0F, 0F, 0F);
Rope = new ModelRenderer(this, 0, 28);
Rope.addBox(0F, 0F, 0F, 1, 7, 1);
Rope.setRotationPoint(4F, 8F, -1F);
Rope.setTextureSize(128, 128);
Rope.mirror = true;
setRotation(Rope, 0F, 0F, 0F);
pivit2 = new ModelRenderer(this, 0, 40);
pivit2.addBox(-1F, 0F, -1F, 2, 3, 1);
pivit2.setRotationPoint(0F, 8F, -1F);
pivit2.setTextureSize(128, 128);
pivit2.mirror = true;
setRotation(pivit2, 0F, 0F, 0F);
pPlate = new ModelRenderer(this, 34, 30);
pPlate.addBox(0F, 0F, 0F, 1, 12, 1);
pPlate.setRotationPoint(-5F, 12F, -1F);
pPlate.setTextureSize(128, 128);
pPlate.mirror = true;
setRotation(pPlate, 0F, 0F, 0F);
Piston = new ModelRenderer(this, 20, 30);
Piston.addBox(0F, 0F, 0F, 3, 12, 3);
Piston.setRotationPoint(-8F, 12F, -2F);
Piston.setTextureSize(128, 128);
Piston.mirror = true;
setRotation(Piston, 0F, 0F, 0F);
Rope2 = new ModelRenderer(this, 0, 28);
Rope2.addBox(0F, 0F, 0F, 1, 7, 1);
Rope2.setRotationPoint(-7F, 8F, -1F);
Rope2.setTextureSize(128, 128);
Rope2.mirror = true;
setRotation(Rope2, 0F, 0F, 0F);
BackPort = new ModelRenderer(this, 0, 50);
BackPort.addBox(-3F, -3F, -6F, 6, 6, 6);
BackPort.setRotationPoint(0F, 16F, 8F);
BackPort.setTextureSize(128, 128);
BackPort.mirror = true;
setRotation(BackPort, 0F, 0F, 0F);
}
Body = new ModelRenderer(this, 0, 109);
Body.addBox(-3F, 0F, -3F, 6, 12, 6);
Body.setRotationPoint(0F, 12F, 0F);
Body.setTextureSize(128, 128);
Body.mirror = true;
setRotation(Body, 0F, 0F, 0F);
pipecc1 = new ModelRenderer(this, 21, 92);
pipecc1.addBox(-3.5F, -3.5F, 3F, 7, 7, 5);
pipecc1.setRotationPoint(0F, 16F, 0F);
pipecc1.setTextureSize(128, 128);
pipecc1.mirror = true;
setRotation(pipecc1, 0F, 1.570796F, 0F);
pipecc3 = new ModelRenderer(this, 8, 50);
pipecc3.addBox(-3.5F, -4F, 3F, 7, 5, 5);
pipecc3.setRotationPoint(0F, 16F, 0F);
pipecc3.setTextureSize(128, 128);
pipecc3.mirror = true;
setRotation(pipecc3, 0F, 3.141593F, 0F);
wheelcenter = new ModelRenderer(this, 0, 25);
wheelcenter.addBox(0F, -2.5F, -2.5F, 1, 5, 5);
wheelcenter.setRotationPoint(-5F, 18F, 0F);
wheelcenter.setTextureSize(128, 128);
wheelcenter.mirror = true;
setRotation(wheelcenter, 0F, 0F, 0F);
wheelcenter2 = new ModelRenderer(this, 0, 25);
wheelcenter2.addBox(0F, -2.5F, -2.5F, 1, 5, 5);
wheelcenter2.setRotationPoint(-5F, 18F, 0F);
wheelcenter2.setTextureSize(128, 128);
wheelcenter2.mirror = true;
setRotation(wheelcenter2, 0.7853982F, 0F, 0F);
joint = new ModelRenderer(this, 0, 18);
joint.addBox(0F, -1.5F, -1.5F, 1, 3, 3);
joint.setRotationPoint(-4F, 18F, 0F);
joint.setTextureSize(128, 128);
joint.mirror = true;
setRotation(joint, 0F, 0F, 0F);
wheelcc0 = new ModelRenderer(this, 0, 0);
wheelcc0.addBox(0F, -4.5F, -2F, 1, 1, 4);
wheelcc0.setRotationPoint(-5F, 18F, 0F);
wheelcc0.setTextureSize(128, 128);
wheelcc0.mirror = true;
setRotation(wheelcc0, 1.570796F, 0F, 0F);
wheelcc1 = new ModelRenderer(this, 0, 0);
wheelcc1.addBox(0F, -4.5F, -2F, 1, 1, 4);
wheelcc1.setRotationPoint(-5F, 18F, 0F);
wheelcc1.setTextureSize(128, 128);
wheelcc1.mirror = true;
setRotation(wheelcc1, 0F, 0F, 0F);
wheelcc2 = new ModelRenderer(this, 0, 0);
wheelcc2.addBox(0F, -4.5F, -2F, 1, 1, 4);
wheelcc2.setRotationPoint(-5F, 18F, 0F);
wheelcc2.setTextureSize(128, 128);
wheelcc2.mirror = true;
setRotation(wheelcc2, -1.570796F, 0F, 0F);
wheelcc3 = new ModelRenderer(this, 0, 0);
wheelcc3.addBox(0F, -4.5F, -2F, 1, 1, 4);
wheelcc3.setRotationPoint(-5F, 18F, 0F);
wheelcc3.setTextureSize(128, 128);
wheelcc3.mirror = true;
setRotation(wheelcc3, 3.141593F, 0F, 0F);
wheelcc4 = new ModelRenderer(this, 0, 0);
wheelcc4.addBox(0F, -4.5F, -2F, 1, 1, 4);
wheelcc4.setRotationPoint(-5F, 18F, 0F);
wheelcc4.setTextureSize(128, 128);
wheelcc4.mirror = true;
setRotation(wheelcc4, 0.7853982F, 0F, 0F);
wheelcc5 = new ModelRenderer(this, 0, 0);
wheelcc5.addBox(0F, -4.5F, -2F, 1, 1, 4);
wheelcc5.setRotationPoint(-5F, 18F, 0F);
wheelcc5.setTextureSize(128, 128);
wheelcc5.mirror = true;
setRotation(wheelcc5, -2.356194F, 0F, 0F);
wheelcc6 = new ModelRenderer(this, 0, 0);
wheelcc6.addBox(0F, -4.5F, -2F, 1, 1, 4);
wheelcc6.setRotationPoint(-5F, 18F, 0F);
wheelcc6.setTextureSize(128, 128);
wheelcc6.mirror = true;
setRotation(wheelcc6, -0.7853982F, 0F, 0F);
wheelcc7 = new ModelRenderer(this, 0, 0);
wheelcc7.addBox(0F, -4.5F, -2F, 1, 1, 4);
wheelcc7.setRotationPoint(-5F, 18F, 0F);
wheelcc7.setTextureSize(128, 128);
wheelcc7.mirror = true;
setRotation(wheelcc7, 2.356194F, 0F, 0F);
wheelBrace = new ModelRenderer(this, 27, 5);
wheelBrace.addBox(0F, -1.5F, -1.5F, 1, 8, 3);
wheelBrace.setRotationPoint(-6F, 18F, 0F);
wheelBrace.setTextureSize(128, 128);
wheelBrace.mirror = true;
setRotation(wheelBrace, 0F, 0F, 0F);
piston_top = new ModelRenderer(this, 0, 81);
piston_top.addBox(-3F, 0F, -3F, 6, 1, 6);
piston_top.setRotationPoint(0F, 10F, 0F);
piston_top.setTextureSize(128, 128);
piston_top.mirror = true;
setRotation(piston_top, 0F, 0F, 0F);
piston = new ModelRenderer(this, 0, 90);
piston.addBox(-2.5F, 0F, -2.5F, 5, 12, 5);
piston.setRotationPoint(0F, 11F, 0F);
piston.setTextureSize(128, 128);
piston.mirror = true;
setRotation(piston, 0F, 0F, 0F);
wheelBrace2 = new ModelRenderer(this, 26, 18);
wheelBrace2.addBox(0F, 0F, -1.5F, 2, 1, 3);
wheelBrace2.setRotationPoint(-5F, 23F, 0F);
wheelBrace2.setTextureSize(128, 128);
wheelBrace2.mirror = true;
setRotation(wheelBrace2, 0F, 0F, 0F);
joint2 = new ModelRenderer(this, 0, 14);
joint2.addBox(0F, -0.5F, -0.5F, 1, 1, 1);
joint2.setRotationPoint(-4F, 14F, -6F);
joint2.setTextureSize(128, 128);
joint2.mirror = true;
setRotation(joint2, 0F, 0F, 0F);
w2 = new ModelRenderer(this, 0, 55);
w2.addBox(0F, -1F, -1F, 1, 2, 2);
w2.setRotationPoint(-5F, 14F, -6F);
w2.setTextureSize(128, 128);
w2.mirror = true;
setRotation(w2, 0.7853982F, 0F, 0F);
w22 = new ModelRenderer(this, 0, 55);
w22.addBox(0F, -1F, -1F, 1, 2, 2);
w22.setRotationPoint(-5F, 14F, -6F);
w22.setTextureSize(128, 128);
w22.mirror = true;
setRotation(w22, 0F, 0F, 0F);
w2cc = new ModelRenderer(this, 0, 50);
w2cc.addBox(0F, 1.3F, -1F, 1, 1, 2);
w2cc.setRotationPoint(-5F, 14F, -6F);
w2cc.setTextureSize(128, 128);
w2cc.mirror = true;
setRotation(w2cc, 1.570796F, 0F, 0F);
w2cc1 = new ModelRenderer(this, 0, 50);
w2cc1.addBox(0F, 1.3F, -1F, 1, 1, 2);
w2cc1.setRotationPoint(-5F, 14F, -6F);
w2cc1.setTextureSize(128, 128);
w2cc1.mirror = true;
setRotation(w2cc1, 0.7853982F, 0F, 0F);
w2cc2 = new ModelRenderer(this, 0, 50);
w2cc2.addBox(0F, 1.3F, -1F, 1, 1, 2);
w2cc2.setRotationPoint(-5F, 14F, -6F);
w2cc2.setTextureSize(128, 128);
w2cc2.mirror = true;
setRotation(w2cc2, 0F, 0F, 0F);
w2cc3 = new ModelRenderer(this, 0, 50);
w2cc3.addBox(0F, 1.3F, -1F, 1, 1, 2);
w2cc3.setRotationPoint(-5F, 14F, -6F);
w2cc3.setTextureSize(128, 128);
w2cc3.mirror = true;
setRotation(w2cc3, -0.7853982F, 0F, 0F);
w2cc4 = new ModelRenderer(this, 0, 50);
w2cc4.addBox(0F, 1.3F, -1F, 1, 1, 2);
w2cc4.setRotationPoint(-5F, 14F, -6F);
w2cc4.setTextureSize(128, 128);
w2cc4.mirror = true;
setRotation(w2cc4, -1.570796F, 0F, 0F);
w2cc5 = new ModelRenderer(this, 0, 50);
w2cc5.addBox(0F, 1.3F, -1F, 1, 1, 2);
w2cc5.setRotationPoint(-5F, 14F, -6F);
w2cc5.setTextureSize(128, 128);
w2cc5.mirror = true;
setRotation(w2cc5, -2.356194F, 0F, 0F);
w2cc6 = new ModelRenderer(this, 0, 50);
w2cc6.addBox(0F, 1.3F, -1F, 1, 1, 2);
w2cc6.setRotationPoint(-5F, 14F, -6F);
w2cc6.setTextureSize(128, 128);
w2cc6.mirror = true;
setRotation(w2cc6, 3.141593F, 0F, 0F);
w2cc7 = new ModelRenderer(this, 0, 50);
w2cc7.addBox(0F, 1.3F, -1F, 1, 1, 2);
w2cc7.setRotationPoint(-5F, 14F, -6F);
w2cc7.setTextureSize(128, 128);
w2cc7.mirror = true;
setRotation(w2cc7, -3.926991F, 0F, 0F);
side7 = new ModelRenderer(this, 0, 65);
side7.addBox(-2.5F, -4F, 3F, 5, 7, 4);
side7.setRotationPoint(0F, 21F, 0F);
side7.setTextureSize(128, 128);
side7.mirror = true;
setRotation(side7, 0F, 3.141593F, 0F);
side8 = new ModelRenderer(this, 25, 111);
side8.addBox(-2.5F, 0F, 3F, 5, 11, 3);
side8.setRotationPoint(0F, 13F, 0F);
side8.setTextureSize(128, 128);
side8.mirror = true;
setRotation(side8, 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);
}
public void render(float f5)
{
Body.render(f5);
pipecc1.render(f5);
pipecc3.render(f5);
public void renderMain(float f5)
{
Main.render(f5);
pivit.render(f5);
crank.render(f5);
Rope.render(f5);
pivit2.render(f5);
Piston.render(f5);
pPlate.render(f5);
Rope2.render(f5);
}
joint.render(f5);
public void renderC1(float f5)
{
sidePort.render(f5);
}
wheelBrace.render(f5);
piston_top.render(f5);
piston.render(f5);
wheelBrace2.render(f5);
joint2.render(f5);
public void renderC2(float f5)
{
FrontPort.render(f5);
}
side7.render(f5);
side8.render(f5);
}
public void renderC3(float f5)
{
BackPort.render(f5);
}
public void renderMotion(float f5, int i)
{
//wheel 1
wheelcenter.render(f5);
wheelcenter2.render(f5);
wheelcc0.render(f5);
wheelcc1.render(f5);
wheelcc2.render(f5);
wheelcc3.render(f5);
wheelcc4.render(f5);
wheelcc5.render(f5);
wheelcc6.render(f5);
wheelcc7.render(f5);
// wheel 2
w2.render(f5);
w22.render(f5);
w2cc.render(f5);
w2cc1.render(f5);
w2cc2.render(f5);
w2cc3.render(f5);
w2cc4.render(f5);
w2cc5.render(f5);
w2cc6.render(f5);
w2cc7.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -41,11 +41,9 @@ public class BlockRenderHelper implements ISimpleBlockRenderingHandler
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(LiquidMechanics.RESOURCE_PATH + "pumps/Pump.png"));
modelPump.renderMain(0.0725F);
modelPump.renderC1(0.0725F);
modelPump.renderC2(0.0725F);
modelPump.renderC3(0.0725F);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(LiquidMechanics.RESOURCE_PATH + "pumps/WaterPump.png"));
modelPump.render(0.0725F);
modelPump.renderMotion(0.0725F,0);
GL11.glPopMatrix();
}
if (block.blockID == LiquidMechanics.blockSink.blockID)

View file

@ -19,7 +19,6 @@ import cpw.mods.fml.client.FMLClientHandler;
/** special tanks to Mekanism github */
public class ItemRenderHelper implements IItemRenderer
{
private ModelPump modelPump = new ModelPump();
private ModelGearRod modelRod = new ModelGearRod();
private ModelGenerator modelGen = new ModelGenerator();
private ModelLargePipe SixPipe = new ModelLargePipe();

View file

@ -23,44 +23,28 @@ public class RenderPump extends TileEntitySpecialRenderer
public void renderAModelAt(TileEntityPump te, double d, double d1, double d2, float f)
{
int meta = te.worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
switch (te.color.ordinal())
{
case 4:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/WaterPump.png");
break;// water
case 1:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/LavaPump.png");
break;// lava
case 0:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/OilPump.png");
break;
default:
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/Pump.png");
break;
}
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/WaterPump.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
switch (meta)
{
case 1:
case 2:
GL11.glRotatef(0f, 0f, 1f, 0f);
break;
case 2:
case 3:
GL11.glRotatef(90f, 0f, 1f, 0f);
break;
case 3:
case 0:
GL11.glRotatef(180f, 0f, 1f, 0f);
break;
case 0:
case 1:
GL11.glRotatef(270f, 0f, 1f, 0f);
break;
}
model.renderMain(0.0625F);
model.renderC1(0.0625F);
model.renderC2(0.0625F);
model.renderC3(0.0625F);
model.render(0.0625F);
model.renderMotion(0.0625F, te.pos);
GL11.glPopMatrix();
}

View file

@ -153,7 +153,7 @@ public class LiquidMechanics extends DummyModContainer
GameRegistry.registerTileEntity(TileEntityReleaseValve.class, "lmeValve");
GameRegistry.registerTileEntity(TileEntityTank.class, "lmTank");
GameRegistry.registerTileEntity(TileEntityGenerator.class, "lmGen");
GameRegistry.registerTileEntity(TileEntitySink.class,"lmSink");
GameRegistry.registerTileEntity(TileEntitySink.class, "lmSink");
System.out.println("Fluid Mechanics Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages.");
}
@ -288,6 +288,12 @@ public class LiquidMechanics extends DummyModContainer
'P', new ItemStack(blockPipe, 1, 15),
'V', new ItemStack(itemParts, 1, Parts.Valve.ordinal()),
'R', Item.redstone });
// sink
GameRegistry.addRecipe(new ItemStack(blockSink, 1), new Object[] {
"I I", "SIS", "SPS",
'P', new ItemStack(blockPipe, 1, 15),
'I', Item.ingotIron,
'S', Block.stone });
// reg ore directory for parts
OreDictionary.registerOre("bronzeTube", new ItemStack(itemParts, 1, Parts.Bronze.ordinal()));

View file

@ -34,14 +34,16 @@ public class BlockPumpMachine extends BlockMachine
this.setHardness(1f);
this.setResistance(5f);
}
public void onBlockAdded(World world, int x, int y, int z)
public void onBlockAdded(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if(MetaGroup.getGrouping(meta) == 1)
if (MetaGroup.getGrouping(meta) == 1)
{
world.setBlockAndMetadata(x, y, z, LiquidMechanics.blockTank.blockID, 15);
}
}
@Override
public boolean isOpaqueCube()
{
@ -77,15 +79,15 @@ public class BlockPumpMachine extends BlockMachine
{
new ItemStack(LiquidMechanics.blockMachine, 1, 0);
}
return null;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving)
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving p)
{
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((p.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
TileEntity ent = world.getBlockTileEntity(x, y, z);
world.setBlockMetadata(x, y, z, angle + MetaGroup.getGroupStartMeta(MetaGroup.getGrouping(meta)));
@ -95,6 +97,10 @@ public class BlockPumpMachine extends BlockMachine
}
world.notifyBlocksOfNeighborChange(x, y, z, this.blockID);
if (p instanceof EntityPlayer)
{
((EntityPlayer) p).sendChatToPlayer("meta:" + world.getBlockMetadata(x, y, z));
}
}
@Override
@ -117,6 +123,7 @@ public class BlockPumpMachine extends BlockMachine
}
return null;
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{

View file

@ -34,42 +34,41 @@ import universalelectricity.prefab.tile.TileEntityElectricityReceiver;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityPump extends TileEntityElectricityReceiver implements IPacketReceiver, IReadOut, IPressure, ITankContainer
public class TileEntityPump extends TileEntityElectricityReceiver implements IPacketReceiver, IReadOut, IPressure
{
public final double WATTS_PER_TICK = 400;
double percentPumped = 0.0;
double joulesReceived = 0;
int wMax = LiquidContainerRegistry.BUCKET_VOLUME * 2;
int disableTimer = 0;
int count = 0;
public int pos = 0;
private boolean converted = false;
public ColorCode color = ColorCode.NONE;
public LiquidTank tank = new LiquidTank(wMax);
public ColorCode color = ColorCode.BLUE;
ForgeDirection back = ForgeDirection.EAST;
ForgeDirection side = ForgeDirection.EAST;
ITankContainer fillTarget = null;
@Override
public void initiate()
{
this.registerWireConnections();
this.getConnections();
ElectricityConnections.registerConnector(this, EnumSet.of(back, side));
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, LiquidMechanics.blockMachine.blockID);
}
public void registerWireConnections()
public void getConnections()
{
int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite();
ForgeDirection[] dirs = new ForgeDirection[] { ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN };
ElectricityConnections.registerConnector(this, EnumSet.of(facing.getOpposite()));
for (int i = 2; i < 6; i++)
back = ForgeDirection.getOrientation(notchMeta);
side = Vector3.getOrientationFromSide(back, ForgeDirection.WEST);
if (notchMeta == 2 || notchMeta == 3)
{
ForgeDirection dir = ForgeDirection.getOrientation(i);
if (dir != facing)
{
dirs[i] = dir;
}
side = side.getOpposite();
}
ElectricityConnections.registerConnector(this, EnumSet.of(dirs[0], dirs[1], dirs[2], dirs[3], dirs[4], dirs[5]));
}
@Override
@ -92,36 +91,25 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
if (!this.worldObj.isRemote)
{
if (count-- <= 0)
{
count = 40;
int bBlock = worldObj.getBlockId(xCoord, yCoord - 1, zCoord);
LiquidData bellow = LiquidHandler.getFromBlockID(bBlock);
if (bellow != null)
{
if (this.color.getLiquidData() != bellow && bellow != LiquidHandler.unkown)
{
this.tank.setLiquid(LiquidHandler.getStack(bellow, 1));
this.color = bellow.getColor();
}
}
}
if (this.tank.getLiquid() == null)
{
this.tank.setLiquid(LiquidHandler.getStack(this.color.getLiquidData(), 1));
}
// consume/give away stored units
this.fillSurroundings();
this.chargeUp();
if (this.joulesReceived >= this.WATTS_PER_TICK - 50 && this.canPump(xCoord, yCoord - 1, zCoord))
TileEntity ent = worldObj.getBlockTileEntity(xCoord+side.offsetX,yCoord+side.offsetY,zCoord+side.offsetZ);
if(ent instanceof ITankContainer)
{
this.fillTarget = (ITankContainer) ent;
}else
{
ent = null;
}
if (this.canPump(xCoord, yCoord - 1, zCoord) && this.joulesReceived >= this.WATTS_PER_TICK)
{
joulesReceived -= this.WATTS_PER_TICK;
this.pos++;
if (pos >= 8)
{
pos = 0;
}
if (percentPumped++ >= 20)
{
this.drainBlock(new Vector3(xCoord, yCoord - 1, zCoord));
@ -133,7 +121,8 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
{
if (this.ticks % 10 == 0)
{
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, color.ordinal());
//TODO fix this to tell the client its running
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, color.ordinal(),this.joulesReceived);
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 60);
}
}
@ -158,34 +147,6 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
return 1;
}
/**
* Cause this to empty its internal tank to surrounding tanks
*/
public void fillSurroundings()
{
LiquidStack stack = tank.getLiquid();
if (stack != null && stack.amount > 1)
{
for (int i = 0; i < 6; i++)
{
ForgeDirection dir = ForgeDirection.getOrientation(i);
TileEntity tile = worldObj.getBlockTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
if (tile instanceof ITankContainer)
{
int moved = ((ITankContainer) tile).fill(dir.getOpposite(), stack, true);
tank.drain(moved, true);
if (stack.amount <= 0)
{
break;
}
}
}
}
}
/**
* causes this to request/drain energy from connected networks
*/
@ -199,7 +160,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
for (int i = 2; i < 6; i++)
{
ForgeDirection dir = ForgeDirection.getOrientation(i);
if (dir != facing)
if (dir == this.back || dir == this.side)
{
TileEntity inputTile = Vector3.getTileEntityFromSide(this.worldObj, new Vector3(this), dir);
ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(inputTile, dir);
@ -222,10 +183,21 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
public boolean canPump(int x, int y, int z)
{
// if (this.tank.getLiquid() == null) return false;
if (this.tank.getLiquid() != null && this.tank.getLiquid().amount >= this.wMax) { return false; }
int blockID = worldObj.getBlockId(x, y, z);
int meta = worldObj.getBlockMetadata(x, y, z);
LiquidData resource = LiquidHandler.getFromBlockID(blockID);
if (this.fillTarget == null || this.fillTarget.fill(side, this.color.getLiquidData().getStack(), false) == 0) { return false; }
if (this.isDisabled()) { return false; }
if ((LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == null || LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == LiquidHandler.unkown)) { return false; }
if (blockID == Block.waterMoving.blockID || blockID == Block.lavaStill.blockID) { return false; }
if (blockID == Block.waterStill.blockID || blockID == Block.waterStill.blockID)
{
}
return true;
}
@ -240,13 +212,17 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
int blockID = worldObj.getBlockId(loc.intX(), loc.intY(), loc.intZ());
int meta = worldObj.getBlockMetadata(loc.intX(), loc.intY(), loc.intZ());
LiquidData resource = LiquidHandler.getFromBlockID(blockID);
if (resource == color.getLiquidData())
if (resource == color.getLiquidData() && meta == 0 && this.fillTarget.fill(back, resource.getStack(), false) != 0)
{
worldObj.setBlockWithNotify(xCoord, yCoord - 1, zCoord, 0);
LiquidStack stack = resource.getStack();
stack.amount = LiquidContainerRegistry.BUCKET_VOLUME;
this.tank.fill(stack, true);
return true;
int f = this.fillTarget.fill(back, this.color.getLiquidData().getStack(), true);
if (f > 0)
{
worldObj.setBlockWithNotify(xCoord, yCoord - 1, zCoord, 0);
return true;
}
}
return false;
@ -257,7 +233,8 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
{
try
{
this.color = (ColorCode.get(data.readInt()));
this.color = ColorCode.get(data.readInt());
this.joulesReceived = data.readDouble();
}
catch (Exception e)
{
@ -265,76 +242,10 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
}
}
/**
* Reads a tile entity from NBT.
*/
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
LiquidStack liquid = new LiquidStack(0, 0, 0);
liquid.readFromNBT(nbt.getCompoundTag("stored"));
tank.setLiquid(liquid);
}
/**
* Writes a tile entity to NBT.
*/
@Override
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
if (tank.getLiquid() != null)
{
nbt.setTag("stored", tank.getLiquid().writeToNBT(new NBTTagCompound()));
}
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
{
LiquidStack stack = this.tank.getLiquid();
if (stack != null) { return (stack.amount / LiquidContainerRegistry.BUCKET_VOLUME) + "/" + (this.tank.getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME) + " " + LiquidHandler.get(stack).getName() + " " + this.joulesReceived + "/" + this.WATTS_PER_TICK + " " + this.percentPumped; }
return "Empty";
}
@Override
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill)
{
return 0;
}
@Override
public int fill(int tankIndex, LiquidStack resource, boolean doFill)
{
return 0;
}
@Override
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
return null;
}
@Override
public LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain)
{
return null;
}
@Override
public ILiquidTank[] getTanks(ForgeDirection direction)
{
return new ILiquidTank[] { tank };
}
@Override
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type)
{
return null;
return this.joulesReceived + "/" + this.WATTS_PER_TICK + " " + this.percentPumped;
}
@Override
@ -348,7 +259,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
@Override
public boolean canPressureToo(LiquidData type, ForgeDirection dir)
{
if (type == this.color.getLiquidData() || type == LiquidHandler.unkown) { return true; }
if (dir == this.side.getOpposite() && (type == this.color.getLiquidData() || type == LiquidHandler.unkown)) { return true; }
return false;
}

View file

@ -45,7 +45,6 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
public void updateEntity()
{
this.color = ColorCode.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
if (++count >= 40)
{
@ -56,30 +55,24 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
this.tradeDown();
this.tradeArround();
this.fillPipe();
int volume = 0;
LiquidStack liquid = tank.getLiquid();
if(liquid != null){volume = liquid.amount;}
if (volume != pVolume)
LiquidStack stack = new LiquidStack(0, 0, 0);
if (this.tank.getLiquid() != null)
{
LiquidStack stack = new LiquidStack(0, 0, 0);
if (this.tank.getLiquid() != null)
{
stack = this.tank.getLiquid();
}
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, new Object[] { stack.itemID, stack.amount, stack.itemMeta });
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 20);
stack = this.tank.getLiquid();
}
pVolume = volume;
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, new Object[] { stack.itemID, stack.amount, stack.itemMeta });
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 20);
}
}
}
public LiquidStack getStack()
{
return tank.getLiquid();
}
@Override
public String getMeterReading(EntityPlayer user, ForgeDirection side)
{
@ -149,9 +142,11 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
return this.tank.fill(resource, doFill);
}
/** find out if this tank is actual full or not
/**
* find out if this tank is actual full or not
*
* @return */
* @return
*/
public boolean isFull()
{
if (this.tank.getLiquid() == null) { return false; }
@ -219,8 +214,10 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead
return false;
}
/** cause this TE to trade liquid down if the liquid is in liquid state or up
* if in gas state. */
/**
* cause this TE to trade liquid down if the liquid is in liquid state or up
* if in gas state.
*/
public void tradeDown()
{
if (this.tank.getLiquid() == null || this.tank.getLiquid().amount <= 0)

View file

@ -12,7 +12,7 @@ tile.lmSink.name = Sink
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.3.name =Waste Pipe
tile.lmPipe.4.name =Water Pipe
tile.lmPipe.5.name =Purple Pipe
tile.lmPipe.6.name =Cyan Pipe

Binary file not shown.

Before

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 733 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
resources/models/Pump3.tcn Normal file

Binary file not shown.

BIN
resources/models/Pump4.tcn Normal file

Binary file not shown.

BIN
resources/models/pump6.tcn Normal file

Binary file not shown.

Binary file not shown.