Face Palm moment
Last few release due to my fail to bug check to most simple of things the pipe nothing would function. Turns out that i fliped the checks on the fill liquid method. Also fixed more issues with crafting recipes, i really need someone to sit and bug test my mods for me. It always seem i'm too focused on the current part to check the rest for failures.
|
@ -5,12 +5,11 @@ import liquidmechanics.api.helpers.ColorCode;
|
|||
public interface IColorCoded
|
||||
{
|
||||
/**
|
||||
* gets the pipeColor being used by this object
|
||||
* Returns the ColorCode of the object
|
||||
*/
|
||||
public ColorCode getColor();
|
||||
/**
|
||||
* sets the pipeColor to be used by this object *
|
||||
* @param obj-can be anything must be sorted
|
||||
* Sets the ColorCode of the Object
|
||||
*/
|
||||
public void setColor(Object obj);
|
||||
}
|
||||
|
|
|
@ -8,11 +8,11 @@ public interface IHeatCreator
|
|||
* @param dir - direction
|
||||
* @return Can create heat in this direction
|
||||
*/
|
||||
public boolean canCreatHeat(ForgeDirection dir);
|
||||
public boolean canOutputHeat(ForgeDirection dir);
|
||||
|
||||
/**
|
||||
* @param dir - direction
|
||||
* @return ammount of heat created in joules
|
||||
*/
|
||||
public int createHeat(ForgeDirection dir);
|
||||
public int outputHeat(ForgeDirection dir);
|
||||
}
|
||||
|
|
|
@ -32,10 +32,10 @@ public enum ColorCode
|
|||
return this.name;
|
||||
}
|
||||
|
||||
/** gets a pipeColor from any of the following
|
||||
/** gets a ColorCode from any of the following
|
||||
*
|
||||
* @param obj
|
||||
* - Integer,String,LiquidData,PipeColor
|
||||
* - Integer,String,LiquidData,ColorCode
|
||||
* @return Color NONE if it can't find it */
|
||||
public static ColorCode get(Object obj)
|
||||
{
|
||||
|
|
|
@ -10,67 +10,65 @@ import net.minecraft.tileentity.TileEntity;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
public class RenderPump extends TileEntitySpecialRenderer
|
||||
{
|
||||
int type = 0;
|
||||
private ModelPump model;
|
||||
int type = 0;
|
||||
private ModelPump model;
|
||||
|
||||
public RenderPump()
|
||||
{
|
||||
model = new ModelPump();
|
||||
}
|
||||
public RenderPump()
|
||||
{
|
||||
model = new ModelPump();
|
||||
}
|
||||
|
||||
public void renderAModelAt(TileEntityPump tileEntity, double d, double d1, double d2, float f)
|
||||
{
|
||||
LiquidData type = tileEntity.type;
|
||||
int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
switch (LiquidHandler.getMeta(type))
|
||||
{
|
||||
default:
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/Pump.png");
|
||||
break;
|
||||
case 1:
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/WaterPump.png");
|
||||
break;// water
|
||||
case 2:
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/LavaPump.png");
|
||||
break;// lava
|
||||
case 3:
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/OilPump.png");
|
||||
break;// oil
|
||||
// case 4://fuel
|
||||
}
|
||||
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:
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 2:
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 0:
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
break;
|
||||
}
|
||||
model.renderMain(0.0625F);
|
||||
model.renderC1(0.0625F);
|
||||
model.renderC2(0.0625F);
|
||||
model.renderC3(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
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 1:
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/WaterPump.png");
|
||||
break;// water
|
||||
case 2:
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/LavaPump.png");
|
||||
break;// lava
|
||||
case 3:
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/OilPump.png");
|
||||
break;
|
||||
default:
|
||||
bindTextureByName(LiquidMechanics.RESOURCE_PATH + "pumps/Pump.png");
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
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:
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 2:
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 0:
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
break;
|
||||
}
|
||||
model.renderMain(0.0625F);
|
||||
model.renderC1(0.0625F);
|
||||
model.renderC2(0.0625F);
|
||||
model.renderC3(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
this.renderAModelAt((TileEntityPump) tileEntity, var2, var4, var6, var8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
this.renderAModelAt((TileEntityPump) tileEntity, var2, var4, var6, var8);
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,6 @@ public class RenderTank extends TileEntitySpecialRenderer
|
|||
private ModelLiquidTank model;
|
||||
private ModelLiquidTankCorner modelC;
|
||||
|
||||
|
||||
public RenderTank()
|
||||
{
|
||||
model = new ModelLiquidTank();
|
||||
|
@ -33,15 +32,14 @@ public class RenderTank extends TileEntitySpecialRenderer
|
|||
int guageMeta = meta;
|
||||
LiquidStack stack = te.getStack();
|
||||
int pos = 0;
|
||||
if(stack != null)
|
||||
if (stack != null)
|
||||
{
|
||||
pos = Math.min((stack.amount / LiquidContainerRegistry.BUCKET_VOLUME), 4);
|
||||
if(meta == ColorCode.NONE.ordinal())
|
||||
if (meta == ColorCode.NONE.ordinal())
|
||||
{
|
||||
guageMeta = ColorCode.get(stack).ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
|
@ -90,6 +88,9 @@ public class RenderTank extends TileEntitySpecialRenderer
|
|||
case 4:
|
||||
type = "Water";
|
||||
break;
|
||||
case 13:
|
||||
type = "Milk";
|
||||
break;
|
||||
case 14:
|
||||
type = "Steam";
|
||||
break;
|
||||
|
@ -127,7 +128,7 @@ public class RenderTank extends TileEntitySpecialRenderer
|
|||
switch (meta)
|
||||
{
|
||||
case 1:
|
||||
type = "Red";
|
||||
type = "Lava";
|
||||
break;
|
||||
case 4:
|
||||
type = "Water";
|
||||
|
@ -136,7 +137,7 @@ public class RenderTank extends TileEntitySpecialRenderer
|
|||
type = "";
|
||||
break;
|
||||
}
|
||||
return LiquidMechanics.RESOURCE_PATH + "tanks/Corner" + type + "png";
|
||||
return LiquidMechanics.RESOURCE_PATH + "tanks/Corner" + type + ".png";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -50,15 +50,17 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
/** Used in the creation of a new mod class
|
||||
/**
|
||||
* Used in the creation of a new mod class
|
||||
*
|
||||
* @author Rseifert */
|
||||
* @author Rseifert
|
||||
*/
|
||||
@Mod(modid = LiquidMechanics.NAME, name = LiquidMechanics.NAME, version = LiquidMechanics.VERSION, dependencies = "after:BasicComponents")
|
||||
@NetworkMod(channels = { LiquidMechanics.CHANNEL }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class)
|
||||
public class LiquidMechanics extends DummyModContainer
|
||||
{
|
||||
// TODO Change in Version Release
|
||||
public static final String VERSION = "0.2.4";
|
||||
public static final String VERSION = "0.2.6";
|
||||
|
||||
// Constants
|
||||
public static final String NAME = "Liquid Mechanics";
|
||||
|
@ -226,25 +228,47 @@ public class LiquidMechanics extends DummyModContainer
|
|||
new ItemStack(Item.dyePowder, 1, it) });
|
||||
}
|
||||
}
|
||||
// steam pipes
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 1, ColorCode.ORANGE.ordinal()), new Object[] {
|
||||
new ItemStack(itemParts, 1, Parts.Bronze.ordinal()),
|
||||
new ItemStack(itemParts, 1, Parts.Seal.ordinal()) });
|
||||
new ItemStack(itemParts, 1, Parts.Bronze.ordinal()),
|
||||
new ItemStack(itemParts, 1, Parts.Seal.ordinal()) });
|
||||
// milk pipes
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 4, ColorCode.WHITE.ordinal()), new Object[] {
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(Item.dyePowder, 1, 0) });
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(blockPipe, 1, 15),
|
||||
new ItemStack(Item.dyePowder, 1, 0) });
|
||||
// steam tank
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(blockTank, 1, ColorCode.ORANGE.ordinal()), new Object[] {
|
||||
new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
|
||||
new ItemStack(itemParts, 1, Parts.Seal.ordinal()),
|
||||
new ItemStack(Item.dyePowder, 1, ColorCode.ORANGE.ordinal()) });
|
||||
new ItemStack(itemParts, 1, Parts.Bronze.ordinal()),
|
||||
new ItemStack(itemParts, 1, Parts.Bronze.ordinal()) });
|
||||
// lava tank
|
||||
GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.RED.ordinal()), new Object[] {
|
||||
" @ ", "@T@", " @ ",
|
||||
"N@N", "@ @", "N@N",
|
||||
'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
|
||||
'@', Block.obsidian, });
|
||||
'@', Block.obsidian,
|
||||
'N', Block.netherrack });
|
||||
// water tank
|
||||
GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.BLUE.ordinal()), new Object[] {
|
||||
"@G@", "STS", "@G@",
|
||||
'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
|
||||
'@', Block.planks,
|
||||
'G', Block.glass,
|
||||
'S', new ItemStack(itemParts, 1, Parts.Seal.ordinal()) });
|
||||
// milk tank
|
||||
GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.WHITE.ordinal()), new Object[] {
|
||||
"W@W", "WTW", "W@W",
|
||||
'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
|
||||
'@', Block.stone,
|
||||
'W', Block.planks });
|
||||
// generic Tank
|
||||
GameRegistry.addRecipe(new ItemStack(blockTank, 1, ColorCode.NONE.ordinal()), new Object[] {
|
||||
"@@@", "@T@", "@@@",
|
||||
'T', new ItemStack(itemParts, 1, Parts.Tank.ordinal()),
|
||||
'@', Block.stone });
|
||||
|
||||
// pump
|
||||
GameRegistry.addRecipe(new ItemStack(blockMachine, 1, 0), new Object[] {
|
||||
|
|
24
minecraft/liquidmechanics/common/block/BlockSink.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockSink extends BlockContainer
|
||||
{
|
||||
|
||||
protected BlockSink(int par1)
|
||||
{
|
||||
super(par1, Material.iron);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -141,6 +141,7 @@ public class BlockTank extends BlockMachine
|
|||
{
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 4));
|
||||
par3List.add(new ItemStack(par1, 1, 13));
|
||||
par3List.add(new ItemStack(par1, 1, 15));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,9 +277,10 @@ public class TileEntityGenerator extends TileEntityElectricityProducer implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getVoltage()
|
||||
public double getVoltage(Object... data)
|
||||
{
|
||||
return 120;
|
||||
return 120;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,11 +28,13 @@ import universalelectricity.prefab.network.PacketManager;
|
|||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileEntityPipe extends TileEntity implements ITankContainer, IReadOut,IColorCoded
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class TileEntityPipe extends TileEntity implements ITankContainer, IReadOut, IColorCoded
|
||||
{
|
||||
private ColorCode color = ColorCode.NONE;
|
||||
|
||||
private int count = 40;
|
||||
private int count = 20;
|
||||
private int count2, presure = 0;
|
||||
|
||||
public boolean converted = false;
|
||||
|
@ -48,7 +50,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
|
|||
|
||||
this.validataConnections();
|
||||
this.color = ColorCode.get(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
if (!worldObj.isRemote && ++count >= 40)
|
||||
if (!worldObj.isRemote && ++count >= 20)
|
||||
{
|
||||
count = 0;
|
||||
this.updatePressure();
|
||||
|
@ -76,7 +78,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
|
|||
stored.drain(((ITankContainer) connectedBlocks[i]).fill(dir.getOpposite(), stack, true), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (stack == null || stack.amount <= 0)
|
||||
{
|
||||
break;
|
||||
|
@ -124,7 +126,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
|
|||
{
|
||||
super.readFromNBT(nbt);
|
||||
UpdateConverter.convert(this, nbt);
|
||||
|
||||
|
||||
LiquidStack liquid = new LiquidStack(0, 0, 0);
|
||||
liquid.readFromNBT(nbt.getCompoundTag("stored"));
|
||||
stored.setLiquid(liquid);
|
||||
|
@ -149,7 +151,7 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
|
|||
LiquidStack stack = this.stored.getLiquid();
|
||||
if (stack != null) { return (stack.amount / LiquidContainerRegistry.BUCKET_VOLUME) + "/" + (this.stored.getCapacity() / LiquidContainerRegistry.BUCKET_VOLUME) + " " + LiquidHandler.get(stack).getName() + " @ " + this.presure + "p"; }
|
||||
|
||||
return "Empty";
|
||||
return "Empty" + " @ " + this.presure + "p";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,36 +161,34 @@ public class TileEntityPipe extends TileEntity implements ITankContainer, IReadO
|
|||
LiquidStack stack = stored.getLiquid();
|
||||
if (color != ColorCode.NONE)
|
||||
{
|
||||
if (color != ColorCode.get(LiquidHandler.get(resource)) || !LiquidHandler.isEqual(stack, resource))
|
||||
|
||||
if (stack == null || LiquidHandler.isEqual(resource, this.color.getLiquidData()))
|
||||
{
|
||||
this.causeMix(stack, resource);
|
||||
return this.fill(0, resource, doFill);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.fill(0, resource, doFill);
|
||||
return this.causeMix(stack, resource);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stack != null && !LiquidHandler.isEqual(stack, resource))
|
||||
if (stack == null || LiquidHandler.isEqual(stack, resource))
|
||||
{
|
||||
this.causeMix(stack, resource);
|
||||
return this.fill(0, resource, doFill);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.fill(0, resource, doFill);
|
||||
return this.causeMix(stack, resource);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(int tankIndex, LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if (tankIndex != 0 || resource == null)
|
||||
return 0;
|
||||
if (tankIndex != 0 || resource == null) { return 0; }
|
||||
|
||||
return stored.fill(resource, doFill);
|
||||
}
|
||||
|
|
|
@ -4,10 +4,12 @@ import java.util.EnumSet;
|
|||
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.IPressure;
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.helpers.LiquidData;
|
||||
import liquidmechanics.api.helpers.LiquidHandler;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.MetaGroup;
|
||||
import liquidmechanics.common.handlers.UpdateConverter;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -19,6 +21,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidContainerData;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
|
@ -31,7 +34,7 @@ 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, ITankContainer
|
||||
{
|
||||
public final double WATTS_PER_TICK = 400;
|
||||
double percentPumped = 0.0;
|
||||
|
@ -42,18 +45,17 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
int count = 0;
|
||||
|
||||
private boolean converted = false;
|
||||
|
||||
public LiquidData type = LiquidHandler.unkown;
|
||||
public ColorCode color = ColorCode.NONE;
|
||||
public LiquidTank tank = new LiquidTank(wMax);
|
||||
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
this.registerConnections();
|
||||
this.registerWireConnections();
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, LiquidMechanics.blockMachine.blockID);
|
||||
}
|
||||
|
||||
public void registerConnections()
|
||||
public void registerWireConnections()
|
||||
{
|
||||
int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite();
|
||||
|
@ -92,29 +94,30 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
{
|
||||
if (count-- <= 0)
|
||||
{
|
||||
count = 40;
|
||||
int bBlock = worldObj.getBlockId(xCoord, yCoord - 1, zCoord);
|
||||
LiquidData bellow = LiquidHandler.getFromBlockID(bBlock);
|
||||
if (bellow != null)
|
||||
{
|
||||
if (this.type != bellow && bellow != LiquidHandler.unkown)
|
||||
if (this.color.getLiquidData() != bellow && bellow != LiquidHandler.unkown)
|
||||
{
|
||||
this.tank.setLiquid(LiquidHandler.getStack(bellow, 0));
|
||||
this.type = bellow;
|
||||
this.tank.setLiquid(LiquidHandler.getStack(bellow, 1));
|
||||
this.color = bellow.getColor();
|
||||
}
|
||||
|
||||
}
|
||||
count = 40;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (this.tank.getLiquid() == null)
|
||||
{
|
||||
this.tank.setLiquid(LiquidHandler.getStack(this.type, 1));
|
||||
this.tank.setLiquid(LiquidHandler.getStack(this.color.getLiquidData(), 1));
|
||||
}
|
||||
|
||||
//consume/give away stored units
|
||||
|
||||
// consume/give away stored units
|
||||
this.fillSurroundings();
|
||||
this.chargeUp();
|
||||
|
||||
|
||||
if (this.joulesReceived >= this.WATTS_PER_TICK - 50 && this.canPump(xCoord, yCoord - 1, zCoord))
|
||||
{
|
||||
|
||||
|
@ -130,11 +133,31 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
{
|
||||
if (this.ticks % 10 == 0)
|
||||
{
|
||||
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, type.getName());
|
||||
Packet packet = PacketManager.getPacket(LiquidMechanics.CHANNEL, this, color.ordinal());
|
||||
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the search range the pump used to find valid block to pump
|
||||
*/
|
||||
public int getPumpRange()
|
||||
{
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
switch (MetaGroup.getGrouping(meta))
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return 1;
|
||||
case 2:
|
||||
return 20;
|
||||
case 3:
|
||||
return 50;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cause this to empty its internal tank to surrounding tanks
|
||||
*/
|
||||
|
@ -154,18 +177,22 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
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
|
||||
*/
|
||||
public void chargeUp()
|
||||
{
|
||||
this.joulesReceived += this.WATTS_PER_TICK; //TODO remove after testing
|
||||
// this.joulesReceived += this.WATTS_PER_TICK; //TODO remove after
|
||||
// testing
|
||||
int notchMeta = MetaGroup.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite();
|
||||
|
||||
|
@ -192,6 +219,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPump(int x, int y, int z)
|
||||
{
|
||||
// if (this.tank.getLiquid() == null) return false;
|
||||
|
@ -212,24 +240,18 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
*/
|
||||
public boolean drainBlock(Vector3 loc)
|
||||
{
|
||||
int bBlock = worldObj.getBlockId(loc.intX(), loc.intY(), loc.intZ());
|
||||
int blockID = worldObj.getBlockId(loc.intX(), loc.intY(), loc.intZ());
|
||||
int meta = worldObj.getBlockMetadata(loc.intX(), loc.intY(), loc.intZ());
|
||||
LiquidData bellow = LiquidHandler.getFromBlockID(bBlock);
|
||||
if (bBlock == Block.waterMoving.blockID || (bBlock == Block.waterStill.blockID && meta != 0))
|
||||
return false;
|
||||
if (bBlock == Block.lavaMoving.blockID || (bBlock == Block.lavaStill.blockID && meta != 0))
|
||||
return false;
|
||||
if (bBlock == type.getStack().itemID)
|
||||
LiquidData resource = LiquidHandler.getFromBlockID(blockID);
|
||||
if (resource == color.getLiquidData())
|
||||
{
|
||||
// FMLLog.info("pumping " + bellow.displayerName + " blockID:" +
|
||||
// bBlock + " Meta:" +
|
||||
// meta);
|
||||
int f = this.tank.fill(LiquidHandler.getStack(this.type, LiquidContainerRegistry.BUCKET_VOLUME), true);
|
||||
if (f > 0)
|
||||
worldObj.setBlockWithNotify(loc.intX(), loc.intY(), loc.intZ(), 0);
|
||||
percentPumped = 0;
|
||||
worldObj.setBlockWithNotify(xCoord, yCoord - 1, zCoord, 0);
|
||||
LiquidStack stack = resource.getStack();
|
||||
stack.amount = LiquidContainerRegistry.BUCKET_VOLUME;
|
||||
this.tank.fill(stack, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -238,7 +260,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
{
|
||||
try
|
||||
{
|
||||
this.type = (LiquidHandler.get(data.readUTF()));
|
||||
this.color = (ColorCode.get(data.readInt()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -255,21 +277,9 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
{
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
this.converted = nbt.getBoolean("converted");
|
||||
if (!converted)
|
||||
{
|
||||
int t = nbt.getInteger("type");
|
||||
this.type = LiquidHandler.getFromMeta(t);
|
||||
this.converted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.type = LiquidHandler.get(nbt.getString("name"));
|
||||
}
|
||||
if (this.type == null) type = LiquidHandler.unkown;
|
||||
|
||||
int stored = nbt.getInteger("liquid");
|
||||
this.tank.setLiquid(LiquidHandler.getStack(this.type, stored));
|
||||
LiquidStack liquid = new LiquidStack(0, 0, 0);
|
||||
liquid.readFromNBT(nbt.getCompoundTag("stored"));
|
||||
tank.setLiquid(liquid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -279,28 +289,19 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setBoolean("converted", this.converted);
|
||||
int s = 1;
|
||||
if (this.tank.getLiquid() != null) s = this.tank.getLiquid().amount;
|
||||
nbt.setInteger("liquid", s);
|
||||
|
||||
nbt.setString("name", type.getName());
|
||||
if (tank.getLiquid() != null)
|
||||
{
|
||||
nbt.setTag("stored", tank.getLiquid().writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMeterReading(EntityPlayer user, ForgeDirection side)
|
||||
{
|
||||
if (type == null) return "Error: No Type";
|
||||
int liquid = 0;
|
||||
if (this.tank.getLiquid() != null)
|
||||
{
|
||||
liquid = (this.tank.getLiquid().amount / LiquidContainerRegistry.BUCKET_VOLUME);
|
||||
}
|
||||
else
|
||||
{
|
||||
liquid = 0;
|
||||
}
|
||||
return liquid + "" + type.getName() + " " + this.joulesReceived + "W " + this.percentPumped + "/20";
|
||||
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
|
||||
|
@ -318,15 +319,12 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
@Override
|
||||
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return drain(0, maxDrain, doDrain);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain)
|
||||
{
|
||||
if (tankIndex == 0)
|
||||
return tank.drain(maxDrain, doDrain);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -345,16 +343,15 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
|||
@Override
|
||||
public int presureOutput(LiquidData type, ForgeDirection dir)
|
||||
{
|
||||
if (type == this.type || type == LiquidHandler.unkown)
|
||||
return this.type.getPressure();
|
||||
if (type == this.color.getLiquidData() || type == LiquidHandler.unkown)
|
||||
return this.color.getLiquidData().getPressure();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPressureToo(LiquidData type, ForgeDirection dir)
|
||||
{
|
||||
if (type == this.type || type == LiquidHandler.unkown)
|
||||
return true;
|
||||
if (type == this.color.getLiquidData() || type == LiquidHandler.unkown) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public class TileEntityReleaseValve extends TileEntity implements IPressure, IRe
|
|||
if (pipe != null)
|
||||
{
|
||||
ILiquidTank tankP = pipe.getTanks(ForgeDirection.UNKNOWN)[0];
|
||||
//FMLLog.warning("Pipe: " + pipe.getColor() + " Vol: " + (tankP.getLiquid() != null ? tankP.getLiquid().amount : 0000));
|
||||
//FMLLog.warning("Pipe: " + pipe.getColor() + " Vol: " + (tankP.getLiquid() != null ? tankP.getLiquid().amount : 0000));
|
||||
int drain = pipe.fill(ForgeDirection.UNKNOWN, tank.getLiquid(), true);
|
||||
tank.drain(drain, true);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ tile.lmPipe.9.name =Pink Pipe
|
|||
tile.lmPipe.10.name =Lime Pipe
|
||||
tile.lmPipe.11.name =Fuel Pipe
|
||||
tile.lmPipe.12.name =LightBlue Pipe
|
||||
tile.lmPipe.13.name =Magenta Pipe
|
||||
tile.lmPipe.13.name =Milk Pipe
|
||||
tile.lmPipe.14.name =Orange Pipe
|
||||
tile.lmPipe.15.name =Generic Pipe
|
||||
|
||||
|
@ -38,7 +38,7 @@ tile.lmTank.9.name =Pink Tank
|
|||
tile.lmTank.10.name =Lime Tank
|
||||
tile.lmTank.11.name =Fuel Tank
|
||||
tile.lmTank.12.name =LightBlue Tank
|
||||
tile.lmTank.13.name =Magenta Tank
|
||||
tile.lmTank.13.name =Milk Tank
|
||||
tile.lmTank.14.name =Steam Tank
|
||||
tile.lmTank.15.name =Generic Tank
|
||||
|
||||
|
|
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 1 KiB |
BIN
minecraft/liquidmechanics/resource/tanks/CornerLava.png
Normal file
After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 431 B After Width: | Height: | Size: 1 KiB |
BIN
minecraft/liquidmechanics/resource/tanks/MilkTank.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 960 B |