diff --git a/src/common/basicpipes/LTanks/TileEntityLTank.java b/src/common/basicpipes/LTanks/TileEntityLTank.java new file mode 100644 index 00000000..a5547fb3 --- /dev/null +++ b/src/common/basicpipes/LTanks/TileEntityLTank.java @@ -0,0 +1,197 @@ +package basicpipes.LTanks; + +import com.google.common.io.ByteArrayDataInput; + +import universalelectricity.network.IPacketReceiver; +import universalelectricity.network.PacketManager; +import universalelectricity.prefab.Vector3; +import basicpipes.BasicPipesMain; +import basicpipes.pipes.api.ILiquidConsumer; +import basicpipes.pipes.api.ILiquidProducer; +import basicpipes.pipes.api.Liquid; +import basicpipes.pipes.api.MHelper; +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.ItemStack; +import net.minecraft.src.NBTTagCompound; +import net.minecraft.src.NBTTagList; +import net.minecraft.src.NetworkManager; +import net.minecraft.src.Packet; +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 TileEntity[] cc = {null,null,null,null,null,null}; +public Liquid type = Liquid.DEFUALT; +public int LStored = 0; +public int pLStored = 0; +public int LMax = 4; +private int count = 0; +private int count2 = 0; +private boolean firstUpdate = true; +public void updateEntity() +{ + if(++count >= 10) + { + count = 0; + this.cc = MHelper.getSourounding(this); + if(!worldObj.isRemote) + { + MHelper.shareLiquid(this, type, LStored); + if(firstUpdate ||(this.LStored != pLStored)|| count2 >= 100) + { + count2 = 0; + firstUpdate = false; + Packet packet = PacketManager.getPacket(BasicPipesMain.channel, this, new Object[]{type.ordinal(),LStored}); + PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 20); + } + this.pLStored = this.LStored; + } + } +} +public void writeToNBT(NBTTagCompound nbt) +{ + super.writeToNBT(nbt); + nbt.setInteger("Vol", this.LStored); + nbt.setInteger("type", this.type.ordinal()); +} + +@Override +public void readFromNBT(NBTTagCompound nbt) +{ + super.readFromNBT(nbt); + this.LStored = nbt.getInteger("Vol"); + this.type = Liquid.getLiquid(nbt.getInteger("type")); +} + +//-------------------- +//Liquid stuff +//------------------------------------ +@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; + } + return vol; +} + +@Override +public boolean canRecieveLiquid(Liquid type, ForgeDirection side) { + if(type == this.type) + { + if(this.type.isGas && side == ForgeDirection.UP) + { + return false; + } + if(!this.type.isGas && side == ForgeDirection.DOWN) + { + return false; + } + return true; + } + return false; +} + +@Override +public int getStoredLiquid(Liquid type) { + if(type == this.type) + { + return LStored; + } + return 0; +} + +@Override +public int getLiquidCapacity(Liquid type) { + if(type == this.type) + { + return LMax; + } + return 0; +} + +public Liquid getType() { + // TODO Auto-generated method stub + return type; +} + +@Override +public int onProduceLiquid(Liquid type, int vol, ForgeDirection side) { + if(type == this.type) + { + 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; + } + return 0; +} + +@Override +public boolean canProduceLiquid(Liquid type, ForgeDirection side) { + if(type == this.type) + { + if(this.type.isGas && side == ForgeDirection.UP) + { + return true; + } + if(!this.type.isGas && side == ForgeDirection.DOWN) + { + return true; + } + } + return false; +} + +@Override +public boolean canProducePresure(Liquid type, ForgeDirection side) { + if(type == this.type) + { + if(this.type.isGas && side == ForgeDirection.UP) + { + return true; + } + if(!this.type.isGas && side == ForgeDirection.DOWN) + { + return true; + } + } + return false; +} + +@Override +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 0; +} + + +@Override +public void handlePacketData(NetworkManager network, + Packet250CustomPayload packet, EntityPlayer player, + ByteArrayDataInput dataStream) { + try + { + this.type = Liquid.getLiquid(dataStream.readInt()); + this.LStored = dataStream.readInt(); + }catch(Exception e) + { + e.printStackTrace(); + System.out.print("Fail reading data for Storage tank \n"); + } + +} +} diff --git a/src/common/basicpipes/conductors/ItemGuage.java b/src/common/basicpipes/conductors/ItemGuage.java index 35902ad0..991183b1 100644 --- a/src/common/basicpipes/conductors/ItemGuage.java +++ b/src/common/basicpipes/conductors/ItemGuage.java @@ -67,8 +67,6 @@ public class ItemGuage extends Item print = typeName +" " + steam +" @ "+pressure+"PSI"; player.sendChatToPlayer(print); - player.sendChatToPlayer("hPre: "+pipeEntity.hPressure+" hPPre:"+pipeEntity.hPProducer); - player.sendChatToPlayer("cUnits: "+pipeEntity.connectedUnits); return true; } if(blockEntity instanceof IMechanical) diff --git a/src/common/basicpipes/conductors/TileEntityPipe.java b/src/common/basicpipes/conductors/TileEntityPipe.java index 7703c118..10ca4e98 100644 --- a/src/common/basicpipes/conductors/TileEntityPipe.java +++ b/src/common/basicpipes/conductors/TileEntityPipe.java @@ -20,6 +20,7 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke public int capacity = 2; private int count = 0; + private int count2 = 0; public int presure = 0; public int connectedUnits = 0; public int hPressure = 0; @@ -87,8 +88,9 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke BlockPipe.updateConductorTileEntity(this.worldObj, this.xCoord, this.yCoord, this.zCoord); if(!this.worldObj.isRemote) { - if(firstUpdate) - { firstUpdate = false; + 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); } @@ -132,7 +134,7 @@ public class TileEntityPipe extends TileEntity implements ILiquidConsumer,IPacke } //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 && this.liquidStored > 0) + if(this.connectedUnits > 0 && this.presure > 0) { for(int i = 0; i < 6; i++) { diff --git a/src/common/basicpipes/machines/TileEntityPump.java b/src/common/basicpipes/machines/TileEntityPump.java index 05b39a34..5485974a 100644 --- a/src/common/basicpipes/machines/TileEntityPump.java +++ b/src/common/basicpipes/machines/TileEntityPump.java @@ -6,7 +6,7 @@ import universalelectricity.implement.IElectricityReceiver; import universalelectricity.prefab.TileEntityElectricityReceiver; import basicpipes.pipes.api.ILiquidProducer; import basicpipes.pipes.api.Liquid; -import basicpipes.pipes.api.TradeHelper; +import basicpipes.pipes.api.MHelper; public class TileEntityPump extends TileEntityElectricityReceiver implements ILiquidProducer,IElectricityReceiver { int dCount = 0; @@ -37,7 +37,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements ILi if(count++ >= 20) { count = 0; - sList = TradeHelper.getSourounding(this); + sList = MHelper.getSourounding(this); int bBlock = worldObj.getBlockId(xCoord, yCoord -1, zCoord); Liquid bellow = Liquid.getLiquidByBlock(bBlock); diff --git a/src/common/basicpipes/machines/TileEntityValve.java b/src/common/basicpipes/machines/TileEntityValve.java index 7542310f..3e322b2e 100644 --- a/src/common/basicpipes/machines/TileEntityValve.java +++ b/src/common/basicpipes/machines/TileEntityValve.java @@ -5,7 +5,7 @@ import net.minecraftforge.common.ForgeDirection; import basicpipes.conductors.TileEntityPipe; import basicpipes.pipes.api.ILiquidConsumer; import basicpipes.pipes.api.Liquid; -import basicpipes.pipes.api.TradeHelper; +import basicpipes.pipes.api.MHelper; public class TileEntityValve extends TileEntity implements ILiquidConsumer { Liquid type = Liquid.DEFUALT; @@ -55,7 +55,7 @@ boolean on = false; case 4: deltaX++;break; } - connected = TradeHelper.getSourounding(this); + connected = MHelper.getSourounding(this); for(int i = 0;i<6;i++) { if(!(connected[i] instanceof TileEntityPipe)) diff --git a/src/common/basicpipes/mcmod.info b/src/common/basicpipes/mcmod.info index 72a86a53..f71701bd 100644 --- a/src/common/basicpipes/mcmod.info +++ b/src/common/basicpipes/mcmod.info @@ -3,7 +3,7 @@ "modid": "basicPipes", "name": "Basic Pipes", "description": "Simple liquid transport system for UE based mods", - "version": "r9", + "version": "1.8", "mcversion": "1.3.2", "url": "http://www.minecraftforge.net/forum/index.php/topic,604.0.html", "updateUrl": "", diff --git a/src/common/basicpipes/pipes/api/Liquid.java b/src/common/basicpipes/pipes/api/Liquid.java index 807ca262..8312de39 100644 --- a/src/common/basicpipes/pipes/api/Liquid.java +++ b/src/common/basicpipes/pipes/api/Liquid.java @@ -9,30 +9,32 @@ import net.minecraft.src.Block; */ public enum Liquid { // -1 == null || unused - STEAM("Steam",false,true,-1,-1), - WATER("Water",false,false,Block.waterStill.blockID,Block.waterMoving.blockID), - LAVA("Lava",false,false,Block.lavaStill.blockID,Block.lavaMoving.blockID), - OIL("Oil",true,false,-1,-1),//BasicComponents.oilStill.blockID,BasicComponents.oilMoving.blockID), - Fuel("Fuel",true,false,-1,-1), - Air("Air",false,true,0,-1), - Methain("Methain",true,true,-1,-1), - BioFuel("BioFuel",true,false,-1,-1), - Coolent("Coolent",false,false,-1,-1), - NukeWaste("NukeWaste",false,false,-1,-1), - Ether("Ether",false,false,-1,-1), - DEFUALT("Empty",false,false,-1,-1); + STEAM("Steam",false,true,-1,-1,100), + WATER("Water",false,false,Block.waterStill.blockID,Block.waterMoving.blockID,32), + LAVA("Lava",false,false,Block.lavaStill.blockID,Block.lavaMoving.blockID,20), + OIL("Oil",true,false,-1,-1,32),//BasicComponents.oilStill.blockID,BasicComponents.oilMoving.blockID), + Fuel("Fuel",true,false,-1,-1,40), + Air("Air",false,true,0,-1,100), + Methain("Methain",true,true,-1,-1,100), + BioFuel("BioFuel",true,false,-1,-1,40), + Coolent("Coolent",false,false,-1,-1,40), + NukeWaste("NukeWaste",false,false,-1,-1,20), + Ether("Ether",false,false,-1,-1,100), + DEFUALT("Empty",false,false,-1,-1,0); public final boolean flamable;//can it catch on fire, not used but might be public final boolean isGas;//is it a gas, used to find if it floats public final int Still;//if there is a block of still liquid linked to this public final int Moving;//if there is a block of moving liquid linked to this - public final String lName; -private Liquid(String name,boolean flame,boolean gas,int block, int Moving) + public final String lName;//Default name for the liquid + public final int defaultPresure;//default pressure output of the liquid +private Liquid(String name,boolean flame,boolean gas,int block, int Moving,int dPressure) { this.flamable = flame; this.isGas = gas; this.Still = block; this.Moving = Moving; this.lName = name; + this.defaultPresure = dPressure; } /** * Only use this if you are converting from the old system diff --git a/src/common/basicpipes/pipes/api/MHelper.java b/src/common/basicpipes/pipes/api/MHelper.java new file mode 100644 index 00000000..3bc87ba7 --- /dev/null +++ b/src/common/basicpipes/pipes/api/MHelper.java @@ -0,0 +1,96 @@ +package basicpipes.pipes.api; + +import net.minecraft.src.TileEntity; +import net.minecraftforge.common.ForgeDirection; + +public class MHelper { +/** + * + * @param entity - entity at center of search + * @return an Array containing TileEntities around the TileEntity + */ + public static TileEntity[] getSourounding(TileEntity te) + { + 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); + if(aEntity instanceof TileEntity) + { + list[i] = aEntity; + } + } + return list; + } + /** + * Used to help trade liquid without having to do too much work + * @param blockEntity - tile entity trading the liquid + * @param type - liquid type being traded + * @param vol - the volume to be traded + * @return the remaining untraded liquid + */ + public static int shareLiquid(TileEntity te, Liquid type,int vol) + { + int currentVol = vol; + 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)) + { + currentVol = ((ILiquidConsumer) first).onReceiveLiquid(type, vol, st); + } + //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) + { + currentVol = ((ILiquidConsumer) sSide).onReceiveLiquid(type, vol, st); + } + } + //trades to the opposite of the first if anything is left + 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)) + { + currentVol = ((ILiquidConsumer) last).onReceiveLiquid(type, vol, st); + } + } + return Math.max(currentVol,0); + } + /** + * + * @param entity - entity in question + * @return 1-4 if corner 0 if not a corner + * you have to figure out which is which depending on what your using this for + * 1 should be north east 2 south east + */ + public static int corner(TileEntity entity) + { + TileEntity[] en = getSourounding(entity); + if(en[4] != null && en[2] != null && en[5] == null && en[3] == null) + { + return 3; + } + if(en[2] != null && en[5] != null && en[3] == null && en[4] == null) + { + return 4; + } + if(en[5] != null && en[3] != null && en[4] == null && en[2] == null) + { + return 1; + } + if(en[3] != null && en[4] != null && en[2] == null && en[5] == null) + { + return 2; + } + + return 0; + + } +} diff --git a/src/common/basicpipes/pipes/api/TradeHelper.java b/src/common/basicpipes/pipes/api/TradeHelper.java deleted file mode 100644 index ace51578..00000000 --- a/src/common/basicpipes/pipes/api/TradeHelper.java +++ /dev/null @@ -1,173 +0,0 @@ -package basicpipes.pipes.api; - -import net.minecraft.src.TileEntity; -import net.minecraftforge.common.ForgeDirection; - -public class TradeHelper { -/** - * - * @param entity - entity at center of search - * @return an Array containing found entities and nulls of nonEntities - */ - public static TileEntity[] getSourounding(TileEntity entity) - { - TileEntity[] list = new TileEntity[]{null,null,null,null,null,null}; - for(int i =0; i< 6;i++) - { - int x = entity.xCoord; - int y = entity.yCoord; - int z = entity.zCoord; - - switch(i) - { - case 0: y = y - 1;break;//down - case 1: y = y + 1;break;//up - case 2: z = z + 1;break;//north - case 3: z = z - 1;break;//south - case 4: x = x + 1;break;//east - case 5: x = x - 1;break;//west - } - TileEntity aEntity = entity.worldObj.getBlockTileEntity(x, y, z); - if(aEntity instanceof TileEntity) - { - list[i] = aEntity; - } - } - return list; - } - /** - * Only works for steam Power's boiler. Still needs recode to work for all things - * @param blockEntity - tile entity trading the liquid - * @param type - liquid type see chart for info - * @param rise - does the liquid rise up like a gas - * @return the remaining untraded liquid - */ - public static int shareLiquid(TileEntity blockEntity,Liquid type,boolean rise) - { - TileEntity[] connectedBlocks = getSourounding(blockEntity); - ILiquidConsumer blockMachine = (ILiquidConsumer) blockEntity; - int wSum = ((ILiquidConsumer)blockEntity).getStoredLiquid(type); - int ammountStored = blockMachine.getStoredLiquid(type); - int tankCount = 1; - boolean bottom = false; - TileEntity firstEntity = null; - TileEntity secondEntity = null; - if(rise) - { - firstEntity = connectedBlocks[1]; - secondEntity = connectedBlocks[0]; - } - else - { - firstEntity = connectedBlocks[0]; - secondEntity = connectedBlocks[1]; - } - //checks wether or not the block bellow it is a tank to move liquid too - if(firstEntity instanceof ILiquidConsumer) - { - int bWater = ((ILiquidConsumer) firstEntity).getStoredLiquid(type); - int bMax = ((ILiquidConsumer) firstEntity).getLiquidCapacity(type); - //checks if that tank has room to get liquid. - - if(bWater < bMax) - { - int tradeVol = 0; - int emptyVol = Math.max( bMax - bWater,0); - tradeVol = Math.min(emptyVol, ammountStored); - int rejected = ((ILiquidConsumer) firstEntity).onReceiveLiquid(type, tradeVol, ForgeDirection.getOrientation(1)); - ammountStored = ammountStored + rejected - tradeVol; - wSum -= tradeVol; - } - else - { - bottom = true; - } - } - else - { - //there was no tank bellow this tank - bottom = true; - } - //if this is the bottom tank or bottom tank is full. Update average water ammount. - if(bottom) - { - //get average water around center tank - for(int i = 2; i<6;i++) - { - TileEntity entityA = connectedBlocks[i]; - if(entityA instanceof ILiquidConsumer) - { - //if is a tank add to the sum - wSum += ((ILiquidConsumer) entityA).getStoredLiquid(type); - tankCount += 1; - } - } - - //if this is the bottom tank or bottom tank is full then trade liquid with tanks around it. - for(int i = 2; i<6;i++) - { - int average = Math.round((float)wSum / (float)tankCount);// takes the sum and makes it an average - int tradeSum = 0; - TileEntity entity = connectedBlocks[i]; - if(entity instanceof ILiquidConsumer) - { - int targetW = ((ILiquidConsumer) entity).getStoredLiquid(type); - if(targetW < average) - { - tradeSum = Math.min(average, ammountStored); //gets the ammount to give to the target tank - int rejectedAm = ((ILiquidConsumer) entity).onReceiveLiquid(type, tradeSum, ForgeDirection.getOrientation(i)); //send that ammount with safty incase some comes back - ammountStored =rejectedAm + ammountStored - tradeSum; //counts up current water sum after trade - } - } - } - - if(secondEntity instanceof ILiquidConsumer) - { - int bWater = ((ILiquidConsumer) secondEntity).getStoredLiquid(type); - int bMax = ((ILiquidConsumer) secondEntity).getLiquidCapacity(type); - if(bottom && ammountStored > 0) - { - if(bWater < bMax) - { - int emptyVolS = Math.max( bMax - bWater,0); - int tradeVolS = Math.min(emptyVolS, ammountStored); - int rejectedS = ((ILiquidConsumer) secondEntity).onReceiveLiquid(type, tradeVolS, ForgeDirection.getOrientation(0));; - ammountStored =rejectedS + ammountStored - tradeVolS; - wSum -= tradeVolS; - } - } - } - } - return ammountStored; - } - /** - * - * @param entity - entity in question - * @return 1-4 if corner 0 if not a corner - * you have to figure out which is which depending on what your using this for - * 1 should be north east 2 south east - */ - public static int corner(TileEntity entity) - { - TileEntity[] en = getSourounding(entity); - if(en[4] != null && en[2] != null && en[5] == null && en[3] == null) - { - return 1; - } - if(en[2] != null && en[5] != null && en[3] == null && en[4] == null) - { - return 2; - } - if(en[5] != null && en[3] != null && en[4] == null && en[2] == null) - { - return 3; - } - if(en[3] != null && en[4] != null && en[2] == null && en[5] == null) - { - return 4; - } - - return 0; - - } -} diff --git a/src/common/steampower/TradeHelper.java b/src/common/steampower/TradeHelper.java deleted file mode 100644 index f7ca41d8..00000000 --- a/src/common/steampower/TradeHelper.java +++ /dev/null @@ -1,175 +0,0 @@ -package steampower; - -import basicpipes.pipes.api.ILiquidConsumer; -import basicpipes.pipes.api.Liquid; -import net.minecraft.src.TileEntity; -import net.minecraftforge.common.ForgeDirection; - -public class TradeHelper { -/** - * - * @param entity - entity at center of search - * @return an Array containing found entities and nulls of nonEntities - */ - public static TileEntity[] getSourounding(TileEntity entity) - { - TileEntity[] list = new TileEntity[]{null,null,null,null,null,null}; - for(int i =0; i< 6;i++) - { - int x = entity.xCoord; - int y = entity.yCoord; - int z = entity.zCoord; - - switch(i) - { - case 0: y = y - 1;break;//down - case 1: y = y + 1;break;//up - case 2: z = z + 1;break;//north - case 3: z = z - 1;break;//south - case 4: x = x + 1;break;//east - case 5: x = x - 1;break;//west - } - TileEntity aEntity = entity.worldObj.getBlockTileEntity(x, y, z); - if(aEntity instanceof TileEntity) - { - list[i] = aEntity; - } - } - return list; - } - /** - * Only works for steam Power's boiler. Still needs recode to work for all things - * @param blockEntity - tile entity trading the liquid - * @param type - liquid type see chart for info - * @param rise - does the liquid rise up like a gas - * @return the remaining untraded liquid - */ - public static int shareLiquid(TileEntity blockEntity,Liquid type,boolean rise) - { - TileEntity[] connectedBlocks = getSourounding(blockEntity); - ILiquidConsumer blockMachine = (ILiquidConsumer) blockEntity; - int wSum = ((ILiquidConsumer)blockEntity).getStoredLiquid(type); - int ammountStored = blockMachine.getStoredLiquid(type); - int tankCount = 1; - boolean bottom = false; - TileEntity firstEntity = null; - TileEntity secondEntity = null; - if(rise) - { - firstEntity = connectedBlocks[1]; - secondEntity = connectedBlocks[0]; - } - else - { - firstEntity = connectedBlocks[0]; - secondEntity = connectedBlocks[1]; - } - //checks wether or not the block bellow it is a tank to move liquid too - if(firstEntity instanceof ILiquidConsumer) - { - int bWater = ((ILiquidConsumer) firstEntity).getStoredLiquid(type); - int bMax = ((ILiquidConsumer) firstEntity).getLiquidCapacity(type); - //checks if that tank has room to get liquid. - - if(bWater < bMax) - { - int tradeVol = 0; - int emptyVol = Math.max( bMax - bWater,0); - tradeVol = Math.min(emptyVol, ammountStored); - int rejected = ((ILiquidConsumer) firstEntity).onReceiveLiquid(type, tradeVol, ForgeDirection.getOrientation(1)); - ammountStored = ammountStored + rejected - tradeVol; - wSum -= tradeVol; - } - else - { - bottom = true; - } - } - else - { - //there was no tank bellow this tank - bottom = true; - } - //if this is the bottom tank or bottom tank is full. Update average water ammount. - if(bottom) - { - //get average water around center tank - for(int i = 2; i<6;i++) - { - TileEntity entityA = connectedBlocks[i]; - if(entityA instanceof ILiquidConsumer) - { - //if is a tank add to the sum - wSum += ((ILiquidConsumer) entityA).getStoredLiquid(type); - tankCount += 1; - } - } - - //if this is the bottom tank or bottom tank is full then trade liquid with tanks around it. - for(int i = 2; i<6;i++) - { - int average = Math.round((float)wSum / (float)tankCount);// takes the sum and makes it an average - int tradeSum = 0; - TileEntity entity = connectedBlocks[i]; - if(entity instanceof ILiquidConsumer) - { - int targetW = ((ILiquidConsumer) entity).getStoredLiquid(type); - if(targetW < average) - { - tradeSum = Math.min(average, ammountStored); //gets the ammount to give to the target tank - int rejectedAm = ((ILiquidConsumer) entity).onReceiveLiquid(type, tradeSum, ForgeDirection.getOrientation(i)); //send that ammount with safty incase some comes back - ammountStored =rejectedAm + ammountStored - tradeSum; //counts up current water sum after trade - } - } - } - - if(secondEntity instanceof ILiquidConsumer) - { - int bWater = ((ILiquidConsumer) secondEntity).getStoredLiquid(type); - int bMax = ((ILiquidConsumer) secondEntity).getLiquidCapacity(type); - if(bottom && ammountStored > 0) - { - if(bWater < bMax) - { - int emptyVolS = Math.max( bMax - bWater,0); - int tradeVolS = Math.min(emptyVolS, ammountStored); - int rejectedS = ((ILiquidConsumer) secondEntity).onReceiveLiquid(type, tradeVolS, ForgeDirection.getOrientation(0));; - ammountStored =rejectedS + ammountStored - tradeVolS; - wSum -= tradeVolS; - } - } - } - } - return ammountStored; - } - /** - * - * @param entity - entity in question - * @return 1-4 if corner 0 if not a corner - * you have to figure out which is which depending on what your using this for - * 1 should be north east 2 south east - */ - public static int corner(TileEntity entity) - { - TileEntity[] en = getSourounding(entity); - if(en[4] != null && en[2] != null && en[5] == null && en[3] == null) - { - return 1; - } - if(en[2] != null && en[5] != null && en[3] == null && en[4] == null) - { - return 2; - } - if(en[5] != null && en[3] != null && en[4] == null && en[2] == null) - { - return 3; - } - if(en[3] != null && en[4] != null && en[2] == null && en[5] == null) - { - return 4; - } - - return 0; - - } -} diff --git a/src/common/steampower/boiler/TileEntityBoiler.java b/src/common/steampower/boiler/TileEntityBoiler.java index bb22ac7a..c0c48107 100644 --- a/src/common/steampower/boiler/TileEntityBoiler.java +++ b/src/common/steampower/boiler/TileEntityBoiler.java @@ -12,13 +12,12 @@ import net.minecraft.src.TileEntity; import net.minecraftforge.common.ForgeDirection; import steampower.SteamPowerMain; import steampower.TileEntityMachine; -import steampower.TradeHelper; -import steampower.burner.TileEntityFireBox; import universalelectricity.network.IPacketReceiver; import basicpipes.pipes.api.IHeatProducer; 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; @@ -130,7 +129,7 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv { count = 0; //update/resets connection list - TileEntity[] entityList = TradeHelper.getSourounding(this); + TileEntity[] entityList = MHelper.getSourounding(this); tankCount = 0; for(int c = 0; c< 6; c++) { @@ -168,8 +167,8 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv emptyBuckets(); //adds water from container slot - this.waterStored = TradeHelper.shareLiquid(this, Liquid.WATER, false); - this.steamStored = TradeHelper.shareLiquid(this, Liquid.STEAM, true); + this.waterStored = MHelper.shareLiquid(this, Liquid.WATER, this.waterStored); + this.steamStored = MHelper.shareLiquid(this, Liquid.STEAM, this.steamStored); if(waterStored > 0 && hullHeated && heatStored > heatNeeded) diff --git a/src/common/steampower/burner/TileEntityFireBox.java b/src/common/steampower/burner/TileEntityFireBox.java index ee556fdb..6389dd84 100644 --- a/src/common/steampower/burner/TileEntityFireBox.java +++ b/src/common/steampower/burner/TileEntityFireBox.java @@ -8,15 +8,13 @@ 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; -import steampower.TradeHelper; import steampower.boiler.TileEntityBoiler; import universalelectricity.network.IPacketReceiver; - import basicpipes.pipes.api.IHeatProducer; +import basicpipes.pipes.api.MHelper; import com.google.common.io.ByteArrayDataInput; @@ -144,7 +142,7 @@ public class TileEntityFireBox extends TileEntityMachine implements IPacketRecei public void addConnection() { connectedUnits = 0; - TileEntity[] aEntity = TradeHelper.getSourounding(this); + TileEntity[] aEntity = MHelper.getSourounding(this); for(int i = 0; i<6; i++) { diff --git a/src/common/steampower/mcmod.info b/src/common/steampower/mcmod.info index 7a4a675c..bba7821a 100644 --- a/src/common/steampower/mcmod.info +++ b/src/common/steampower/mcmod.info @@ -3,7 +3,7 @@ "modid": "SteamPower", "name": "Steam Power", "description": "Basic coal fired power plant generator pack for UE", - "version": "r5", + "version": "1.8", "mcversion": "1.3.2", "url": "http://www.minecraftforge.net/forum/index.php/topic,222.0.html", "updateUrl": "", diff --git a/src/minecraft/basicpipes/renderTank/ModelLiquidTank.java b/src/minecraft/basicpipes/renderTank/ModelLiquidTank.java new file mode 100644 index 00000000..8375b443 --- /dev/null +++ b/src/minecraft/basicpipes/renderTank/ModelLiquidTank.java @@ -0,0 +1,427 @@ +// Date: 10/8/2012 7:31:40 PM +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package basicpipes.renderTank; + +import basicpipes.LTanks.TileEntityLTank; +import basicpipes.conductors.TileEntityPipe; +import net.minecraft.src.Entity; +import net.minecraft.src.ModelBase; +import net.minecraft.src.ModelRenderer; +import net.minecraft.src.TileEntity; +import net.minecraftforge.common.ForgeDirection; + +public class ModelLiquidTank extends ModelBase +{ + //fields + ModelRenderer Mid; + ModelRenderer Corner; + ModelRenderer Corner2; + ModelRenderer Corner3; + ModelRenderer Corner4; + ModelRenderer C8; + ModelRenderer C7; + ModelRenderer C6; + ModelRenderer C5; + ModelRenderer C4; + ModelRenderer C; + ModelRenderer C3; + ModelRenderer C2; + ModelRenderer GuageT; + ModelRenderer GuageB; + ModelRenderer Guage; + ModelRenderer GuageR; + ModelRenderer GuageGlass; + ModelRenderer GuageL; + + ModelRenderer GuageT2; + ModelRenderer GuageB2; + ModelRenderer Guage2; + ModelRenderer GuageR2; + ModelRenderer GuageGlass2; + ModelRenderer GuageL2; + + ModelRenderer GuageT3; + ModelRenderer GuageB3; + ModelRenderer Guage3; + ModelRenderer GuageR3; + ModelRenderer GuageGlass3; + ModelRenderer GuageL3; + + ModelRenderer GuageT4; + ModelRenderer GuageB4; + ModelRenderer Guage4; + ModelRenderer GuageR4; + ModelRenderer GuageGlass4; + ModelRenderer GuageL4; + + ModelRenderer CCBottom; + ModelRenderer CCRight; + ModelRenderer CCLeft; + ModelRenderer CCFront; + ModelRenderer CCBack; + ModelRenderer CCTop; + + public ModelLiquidTank() + { + textureWidth = 128; + textureHeight = 128; + + Mid = new ModelRenderer(this, 0, 50); + Mid.addBox(-6F, 0F, -6F, 12, 14, 12); + Mid.setRotationPoint(0F, 9F, 0F); + Mid.setTextureSize(128, 128); + Mid.mirror = true; + setRotation(Mid, 0F, 0F, 0F); + Corner = new ModelRenderer(this, 0, 30); + Corner.addBox(-1F, 0F, -1F, 2, 16, 2); + Corner.setRotationPoint(-7F, 8F, 7F); + Corner.setTextureSize(128, 128); + Corner.mirror = true; + setRotation(Corner, 0F, 0F, 0F); + Corner2 = new ModelRenderer(this, 0, 30); + Corner2.addBox(-1F, 0F, -1F, 2, 16, 2); + Corner2.setRotationPoint(-7F, 8F, -7F); + Corner2.setTextureSize(128, 128); + Corner2.mirror = true; + setRotation(Corner2, 0F, 0F, 0F); + Corner3 = new ModelRenderer(this, 0, 30); + Corner3.addBox(-1F, 0F, -1F, 2, 16, 2); + Corner3.setRotationPoint(7F, 8F, -7F); + Corner3.setTextureSize(128, 128); + Corner3.mirror = true; + setRotation(Corner3, 0F, 0F, 0F); + Corner4 = new ModelRenderer(this, 0, 30); + Corner4.addBox(-1F, 0F, -1F, 2, 16, 2); + Corner4.setRotationPoint(7F, 8F, 7F); + Corner4.setTextureSize(128, 128); + Corner4.mirror = true; + setRotation(Corner4, 0F, 0F, 0F); + C8 = new ModelRenderer(this, 9, 35); + C8.addBox(-1F, 0F, -1F, 2, 2, 12); + C8.setRotationPoint(6F, 22F, -5F); + C8.setTextureSize(128, 128); + C8.mirror = true; + setRotation(C8, 0F, 0F, 0F); + C7 = new ModelRenderer(this, 9, 35); + C7.addBox(-1F, 0F, -1F, 2, 2, 12); + C7.setRotationPoint(-6F, 8F, -5F); + C7.setTextureSize(128, 128); + C7.mirror = true; + setRotation(C7, 0F, 0F, 0F); + C6 = new ModelRenderer(this, 9, 35); + C6.addBox(-1F, 0F, -1F, 2, 2, 12); + C6.setRotationPoint(6F, 8F, -5F); + C6.setTextureSize(128, 128); + C6.mirror = true; + setRotation(C6, 0F, 0F, 0F); + C5 = new ModelRenderer(this, 9, 30); + C5.addBox(-1F, 0F, -1F, 12, 2, 2); + C5.setRotationPoint(-5F, 8F, 6F); + C5.setTextureSize(128, 128); + C5.mirror = true; + setRotation(C5, 0F, 0F, 0F); + C4 = new ModelRenderer(this, 9, 35); + C4.addBox(-1F, 0F, -1F, 2, 2, 12); + C4.setRotationPoint(-6F, 22F, -5F); + C4.setTextureSize(128, 128); + C4.mirror = true; + setRotation(C4, 0F, 0F, 0F); + C = new ModelRenderer(this, 9, 30); + C.addBox(-1F, 0F, -1F, 12, 2, 2); + C.setRotationPoint(-5F, 22F, 6F); + C.setTextureSize(128, 128); + C.mirror = true; + setRotation(C, 0F, 0F, 0F); + C3 = new ModelRenderer(this, 9, 30); + C3.addBox(-1F, 0F, -1F, 12, 2, 2); + C3.setRotationPoint(-5F, 8F, -6F); + C3.setTextureSize(128, 128); + C3.mirror = true; + setRotation(C3, 0F, 0F, 0F); + C2 = new ModelRenderer(this, 9, 30); + C2.addBox(-1F, 0F, -1F, 12, 2, 2); + C2.setRotationPoint(-5F, 22F, -6F); + C2.setTextureSize(128, 128); + C2.mirror = true; + setRotation(C2, 0F, 0F, 0F); + //G1-------------------------------------- + GuageT = new ModelRenderer(this, 54, 42); + GuageT.addBox(-1F, -1F, 0F, 2, 1, 2); + GuageT.setRotationPoint(0F, 12F, -8F); + GuageT.setTextureSize(128, 128); + GuageT.mirror = true; + setRotation(GuageT, 0F, 0F, 0F); + GuageB = new ModelRenderer(this, 54, 42); + GuageB.addBox(-1F, 8F, 0F, 2, 1, 2); + GuageB.setRotationPoint(0F, 12F, -8F); + GuageB.setTextureSize(128, 128); + GuageB.mirror = true; + setRotation(GuageB, 0F, 0F, 0F); + Guage = new ModelRenderer(this, 54, 32); + Guage.addBox(-1F, 0F, 0F, 2, 8, 1); + Guage.setRotationPoint(0F, 12F, -7F); + Guage.setTextureSize(128, 128); + Guage.mirror = true; + setRotation(Guage, 0F, 0F, 0F); + GuageR = new ModelRenderer(this, 44, 32); + GuageR.addBox(1F, -1F, -1F, 2, 10, 2); + GuageR.setRotationPoint(0F, 12F, -7F); + GuageR.setTextureSize(128, 128); + GuageR.mirror = true; + setRotation(GuageR, 0F, 0F, 0F); + GuageGlass = new ModelRenderer(this, 60, 32); + GuageGlass.addBox(-1F, 0F, 0F, 2, 8, 1); + GuageGlass.setRotationPoint(0F, 12F, -8F); + GuageGlass.setTextureSize(128, 128); + GuageGlass.mirror = true; + setRotation(GuageGlass, 0F, 0F, 0F); + GuageL = new ModelRenderer(this, 44, 32); + GuageL.addBox(-3F, -1F, -1F, 2, 10, 2); + GuageL.setRotationPoint(0F, 12F, -7F); + GuageL.setTextureSize(128, 128); + GuageL.mirror = true; + setRotation(GuageL, 0F, 0F, 0F); + //G2---------------------------------- + GuageT2 = new ModelRenderer(this, 54, 42); + GuageT2.addBox(-1F, -1F, 0F, 2, 1, 2); + GuageT2.setRotationPoint(-8F, 12F, 0F); + GuageT2.setTextureSize(128, 128); + GuageT2.mirror = true; + setRotation(GuageT2, 0F, 1.570796F, 0F); + GuageB2 = new ModelRenderer(this, 54, 42); + GuageB2.addBox(-1F, 8F, 0F, 2, 1, 2); + GuageB2.setRotationPoint(-8F, 12F, 0F); + GuageB2.setTextureSize(128, 128); + GuageB2.mirror = true; + setRotation(GuageB2, 0F, 1.570796F, 0F); + Guage2 = new ModelRenderer(this, 54, 32); + Guage2.addBox(-1F, 0F, 0F, 2, 8, 1); + Guage2.setRotationPoint(-7F, 12F, 0F); + Guage2.setTextureSize(128, 128); + Guage2.mirror = true; + setRotation(Guage2, 0F, 1.570796F, 0F); + GuageR2 = new ModelRenderer(this, 44, 32); + GuageR2.addBox(1F, -1F, -1F, 2, 10, 2); + GuageR2.setRotationPoint(-7F, 12F, 0F); + GuageR2.setTextureSize(128, 128); + GuageR2.mirror = true; + setRotation(GuageR2, 0F, 1.570796F, 0F); + GuageGlass2 = new ModelRenderer(this, 60, 32); + GuageGlass2.addBox(-1F, 0F, 0F, 2, 8, 1); + GuageGlass2.setRotationPoint(-8F, 12F, 0F); + GuageGlass2.setTextureSize(128, 128); + GuageGlass2.mirror = true; + setRotation(GuageGlass2, 0F, 1.570796F, 0F); + GuageL2 = new ModelRenderer(this, 44, 32); + GuageL2.addBox(-3F, -1F, -1F, 2, 10, 2); + GuageL2.setRotationPoint(-7F, 12F, 0F); + GuageL2.setTextureSize(128, 128); + GuageL2.mirror = true; + setRotation(GuageL2, 0F, 1.570796F, 0F); + //G3-------------------------------------- + GuageT3 = new ModelRenderer(this, 54, 42); + GuageT3.addBox(-1F, -1F, 0F, 2, 1, 2); + GuageT3.setRotationPoint(0F, 12F, 8F); + GuageT3.setTextureSize(128, 128); + GuageT3.mirror = true; + setRotation(GuageT3, 0F, 3.141593F, 0F); + GuageB3 = new ModelRenderer(this, 54, 42); + GuageB3.addBox(-1F, 8F, 0F, 2, 1, 2); + GuageB3.setRotationPoint(0F, 12F, 8F); + GuageB3.setTextureSize(128, 128); + GuageB3.mirror = true; + setRotation(GuageB3, 0F, 3.141593F, 0F); + Guage3 = new ModelRenderer(this, 54, 32); + Guage3.addBox(-1F, 0F, 0F, 2, 8, 1); + Guage3.setRotationPoint(0F, 12F, 7F); + Guage3.setTextureSize(128, 128); + Guage3.mirror = true; + setRotation(Guage3, 0F, 3.141593F, 0F); + GuageR3 = new ModelRenderer(this, 44, 32); + GuageR3.addBox(1F, -1F, -1F, 2, 10, 2); + GuageR3.setRotationPoint(0F, 12F, 7F); + GuageR3.setTextureSize(128, 128); + GuageR3.mirror = true; + setRotation(GuageR3, 0F, 3.141593F, 0F); + GuageGlass3 = new ModelRenderer(this, 60, 32); + GuageGlass3.addBox(-1F, 0F, 0F, 2, 8, 1); + GuageGlass3.setRotationPoint(0F, 12F, 8F); + GuageGlass3.setTextureSize(128, 128); + GuageGlass3.mirror = true; + setRotation(GuageGlass3, 0F, 3.141593F, 0F); + GuageL3 = new ModelRenderer(this, 44, 32); + GuageL3.addBox(-3F, -1F, -1F, 2, 10, 2); + GuageL3.setRotationPoint(0F, 12F, 7F); + GuageL3.setTextureSize(128, 128); + GuageL3.mirror = true; + setRotation(GuageL3, 0F, 3.141593F, 0F); + //G4------------------------------- + GuageT4 = new ModelRenderer(this, 54, 42); + GuageT4.addBox(-1F, -1F, 0F, 2, 1, 2); + GuageT4.setRotationPoint(8F, 12F, 0F); + GuageT4.setTextureSize(128, 128); + GuageT4.mirror = true; + setRotation(GuageT4, 0F, -1.570796F, 0F); + GuageB4 = new ModelRenderer(this, 54, 42); + GuageB4.addBox(-1F, 8F, 0F, 2, 1, 2); + GuageB4.setRotationPoint(8F, 12F, 0F); + GuageB4.setTextureSize(128, 128); + GuageB4.mirror = true; + setRotation(GuageB4, 0F, -1.570796F, 0F); + Guage4 = new ModelRenderer(this, 54, 32); + Guage4.addBox(-1F, 0F, 0F, 2, 8, 1); + Guage4.setRotationPoint(7F, 12F, 0F); + Guage4.setTextureSize(128, 128); + Guage4.mirror = true; + setRotation(Guage4, 0F, -1.570796F, 0F); + GuageR4 = new ModelRenderer(this, 44, 32); + GuageR4.addBox(1F, -1F, -1F, 2, 10, 2); + GuageR4.setRotationPoint(7F, 12F, 0F); + GuageR4.setTextureSize(128, 128); + GuageR4.mirror = true; + setRotation(GuageR4, 0F, -1.570796F, 0F); + GuageGlass4 = new ModelRenderer(this, 60, 32); + GuageGlass4.addBox(-1F, 0F, 0F, 2, 8, 1); + GuageGlass4.setRotationPoint(8F, 12F, 0F); + GuageGlass4.setTextureSize(128, 128); + GuageGlass4.mirror = true; + setRotation(GuageGlass4, 0F, -1.570796F, 0F); + GuageL4 = new ModelRenderer(this, 44, 32); + GuageL4.addBox(-3F, -1F, -1F, 2, 10, 2); + GuageL4.setRotationPoint(7F, 12F, 0F); + GuageL4.setTextureSize(128, 128); + GuageL4.mirror = true; + setRotation(GuageL4, 0F, -1.570796F, 0F); + //Pipe Connectors + CCBottom = new ModelRenderer(this, 0, 0); + CCBottom.addBox(-3F, -9F, -3F, 6, 1, 6); + CCBottom.setRotationPoint(0F, 15F, 0F); + CCBottom.setTextureSize(128, 128); + CCBottom.mirror = true; + setRotation(CCBottom, 3.141593F, 0F, 0F); + CCRight = new ModelRenderer(this, 0, 0); + CCRight.addBox(-3F, -8F, -3F, 6, 2, 6); + CCRight.setRotationPoint(0F, 15F, 0F); + CCRight.setTextureSize(128, 128); + CCRight.mirror = true; + setRotation(CCRight, 0F, 0F, -1.570796F); + CCLeft = new ModelRenderer(this, 0, 0); + CCLeft.addBox(-3F, -8F, -3F, 6, 2, 6); + CCLeft.setRotationPoint(0F, 15F, 0F); + CCLeft.setTextureSize(128, 128); + CCLeft.mirror = true; + setRotation(CCLeft, 0F, 0F, 1.570796F); + CCFront = new ModelRenderer(this, 0, 0); + CCFront.addBox(-3F, -8F, -3F, 6, 2, 6); + CCFront.setRotationPoint(0F, 15F, 0F); + CCFront.setTextureSize(128, 128); + CCFront.mirror = true; + setRotation(CCFront, 1.570796F, 0F, 0F); + CCBack = new ModelRenderer(this, 0, 0); + CCBack.addBox(-3F, -8F, -3F, 6, 2, 6); + CCBack.setRotationPoint(0F, 15F, 0F); + CCBack.setTextureSize(128, 128); + CCBack.mirror = true; + setRotation(CCBack, -1.570796F, 0F, 0F); + CCTop = new ModelRenderer(this, 0, 0); + CCTop.addBox(-3F, -7F, -3F, 6, 1, 6); + CCTop.setRotationPoint(0F, 15F, 0F); + CCTop.setTextureSize(128, 128); + CCTop.mirror = true; + setRotation(CCTop, 0F, 0F, 0F); + } + + public void renderMain(TileEntityLTank te ,float f5) + { + //render regardless of sides + Mid.render(f5); + Corner.render(f5); + Corner2.render(f5); + Corner3.render(f5); + Corner4.render(f5); + C8.render(f5); + C7.render(f5); + C6.render(f5); + C5.render(f5); + C4.render(f5); + C.render(f5); + C3.render(f5); + C2.render(f5); + CCTop.render(f5);CCBottom.render(f5); + //Front + if(te.cc[2] instanceof TileEntityPipe) + { + CCFront.render(f5); + }else + { + GuageT.render(f5); + GuageB.render(f5); + Guage.render(f5); + GuageR.render(f5); + GuageGlass.render(f5); + GuageL.render(f5); + } + //back + if(te.cc[3] instanceof TileEntityPipe) + { + CCBack.render(f5); + }else + { + GuageT3.render(f5); + Guage3.render(f5); + Guage3.render(f5); + GuageR3.render(f5); + GuageGlass3.render(f5); + GuageL3.render(f5); + } + //right + if(te.cc[4] instanceof TileEntityPipe) + { + CCRight.render(f5); + }else + { + GuageT4.render(f5); + Guage4.render(f5); + Guage4.render(f5); + GuageR4.render(f5); + GuageGlass4.render(f5); + GuageL4.render(f5); + } + //left + if(te.cc[5] instanceof TileEntityPipe) + { + CCLeft.render(f5); + }else + { + GuageT2.render(f5); + Guage2.render(f5); + Guage2.render(f5); + GuageR2.render(f5); + GuageGlass2.render(f5); + GuageL2.render(f5); + + } + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) + { + super.setRotationAngles(f, f1, f2, f3, f4, f5); + } + +} diff --git a/src/minecraft/basicpipes/renderTank/RenderLTank.java b/src/minecraft/basicpipes/renderTank/RenderLTank.java new file mode 100644 index 00000000..31897a9b --- /dev/null +++ b/src/minecraft/basicpipes/renderTank/RenderLTank.java @@ -0,0 +1,51 @@ +package basicpipes.renderTank; + +import net.minecraft.src.ModelBase; +import net.minecraft.src.TileEntity; +import net.minecraft.src.TileEntitySpecialRenderer; + +import org.lwjgl.opengl.GL11; + +import basicpipes.BasicPipesMain; +import basicpipes.ModelLargePipe; +import basicpipes.ModelPipe; +import basicpipes.LTanks.TileEntityLTank; +import basicpipes.conductors.TileEntityPipe; +import basicpipes.pipes.api.Liquid; + + +public class RenderLTank extends TileEntitySpecialRenderer +{ + private Liquid type = Liquid.DEFUALT; + private ModelLiquidTank model; + private int pos = 0; + + public RenderLTank() + { + model = new ModelLiquidTank(); + } + + public void renderAModelAt(TileEntityLTank te, double d, double d1, double d2, float f) + { + type = te.getType(); + pos = Math.min(te.getStoredLiquid(type),4); + GL11.glPushMatrix(); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); + GL11.glScalef(1.0F, -1F, -1F); + + switch(type.ordinal()) + { + //case 0: bindTextureByName(BasicPipesMain.textureFile+"/pipes/SixSteamPipe.png");break; + default:bindTextureByName(BasicPipesMain.textureFile+"/tanks/LiquidTank"+pos+".png"); break; + } + model.renderMain(te, 0.0625F); + GL11.glPopMatrix(); + + } + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) { + this.renderAModelAt((TileEntityLTank)tileEntity, var2, var4, var6, var8); + } + +} \ No newline at end of file diff --git a/src/minecraft/steampower/GUISteamPiston.java b/src/minecraft/steampower/GUISteamPiston.java index 3d220089..9ec3949c 100644 --- a/src/minecraft/steampower/GUISteamPiston.java +++ b/src/minecraft/steampower/GUISteamPiston.java @@ -34,8 +34,6 @@ import universalelectricity.electricity.ElectricInfo.ElectricUnit; String displayText = ""; String displayText2 = ""; String displayText3 = ""; - String displayText4 = ""; - String displayText5 = ""; /** if(tileEntity.connectedElectricUnit == null) { @@ -57,18 +55,13 @@ import universalelectricity.electricity.ElectricInfo.ElectricUnit; { //displayText = ElectricUnit.getWattDisplay((int)(tileEntity.generateRate*20)); displayText = "ForceOut: "+tileEntity.force+"N"; - } displayText2 = "water" + "-" + tileEntity.water; displayText3 = "steam" + "-" + tileEntity.steam; - - displayText4 = "Db:PacketsReceived " + "=" + tileEntity.pCount; - //displayText5 = "Debug:bforce" + "=" + tileEntity.bForce; + } this.fontRenderer.drawString(displayText, (int)(105-displayText.length()*1), 45, 4210752); this.fontRenderer.drawString(displayText2, (int)(105-displayText.length()*1), 55, 4210752); this.fontRenderer.drawString(displayText3, (int)(105-displayText.length()*1), 65, 4210752); - this.fontRenderer.drawString(displayText4, (int)(105-displayText.length()*1), 75, 4210752); - // this.fontRenderer.drawString(displayText5, (int)(105-displayText.length()*1), 85, 4210752); this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); } diff --git a/src/minecraft/steampower/RenderBoiler.java b/src/minecraft/steampower/RenderBoiler.java index 1af554d7..f837f16c 100644 --- a/src/minecraft/steampower/RenderBoiler.java +++ b/src/minecraft/steampower/RenderBoiler.java @@ -6,6 +6,7 @@ import net.minecraft.src.TileEntitySpecialRenderer; import org.lwjgl.opengl.GL11; import steampower.boiler.TileEntityBoiler; +import basicpipes.pipes.api.MHelper; public class RenderBoiler extends TileEntitySpecialRenderer { @@ -36,14 +37,14 @@ public class RenderBoiler extends TileEntitySpecialRenderer model.generalRender(0.0625F); } else - if(TradeHelper.corner(tileEntity) == 0 || ((TileEntityBoiler)tileEntity).tankCount > 2) + if(MHelper.corner(tileEntity) == 0 || ((TileEntityBoiler)tileEntity).tankCount > 2) { bindTextureByName(SteamPowerMain.textureFile+"tankBlock.png"); model2.renderBlock(0.0625F); } else { - int corner = TradeHelper.corner(tileEntity); + int corner = MHelper.corner(tileEntity); bindTextureByName(SteamPowerMain.textureFile+"CornerTank.png"); switch(corner) { diff --git a/src/minecraft/textures/tanks/GUITurret.png b/src/minecraft/textures/tanks/GUITurret.png new file mode 100644 index 00000000..ab367dbb Binary files /dev/null and b/src/minecraft/textures/tanks/GUITurret.png differ diff --git a/src/minecraft/textures/tanks/LiquidTank.png b/src/minecraft/textures/tanks/LiquidTank.png new file mode 100644 index 00000000..446b443d Binary files /dev/null and b/src/minecraft/textures/tanks/LiquidTank.png differ diff --git a/src/minecraft/textures/tanks/LiquidTank0.png b/src/minecraft/textures/tanks/LiquidTank0.png new file mode 100644 index 00000000..821f9a02 Binary files /dev/null and b/src/minecraft/textures/tanks/LiquidTank0.png differ diff --git a/src/minecraft/textures/tanks/LiquidTank1.png b/src/minecraft/textures/tanks/LiquidTank1.png new file mode 100644 index 00000000..4d427d6a Binary files /dev/null and b/src/minecraft/textures/tanks/LiquidTank1.png differ diff --git a/src/minecraft/textures/tanks/LiquidTank2.png b/src/minecraft/textures/tanks/LiquidTank2.png new file mode 100644 index 00000000..5e686ad6 Binary files /dev/null and b/src/minecraft/textures/tanks/LiquidTank2.png differ diff --git a/src/minecraft/textures/tanks/LiquidTank3.png b/src/minecraft/textures/tanks/LiquidTank3.png new file mode 100644 index 00000000..dec251e7 Binary files /dev/null and b/src/minecraft/textures/tanks/LiquidTank3.png differ diff --git a/src/minecraft/textures/tanks/LiquidTank4.png b/src/minecraft/textures/tanks/LiquidTank4.png new file mode 100644 index 00000000..f1112916 Binary files /dev/null and b/src/minecraft/textures/tanks/LiquidTank4.png differ