bug fixes, bugs fixes, and ninja update

suprised how long it too someone to noticed the major bugs i fixed.
Guess i need to play my own mods more and find the bugs myself ;/.
Fixed pipes again
Fixed boiler & LiquidTank liquid sharing system
Added a way for pipes to pump to tanks up a boiler chain
Fixed Boiler GUI
Fixed most machines in general (packets stopped being sent)
pre implemented use of Liquid tank in place of boiler's internal storage
tanks
storage tanks act as pumps on sides, Top for gases, bottom for liquids.
Added crafting for lava, water,steam.fuel,and oil tanks.
Made 4 iron the default tank receipe, and 4 bronze optional will change
out later.
This commit is contained in:
Rseifert 2012-10-19 01:38:53 -04:00
parent fccf7d2f29
commit 64179b0e17
20 changed files with 458 additions and 639 deletions

View file

@ -31,7 +31,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "basicPipes", name = "Basic Pipes", version = "1.7",dependencies = "after:UniversalElectricity")
@Mod(modid = "basicPipes", name = "Basic Pipes", version = "1.9",dependencies = "after:UniversalElectricity")
@NetworkMod(channels = { "Pipes" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class)
public class BasicPipesMain{
@ -142,7 +142,17 @@ public class BasicPipesMain{
//fuel
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,4), new Object[] { new ItemStack(parts, 1,1),new ItemStack(parts, 1,4),new ItemStack(Item.dyePowder, 1,11)});
GameRegistry.addRecipe(new ItemStack(parts, 1,7), new Object[] { "T@T", 'T',new ItemStack(parts,1,0),'@',Block.lever});//valve
GameRegistry.addRecipe(new ItemStack(parts, 1,6), new Object[] { " @ ","@ @"," @ ", '@',Item.ingotIron});//tank
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1,0), new Object[] { new ItemStack(parts, 1,6),new ItemStack(parts, 1,4),new ItemStack(Item.dyePowder, 1,15)});
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1,1), new Object[] { new ItemStack(parts, 1,6),new ItemStack(parts, 1,4),new ItemStack(Item.dyePowder, 1,4)});
//lava TODO change to use obby pipe and nether items
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1,2), new Object[] { new ItemStack(parts, 1,6),Block.obsidian,Block.obsidian,Block.obsidian,Block.obsidian});
//oil
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1,3), new Object[] { new ItemStack(parts, 1,6),new ItemStack(parts, 1,4),new ItemStack(Item.dyePowder, 1,0)});
//fuel
GameRegistry.addShapelessRecipe(new ItemStack(itemTank, 1,4), new Object[] { new ItemStack(parts, 1,6),new ItemStack(parts, 1,4),new ItemStack(Item.dyePowder, 1,11)});
try{
GameRegistry.addRecipe(new ItemStack(parts, 2,0), new Object[] { "@@@", '@',BasicComponents.itemBronzeIngot});//bronze tube
//steam
@ -164,7 +174,7 @@ public class BasicPipesMain{
{
System.out.print("UE based recipes not loaded");
//secondary boiler tank
GameRegistry.addRecipe(new ItemStack(parts, 1,6), new Object[] { " @ ","@ @"," @ ", '@',Item.ingotIron});//tank
//steam
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,0), new Object[] { new ItemStack(parts, 1,1),new ItemStack(parts, 1,4)});
}

View file

@ -6,8 +6,10 @@ import universalelectricity.network.IPacketReceiver;
import universalelectricity.network.PacketManager;
import universalelectricity.prefab.Vector3;
import basicpipes.BasicPipesMain;
import basicpipes.conductors.TileEntityPipe;
import basicpipes.pipes.api.ILiquidConsumer;
import basicpipes.pipes.api.ILiquidProducer;
import basicpipes.pipes.api.IStorageTank;
import basicpipes.pipes.api.Liquid;
import basicpipes.pipes.api.MHelper;
import net.minecraft.src.EntityPlayer;
@ -20,7 +22,7 @@ import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
public class TileEntityLTank extends TileEntity implements ILiquidConsumer,ILiquidProducer,IPacketReceiver{
public class TileEntityLTank extends TileEntity implements IStorageTank,ILiquidProducer,IPacketReceiver{
public TileEntity[] cc = {null,null,null,null,null,null};
public Liquid type = Liquid.DEFUALT;
public int LStored = 0;
@ -31,13 +33,13 @@ private int count2 = 0;
private boolean firstUpdate = true;
public void updateEntity()
{
if(++count >= 10)
if(++count >= 5)
{
count = 0;
this.cc = MHelper.getSourounding(this);
this.cc = MHelper.getSourounding(worldObj,xCoord, yCoord, zCoord);
if(!worldObj.isRemote)
{
MHelper.shareLiquid(this, type, LStored);
MHelper.shareLiquid(worldObj,xCoord, yCoord, zCoord,this.LStored,this.getLiquidCapacity(type), type);
if(firstUpdate ||(this.LStored != pLStored)|| count2 >= 100)
{
count2 = 0;
@ -70,11 +72,29 @@ public void readFromNBT(NBTTagCompound nbt)
@Override
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side)
{
if(type == this.type)
{
int rejectedVolume = Math.max((this.getStoredLiquid(type) + vol) - this.LMax, 0);
this.LStored = Math.min(Math.max((LStored + vol - rejectedVolume),0),this.LMax);
return rejectedVolume;
if(this.LStored < this.getLiquidCapacity(this.type))
{
int rejectedVolume = Math.max((this.getStoredLiquid(type) + vol) - this.LMax, 0);
this.LStored = Math.min(Math.max((LStored + vol - rejectedVolume),0),this.LMax);
return rejectedVolume;
}else
{
TileEntity te = null;
if(this.type.isGas)
{
worldObj.getBlockTileEntity(xCoord, yCoord+1, zCoord);
}else
{
worldObj.getBlockTileEntity(xCoord, yCoord-1, zCoord);
}
if( te instanceof IStorageTank)
{
return ((IStorageTank)te).onReceiveLiquid(type, vol, ForgeDirection.UNKNOWN);
}
}
}
return vol;
}
@ -121,11 +141,11 @@ public Liquid getType() {
@Override
public int onProduceLiquid(Liquid type, int vol, ForgeDirection side) {
if(type == this.type)
if(type == this.type && this.LStored > 1 && vol > 0)
{
int aVol = Math.max(((this.getStoredLiquid(type) - vol) + this.LMax)-vol, 0);
this.LStored = Math.min(Math.max((LStored - aVol),0),this.LMax);
return aVol;
//TODO correct / do math for
LStored--;
return 1;
}
return 0;
}
@ -150,11 +170,11 @@ public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
public boolean canProducePresure(Liquid type, ForgeDirection side) {
if(type == this.type)
{
if(this.type.isGas && side == ForgeDirection.UP)
if(this.type.isGas && side == ForgeDirection.DOWN)
{
return true;
}
if(!this.type.isGas && side == ForgeDirection.DOWN)
if(!this.type.isGas && side == ForgeDirection.UP)
{
return true;
}
@ -166,14 +186,7 @@ public boolean canProducePresure(Liquid type, ForgeDirection side) {
public int presureOutput(Liquid type, ForgeDirection side) {
if(type == this.type)
{
if(this.type.isGas && side == ForgeDirection.UP)
{
return this.type.defaultPresure;
}
if(!this.type.isGas && side == ForgeDirection.DOWN)
{
return this.type.defaultPresure;
}
return this.type.defaultPresure;
}
return 0;
}

View file

@ -35,32 +35,7 @@ public class BlockPipe extends BlockContainer
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
this.updateConductorTileEntity(world, x, y, z);
}
public static TileEntity getLiquidUnit(World world, int x, int y, int z, ForgeDirection side,Liquid type)
{
//Check if the designated block is a UE Unit - producer, consumer or a conductor
TileEntity tileEntity = world.getBlockTileEntity(x+side.offsetX, y+side.offsetY, z+side.offsetZ);
TileEntity returnValue = null;
if(tileEntity instanceof ILiquidConsumer)
{
if(((ILiquidConsumer)tileEntity).canRecieveLiquid(type,side))
{
returnValue = tileEntity;
}
}
if (tileEntity instanceof ILiquidProducer)
{
if(((ILiquidProducer)tileEntity).canProduceLiquid(type,side))
{
returnValue = tileEntity;
}
}
return returnValue;
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
@ -69,7 +44,6 @@ public class BlockPipe extends BlockContainer
public void onNeighborBlockChange(World world, int x, int y, int z, int blockID)
{
super.onNeighborBlockChange(world, x, y, z, blockID);
this.updateConductorTileEntity(world, x, y, z);
}
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
@ -82,18 +56,6 @@ public class BlockPipe extends BlockContainer
{
return true;
}
public static void updateConductorTileEntity(World world, int x, int y, int z)
{
for(int i = 0; i < 6; i++)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if(tileEntity instanceof TileEntityPipe)
{
((TileEntityPipe) tileEntity).addConnection(getLiquidUnit(world, x, y, z,
ForgeDirection.getOrientation(i), ((TileEntityPipe) tileEntity).getType()), ForgeDirection.getOrientation(i));
}
}
}
@Override
public TileEntity createNewTileEntity(World var1) {

View file

@ -1,18 +1,18 @@
package basicpipes.conductors;
import java.util.ArrayList;
import java.util.List;
import steampower.turbine.TileEntitySteamPiston;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import basicpipes.BasicPipesMain;
import basicpipes.LTanks.TileEntityLTank;
import basicpipes.pipes.api.IMechanical;
import basicpipes.pipes.api.Liquid;
import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection;
public class ItemGuage extends Item
{
private int spawnID;

View file

@ -12,58 +12,100 @@ import universalelectricity.prefab.Vector3;
import basicpipes.pipes.api.ILiquidConsumer;
import basicpipes.pipes.api.ILiquidProducer;
import basicpipes.pipes.api.Liquid;
import basicpipes.pipes.api.MHelper;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacketReceiver
{
protected Liquid type = Liquid.DEFUALT;
public int capacity = 2;
private int count = 0;
private int count2 = 0;
public int capacity = 2;
public int presure = 0;
public int connectedUnits = 0;
public int hPressure = 0;
public int hPProducer = 0;
protected int liquidStored = 0;
public int liquidStored = 0;
private int count = 0;
private int count2 =0;
private boolean intiUpdate = true;
protected boolean firstUpdate = true;
public TileEntity[] connectedBlocks = {null, null, null, null, null, null};
/**
* This function adds a connection between this pipe and other blocks
* @param tileEntity - Must be either a producer, consumer or a conductor
* @param side - side in which the connection is coming from
*/
public void addConnection(TileEntity tileEntity, ForgeDirection side)
{
this.connectedBlocks[side.ordinal()] = null;
if(tileEntity instanceof ILiquidConsumer)
{
if(((ILiquidConsumer)tileEntity).canRecieveLiquid(this.type, side))
{
this.connectedBlocks[side.ordinal()] = tileEntity;
}
}
if(tileEntity instanceof ILiquidProducer)
{
if(((ILiquidProducer)tileEntity).canProduceLiquid(this.type, side))
{
this.connectedBlocks[side.ordinal()] = tileEntity;
}
}
}
public int getPressure()
{
return this.presure;
}
/**
* onRecieveLiquid is called whenever a something sends a volume to the pipe (which is this block).
* @param vols - The amount of vol source is trying to give to this pipe
* @param side - The side of the block in which the liquid came from
* @return vol - The amount of rejected liquid that can't enter the pipe
*/
@Override
public void updateEntity()
{
int highestPressure = 0;
if(++count >= 5)
{
this.connectedBlocks = MHelper.getSourounding(worldObj,xCoord, yCoord, zCoord);
for(int i =0; i < 6; i++)
{
if(connectedBlocks[i] instanceof ILiquidConsumer && ((ILiquidConsumer) connectedBlocks[i]).canRecieveLiquid(this.type, ForgeDirection.getOrientation(i).getOpposite()))
{
this.connectedUnits++;
if(connectedBlocks[i] instanceof TileEntityPipe)
{
if(((TileEntityPipe) connectedBlocks[i]).getPressure() > highestPressure)
{
highestPressure = ((TileEntityPipe) connectedBlocks[i]).getPressure();
}
}
}
else
if(connectedBlocks[i] instanceof ILiquidProducer && ((ILiquidProducer) connectedBlocks[i]).canProduceLiquid(this.type, ForgeDirection.getOrientation(i).getOpposite()))
{
this.connectedUnits++;
if(((ILiquidProducer) connectedBlocks[i]).canProducePresure(this.type, ForgeDirection.getOrientation(i)) && ((ILiquidProducer) connectedBlocks[i]).presureOutput(this.type,ForgeDirection.getOrientation(i).getOpposite()) > highestPressure)
{
highestPressure = ((ILiquidProducer) connectedBlocks[i]).presureOutput(this.type,ForgeDirection.getOrientation(i));
}
}
else
{
connectedBlocks[i] = null;
}
}
if(!worldObj.isRemote)
{
if(firstUpdate || count2++ >= 10)
{ count2= 0;
firstUpdate = false;
Packet packet = PacketManager.getPacket("Pipes",this, new Object[]{this.type.ordinal()});
PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 60);
}
this.presure = highestPressure -1;
for(int i =0; i < 6; i++)
{
if(connectedBlocks[i] instanceof ILiquidProducer)
{
int vol = ((ILiquidProducer)connectedBlocks[i]).onProduceLiquid(this.type, this.capacity - this.liquidStored, ForgeDirection.getOrientation(i).getOpposite());
this.liquidStored = Math.max(this.liquidStored + vol,this.capacity);
}
if(connectedBlocks[i] instanceof ILiquidConsumer && this.liquidStored > 0 && this.presure > 0)
{
if(connectedBlocks[i] instanceof TileEntityPipe)
{
this.liquidStored--;
int vol = ((ILiquidConsumer)connectedBlocks[i]).onReceiveLiquid(this.type, Math.max(this.liquidStored,1), ForgeDirection.getOrientation(i).getOpposite());
this.liquidStored += vol;
}else
{
this.liquidStored = ((ILiquidConsumer)connectedBlocks[i]).onReceiveLiquid(this.type, this.liquidStored, ForgeDirection.getOrientation(i).getOpposite());
}
}
}
}
}
}
//---------------
//liquid stuff
//---------------
@Override
public int onReceiveLiquid(Liquid type,int vol, ForgeDirection side)
{
@ -75,110 +117,6 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
}
return vol;
}
@Override
public void updateEntity()
{
if(++count >= 5)
{
this.connectedUnits = 0;
this.hPressure = 0;
this.hPProducer = 0;
count = 0;
BlockPipe.updateConductorTileEntity(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
if(!this.worldObj.isRemote)
{
if(firstUpdate || count2++ >= 10)
{ count2= 0;
firstUpdate = false;
Packet packet = PacketManager.getPacket("Pipes",this, new Object[]{this.type.ordinal()});
PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 60);
}
for(int i = 0; i < 6; i++)
{
if(connectedBlocks[i] instanceof ILiquidProducer)
{
if(((ILiquidProducer)connectedBlocks[i]).canProducePresure(this.type, ForgeDirection.getOrientation(i)))
{++this.connectedUnits;
if(((ILiquidProducer)connectedBlocks[i]).presureOutput(this.type,ForgeDirection.getOrientation(i)) > hPProducer)
{
hPProducer = ((ILiquidProducer)connectedBlocks[i]).presureOutput(this.type,ForgeDirection.getOrientation(i));
}
}
}
if(connectedBlocks[i] instanceof TileEntityPipe)
{
++this.connectedUnits;
if(((TileEntityPipe)connectedBlocks[i]).presure > hPressure)
{
hPressure = ((TileEntityPipe)connectedBlocks[i]).getPressure();
}
}
}//end of pressure update
this.presure = 0;
if(connectedUnits > 0)
{
if(hPProducer > 0)
{
this.presure = hPProducer;
}else
{
this.presure = Math.max(hPressure - 1,0);
}
}else
{
this.presure = 0;
}
//only trade liquid if there is more than one thing connect and its pressure is higher than 1
if(this.connectedUnits > 0 && this.presure > 0)
{
for(int i = 0; i < 6; i++)
{
if(connectedBlocks[i] != null)
{
//Spread the liquid among the different blocks
if(connectedBlocks[i] instanceof ILiquidConsumer && this.liquidStored > 0)
{
if(((ILiquidConsumer)connectedBlocks[i]).canRecieveLiquid(this.type,ForgeDirection.getOrientation(i)))
{
int transferVolumeAmount = 0; //amount to be moved
ILiquidConsumer connectedConsumer = ((ILiquidConsumer)connectedBlocks[i]);
if(connectedConsumer instanceof TileEntityPipe)
{
if(((TileEntityPipe)connectedBlocks[i]).presure < this.presure)
{
transferVolumeAmount = this.liquidStored;
}
}
else
{
transferVolumeAmount = this.liquidStored;
}
int rejectedVolume = connectedConsumer.onReceiveLiquid(this.type,transferVolumeAmount, ForgeDirection.getOrientation(i));
this.liquidStored = Math.max(Math.min(this.liquidStored - transferVolumeAmount + rejectedVolume, this.capacity), 0);
}
}
if(connectedBlocks[i] instanceof ILiquidProducer && this.liquidStored < this.getLiquidCapacity(type))
{
if(((ILiquidProducer)connectedBlocks[i]).canProduceLiquid(this.type,ForgeDirection.getOrientation(i)))
{
int gainedVolume = ((ILiquidProducer)connectedBlocks[i]).onProduceLiquid(this.type,this.capacity-this.liquidStored, ForgeDirection.getOrientation(i));
this.onReceiveLiquid(this.type, gainedVolume, ForgeDirection.getOrientation(i));
}
}
}
}
}//end of liquid trader
}//end of !worldObj.isRemote
}
}
/**
* @return Return the stored volume in this pipe.
*/
@ -201,27 +139,8 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
return this.capacity;
}
return 0;
}
}
/**
* Reads a tile entity from NBT.
*/
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.liquidStored = par1NBTTagCompound.getInteger("liquid");
this.type = Liquid.getLiquid(par1NBTTagCompound.getInteger("type"));
}
/**
* Writes a tile entity to NBT.
*/
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("liquid", this.liquidStored);
par1NBTTagCompound.setInteger("type", this.type.ordinal());
}
//find wether or not this side of X block can recieve X liquid type. Also use to determine connection of a pipe
@Override
public boolean canRecieveLiquid(Liquid type, ForgeDirection side) {
@ -243,7 +162,9 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
}
//---------------------
//data
//--------------------
@Override
public void handlePacketData(NetworkManager network, int packetType,
Packet250CustomPayload packet, EntityPlayer player,
@ -263,13 +184,24 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke
}
/**
* Reads a tile entity from NBT.
*/
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.liquidStored = par1NBTTagCompound.getInteger("liquid");
this.type = Liquid.getLiquid(par1NBTTagCompound.getInteger("type"));
}
public int getSize() {
// TODO Auto-generated method stub
return 6;
}
/**
* Writes a tile entity to NBT.
*/
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("liquid", this.liquidStored);
par1NBTTagCompound.setInteger("type", this.type.ordinal());
}
}

View file

@ -34,10 +34,10 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements ILi
@Override
public void updateEntity() {
super.updateEntity();
if(count++ >= 20)
if(count++ >= 40)
{
count = 0;
sList = MHelper.getSourounding(this);
sList = MHelper.getSourounding(worldObj,xCoord, yCoord, zCoord);
int bBlock = worldObj.getBlockId(xCoord, yCoord -1, zCoord);
Liquid bellow = Liquid.getLiquidByBlock(bBlock);

View file

@ -55,7 +55,7 @@ boolean on = false;
case 4: deltaX++;break;
}
connected = MHelper.getSourounding(this);
connected = MHelper.getSourounding(worldObj,xCoord, yCoord, zCoord);
for(int i = 0;i<6;i++)
{
if(!(connected[i] instanceof TileEntityPipe))

View file

@ -1,5 +1,7 @@
package basicpipes.pipes.api;
import net.minecraftforge.common.ForgeDirection;
public interface IHeatProducer
{
@ -7,8 +9,8 @@ public interface IHeatProducer
* onProduceElectricity is called when a conductor is connected to the producer block in which the conductor will demand power from the producer
* block.
* @param jouls - The maximum jouls can be transfered
* @param side - The side of block in which the conductor is on
* @param up - The side of block in which the conductor is on
* @return jouls - Return jouls to consumer
*/
public float onProduceHeat(float jouls, int side);
public float onProduceHeat(float jouls, ForgeDirection up);
}

View file

@ -0,0 +1,5 @@
package basicpipes.pipes.api;
public interface IStorageTank extends ILiquidConsumer {
}

View file

@ -1,21 +1,23 @@
package basicpipes.pipes.api;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import net.minecraftforge.common.ForgeDirection;
public class MHelper {
/**
*
* you will have to tell your TileEntity to trade up if liquid or down if gas. I suggest having your onRecieveLiquid
* pump liquid one block up if you block is full.
* @param entity - entity at center of search
* @return an Array containing TileEntities around the TileEntity
*/
public static TileEntity[] getSourounding(TileEntity te)
public static TileEntity[] getSourounding(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 = te.worldObj.getBlockTileEntity(te.xCoord+d.offsetX, te.yCoord+d.offsetY, te.zCoord+d.offsetZ);
TileEntity aEntity = world.getBlockTileEntity(x+d.offsetX, y+d.offsetY, z+d.offsetZ);
if(aEntity instanceof TileEntity)
{
list[i] = aEntity;
@ -30,37 +32,64 @@ public class MHelper {
* @param vol - the volume to be traded
* @return the remaining untraded liquid
*/
public static int shareLiquid(TileEntity te, Liquid type,int vol)
public static int shareLiquid(World world, int x, int y, int z,int vol,int max, Liquid type)
{
TileEntity ent = world.getBlockTileEntity(x, y, z);
int currentVol = vol;
int tCount = 1;
boolean rise = type.isGas;
ForgeDirection st = ForgeDirection.getOrientation(rise ? 1 : 0);
TileEntity first = te.worldObj.getBlockTileEntity(te.xCoord+st.offsetX, te.yCoord+st.offsetX, te.zCoord+st.offsetX);
//trades to the first, bottom for liquid, top for gas
if(first instanceof ILiquidConsumer && ((ILiquidConsumer) first).getStoredLiquid(type) < ((ILiquidConsumer) first).getLiquidCapacity(type))
if(currentVol <= 0)
{
currentVol = ((ILiquidConsumer) first).onReceiveLiquid(type, vol, st);
return 0;
}
ForgeDirection st = ForgeDirection.getOrientation(rise ? 1 : 0);
TileEntity first = world.getBlockTileEntity(x+st.offsetX, y+st.offsetY, z+st.offsetZ);
//trades to the first, bottom for liquid, top for gas
if(first instanceof IStorageTank && currentVol > 0 && ((IStorageTank) first).getStoredLiquid(type) < ((IStorageTank) first).getLiquidCapacity(type))
{
currentVol = ((ILiquidConsumer) first).onReceiveLiquid(type, currentVol, st);
}
int vAve = currentVol;
TileEntity[] TeA = MHelper.getSourounding(world,x,y,z);
for(int i = 2; i < 6; i++)
{
if(TeA[i] instanceof IStorageTank)
{
vAve += ((IStorageTank)TeA[i]).getStoredLiquid(type);
tCount++;
}
}
vAve = (int)(vAve/tCount);
//trades to side if anything is left
for(int i = 2; i < 6;i++)
{
ForgeDirection side = ForgeDirection.getOrientation(i);
TileEntity sSide = te.worldObj.getBlockTileEntity(te.xCoord+side.offsetX, te.yCoord+side.offsetX, te.zCoord+side.offsetX);
if(sSide instanceof ILiquidConsumer && ((ILiquidConsumer) sSide).getStoredLiquid(type) < ((ILiquidConsumer) sSide).getLiquidCapacity(type)
&& currentVol > 0)
TileEntity sSide = world.getBlockTileEntity(x+side.offsetX, y+side.offsetY, z+side.offsetZ);
if(currentVol <= 0 || currentVol <= vAve)
{
currentVol = ((ILiquidConsumer) sSide).onReceiveLiquid(type, vol, st);
break;
}
if(sSide instanceof IStorageTank &&((IStorageTank) sSide).getStoredLiquid(type) < vAve)
{
int tA = vAve -Math.max((vAve - currentVol), 0);
currentVol = ((ILiquidConsumer) sSide).onReceiveLiquid(type, tA, st) -tA + currentVol;
}
}
//trades to the opposite of the first if anything is left
/**
* need to find a way to solve it just trading back the ammount on next cycle
if(currentVol > 0)
{
TileEntity last = te.worldObj.getBlockTileEntity(te.xCoord+st.getOpposite().offsetX, te.yCoord+st.getOpposite().offsetX, te.zCoord+st.getOpposite().offsetX);
if(last instanceof ILiquidConsumer && ((ILiquidConsumer) last).getStoredLiquid(type) < ((ILiquidConsumer) last).getLiquidCapacity(type))
TileEntity last = world.getBlockTileEntity(x+st.getOpposite().offsetX, y+st.getOpposite().offsetY, z+st.getOpposite().offsetZ);
if(last instanceof IStorageTank && currentVol == max)
{
currentVol = ((ILiquidConsumer) last).onReceiveLiquid(type, vol, st);
currentVol = ((ILiquidConsumer) last).onReceiveLiquid(type, max/10, st.getOpposite()) + currentVol -(max/10);
}
}
*/
return Math.max(currentVol,0);
}
/**
@ -72,7 +101,7 @@ public class MHelper {
*/
public static int corner(TileEntity entity)
{
TileEntity[] en = getSourounding(entity);
TileEntity[] en = getSourounding(entity.worldObj, entity.xCoord,entity.yCoord,entity.zCoord);
if(en[4] != null && en[2] != null && en[5] == null && en[3] == null)
{
return 3;

View file

@ -1,16 +1,18 @@
package steampower.turbine;
package steampower;
import net.minecraft.src.Container;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IInventory;
import net.minecraft.src.InventoryPlayer;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Slot;
import net.minecraft.src.TileEntity;
public class ContainerGenerator extends Container
public class ContainerFake extends Container
{
private TileEntitySteamPiston tileEntity;
private IInventory tileEntity;
public ContainerGenerator(InventoryPlayer par1InventoryPlayer, TileEntitySteamPiston tileEntity)
public ContainerFake(InventoryPlayer par1InventoryPlayer, IInventory tileEntity)
{
this.tileEntity = tileEntity;
// this.addSlotToContainer(new Slot(tileEntity, 0, 33, 34));

View file

@ -24,7 +24,7 @@ import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "SteamPower", name = "Steam Power", version = "1.7",dependencies = "after:basicPipes")
@Mod(modid = "SteamPower", name = "Steam Power", version = "1.9",dependencies = "after:basicPipes")
@NetworkMod(channels = { "SPpack" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class)
public class SteamPowerMain{

View file

@ -1,13 +1,12 @@
package steampower;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IInventory;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import steampower.boiler.ContainerBoiler;
import steampower.boiler.TileEntityBoiler;
import steampower.burner.ContainerFireBox;
import steampower.burner.TileEntityFireBox;
import steampower.turbine.ContainerGenerator;
import steampower.turbine.TileEntityGen;
import steampower.turbine.TileEntitySteamPiston;
import cpw.mods.fml.common.network.IGuiHandler;
@ -58,9 +57,8 @@ public class SteamProxy implements IGuiHandler{
{
switch(ID)
{
case 0: return new ContainerFireBox(player.inventory, ((TileEntityFireBox)tileEntity));
case 1: return new ContainerBoiler(player.inventory, ((TileEntityBoiler)tileEntity));
case 2: return new ContainerGenerator(player.inventory, ((TileEntitySteamPiston)tileEntity));
case 0: return new ContainerFireBox(player.inventory, ((TileEntityFireBox)tileEntity));
default: return new ContainerFake(player.inventory, (IInventory) tileEntity);
}
}

View file

@ -84,8 +84,9 @@ public class TileEntityMachine extends TileEntity implements IInventory, ISided
}
public boolean needUpdate()
{
return false;
return true;
}
@Override
public void updateEntity()
{
super.updateEntity();

View file

@ -1,58 +0,0 @@
package steampower.boiler;
import net.minecraft.src.*;
public class ContainerBoiler extends Container
{
private TileEntityBoiler boiler;
private int lastCookTime = 0;
private int lastBurnTime = 0;
private int lastItemBurnTime = 0;
public ContainerBoiler(InventoryPlayer par1InventoryPlayer, TileEntityBoiler par2TileEntityboiler)
{
this.boiler = par2TileEntityboiler;
this.addSlotToContainer(new Slot(par2TileEntityboiler, 0, 56, 17));
int line;
for (line = 0; line < 3; ++line)
{
for (int slot = 0; slot < 9; ++slot)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, slot + line * 9 + 9, 8 + slot * 18, 84 + line * 18));
}
}
for (line = 0; line < 9; ++line)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, line, 8 + line * 18, 142));
}
}
public void updateProgressBar(int par1, int par2)
{
if (par1 == 0)
{
// this.boiler.furnaceCookTime = par2;
}
if (par1 == 1)
{
//this.boiler.boilerRunTime = par2;
}
}
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return this.boiler.isUseableByPlayer(par1EntityPlayer);
}
/**
* Called to transfer a stack from one inventory to the other eg. when shift clicking.
*/
public ItemStack transferStackInSlot(int par1)
{
return null;
}
}

View file

@ -6,6 +6,7 @@ import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NBTTagList;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.TileEntity;
@ -13,323 +14,244 @@ import net.minecraftforge.common.ForgeDirection;
import steampower.SteamPowerMain;
import steampower.TileEntityMachine;
import universalelectricity.network.IPacketReceiver;
import basicpipes.conductors.TileEntityPipe;
import basicpipes.pipes.api.IHeatProducer;
import basicpipes.pipes.api.ILiquidConsumer;
import basicpipes.pipes.api.ILiquidProducer;
import basicpipes.pipes.api.IStorageTank;
import basicpipes.pipes.api.Liquid;
import basicpipes.pipes.api.MHelper;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiver,ILiquidProducer, ILiquidConsumer
public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiver,ILiquidProducer, IStorageTank
{
public int steam = 0;
public int water = 0;
public int heat = 0;
public int hullHeat = 0;
public TileEntity[] connectedBlocks = {null,null,null,null,null,null};
public int tankCount = 0;
public int tickCount = 0;
/**
* The ItemStacks that hold the items currently being used in the furnace
*/
/** The number of ticks that the boiler will keep burning */
public int RunTime = 0;
/** The ammount of water stored */
public int waterStored = 0;
/** The ammount of steam stored */
public int steamStored = 0;
/** The ammount of heat stored */
public int heatStored = 0;
public int heatMax = 10000;
/** The ammount of heat stored */
public int hullHeat = 0;
public int hullHeatMax = 4700;
private int heatTick = 0;
public int tankCount = 0;
private int heatNeeded = SteamPowerMain.boilerHeat; // kilo joules
int count = 0;
boolean hullHeated = false;
public TileEntity[] connectedBlocks = {null, null, null, null, null, null};
int steamMax = 140;
public boolean isBeingHeated = false;
private Random random = new Random();
private int pWater = 0;
private int pSteam = 0;
private int pHullH = 0;
public String getInvName()
{
return "container.boiler";
}
public Object[] getSendData()
//-----------------------------
//Update stuff
//-----------------------------
@Override
public void updateEntity()
{
//update connection list used for rendering
this.connectedBlocks = MHelper.getSourounding(worldObj,xCoord, yCoord, zCoord);
this.tankCount = 0;
for(int i =0; i < connectedBlocks.length; i++)
{
return new Object[]{(int)RunTime,(int)waterStored,
(int)steamStored,(int)heatStored,(int)hullHeat,(int)heatTick};
}
@Override
public void handlePacketData(NetworkManager network, int packetType,
Packet250CustomPayload packet, EntityPlayer player,
ByteArrayDataInput dataStream) {
try
if(connectedBlocks[i] != null)
{
RunTime = dataStream.readInt();
waterStored = dataStream.readInt();
steamStored = dataStream.readInt();
heatStored = dataStream.readInt();
hullHeat = dataStream.readInt();
heatTick = dataStream.readInt();
tankCount++;
}
catch(Exception e)
{
e.printStackTrace();
}
}
/**
* Reads a tile entity from NBT.
*/
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.RunTime = par1NBTTagCompound.getShort("BurnTime");
this.steamStored = par1NBTTagCompound.getInteger("steamStore");
this.heatStored = par1NBTTagCompound.getInteger("heatStore");
this.waterStored = par1NBTTagCompound.getInteger("waterStore");
this.hullHeat = par1NBTTagCompound.getInteger("hullHeat");
}
/**
* Writes a tile entity to NBT.
*/
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setShort("BurnTime", (short)this.RunTime);
par1NBTTagCompound.setInteger("steamStore", (int)this.steamStored);
par1NBTTagCompound.setInteger("heatStore", (int)this.heatStored);
par1NBTTagCompound.setInteger("waterStore", (int)this.waterStored);
par1NBTTagCompound.setInteger("hullHeat", (int)this.hullHeat);
}
/**
* Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count
* ticks and creates a new spawn inside its implementation.
*/
public boolean needUpdate()
}//end connection update
if(tickCount++ >= 10 && !worldObj.isRemote)
{
if(this.pWater != this.waterStored || this.pSteam != this.steamStored || this.pHullH != this.hullHeat)
{
return true;
}
return false;
}
@Override
public void updateEntity()
{
super.updateEntity();
if(count++ >=20)
{
count = 0;
//update/resets connection list
TileEntity[] entityList = MHelper.getSourounding(this);
tankCount = 0;
for(int c = 0; c< 6; c++)
{
if(entityList[c] instanceof TileEntityBoiler)
{
connectedBlocks[c] = entityList[c];
if(c != 0 && c != 1)
{
tankCount++;
}
}
else
{
connectedBlocks[c] = null;
}
}
hullHeated = false;
if(hullHeat >= hullHeatMax)
{
hullHeated = true;
}
else
{
if(!worldObj.isRemote)
{
hullHeat = Math.min(hullHeat + heatStored, hullHeatMax);
}
}
tickCount = 0;
if(!worldObj.isRemote)
{
emptyBuckets();
//adds water from container slot
this.waterStored = MHelper.shareLiquid(this, Liquid.WATER, this.waterStored);
this.steamStored = MHelper.shareLiquid(this, Liquid.STEAM, this.steamStored);
if(waterStored > 0 && hullHeated && heatStored > heatNeeded)
{
heatStored = Math.max(heatStored - heatNeeded, 0);
--waterStored;
steamStored = Math.min(steamStored + 20,this.steamMax);
}
TileEntity blockE = worldObj.getBlockTileEntity(xCoord, yCoord -1, zCoord);
this.isBeingHeated = false;
if(blockE instanceof IHeatProducer)
{
this.isBeingHeated = true;
heatStored = (int) Math.min((heatStored + ((IHeatProducer)blockE).onProduceHeat(250, 1)), heatMax);
}
else if(worldObj.getBlockId(xCoord, yCoord-1, zCoord) == Block.lavaStill.blockID)
{
heatStored += (int) Math.min((int)(random.nextDouble()*100), heatMax);
}
//keeps track of what the previous measure were so packets stop sending after the machine doesn't change any
this.pWater = this.waterStored;
this.pSteam = this.steamStored;
this.pHullH = this.hullHeat;
}
}
}
private void emptyBuckets()
{
if (storedItems[0] != null)
{
if(storedItems[0].isItemEqual(new ItemStack(Item.bucketWater,1)))
{
if((int)waterStored < getLiquidCapacity(Liquid.WATER))
{
++waterStored;
this.storedItems[0] = new ItemStack(Item.bucketEmpty,1);
this.onInventoryChanged();
}
}
if(storedItems[0].isItemEqual(new ItemStack(Block.ice,1)))
{
if((int)waterStored < getLiquidCapacity(Liquid.WATER) && this.heatStored > 100)
{
++waterStored;
int stacksize = this.storedItems[0].stackSize;
if(stacksize > 1)
{
this.storedItems[0] = new ItemStack(Block.ice,stacksize -1);
}
if(stacksize == 1)
{
this.storedItems[0] = null;
}
this.heatStored-=100;
this.onInventoryChanged();
}
}
}
}
public int precentHeated() {
int var1 = 0;
if(hullHeat < 100)
TileEntity ent = worldObj.getBlockTileEntity(xCoord, yCoord-1, zCoord);
if(ent instanceof IHeatProducer)
{
var1 = (int)(100 *(hullHeat/hullHeatMax));
this.heat = (int) Math.min(((IHeatProducer)ent).onProduceHeat(250, ForgeDirection.UP)+heat,2000);
}else
if(worldObj.getBlockId(xCoord, yCoord-1, zCoord) == Block.lavaStill.blockID)
{
this.heat = Math.min(90+heat,2000);
}
if(hullHeat < 10000)
{
int mHeat = 10000 - hullHeat;
int hHeat = mHeat - Math.max((mHeat - this.heat),0);
hullHeat = Math.min(hullHeat + hHeat,10000);
this.heat -=hHeat;
}else
{
if(heat >= 2000 && this.water >= 1 && this.steam < this.getLiquidCapacity(Liquid.STEAM))
{
this.water--;
this.steam = Math.min(this.steam +20,this.getLiquidCapacity(Liquid.STEAM));
this.heat -= 2000;
}
this.hullHeat-=5;
}
this.water = MHelper.shareLiquid(worldObj,xCoord, yCoord, zCoord,this.water,this.getLiquidCapacity(Liquid.WATER), Liquid.WATER);
this.steam = MHelper.shareLiquid(worldObj,xCoord, yCoord, zCoord,this.steam,this.getLiquidCapacity(Liquid.STEAM), Liquid.STEAM);
}
super.updateEntity();
}
//-----------------------------
//Liquid stuff
//-----------------------------
@Override
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side)
{
if(type == Liquid.WATER)
{
if(this.water < this.getLiquidCapacity(Liquid.WATER))
{
int rej = Math.max((this.water + vol) - this.getLiquidCapacity(Liquid.WATER), 0);
this.water += vol - rej;
return rej;
}
else
{
var1 = 100;
}
return var1;
}
@Override
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side) {
if(type == Liquid.STEAM)
{
int rejectedSteam = Math.max((this.steamStored + vol) - this.getLiquidCapacity(Liquid.STEAM), 0);
this.steamStored += vol - rejectedSteam;
return rejectedSteam;
}
if(type == Liquid.WATER)
{
int rejectedWater = Math.max((this.waterStored + vol) - this.getLiquidCapacity(Liquid.WATER), 0);
this.waterStored += vol - rejectedWater;
return rejectedWater;
}
return vol;
}
@Override
public boolean canRecieveLiquid(Liquid type,ForgeDirection side) {
if(type == Liquid.WATER)
{
return true;
}
return false;
}
@Override
public int getStoredLiquid(Liquid type) {
if(type == Liquid.WATER)
{
return this.waterStored;
}
if(type == Liquid.STEAM)
{
return this.steamStored;
}
return 0;
}
@Override
public int getLiquidCapacity(Liquid type) {
if(type ==Liquid.WATER)
{
return 14;
}
if(type == Liquid.STEAM)
{
return steamMax;
}
return 0;
}
@Override
public int onProduceLiquid(Liquid type, int maxVol, ForgeDirection side) {
if(type == Liquid.STEAM)
{
if(steamStored > 1)
TileEntity te = worldObj.getBlockTileEntity(xCoord, yCoord+1, zCoord);
if( te instanceof IStorageTank)
{
this.steamStored -= 1;
return 1;
return ((IStorageTank)te).onReceiveLiquid(type, vol, ForgeDirection.UNKNOWN);
}
}
return 0;
}
@Override
public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
if(type == Liquid.STEAM)
{
return true;
}
return false;
}
@Override
public int presureOutput(Liquid type, ForgeDirection side) {
if(type == Liquid.STEAM)
{
return (this.steamStored/this.steamMax)*40 +60;
}
return 0;
}
@Override
public boolean canProducePresure(Liquid type, ForgeDirection side)
}else
if(type == Liquid.STEAM)
{
if(type == Liquid.STEAM)
if(this.steam < this.getLiquidCapacity(Liquid.STEAM))
{
return true;
int rej = Math.max((this.steam + vol) - this.getLiquidCapacity(Liquid.STEAM), 0);
this.steam += vol - rej;
return rej;
}
else
{
TileEntity te = worldObj.getBlockTileEntity(xCoord, yCoord-1, zCoord);
if( te instanceof IStorageTank)
{
return ((IStorageTank)te).onReceiveLiquid(type, vol, ForgeDirection.UNKNOWN);
}
}
return false;
}
return vol;
}
@Override
public boolean canRecieveLiquid(Liquid type, ForgeDirection s) {
if(type == Liquid.WATER)
{
return true;
}else
if(type == Liquid.STEAM && s == ForgeDirection.UNKNOWN)
{
return true;
}
return false;
}
@Override
public int getStoredLiquid(Liquid type) {
if(type == Liquid.WATER)
{
return this.water;
}else
if(type == Liquid.STEAM)
{
return this.steam;
}
return 0;
}
@Override
public int getLiquidCapacity(Liquid type) {
if(type == Liquid.WATER)
{
return 14;
}else
if(type == Liquid.STEAM)
{
return 140;
}
return 0;
}
@Override
public int onProduceLiquid(Liquid type, int vol, ForgeDirection side) {
if(type == Liquid.STEAM)
{
//TODO setup the actual math for this
if(vol < this.steam)
{
this.steam -= vol;
return vol;
}else
if(this.steam >= 1)
{
this.steam -= 1;
return 1;
}
}
return 0;
}
@Override
public boolean canProduceLiquid(Liquid type, ForgeDirection side) {
if(type == Liquid.STEAM)
{
return true;
}
return false;
}
@Override
public boolean canProducePresure(Liquid type, ForgeDirection side) {
if(type == Liquid.STEAM)
{
return true;
}
return false;
}
@Override
public int presureOutput(Liquid type, ForgeDirection side) {
if(type == Liquid.STEAM)
{
return 100;
}
return 0;
}
//-----------------------------
//Data
//-----------------------------
public Object[] getSendData()
{
return new Object[]{this.water,this.steam,this.heat,this.hullHeat};
}
@Override
public void handlePacketData(NetworkManager network, int packetType,
Packet250CustomPayload packet, EntityPlayer player,
ByteArrayDataInput dataStream) {
try{
this.water = dataStream.readInt();
this.steam = dataStream.readInt();
this.heat = dataStream.readInt();
this.hullHeat = dataStream.readInt();
}catch(Exception e)
{
e.printStackTrace();
}
}
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("water", this.water);
par1NBTTagCompound.setInteger("steam", this.steam);
par1NBTTagCompound.setInteger("heat", this.heat);
par1NBTTagCompound.setInteger("hullHeat", this.hullHeat);
}
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.water = par1NBTTagCompound.getInteger("water");
this.steam = par1NBTTagCompound.getInteger("steam");
this.heat = par1NBTTagCompound.getInteger("heat");
this.hullHeat = par1NBTTagCompound.getInteger("hullHeat");
}
}

View file

@ -8,6 +8,7 @@ import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
import steampower.SteamPowerMain;
import steampower.TileEntityMachine;
@ -87,7 +88,7 @@ public class TileEntityFireBox extends TileEntityMachine implements IPacketRecei
this.itemCookTime --;
if(isConnected)
{
this.generateRate = Math.min(this.generateRate+Math.min((this.generateRate)+1, 1), this.maxGenerateRate/20);
this.generateRate = Math.min(this.generateRate+Math.min((this.generateRate)+1, 1), this.maxGenerateRate/10);
}
}
//Loose heat when the generator is not connected or if there is no coal in the inventory.
@ -142,7 +143,7 @@ public class TileEntityFireBox extends TileEntityMachine implements IPacketRecei
public void addConnection()
{
connectedUnits = 0;
TileEntity[] aEntity = MHelper.getSourounding(this);
TileEntity[] aEntity = MHelper.getSourounding(worldObj,xCoord, yCoord, zCoord);
for(int i = 0; i<6; i++)
{
@ -180,9 +181,12 @@ public class TileEntityFireBox extends TileEntityMachine implements IPacketRecei
public String getInvName() {
return "FireBox";
}
public float onProduceHeat(float jouls, int side) {
// TODO Auto-generated method stub
return Math.min(generateRate*getTickInterval(),jouls);
public float onProduceHeat(float jouls, ForgeDirection side) {
if(side == ForgeDirection.UP)
{
return Math.min(generateRate,jouls);
}
return 0;
}
@Override
public Object[] getSendData()

View file

@ -30,14 +30,11 @@ public class RenderPipe extends TileEntitySpecialRenderer
//Texture file
type = tileEntity.getType();
size = tileEntity.getSize();
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
if(size == 6)
{
switch(type.ordinal())
{
case 0: bindTextureByName(BasicPipesMain.textureFile+"/pipes/SixSteamPipe.png");break;
@ -53,7 +50,6 @@ public class RenderPipe extends TileEntitySpecialRenderer
if(tileEntity.connectedBlocks[5] != null) SixPipe.renderRight();
if(tileEntity.connectedBlocks[4] != null) SixPipe.renderLeft();
SixPipe.renderMiddle();
}
GL11.glPopMatrix();
}

View file

@ -6,7 +6,6 @@ import net.minecraft.src.StatCollector;
import org.lwjgl.opengl.GL11;
import steampower.turbine.ContainerGenerator;
import steampower.turbine.TileEntitySteamPiston;
import universalelectricity.electricity.ElectricInfo;
import universalelectricity.electricity.ElectricInfo.ElectricUnit;
@ -20,7 +19,7 @@ import universalelectricity.electricity.ElectricInfo.ElectricUnit;
public GUISteamPiston(InventoryPlayer par1InventoryPlayer, TileEntitySteamPiston tileEntity)
{
super(new ContainerGenerator(par1InventoryPlayer, tileEntity));
super(new ContainerFake(par1InventoryPlayer, tileEntity));
this.tileEntity = tileEntity;
}

View file

@ -7,10 +7,8 @@ import net.minecraft.src.StatCollector;
import org.lwjgl.opengl.GL11;
import basicpipes.pipes.api.Liquid;
import steampower.boiler.ContainerBoiler;
import steampower.boiler.TileEntityBoiler;
import basicpipes.pipes.api.Liquid;
public class GuiBoiler extends GuiContainer
{
@ -18,7 +16,7 @@ public class GuiBoiler extends GuiContainer
public GuiBoiler(InventoryPlayer par1InventoryPlayer, TileEntityBoiler par2TileEntityGrinder)
{
super(new ContainerBoiler(par1InventoryPlayer, par2TileEntityGrinder));
super(new ContainerFake(par1InventoryPlayer, par2TileEntityGrinder));
this.boilerInventory = par2TileEntityGrinder;
}
@ -51,23 +49,27 @@ public class GuiBoiler extends GuiContainer
int var8;
int var9;
int var10;
if (this.boilerInventory.waterStored > 0)
if (this.boilerInventory.getStoredLiquid(Liquid.WATER)> 0)
{
var7 = boilerInventory.getStoredLiquid(Liquid.WATER)*4 + 1;
this.drawTexturedModalRect(var5 + 29, var6 + 72 - var7, 176, 148 - var7, 23, var7);
}
if (this.boilerInventory.steamStored > 0)
if (this.boilerInventory.getStoredLiquid(Liquid.STEAM) > 0)
{
var8 = boilerInventory.steamStored/14*4 + 1;
var8 = boilerInventory.getStoredLiquid(Liquid.STEAM)/14*4 + 1;
this.drawTexturedModalRect(var5 + 108, var6 + 72 - var8, 176, 90 - var8, 23, var8);
}
float precentH = Math.min(boilerInventory.hullHeat/1000 + 1, 10);
var9 = (int) Math.min(precentH*3.0F,30);
this.drawTexturedModalRect(var5 + 59, var6 + 70 - var9, 199, 71 - var9, 9, var9);
float precentSH = this.boilerInventory.heatStored/1000;
float precentSH = this.boilerInventory.heat/1000;
var10 = (int) Math.round(precentSH*5.33);
this.drawTexturedModalRect(var5 + 78, var6 + 16, 176, 14, var10, 16);
//debug
this.fontRenderer.drawString("NonGraphic Debug", (int)(200), 90, 000000);
this.fontRenderer.drawString("Water:"+this.boilerInventory.water+"/14", (int)(200), 100, 000000);
this.fontRenderer.drawString("Steam:"+this.boilerInventory.steam+"/140", (int)(200), 110, 000000);
}
public static String getWattDisplay(int watts)