From 40f0710849471b70730e6834d06d5a16a3ed36c3 Mon Sep 17 00:00:00 2001 From: Rseifert Date: Mon, 27 Aug 2012 07:59:13 -0400 Subject: [PATCH] Update of code I really should have update git after i changed packages. Now there so many changes i really don't care to sort threw them. Main changes though are boiler tank model/code changed to show corner block when more than one boil is placed togther. Steam engine was changed to steam piston set and shows animation when running. FireBox now shows flames on the correct side. All models rotate as well but only when first placed. No wrench rotation support will be added. A lot of code cleanup and bug fixes including an infinite water loop in the boiler tanks. --- .../EUI/SteamPower/TileEntityMachine.java | 136 ----- .../SteamPower/boiler/TileEntityBoiler.java | 540 ------------------ .../SteamPower/burner/TileEntityFireBox.java | 301 ---------- .../{EUI => }/SteamPower/BlockMachine.java | 103 +--- .../{EUI => }/SteamPower/ItemCoalFuel.java | 2 +- .../{EUI => }/SteamPower/ItemMachine.java | 2 +- .../{EUI => }/SteamPower/ItemParts.java | 2 +- .../SteamPowerMain.java} | 63 +- .../{EUI => }/SteamPower/SteamProxy.java | 25 +- 1.3/common/SteamPower/TileEntityMachine.java | 261 +++++++++ .../SteamPower/TileEntityNuller.java | 2 +- .../api => SteamPower/ap}/IHeatConsumer.java | 2 +- .../api => SteamPower/ap}/IHeatProducer.java | 2 +- .../SteamPower/boiler/ContainerBoiler.java | 2 +- .../SteamPower/boiler/TileEntityBoiler.java | 329 +++++++++++ .../SteamPower/burner/ContainerFireBox.java | 2 +- .../SteamPower/burner/TileEntityFireBox.java | 203 +++++++ .../SteamPower/turbine/BlockEngine.java | 185 ++++++ .../turbine/ContainerGenerator.java | 2 +- 1.3/common/SteamPower/turbine/ItemEngine.java | 66 +++ .../turbine/TileEntityGenerator.java | 124 ++-- .../SteamPower/turbine/TileEntitytopGen.java | 69 +++ .../EUIClient/SteamPower/RenderBoiler.java | 30 - .../EUIClient/Textures/CornerTank.png | Bin 0 -> 2686 bytes 1.3/minecraft/EUIClient/Textures/Engine.png | Bin 0 -> 2686 bytes .../EUIClient/Textures/tankBlock.png | Bin 0 -> 2478 bytes .../SteamPower/GUIFireBox.java | 27 +- .../SteamPower/GUIGenerator.java | 23 +- .../{EUIClient => }/SteamPower/GuiBoiler.java | 13 +- 1.3/minecraft/SteamPower/ModelCenterTank.java | 59 ++ 1.3/minecraft/SteamPower/ModelCornerTank.java | 100 ++++ 1.3/minecraft/SteamPower/ModelEngine.java | 115 ++++ .../SteamPower/ModelFurnace.java | 2 +- .../{EUIClient => }/SteamPower/ModelTank.java | 5 +- .../ModelToyEngine.java} | 6 +- 1.3/minecraft/SteamPower/RenderBoiler.java | 62 ++ .../SteamPower/RenderFurnace.java | 18 +- .../SteamPower/RenderSteamEngine.java | 49 ++ .../RenderToyEngine.java} | 18 +- .../SteamPower/SteamClientProxy.java | 23 +- 40 files changed, 1736 insertions(+), 1237 deletions(-) delete mode 100644 1.3/common/EUI/SteamPower/TileEntityMachine.java delete mode 100644 1.3/common/EUI/SteamPower/boiler/TileEntityBoiler.java delete mode 100644 1.3/common/EUI/SteamPower/burner/TileEntityFireBox.java rename 1.3/common/{EUI => }/SteamPower/BlockMachine.java (76%) rename 1.3/common/{EUI => }/SteamPower/ItemCoalFuel.java (98%) rename 1.3/common/{EUI => }/SteamPower/ItemMachine.java (98%) rename 1.3/common/{EUI => }/SteamPower/ItemParts.java (98%) rename 1.3/common/{EUI/SteamPower/SteamPower.java => SteamPower/SteamPowerMain.java} (71%) rename 1.3/common/{EUI => }/SteamPower/SteamProxy.java (74%) create mode 100644 1.3/common/SteamPower/TileEntityMachine.java rename 1.3/common/{EUI => }/SteamPower/TileEntityNuller.java (95%) rename 1.3/common/{EUI/SteamPower/api => SteamPower/ap}/IHeatConsumer.java (96%) rename 1.3/common/{EUI/SteamPower/api => SteamPower/ap}/IHeatProducer.java (93%) rename 1.3/common/{EUI => }/SteamPower/boiler/ContainerBoiler.java (97%) create mode 100644 1.3/common/SteamPower/boiler/TileEntityBoiler.java rename 1.3/common/{EUI => }/SteamPower/burner/ContainerFireBox.java (97%) create mode 100644 1.3/common/SteamPower/burner/TileEntityFireBox.java create mode 100644 1.3/common/SteamPower/turbine/BlockEngine.java rename 1.3/common/{EUI => }/SteamPower/turbine/ContainerGenerator.java (97%) create mode 100644 1.3/common/SteamPower/turbine/ItemEngine.java rename 1.3/common/{EUI => }/SteamPower/turbine/TileEntityGenerator.java (78%) create mode 100644 1.3/common/SteamPower/turbine/TileEntitytopGen.java delete mode 100644 1.3/minecraft/EUIClient/SteamPower/RenderBoiler.java create mode 100644 1.3/minecraft/EUIClient/Textures/CornerTank.png create mode 100644 1.3/minecraft/EUIClient/Textures/Engine.png create mode 100644 1.3/minecraft/EUIClient/Textures/tankBlock.png rename 1.3/minecraft/{EUIClient => }/SteamPower/GUIFireBox.java (81%) rename 1.3/minecraft/{EUIClient => }/SteamPower/GUIGenerator.java (85%) rename 1.3/minecraft/{EUIClient => }/SteamPower/GuiBoiler.java (89%) create mode 100644 1.3/minecraft/SteamPower/ModelCenterTank.java create mode 100644 1.3/minecraft/SteamPower/ModelCornerTank.java create mode 100644 1.3/minecraft/SteamPower/ModelEngine.java rename 1.3/minecraft/{EUIClient => }/SteamPower/ModelFurnace.java (98%) rename 1.3/minecraft/{EUIClient => }/SteamPower/ModelTank.java (98%) rename 1.3/minecraft/{EUIClient/SteamPower/ModelEngine.java => SteamPower/ModelToyEngine.java} (99%) create mode 100644 1.3/minecraft/SteamPower/RenderBoiler.java rename 1.3/minecraft/{EUIClient => }/SteamPower/RenderFurnace.java (52%) create mode 100644 1.3/minecraft/SteamPower/RenderSteamEngine.java rename 1.3/minecraft/{EUIClient/SteamPower/RenderSteamEngine.java => SteamPower/RenderToyEngine.java} (52%) rename 1.3/minecraft/{EUIClient => }/SteamPower/SteamClientProxy.java (59%) diff --git a/1.3/common/EUI/SteamPower/TileEntityMachine.java b/1.3/common/EUI/SteamPower/TileEntityMachine.java deleted file mode 100644 index a57975dd..00000000 --- a/1.3/common/EUI/SteamPower/TileEntityMachine.java +++ /dev/null @@ -1,136 +0,0 @@ -package EUI.SteamPower; - -import com.google.common.io.ByteArrayDataInput; - -import universalelectricity.electricity.TileEntityElectricUnit; -import universalelectricity.extend.IRotatable; -import universalelectricity.network.IPacketReceiver; -import universalelectricity.network.PacketManager; -import net.minecraft.src.*; -import net.minecraftforge.common.ForgeDirection; -public class TileEntityMachine extends TileEntityElectricUnit -{ - public int facing = 0; - private int count = 0; - public TileEntity getSteamMachine(int i) - { - int x = this.xCoord; - int y = this.yCoord; - int z = this.zCoord; - - switch(i) - { - case 0: y = y - 1;break; - case 1: y = y + 1;break; - case 2: z = z + 1;break; - case 3: z = z - 1;break; - case 4: x = x + 1;break; - case 5: x = x - 1;break; - } - TileEntity aEntity = worldObj.getBlockTileEntity(x, y, z); - if(aEntity instanceof TileEntityMachine) - { - return aEntity; - } - - return null; - } - - public int getDirection() - { - return this.facing; - } - - public void setDirection(int i) - { - this.facing = i; - } - - @Override - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { - super.writeToNBT(par1NBTTagCompound); - par1NBTTagCompound.setInteger("facing", this.facing); - } - - @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { - super.readFromNBT(par1NBTTagCompound); - this.facing = par1NBTTagCompound.getInteger("facing"); - } - - @Override - public float electricityRequest() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public boolean canReceiveFromSide(ForgeDirection side) { - // TODO Auto-generated method stub - return false; - } - - - public int getSizeInventory() { - // TODO Auto-generated method stub - return 0; - } - - public ItemStack getStackInSlot(int var6) { - // TODO Auto-generated method stub - return null; - } - @Override - public boolean canUpdate() - { - return true; - } - public Object[] getSendData() - { - return new Object[]{}; - } - public int getNumSide(ForgeDirection side) - { - if(side == ForgeDirection.DOWN) - { - return 0; - } - if(side == ForgeDirection.UP) - { - return 1; - } - if(side == ForgeDirection.NORTH) - { - return 2; - } - if(side == ForgeDirection.SOUTH) - { - return 3; - } - if(side == ForgeDirection.WEST) - { - return 4; - } - if(side == ForgeDirection.EAST) - { - return 5; - } - return 0; - } - - public void onUpdate(float watts, float voltage, ForgeDirection side) - { - super.onUpdate(watts, voltage, side); - count++; - if(count >= 10) - { - if(!worldObj.isRemote) - { - PacketManager.sendTileEntityPacket(this, SteamPower.channel, getSendData()); - } - count = 0; - } - } -} \ No newline at end of file diff --git a/1.3/common/EUI/SteamPower/boiler/TileEntityBoiler.java b/1.3/common/EUI/SteamPower/boiler/TileEntityBoiler.java deleted file mode 100644 index 46ad17aa..00000000 --- a/1.3/common/EUI/SteamPower/boiler/TileEntityBoiler.java +++ /dev/null @@ -1,540 +0,0 @@ -package EUI.SteamPower.boiler; -import com.google.common.io.ByteArrayDataInput; - -import universalelectricity.network.IPacketReceiver; -import EUI.BasicPipes.pipes.api.ILiquidConsumer; -import EUI.BasicPipes.pipes.api.ILiquidProducer; -import EUI.SteamPower.SteamPower; -import EUI.SteamPower.TileEntityMachine; -import EUI.SteamPower.burner.TileEntityFireBox; -import net.minecraft.src.*; -import net.minecraftforge.common.ForgeDirection; -import net.minecraftforge.common.ISidedInventory; - -public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiver, IInventory, ISidedInventory,ILiquidProducer, ILiquidConsumer -{ - - /** - * The ItemStacks that hold the items currently being used in the furnace - */ - private ItemStack[] furnaceItemStacks = new ItemStack[1]; - - /** The number of ticks that the boiler will keep burning */ - public int RunTime = 0; - /** The ammount of energy stored before being add to run Timer */ - public int energyStore = 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 = 10000; - private int heatTick = 0; - int count = 0; - boolean hullHeated = false; - TileEntity[] connectedBlocks = {null, null, null, null, null, null}; - int steamMax = 140; - public boolean isBeingHeated = false; - /** - * Returns the number of slots in the inventory. - */ - public int getSizeInventory() - { - return this.furnaceItemStacks.length; - } - - /** - * Returns the stack in slot i - */ - public ItemStack getStackInSlot(int par1) - { - return this.furnaceItemStacks[par1]; - } - - public ItemStack decrStackSize(int par1, int par2) - { - if (this.furnaceItemStacks[par1] != null) - { - ItemStack var3; - - if (this.furnaceItemStacks[par1].stackSize <= par2) - { - var3 = this.furnaceItemStacks[par1]; - this.furnaceItemStacks[par1] = null; - return var3; - } - else - { - var3 = this.furnaceItemStacks[par1].splitStack(par2); - - if (this.furnaceItemStacks[par1].stackSize == 0) - { - this.furnaceItemStacks[par1] = null; - } - - return var3; - } - } - else - { - return null; - } - } - - /** - * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - - * like when you close a workbench GUI. - */ - public ItemStack getStackInSlotOnClosing(int par1) - { - if (this.furnaceItemStacks[par1] != null) - { - ItemStack var2 = this.furnaceItemStacks[par1]; - this.furnaceItemStacks[par1] = null; - return var2; - } - else - { - return null; - } - } - - /** - * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). - */ - public void setInventorySlotContents(int par1, ItemStack par2ItemStack) - { - this.furnaceItemStacks[par1] = par2ItemStack; - - if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) - { - par2ItemStack.stackSize = this.getInventoryStackLimit(); - } - } - - /** - * Returns the name of the inventory. - */ - public String getInvName() - { - return "container.boiler"; - } - - /** - * Reads a tile entity from NBT. - */ - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { - super.readFromNBT(par1NBTTagCompound); - NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); - this.furnaceItemStacks = new ItemStack[this.getSizeInventory()]; - - for (int var3 = 0; var3 < var2.tagCount(); ++var3) - { - NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); - byte var5 = var4.getByte("Slot"); - - if (var5 >= 0 && var5 < this.furnaceItemStacks.length) - { - this.furnaceItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4); - } - } - - this.RunTime = par1NBTTagCompound.getShort("BurnTime"); - this.energyStore = par1NBTTagCompound.getInteger("energyStore"); - 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("energyStore", (int)this.energyStore); - par1NBTTagCompound.setInteger("steamStore", (int)this.steamStored); - par1NBTTagCompound.setInteger("heatStore", (int)this.heatStored); - par1NBTTagCompound.setInteger("waterStore", (int)this.waterStored); - par1NBTTagCompound.setInteger("hullHeat", (int)this.hullHeat); - NBTTagList var2 = new NBTTagList(); - - for (int var3 = 0; var3 < this.furnaceItemStacks.length; ++var3) - { - if (this.furnaceItemStacks[var3] != null) - { - NBTTagCompound var4 = new NBTTagCompound(); - var4.setByte("Slot", (byte)var3); - this.furnaceItemStacks[var3].writeToNBT(var4); - var2.appendTag(var4); - } - } - - par1NBTTagCompound.setTag("Items", var2); - } - - /** - * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't - * this more of a set than a get?* - */ - public int getInventoryStackLimit() - { - return 64; - } - - /** - * 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. - */ - private boolean getIsHeated() { - TileEntity blockEntity = worldObj.getBlockTileEntity(this.xCoord, this.yCoord - 1, this.zCoord); - if(blockEntity instanceof TileEntityFireBox) - { - return true; - } - else - { - return false; - } - } - @Override - public void updateEntity(){ - count++; - if(count >= 20){ - isBeingHeated = getIsHeated(); - addWater();//adds water from container slot - shareWater(); - count = 0; - } - - //changed hullHeat max depending on contents of boiler - if(waterStored > 0) - { - hullHeatMax = 4700; - if(hullHeat > hullHeatMax) - { - hullHeat = 4700; - } - } - else - { - hullHeatMax = 10000; - } - //Checks if the hull is heated - if(hullHeat >= hullHeatMax) - { - hullHeated = true; - } - else - { - hullHeat = Math.min(hullHeat + heatStored, hullHeatMax); - } - //checks if heat level hit max - if(hullHeat >= 10000) - { - if(heatTick >= 1200) - { - // TODO remove block and set fire - heatTick = 0; - } - else - { - heatTick += 1; - } - } - - - int heatNeeded = SteamPower.boilerHeat; // kilo joules - //if hull heated do work - if(hullHeated) - { - if(heatStored > SteamPower.fireOutput) - { - if(waterStored >= 1){ - if(heatStored >= heatNeeded) - { - heatStored = Math.max(heatStored - heatNeeded, 0); - --waterStored; - steamStored = Math.min(steamStored + SteamPower.steamOutBoiler,this.steamMax); - } - } - else - { - heatStored = 0; - } - } - } - TileEntity blockE = worldObj.getBlockTileEntity(xCoord, yCoord -1, zCoord); - if(blockE instanceof TileEntityFireBox) - { - if(!hullHeated || waterStored > 0) - { - heatStored = (int) Math.min((heatStored + ((TileEntityFireBox)blockE).onProduceHeat(SteamPower.fireOutput, 1)), heatMax); - } - } - - } - public void shareWater() - { - int wSum = getStoredLiquid(1); //pre-sets the sum to the first tanks current volume - int tankCount = 1; //amount of tanks around this tank, used to get avarage liquid ammount - boolean bottom = false; // whether or not this tanks need to worry about what is bellow it - TileEntity entityBellow = worldObj.getBlockTileEntity(this.xCoord,this.yCoord-1, this.zCoord); - TileEntity entityAbove = worldObj.getBlockTileEntity(this.xCoord,this.yCoord+1, this.zCoord); - //checks wether or not the block bellow it is a tank to move liquid too - if(entityBellow instanceof TileEntityBoiler) - { - int bWater = ((TileEntityBoiler) entityBellow).getStoredLiquid(1); - int bMax = ((TileEntityBoiler) entityBellow).getLiquidCapacity(1); - //checks if that tank has room to get liquid. - - if(bWater < bMax) - { - int emptyVol = Math.max( bMax - bWater,0); - int tradeVol = Math.min(emptyVol, waterStored); - int rejected = ((TileEntityBoiler) entityBellow).onReceiveLiquid(1, tradeVol, ForgeDirection.getOrientation(1)); - waterStored = Math.max(waterStored - rejected,0); - wSum -= rejected; - } - else - { - bottom = true; - } - } - else - { - //there was no tank bellow this tank - bottom = true; - } - //if this is the bottom tank or bottom tank is full then trade liquid with tanks around it. - if(bottom) - { - //get average water around center tank - for(int i = 0; i<4;i++) - { - int x = this.xCoord; - int z = this.zCoord; - //switch to check each side TODO rewrite for side values - switch(i) - { - case 0: --x; - case 1: ++x; - case 2: --z; - case 3: ++z; - } - TileEntity entity = worldObj.getBlockTileEntity(x,this.yCoord, z); - if(entity instanceof TileEntityBoiler) - { - //if is a tank add to the sum - wSum += ((TileEntityBoiler) entity).getStoredLiquid(1); - tankCount += 1; - } - } - } - //transfers water - for(int i = 0; i<4;i++) - { - int average = wSum / tankCount;// takes the sum and makes it an average - int x2 = this.xCoord; - int z2 = this.zCoord; - int tradeSum = 0; - //switch to check each side TODO rewrite for side values - switch(i) - { - case 0: --x2; - case 1: ++x2; - case 2: --z2; - case 3: ++z2; - } - TileEntity entity = worldObj.getBlockTileEntity(x2,this.yCoord, z2); - if(entity instanceof TileEntityBoiler) - { - int targetW = ((TileEntityBoiler) entity).getStoredLiquid(1); - if(targetW < average) - { - tradeSum = Math.min(average, waterStored); //gets the ammount to give to the target tank - int rejectedAm = ((TileEntityBoiler) entity).onReceiveLiquid(1, tradeSum, ForgeDirection.getOrientation(i)); //send that ammount with safty incase some comes back - waterStored =rejectedAm + waterStored - tradeSum; //counts up current water sum after trade - } - } - } - if(entityAbove instanceof TileEntityBoiler) - { - int bWater = ((TileEntityBoiler) entityAbove).getStoredLiquid(1); - int bMax = ((TileEntityBoiler) entityAbove).getLiquidCapacity(1); - if(bottom && waterStored > 0) - { - if(bWater < bMax) - { - int emptyVolS = Math.max( bMax - bWater,0); - int tradeVolS = Math.min(emptyVolS, steamStored); - int rejectedS = ((TileEntityBoiler) entityAbove).addSteam(tradeVolS); - waterStored = Math.max(waterStored - rejectedS,0); - wSum -= rejectedS; - } - } - } - - - - - - } - public int addSteam(int watt) { - int rejectedElectricity = Math.max((this.steamStored + watt) - steamMax, 0); - this.steamStored += watt - rejectedElectricity; - return rejectedElectricity; - } - private void addWater() { - if (this.furnaceItemStacks[0] != null) - { - if(this.furnaceItemStacks[0].isItemEqual(new ItemStack(Item.bucketWater,1))) - { - if((int)waterStored < getLiquidCapacity(1)) - { - ++waterStored; - this.furnaceItemStacks[0] = new ItemStack(Item.bucketEmpty,1); - this.onInventoryChanged(); - } - } - } - - } - - /** - * Do not make give this method the name canInteractWith because it clashes with Container - */ - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) - { - return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; - } - - public void openChest() {} - - public void closeChest() {} - - public int precentHeated() { - int var1; - if(hullHeat < 100) - { - var1 = (int)(100 *(hullHeat/100)); - } - else - { - var1 = 100; - } - return var1; - } - @Override - public int onReceiveLiquid(int type, int vol, ForgeDirection side) { - if(type == 1) - { - int rejectedElectricity = Math.max((this.waterStored + vol) - this.getLiquidCapacity(1), 0); - this.waterStored += vol - rejectedElectricity; - return rejectedElectricity; - } - return vol; - } - - @Override - public boolean canRecieveLiquid(int type,ForgeDirection side) { - if(type == 1) - { - return true; - } - return false; - } - - @Override - public int getStoredLiquid(int type) { - if(type == 1) - { - return this.waterStored; - } - if(type == 0) - { - return this.steamStored; - } - return 0; - } - - @Override - public int getLiquidCapacity(int type) { - if(type ==1) - { - return 14; - } - if(type == 0) - { - return steamMax; - } - return 0; - } - @Override - public int onProduceLiquid(int type, int maxVol, ForgeDirection side) { - if(type == 0) - { - if(steamStored > 1) - { - this.steamStored -= 1; - return 1; - } - } - return 0; - } - - @Override - public boolean canProduceLiquid(int type, ForgeDirection side) { - if(type == 0) - { - return true; - } - return false; - } - - @Override - public int getStartInventorySide(ForgeDirection side) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getSizeInventorySide(ForgeDirection side) { - // TODO Auto-generated method stub - return 0; - } - public Object[] getSendData() - { - return new Object[]{(int)facing,(int)RunTime,(int)energyStore,(int)waterStored, - (int)steamStored,(int)heatStored,(int)hullHeat,(int)heatTick}; - } - - @Override - public void handlePacketData(NetworkManager network, - Packet250CustomPayload packet, EntityPlayer player, - ByteArrayDataInput dataStream) { - try{ - facing = dataStream.readInt(); - RunTime = dataStream.readInt(); - energyStore = dataStream.readInt(); - waterStored = dataStream.readInt(); - steamStored = dataStream.readInt(); - heatStored = dataStream.readInt(); - hullHeat = dataStream.readInt(); - heatTick = dataStream.readInt(); - } - catch(Exception e) - { - e.printStackTrace(); - } - - } - - } diff --git a/1.3/common/EUI/SteamPower/burner/TileEntityFireBox.java b/1.3/common/EUI/SteamPower/burner/TileEntityFireBox.java deleted file mode 100644 index c07c5fd2..00000000 --- a/1.3/common/EUI/SteamPower/burner/TileEntityFireBox.java +++ /dev/null @@ -1,301 +0,0 @@ -package EUI.SteamPower.burner; - -import com.google.common.io.ByteArrayDataInput; - -import universalelectricity.network.IPacketReceiver; -import net.minecraft.src.EntityPlayer; -import net.minecraft.src.IInventory; -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; -import net.minecraftforge.common.ForgeDirection; -import net.minecraftforge.common.ISidedInventory; -import EUI.SteamPower.SteamPower; -import EUI.SteamPower.TileEntityMachine; -import EUI.SteamPower.api.IHeatProducer; -import EUI.SteamPower.boiler.*; - -public class TileEntityFireBox extends TileEntityMachine implements IPacketReceiver,IInventory, ISidedInventory, IHeatProducer -{ - //max heat generated per second - - public boolean isConnected = false; - public TileEntity[] connectedBlocks = {null, null, null, null, null, null}; - private int connectedUnits = 0; - public static int maxGenerateRate = 250; - //Current generation rate based on hull heat. In TICKS. - public int generateRate = 0; - int count = 0; - public int itemCookTime = 0; - public ItemStack[] containingItems = new ItemStack[1]; - public void updateEntity() - {if (!this.worldObj.isRemote){ - - if(count == 20) - { - addConnection(); - sharCoal(); - - count = 0; - } - count++; - maxGenerateRate = SteamPower.fireOutput + (connectedUnits*5); - TileEntity blockEntity = worldObj.getBlockTileEntity(this.xCoord, this.yCoord + 1, this.zCoord); - if(blockEntity instanceof TileEntityBoiler) - { - isConnected = true; - } - else - { - isConnected = false; - } - //The top slot is for recharging items. Check if the item is a electric item. If so, recharge it. - if (this.containingItems[0] != null && isConnected) - { - if (this.containingItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex) - { - if(this.itemCookTime <= 0) - { - itemCookTime = Math.max(1600 - (int)(this.generateRate*20), 400); - this.decrStackSize(0, 1); - } - } - } - - } - //Starts generating electricity if the device is heated up - if (this.itemCookTime > 0) - { - this.itemCookTime --; - if(isConnected) - { - this.generateRate = Math.min(this.generateRate+Math.min((this.generateRate)+1, 1), this.maxGenerateRate/20); - } - } - //Loose heat when the generator is not connected or if there is no coal in the inventory. - if(this.itemCookTime <= 0 || !isConnected) - { - this.generateRate = Math.max(this.generateRate-5, 0); - } - } - - //gets all connected fireBoxes and shares its supply of coal - public void sharCoal(){ - for(int i =0; i<6;i++) - { - - if(connectedBlocks[i] instanceof TileEntityFireBox) - { - TileEntityFireBox connectedConsumer = (TileEntityFireBox) connectedBlocks[i]; - if(this.containingItems[0] != null) - { - if(this.containingItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex && this.containingItems[0].stackSize > 0) - { - if(connectedConsumer.containingItems[0] != null) - { - if(connectedConsumer.containingItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex) - { - if(connectedConsumer.containingItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex) - { - int CSum = Math.round(this.containingItems[0].stackSize + connectedConsumer.containingItems[0].stackSize)/2; - if(this.containingItems[0].stackSize > connectedConsumer.containingItems[0].stackSize) - { - int transferC = 0; - transferC = Math.round(CSum - connectedConsumer.containingItems[0].stackSize); - connectedConsumer.containingItems[0].stackSize = connectedConsumer.containingItems[0].stackSize + transferC; - this.containingItems[0].stackSize = this.containingItems[0].stackSize - transferC; - } - } - } - } - else - { - connectedConsumer.containingItems[0] = new ItemStack(this.containingItems[0].getItem()); - this.containingItems[0].stackSize -= 1; - } - } - } - } - } - - - } - public void addConnection() - { - connectedUnits = 0; - for(int i = 0; i<6; i++) - { - - TileEntity aEntity = getSteamMachine(i); - if(aEntity instanceof TileEntityFireBox && i != 0 && i != 1) - { - this.connectedBlocks[i] = aEntity; - connectedUnits += 1; - } - else - { - this.connectedBlocks[i] = null; - } - } - } - /** - * Reads a tile entity from NBT. - */ - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { - super.readFromNBT(par1NBTTagCompound); - this.itemCookTime = par1NBTTagCompound.getInteger("itemCookTime"); - this.generateRate = par1NBTTagCompound.getInteger("generateRate"); - NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); - this.containingItems = new ItemStack[this.getSizeInventory()]; - for (int var3 = 0; var3 < var2.tagCount(); ++var3) - { - NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); - byte var5 = var4.getByte("Slot"); - if (var5 >= 0 && var5 < this.containingItems.length) - { - this.containingItems[var5] = ItemStack.loadItemStackFromNBT(var4); - } - } - } - /** - * Writes a tile entity to NBT. - */ - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { - super.writeToNBT(par1NBTTagCompound); - par1NBTTagCompound.setInteger("itemCookTime", (int)this.itemCookTime); - par1NBTTagCompound.setInteger("generateRate", (int)this.generateRate); - NBTTagList var2 = new NBTTagList(); - for (int var3 = 0; var3 < this.containingItems.length; ++var3) - { - if (this.containingItems[var3] != null) - { - NBTTagCompound var4 = new NBTTagCompound(); - var4.setByte("Slot", (byte)var3); - this.containingItems[var3].writeToNBT(var4); - var2.appendTag(var4); - } - } - par1NBTTagCompound.setTag("Items", var2); - } - @Override - public int getStartInventorySide(ForgeDirection side) - { - if (side == ForgeDirection.DOWN) - { - return 1; - } - if (side == ForgeDirection.UP) - { - return 0; - } - return 2; - } - @Override - public int getSizeInventorySide(ForgeDirection side) { return getSizeInventory(); } - @Override - public int getSizeInventory() { return this.containingItems.length; } - @Override - public ItemStack getStackInSlot(int par1) { return this.containingItems[par1]; } - @Override - public ItemStack decrStackSize(int par1, int par2) - { - if (this.containingItems[par1] != null) - { - ItemStack var3; - if (this.containingItems[par1].stackSize <= par2) - { - var3 = this.containingItems[par1]; - this.containingItems[par1] = null; - return var3; - } - else - { - var3 = this.containingItems[par1].splitStack(par2); - if (this.containingItems[par1].stackSize == 0) - { - this.containingItems[par1] = null; - } - return var3; - } - } - else - { - return null; - } - } - @Override - public ItemStack getStackInSlotOnClosing(int par1) - { - if (this.containingItems[par1] != null) - { - ItemStack var2 = this.containingItems[par1]; - this.containingItems[par1] = null; - return var2; - } - else - { - return null; - } - } - @Override - public void setInventorySlotContents(int par1, ItemStack par2ItemStack) - { - this.containingItems[par1] = par2ItemStack; - if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) - { - par2ItemStack.stackSize = this.getInventoryStackLimit(); - } - } - @Override - public String getInvName() { - return "FireBox"; - } - @Override - public int getInventoryStackLimit() - { - return 64; - } - @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) - { - return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; - } - @Override - public void openChest() { } - @Override - public void closeChest() { } - @Override - public float onProduceHeat(float jouls, int side) { - // TODO Auto-generated method stub - return Math.min(generateRate,jouls); - } - @Override - public Object[] getSendData() - { - return new Object[]{(int)facing,(int)connectedUnits,(int)generateRate,(int)itemCookTime}; - } - - @Override - public void handlePacketData(NetworkManager network, - Packet250CustomPayload packet, EntityPlayer player, - ByteArrayDataInput dataStream) { - try - { - facing = dataStream.readInt(); - connectedUnits = dataStream.readInt(); - generateRate = dataStream.readInt(); - itemCookTime = dataStream.readInt(); - } - catch(Exception e) - { - e.printStackTrace(); - } - - } -} diff --git a/1.3/common/EUI/SteamPower/BlockMachine.java b/1.3/common/SteamPower/BlockMachine.java similarity index 76% rename from 1.3/common/EUI/SteamPower/BlockMachine.java rename to 1.3/common/SteamPower/BlockMachine.java index 6a5ac1bf..61391e62 100644 --- a/1.3/common/EUI/SteamPower/BlockMachine.java +++ b/1.3/common/SteamPower/BlockMachine.java @@ -1,21 +1,21 @@ -package EUI.SteamPower; +package SteamPower; -import java.util.ArrayList; import java.util.List; import java.util.Random; -import universalelectricity.basiccomponents.BasicComponents; - -import EUI.SteamPower.boiler.TileEntityBoiler; -import EUI.SteamPower.burner.TileEntityFireBox; -import EUI.SteamPower.turbine.TileEntityGenerator; -import net.minecraft.client.Minecraft; -import net.minecraft.src.*; -import EUI.SteamPower.*; -import EUIClient.SteamPower.GUIFireBox; -import EUIClient.SteamPower.GUIGenerator; -import EUIClient.SteamPower.GuiBoiler; -import net.minecraftforge.common.ForgeDirection; +import net.minecraft.src.CreativeTabs; +import net.minecraft.src.EntityItem; +import net.minecraft.src.EntityLiving; +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.ItemStack; +import net.minecraft.src.Material; +import net.minecraft.src.MathHelper; +import net.minecraft.src.NBTTagCompound; +import net.minecraft.src.TileEntity; +import net.minecraft.src.World; +import SteamPower.boiler.TileEntityBoiler; +import SteamPower.burner.TileEntityFireBox; +import SteamPower.turbine.TileEntityGenerator; public class BlockMachine extends universalelectricity.extend.BlockMachine { @@ -36,7 +36,6 @@ public class BlockMachine extends universalelectricity.extend.BlockMachine par3List.add(new ItemStack(this, 1, 1)); par3List.add(new ItemStack(this, 1, 2)); - par3List.add(new ItemStack(this, 1, 3)); par3List.add(new ItemStack(this, 1, 15)); } @Override @@ -60,22 +59,22 @@ public class BlockMachine extends universalelectricity.extend.BlockMachine float var10 = 0.52F; float var11 = par5Random.nextFloat() * 0.6F - 0.3F; - if (var6 == 5) + if (var6 == 4) { par1World.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); } - else if (var6 == 4) + else if (var6 == 2) { par1World.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); } - else if (var6 == 3) + else if (var6 == 1) { par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D); } - else if (var6 == 2) + else if (var6 == 3) { par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D); @@ -83,45 +82,7 @@ public class BlockMachine extends universalelectricity.extend.BlockMachine } } } - @Override - public int getBlockTexture(IBlockAccess par1iBlockAccess, int x, int y, int z, int side) - { - TileEntity tileEntity = par1iBlockAccess.getBlockTileEntity(x, y, z); - int metadata = par1iBlockAccess.getBlockMetadata(x, y, z); - if(metadata > -1 && tileEntity != null) - { - if (side == 1) - { - switch(metadata) - { - case 0: return 6; - case 1: return 4; - case 2: return 7; - case 3: return 4; - } - } - //If it is the back side - else if(side == ((TileEntityMachine) tileEntity).getDirection()); - { - switch(metadata) - { - case 0: return 5; - case 2: return 8; - case 3: return 4; - } - } - - - switch(metadata) - { - case 1: return 0; - case 2: return 2; - } - } - return 1; - - - } + @Override public boolean onUseWrench(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) { @@ -130,10 +91,10 @@ public class BlockMachine extends universalelectricity.extend.BlockMachine //Reorient the block switch(tileEntity.getDirection()) { - case 2: tileEntity.setDirection(5); break; - case 5: tileEntity.setDirection(3); break; + case 1: tileEntity.setDirection(2); break; + case 2: tileEntity.setDirection(3); break; case 3: tileEntity.setDirection(4); break; - case 4: tileEntity.setDirection(2); break; + case 4: tileEntity.setDirection(1); break; } return true; @@ -159,17 +120,12 @@ public class BlockMachine extends universalelectricity.extend.BlockMachine if(blockEntity instanceof TileEntityBoiler) { TileEntity var6 = (TileEntityBoiler)par1World.getBlockTileEntity(x, y, z); - par5EntityPlayer.openGui(SteamPower.instance, 1, par1World, x, y, z); + par5EntityPlayer.openGui(SteamPowerMain.instance, 1, par1World, x, y, z); } if(blockEntity instanceof TileEntityFireBox) { TileEntity var6 = (TileEntityFireBox)par1World.getBlockTileEntity(x, y, z); - par5EntityPlayer.openGui(SteamPower.instance, 0, par1World, x, y, z); - } - if(blockEntity instanceof TileEntityGenerator) - { - TileEntity var6 = (TileEntityGenerator)par1World.getBlockTileEntity(x, y, z); - par5EntityPlayer.openGui(SteamPower.instance, 2, par1World, x, y, z); + par5EntityPlayer.openGui(SteamPowerMain.instance, 0, par1World, x, y, z); } } @@ -183,7 +139,6 @@ public class BlockMachine extends universalelectricity.extend.BlockMachine { case 1: return new TileEntityBoiler(); case 2: return new TileEntityFireBox(); - case 3: return new TileEntityGenerator(); case 15: return new TileEntityNuller(); } return null; @@ -201,10 +156,10 @@ public class BlockMachine extends universalelectricity.extend.BlockMachine switch (angle) { - case 0: tileEntity.setDirection(5); break; - case 1: tileEntity.setDirection(3); break; - case 2: tileEntity.setDirection(4); break; - case 3: tileEntity.setDirection(2); break; + case 0: tileEntity.setDirection(1); break; + case 1: tileEntity.setDirection(2); break; + case 2: tileEntity.setDirection(3); break; + case 3: tileEntity.setDirection(4); break; } } /** @@ -266,6 +221,7 @@ public class BlockMachine extends universalelectricity.extend.BlockMachine super.breakBlock(par1World, par2, par3, par4, par5, par6); } + @Override public String getTextureFile() { @@ -286,4 +242,5 @@ public class BlockMachine extends universalelectricity.extend.BlockMachine { return -1; } + } diff --git a/1.3/common/EUI/SteamPower/ItemCoalFuel.java b/1.3/common/SteamPower/ItemCoalFuel.java similarity index 98% rename from 1.3/common/EUI/SteamPower/ItemCoalFuel.java rename to 1.3/common/SteamPower/ItemCoalFuel.java index 8a25c219..19036e6a 100644 --- a/1.3/common/EUI/SteamPower/ItemCoalFuel.java +++ b/1.3/common/SteamPower/ItemCoalFuel.java @@ -1,4 +1,4 @@ -package EUI.SteamPower; +package SteamPower; import java.util.ArrayList; diff --git a/1.3/common/EUI/SteamPower/ItemMachine.java b/1.3/common/SteamPower/ItemMachine.java similarity index 98% rename from 1.3/common/EUI/SteamPower/ItemMachine.java rename to 1.3/common/SteamPower/ItemMachine.java index 5a41ce2d..b25de352 100644 --- a/1.3/common/EUI/SteamPower/ItemMachine.java +++ b/1.3/common/SteamPower/ItemMachine.java @@ -1,4 +1,4 @@ -package EUI.SteamPower; +package SteamPower; import java.util.ArrayList; import java.util.List; diff --git a/1.3/common/EUI/SteamPower/ItemParts.java b/1.3/common/SteamPower/ItemParts.java similarity index 98% rename from 1.3/common/EUI/SteamPower/ItemParts.java rename to 1.3/common/SteamPower/ItemParts.java index 22255215..4274bf2d 100644 --- a/1.3/common/EUI/SteamPower/ItemParts.java +++ b/1.3/common/SteamPower/ItemParts.java @@ -1,4 +1,4 @@ -package EUI.SteamPower; +package SteamPower; import java.util.ArrayList; diff --git a/1.3/common/EUI/SteamPower/SteamPower.java b/1.3/common/SteamPower/SteamPowerMain.java similarity index 71% rename from 1.3/common/EUI/SteamPower/SteamPower.java rename to 1.3/common/SteamPower/SteamPowerMain.java index ede15267..d79b7bf6 100644 --- a/1.3/common/EUI/SteamPower/SteamPower.java +++ b/1.3/common/SteamPower/SteamPowerMain.java @@ -1,24 +1,25 @@ -package EUI.SteamPower; +package SteamPower; +import java.io.File; + +import SteamPower.turbine.BlockEngine; +import SteamPower.turbine.ItemEngine; +import SteamPower.turbine.TileEntitytopGen; + import net.minecraft.client.Minecraft; import net.minecraft.src.Block; +import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraftforge.common.Configuration; - -import java.util.ArrayList; -import java.util.Map; -import java.io.*; - -import EUI.BasicPipes.BasicPipes; -import EUI.SteamPower.boiler.TileEntityBoiler; -import EUI.SteamPower.burner.TileEntityFireBox; -import EUI.SteamPower.turbine.TileEntityGenerator; - +import universalelectricity.UniversalElectricity; +import universalelectricity.basiccomponents.BasicComponents; +import universalelectricity.network.PacketManager; +import BasicPipes.BasicPipesMain; import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.Mod.PostInit; -import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; +import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; +import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @@ -26,33 +27,35 @@ 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; - -import universalelectricity.UniversalElectricity; -import universalelectricity.basiccomponents.BasicComponents; -import universalelectricity.network.PacketManager; -@Mod(modid = "SteamPower", name = "Steam Power", version = "V4") +@Mod(modid = "SteamPower", name = "Steam Power", version = "V8") @NetworkMod(channels = { "SPpack" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class) -public class SteamPower{ +public class SteamPowerMain{ static Configuration config = new Configuration((new File(Minecraft.getMinecraftDir(), "config/EUIndustry/SteamPower.cfg"))); private static int BlockID= configurationProperties(); + public static int EngineItemID; + public static int EngineID; public static int genOutput; public static int steamOutBoiler; public static int pipeLoss; public static int boilerHeat; public static int fireOutput; public static final String channel = "SPpack"; - public static Block machine = new EUI.SteamPower.BlockMachine(BlockID).setBlockName("machine"); + public static Block machine = new BlockMachine(BlockID).setBlockName("machine"); + public static Block engine = new BlockEngine(EngineID).setBlockName("SteamEngien"); + public static Item itemEngine = new ItemEngine(EngineItemID).setItemName("SteamEngine"); @Instance - public static SteamPower instance; + public static SteamPowerMain instance; - @SidedProxy(clientSide = "EUIClient.SteamPower.SteamClientProxy", serverSide = "EUI.SteamPower.SteamProxy") + @SidedProxy(clientSide = "SteamPower.SteamClientProxy", serverSide = "SteamPower.SteamProxy") public static SteamProxy proxy; public static String textureFile = "/EUIClient/Textures/"; public static int configurationProperties() { config.load(); BlockID = Integer.parseInt(config.getOrCreateIntProperty("MachinesID", Configuration.CATEGORY_BLOCK, 3030).value); + EngineItemID = Integer.parseInt(config.getOrCreateIntProperty("EngineItem", Configuration.CATEGORY_ITEM, 30308).value); + EngineID = Integer.parseInt(config.getOrCreateIntProperty("SteamEngineID", Configuration.CATEGORY_BLOCK, 3031).value); genOutput = Integer.parseInt(config.getOrCreateIntProperty("genOutputWattsmax", Configuration.CATEGORY_GENERAL, 1000).value); steamOutBoiler = Integer.parseInt(config.getOrCreateIntProperty("steamOutPerCycle", Configuration.CATEGORY_GENERAL, 10).value); boilerHeat = Integer.parseInt(config.getOrCreateIntProperty("boilerInKJNeed", Configuration.CATEGORY_GENERAL, 4500).value); @@ -67,16 +70,18 @@ public class SteamPower{ NetworkRegistry.instance().registerGuiHandler(this, this.proxy); proxy.preInit(); GameRegistry.registerBlock(machine, ItemMachine.class); + GameRegistry.registerBlock(engine); } @Init public void load(FMLInitializationEvent evt) { proxy.init(); GameRegistry.registerTileEntity(TileEntityNuller.class, "EUNuller"); + GameRegistry.registerTileEntity(TileEntitytopGen.class, "gentop"); //Names............... LanguageRegistry.addName((new ItemStack(machine, 1, 1)), "Boiler"); LanguageRegistry.addName((new ItemStack(machine, 1, 2)), "FireBox"); - LanguageRegistry.addName((new ItemStack(machine, 1, 3)), "SteamGen"); + LanguageRegistry.addName((new ItemStack(itemEngine, 1, 0)), "SteamPiston"); LanguageRegistry.addName((new ItemStack(machine, 1, 15)), "EUVampire"); @@ -84,8 +89,8 @@ public class SteamPower{ @PostInit public void postInit(FMLPostInitializationEvent event) { + proxy.postInit(); - UniversalElectricity.registerMod(this,"SteamPower", "0.5.1"); //Crafting /** * case 0: return new TileEntityGrinder(); <-Removed @@ -96,15 +101,15 @@ public class SteamPower{ case 15: return new TileEntityNuller();<-Just for testing Not craftable */ GameRegistry.addRecipe(new ItemStack(machine, 1, 1), new Object [] {"@T@", "OVO", "@T@", - 'T',new ItemStack(BasicPipes.parts, 1,5), + 'T',new ItemStack(BasicPipesMain.parts, 1,5), '@',new ItemStack(BasicComponents.itemSteelPlate), - 'O',new ItemStack(BasicPipes.parts, 1,1), - 'V',new ItemStack(BasicPipes.parts, 1,6)}); + 'O',new ItemStack(BasicPipesMain.parts, 1,1), + 'V',new ItemStack(BasicPipesMain.parts, 1,6)}); GameRegistry.addRecipe(new ItemStack(machine, 1, 2), new Object [] { "@", "F", 'F',Block.stoneOvenIdle, '@',new ItemStack(BasicComponents.itemSteelPlate)}); - GameRegistry.addRecipe(new ItemStack(machine, 1, 3), new Object [] {"@T@", "PMP", "@T@", - 'T',new ItemStack(BasicPipes.parts, 1,0), + GameRegistry.addRecipe(new ItemStack(itemEngine, 1, 0), new Object [] {"@T@", "PMP", "@T@", + 'T',new ItemStack(BasicPipesMain.parts, 1,0), '@',new ItemStack(BasicComponents.itemSteelPlate), 'P',Block.pistonBase, 'M',new ItemStack(BasicComponents.itemMotor)}); diff --git a/1.3/common/EUI/SteamPower/SteamProxy.java b/1.3/common/SteamPower/SteamProxy.java similarity index 74% rename from 1.3/common/EUI/SteamPower/SteamProxy.java rename to 1.3/common/SteamPower/SteamProxy.java index c82623ac..ca53eb48 100644 --- a/1.3/common/EUI/SteamPower/SteamProxy.java +++ b/1.3/common/SteamPower/SteamProxy.java @@ -1,21 +1,17 @@ -package EUI.SteamPower; +package SteamPower; -import universalelectricity.basiccomponents.GUIBatteryBox; -import universalelectricity.basiccomponents.TileEntityBatteryBox; -import EUI.SteamPower.boiler.ContainerBoiler; -import EUI.SteamPower.boiler.TileEntityBoiler; -import EUI.SteamPower.burner.ContainerFireBox; -import EUI.SteamPower.burner.TileEntityFireBox; -import EUI.SteamPower.turbine.ContainerGenerator; -import EUI.SteamPower.turbine.TileEntityGenerator; -import EUIClient.SteamPower.GUIFireBox; -import EUIClient.SteamPower.GUIGenerator; -import EUIClient.SteamPower.GuiBoiler; -import cpw.mods.fml.common.network.IGuiHandler; -import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.src.EntityPlayer; 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.TileEntityGenerator; +import SteamPower.turbine.TileEntitytopGen; +import cpw.mods.fml.common.network.IGuiHandler; +import cpw.mods.fml.common.registry.GameRegistry; public class SteamProxy implements IGuiHandler{ @@ -29,6 +25,7 @@ public class SteamProxy implements IGuiHandler{ GameRegistry.registerTileEntity(TileEntityFireBox.class, "fireBox"); GameRegistry.registerTileEntity(TileEntityGenerator.class, "generator"); + } public void postInit() { diff --git a/1.3/common/SteamPower/TileEntityMachine.java b/1.3/common/SteamPower/TileEntityMachine.java new file mode 100644 index 00000000..081562a8 --- /dev/null +++ b/1.3/common/SteamPower/TileEntityMachine.java @@ -0,0 +1,261 @@ +package SteamPower; + +import com.google.common.io.ByteArrayDataInput; + +import universalelectricity.electricity.TileEntityElectricUnit; +import universalelectricity.extend.IRotatable; +import universalelectricity.network.IPacketReceiver; +import universalelectricity.network.PacketManager; +import net.minecraft.src.*; +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.ISidedInventory; +public class TileEntityMachine extends TileEntityElectricUnit implements IInventory, ISidedInventory +{ + public int facing = 0; + private int count = 0; + public ItemStack[] storedItems = new ItemStack[this.getInvSize()]; + public int getTickInterval() + { + return 10; + + } + private int getInvSize() { + return 1; + } + public int getDirection() + { + return this.facing; + } + + public void setDirection(int i) + { + this.facing = i; + } + + @Override + public void writeToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("facing", this.facing); + //inventory + NBTTagList var2 = new NBTTagList(); + + for (int var3 = 0; var3 < this.storedItems.length; ++var3) + { + if (this.storedItems[var3] != null) + { + NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("Slot", (byte)var3); + this.storedItems[var3].writeToNBT(var4); + var2.appendTag(var4); + } + } + + par1NBTTagCompound.setTag("Items", var2); + } + + @Override + public void readFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readFromNBT(par1NBTTagCompound); + //inventory + NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); + this.storedItems = new ItemStack[this.getSizeInventory()]; + + for (int var3 = 0; var3 < var2.tagCount(); ++var3) + { + NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + byte var5 = var4.getByte("Slot"); + + if (var5 >= 0 && var5 < this.storedItems.length) + { + this.storedItems[var5] = ItemStack.loadItemStackFromNBT(var4); + } + } + //vars + this.facing = par1NBTTagCompound.getInteger("facing"); + } + + @Override + public float electricityRequest() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean canReceiveFromSide(ForgeDirection side) { + // TODO Auto-generated method stub + return false; + } + @Override + public boolean canUpdate() + { + return true; + } + public Object[] getSendData() + { + return new Object[]{}; + } + public int getNumSide(ForgeDirection side) + { + if(side == ForgeDirection.DOWN) + { + return 0; + } + if(side == ForgeDirection.UP) + { + return 1; + } + if(side == ForgeDirection.NORTH) + { + return 2; + } + if(side == ForgeDirection.SOUTH) + { + return 3; + } + if(side == ForgeDirection.WEST) + { + return 4; + } + if(side == ForgeDirection.EAST) + { + return 5; + } + return 0; + } + + public void onUpdate(float watts, float voltage, ForgeDirection side) + { + super.onUpdate(watts, voltage, side); + count++; + + if(!worldObj.isRemote) + { + PacketManager.sendTileEntityPacket(this, SteamPowerMain.channel, getSendData()); + } + count = 0; + + } + + + ////////////////////////// + //I Inventory shit + ///////////////////////// + public int getSizeInventory() + { + return this.storedItems.length; + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't + * this more of a set than a get?* + */ + public int getInventoryStackLimit() + { + return 64; + } + + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + { + return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; + } + + /** + * Returns the stack in slot i + */ + public ItemStack getStackInSlot(int par1) + { + return this.storedItems[par1]; + } + + public ItemStack decrStackSize(int par1, int par2) + { + if (this.storedItems[par1] != null) + { + ItemStack var3; + + if (this.storedItems[par1].stackSize <= par2) + { + var3 = this.storedItems[par1]; + this.storedItems[par1] = null; + return var3; + } + else + { + var3 = this.storedItems[par1].splitStack(par2); + + if (this.storedItems[par1].stackSize == 0) + { + this.storedItems[par1] = null; + } + + return var3; + } + } + else + { + return null; + } + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + public ItemStack getStackInSlotOnClosing(int par1) + { + if (this.storedItems[par1] != null) + { + ItemStack var2 = this.storedItems[par1]; + this.storedItems[par1] = null; + return var2; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) + { + this.storedItems[par1] = par2ItemStack; + + if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) + { + par2ItemStack.stackSize = this.getInventoryStackLimit(); + } + } + @Override + public int getStartInventorySide(ForgeDirection side) { + // TODO Auto-generated method stub + return 0; + } + @Override + public int getSizeInventorySide(ForgeDirection side) { + // TODO Auto-generated method stub + return 0; + } + @Override + public String getInvName() { + // TODO Auto-generated method stub + return "SteamMachine"; + } + @Override + public void openChest() { + // TODO Auto-generated method stub + + } + @Override + public void closeChest() { + // TODO Auto-generated method stub + + } +} \ No newline at end of file diff --git a/1.3/common/EUI/SteamPower/TileEntityNuller.java b/1.3/common/SteamPower/TileEntityNuller.java similarity index 95% rename from 1.3/common/EUI/SteamPower/TileEntityNuller.java rename to 1.3/common/SteamPower/TileEntityNuller.java index 28ceb6c9..00c1af36 100644 --- a/1.3/common/EUI/SteamPower/TileEntityNuller.java +++ b/1.3/common/SteamPower/TileEntityNuller.java @@ -1,4 +1,4 @@ -package EUI.SteamPower; +package SteamPower; import net.minecraftforge.common.ForgeDirection; import universalelectricity.extend.IElectricUnit; diff --git a/1.3/common/EUI/SteamPower/api/IHeatConsumer.java b/1.3/common/SteamPower/ap/IHeatConsumer.java similarity index 96% rename from 1.3/common/EUI/SteamPower/api/IHeatConsumer.java rename to 1.3/common/SteamPower/ap/IHeatConsumer.java index 6b5e1c28..8d4f24c1 100644 --- a/1.3/common/EUI/SteamPower/api/IHeatConsumer.java +++ b/1.3/common/SteamPower/ap/IHeatConsumer.java @@ -1,4 +1,4 @@ -package EUI.SteamPower.api; +package SteamPower.ap; /** * The IHeatConsumer interface is an interface that must be applied to all tile entities that can receive heat joules. diff --git a/1.3/common/EUI/SteamPower/api/IHeatProducer.java b/1.3/common/SteamPower/ap/IHeatProducer.java similarity index 93% rename from 1.3/common/EUI/SteamPower/api/IHeatProducer.java rename to 1.3/common/SteamPower/ap/IHeatProducer.java index 1c8e33db..4b729111 100644 --- a/1.3/common/EUI/SteamPower/api/IHeatProducer.java +++ b/1.3/common/SteamPower/ap/IHeatProducer.java @@ -1,4 +1,4 @@ -package EUI.SteamPower.api; +package SteamPower.ap; public interface IHeatProducer diff --git a/1.3/common/EUI/SteamPower/boiler/ContainerBoiler.java b/1.3/common/SteamPower/boiler/ContainerBoiler.java similarity index 97% rename from 1.3/common/EUI/SteamPower/boiler/ContainerBoiler.java rename to 1.3/common/SteamPower/boiler/ContainerBoiler.java index af6599f5..c6ab4323 100644 --- a/1.3/common/EUI/SteamPower/boiler/ContainerBoiler.java +++ b/1.3/common/SteamPower/boiler/ContainerBoiler.java @@ -1,4 +1,4 @@ -package EUI.SteamPower.boiler; +package SteamPower.boiler; import net.minecraft.src.*; public class ContainerBoiler extends Container diff --git a/1.3/common/SteamPower/boiler/TileEntityBoiler.java b/1.3/common/SteamPower/boiler/TileEntityBoiler.java new file mode 100644 index 00000000..bd70d7f1 --- /dev/null +++ b/1.3/common/SteamPower/boiler/TileEntityBoiler.java @@ -0,0 +1,329 @@ +package SteamPower.boiler; +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.Item; +import net.minecraft.src.ItemStack; +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 universalelectricity.network.IPacketReceiver; +import BasicPipes.TradeHelper; +import BasicPipes.pipes.api.ILiquidConsumer; +import BasicPipes.pipes.api.ILiquidProducer; +import SteamPower.SteamPowerMain; +import SteamPower.TileEntityMachine; +import SteamPower.burner.TileEntityFireBox; + +import com.google.common.io.ByteArrayDataInput; + +public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiver,ILiquidProducer, ILiquidConsumer +{ + + /** + * 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 energy stored before being add to run Timer */ + public int energyStore = 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 = 10000; + 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; + public String getInvName() + { + return "container.boiler"; + } + public Object[] getSendData() + { + return new Object[]{(int)facing,(int)RunTime,(int)energyStore,(int)waterStored, + (int)steamStored,(int)heatStored,(int)hullHeat,(int)heatTick}; + } + + @Override + public void handlePacketData(NetworkManager network, + Packet250CustomPayload packet, EntityPlayer player, + ByteArrayDataInput dataStream) { + try{ + facing = dataStream.readInt(); + RunTime = dataStream.readInt(); + energyStore = dataStream.readInt(); + waterStored = dataStream.readInt(); + steamStored = dataStream.readInt(); + heatStored = dataStream.readInt(); + hullHeat = dataStream.readInt(); + heatTick = dataStream.readInt(); + } + 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.energyStore = par1NBTTagCompound.getInteger("energyStore"); + 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("energyStore", (int)this.energyStore); + par1NBTTagCompound.setInteger("steamStore", (int)this.steamStored); + par1NBTTagCompound.setInteger("heatStore", (int)this.heatStored); + par1NBTTagCompound.setInteger("waterStore", (int)this.waterStored); + par1NBTTagCompound.setInteger("hullHeat", (int)this.hullHeat); + + } + + + private boolean getIsHeated() { + TileEntity blockEntity = worldObj.getBlockTileEntity(this.xCoord, this.yCoord - 1, this.zCoord); + if(blockEntity instanceof TileEntityFireBox) + { + return true; + } + else + { + return false; + } + } + /** + * 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. + */ + @Override + public void onUpdate(float watts, float voltage, ForgeDirection side) + { + super.onUpdate(watts, voltage, side); + //update connection list + TileEntity[] entityList = TradeHelper.getSourounding(this); + tankCount = 0; + for(int c = 0; c< 6; c++) + { + + if(entityList[c] instanceof TileEntityBoiler) + { + connectedBlocks[c] = entityList[c]; + if(entityList[c] == connectedBlocks[0] || entityList[c] == connectedBlocks[1]) + { + + } + else + { + tankCount++; + } + } + else + { + connectedBlocks[c] = null; + } + } + isBeingHeated = getIsHeated(); + if(!worldObj.isRemote) + { + addWater();//adds water from container slot + this.waterStored = TradeHelper.shareLiquid(this, 1, false); + this.steamStored = TradeHelper.shareLiquid(this, 0, true); + + //changed hullHeat max depending on contents of boiler + if(waterStored > 0) + { + hullHeatMax = 4700; + if(hullHeat > hullHeatMax) + { + hullHeat = 4700; + } + } + else + { + hullHeatMax = 10000; + } + + //Checks if the hull is heated + if(hullHeat >= hullHeatMax) + { + hullHeated = true; + } + else + { + hullHeat = Math.min(hullHeat + heatStored, hullHeatMax); + } + + //checks if heat level hit max + if(hullHeat >= 10000) + { + if(heatTick >= 1200) + { + // TODO remove block and set fire + heatTick = 0; + } + else + { + heatTick += 1; + } + } + + + + //hull heated ? (do work) : move on + if(hullHeated) + { + if(heatStored > SteamPowerMain.fireOutput) + { + if(waterStored >= 1){ + if(heatStored >= heatNeeded) + { + heatStored = Math.max(heatStored - heatNeeded, 0); + --waterStored; + steamStored = Math.min(steamStored + SteamPowerMain.steamOutBoiler,this.steamMax); + } + } + else + { + heatStored = 0; + } + } + } + TileEntity blockE = worldObj.getBlockTileEntity(xCoord, yCoord -1, zCoord); + if(blockE instanceof TileEntityFireBox) + { + if(!hullHeated || waterStored > 0) + { + heatStored = (int) Math.min((heatStored + ((TileEntityFireBox)blockE).onProduceHeat(SteamPowerMain.fireOutput, 1)), heatMax); + } + } + } + } + + public int addSteam(int watt) { + int rejectedElectricity = Math.max((this.steamStored + watt) - steamMax, 0); + this.steamStored += watt - rejectedElectricity; + return rejectedElectricity; + } + private void addWater() { + if (storedItems[0] != null) + { + if(storedItems[0].isItemEqual(new ItemStack(Item.bucketWater,1))) + { + if((int)waterStored < getLiquidCapacity(1)) + { + ++waterStored; + this.storedItems[0] = new ItemStack(Item.bucketEmpty,1); + this.onInventoryChanged(); + } + } + } + + } + public int precentHeated() { + int var1; + if(hullHeat < 100) + { + var1 = (int)(100 *(hullHeat/100)); + } + else + { + var1 = 100; + } + return var1; + } + @Override + public int onReceiveLiquid(int type, int vol, ForgeDirection side) { + if(type == 1) + { + int rejectedElectricity = Math.max((this.waterStored + vol) - this.getLiquidCapacity(1), 0); + this.waterStored += vol - rejectedElectricity; + return rejectedElectricity; + } + return vol; + } + + @Override + public boolean canRecieveLiquid(int type,ForgeDirection side) { + if(type == 1) + { + return true; + } + return false; + } + + @Override + public int getStoredLiquid(int type) { + if(type == 1) + { + return this.waterStored; + } + if(type == 0) + { + return this.steamStored; + } + return 0; + } + + @Override + public int getLiquidCapacity(int type) { + if(type ==1) + { + return 14; + } + if(type == 0) + { + return steamMax; + } + return 0; + } + @Override + public int onProduceLiquid(int type, int maxVol, ForgeDirection side) { + if(type == 0) + { + if(steamStored > 1) + { + this.steamStored -= 1; + return 1; + } + } + return 0; + } + + @Override + public boolean canProduceLiquid(int type, ForgeDirection side) { + if(type == 0) + { + return true; + } + return false; + } + + + } diff --git a/1.3/common/EUI/SteamPower/burner/ContainerFireBox.java b/1.3/common/SteamPower/burner/ContainerFireBox.java similarity index 97% rename from 1.3/common/EUI/SteamPower/burner/ContainerFireBox.java rename to 1.3/common/SteamPower/burner/ContainerFireBox.java index 20918815..f4176fd4 100644 --- a/1.3/common/EUI/SteamPower/burner/ContainerFireBox.java +++ b/1.3/common/SteamPower/burner/ContainerFireBox.java @@ -1,4 +1,4 @@ -package EUI.SteamPower.burner; +package SteamPower.burner; import net.minecraft.src.*; diff --git a/1.3/common/SteamPower/burner/TileEntityFireBox.java b/1.3/common/SteamPower/burner/TileEntityFireBox.java new file mode 100644 index 00000000..2badf0a5 --- /dev/null +++ b/1.3/common/SteamPower/burner/TileEntityFireBox.java @@ -0,0 +1,203 @@ +package SteamPower.burner; + +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.IInventory; +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; +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.ISidedInventory; +import universalelectricity.network.IPacketReceiver; +import BasicPipes.TradeHelper; +import SteamPower.TileEntityMachine; +import SteamPower.ap.IHeatProducer; +import SteamPower.boiler.TileEntityBoiler; + +import com.google.common.io.ByteArrayDataInput; + +public class TileEntityFireBox extends TileEntityMachine implements IPacketReceiver,IInventory, ISidedInventory, IHeatProducer +{ + //max heat generated per second + + public boolean isConnected = false; + public TileEntity[] connectedBlocks = {null, null, null, null, null, null}; + private int connectedUnits = 0; + public static int maxGenerateRate = 250; + //Current generation rate based on hull heat. In TICKS. + public int generateRate = 0; + int count = 0; + public int itemCookTime = 0; + private int getInvSize() { + return 1; + } + public int getTickInterval() + { + return 5; + + } + public void onUpdate(float watts, float voltage, ForgeDirection side) + { + super.onUpdate(watts, voltage, side); + addConnection(); + if(!worldObj.isRemote) + { + sharCoal(); + } + TileEntity blockEntity = worldObj.getBlockTileEntity(this.xCoord, this.yCoord + 1, this.zCoord); + if(blockEntity instanceof TileEntityBoiler) + { + isConnected = true; + } + else + { + isConnected = false; + } + if (!this.worldObj.isRemote){ + + + maxGenerateRate = SteamPower.SteamPowerMain.fireOutput + (connectedUnits*5); + + //The top slot is for recharging items. Check if the item is a electric item. If so, recharge it. + if (this.storedItems[0] != null && isConnected) + { + if (this.storedItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex) + { + if(this.itemCookTime <= 0) + { + itemCookTime = Math.max(1600 - (int)(this.generateRate*20), 400); + this.decrStackSize(0, 1); + } + } + } + + } + //Starts generating electricity if the device is heated up + if (this.itemCookTime > 0) + { + this.itemCookTime --; + if(isConnected) + { + this.generateRate = Math.min(this.generateRate+Math.min((this.generateRate)+1, 1), this.maxGenerateRate/20); + } + } + //Loose heat when the generator is not connected or if there is no coal in the inventory. + if(this.itemCookTime <= 0 || !isConnected) + { + this.generateRate = Math.max(this.generateRate-5, 0); + } + } + + //gets all connected fireBoxes and shares its supply of coal + public void sharCoal(){ + for(int i =0; i<6;i++) + { + + if(connectedBlocks[i] instanceof TileEntityFireBox) + { + TileEntityFireBox connectedConsumer = (TileEntityFireBox) connectedBlocks[i]; + if(this.storedItems[0] != null) + { + if(this.storedItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex && this.storedItems[0].stackSize > 0) + { + if(connectedConsumer.storedItems[0] != null) + { + if(connectedConsumer.storedItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex) + { + if(connectedConsumer.storedItems[0].getItem().shiftedIndex == Item.coal.shiftedIndex) + { + int CSum = Math.round(this.storedItems[0].stackSize + connectedConsumer.storedItems[0].stackSize)/2; + if(this.storedItems[0].stackSize > connectedConsumer.storedItems[0].stackSize) + { + int transferC = 0; + transferC = Math.round(CSum - connectedConsumer.storedItems[0].stackSize); + connectedConsumer.storedItems[0].stackSize = connectedConsumer.storedItems[0].stackSize + transferC; + this.storedItems[0].stackSize = this.storedItems[0].stackSize - transferC; + } + } + } + } + else + { + connectedConsumer.storedItems[0] = new ItemStack(this.storedItems[0].getItem()); + this.storedItems[0].stackSize -= 1; + } + } + } + } + } + + + } + public void addConnection() + { + connectedUnits = 0; + TileEntity[] aEntity = TradeHelper.getSourounding(this); + for(int i = 0; i<6; i++) + { + + + if(aEntity[i] instanceof TileEntityFireBox && i != 0 && i != 1) + { + this.connectedBlocks[i] = aEntity[i]; + connectedUnits += 1; + } + else + { + this.connectedBlocks[i] = null; + } + } + } + /** + * Reads a tile entity from NBT. + */ + public void readFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readFromNBT(par1NBTTagCompound); + this.itemCookTime = par1NBTTagCompound.getInteger("itemCookTime"); + this.generateRate = par1NBTTagCompound.getInteger("generateRate"); + } + /** + * Writes a tile entity to NBT. + */ + public void writeToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("itemCookTime", (int)this.itemCookTime); + par1NBTTagCompound.setInteger("generateRate", (int)this.generateRate); + } + @Override + public String getInvName() { + return "FireBox"; + } + public float onProduceHeat(float jouls, int side) { + // TODO Auto-generated method stub + return Math.min(generateRate,jouls); + } + @Override + public Object[] getSendData() + { + return new Object[]{(int)facing,(int)connectedUnits,(int)generateRate,(int)itemCookTime}; + } + + @Override + public void handlePacketData(NetworkManager network, + Packet250CustomPayload packet, EntityPlayer player, + ByteArrayDataInput dataStream) { + try + { + facing = dataStream.readInt(); + connectedUnits = dataStream.readInt(); + generateRate = dataStream.readInt(); + itemCookTime = dataStream.readInt(); + } + catch(Exception e) + { + e.printStackTrace(); + } + + } +} diff --git a/1.3/common/SteamPower/turbine/BlockEngine.java b/1.3/common/SteamPower/turbine/BlockEngine.java new file mode 100644 index 00000000..0a1c3d78 --- /dev/null +++ b/1.3/common/SteamPower/turbine/BlockEngine.java @@ -0,0 +1,185 @@ +package SteamPower.turbine; + +import java.util.List; +import java.util.Random; + +import net.minecraft.src.CreativeTabs; +import net.minecraft.src.EntityLiving; +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.ItemStack; +import net.minecraft.src.Material; +import net.minecraft.src.MathHelper; +import net.minecraft.src.TileEntity; +import net.minecraft.src.World; +import SteamPower.SteamPowerMain; +import SteamPower.TileEntityMachine; + +public class BlockEngine extends universalelectricity.extend.BlockMachine{ + + public BlockEngine(int par1) { + super("SteamEngine", par1, Material.iron); + + } + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(this, 1, 0)); + } + @Override + public boolean onUseWrench(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) + { + TileEntityMachine tileEntity = (TileEntityMachine)par1World.getBlockTileEntity(par2, par3, par4); + + //Reorient the block + switch(tileEntity.getDirection()) + { + case 1: tileEntity.setDirection(2); break; + case 2: tileEntity.setDirection(3); break; + case 3: tileEntity.setDirection(4); break; + case 4: tileEntity.setDirection(1); break; + } + + return true; + } + @Override + public void onBlockPlacedBy(World par1World, int x, int y, int z, EntityLiving par5EntityLiving) + { + int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int metadata = par1World.getBlockMetadata(x, y, z); + TileEntityMachine tileEntity = (TileEntityMachine)par1World.getBlockTileEntity(x, y, z); + + switch (angle) + { + case 0: tileEntity.setDirection(1); break; + case 1: tileEntity.setDirection(2); break; + case 2: tileEntity.setDirection(3); break; + case 3: tileEntity.setDirection(4); break; + } + } + public TileEntity createNewTileEntity(World var1) + { + return null; + } + public boolean onMachineActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer) + { + if (par1World.isRemote) + { + return true; + } + else + { + TileEntity blockEntity = (TileEntity)par1World.getBlockTileEntity(x, y, z); + + if (blockEntity != null) + { + + if(blockEntity instanceof TileEntityGenerator) + { + par5EntityPlayer.openGui(SteamPowerMain.instance, 2, par1World, x, y, z); + } + if(blockEntity instanceof TileEntitytopGen) + { + par5EntityPlayer.openGui(SteamPowerMain.instance, 2, par1World, x, y-1, z); + } + } + + return true; + } + } + public void breakBlock(World world, int x, int y, int z,int par5, int par6) + { + super.breakBlock(world, x, y, z, par5, par6); + int meta = world.getBlockMetadata(x, y, z); + if(meta < 4) + { + if(world.getBlockId(x, y+1, z) == this.blockID) + { + if(world.getBlockMetadata(x, y, z)> 4) + { + world.setBlockAndMetadataWithUpdate(x, y, z, 0, 0, true); + } + } + } + else + if(meta > 4) + { + if(world.getBlockId(x, y-1, z) == this.blockID) + { + if(world.getBlockMetadata(x, y, z)< 4) + { + world.setBlockAndMetadataWithUpdate(x, y, z, 0, 0, true); + } + } + } + } + @Override + public boolean isOpaqueCube() + { + return false; + } + @Override + public boolean renderAsNormalBlock() + { + return false; + } + @Override + public int getRenderType() + { + return -1; + } + @Override + public TileEntity createNewTileEntity(World world, int metadata) + { + if(metadata < 4) + { + return new TileEntityGenerator(); + } + if(metadata == 14) + { + return new TileEntitytopGen(); + } + if(metadata == 15) + { + return null; + } + return null; + } + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + int meta = par1World.getBlockMetadata(par2, par3, par4); + boolean var7 = false; + if (meta < 4) + { + if (par1World.getBlockId(par2, par3 + 1, par4) != this.blockID) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + var7 = true; + } + } + else + { + if (par1World.getBlockId(par2, par3 - 1, par4) != this.blockID) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + } + } + if (var7) + { + if (!par1World.isRemote) + { + this.dropBlockAsItem(par1World, par2, par3, par4, 0, 0); + } + } + } + @Override + public int idDropped(int par1, Random par2Random, int par3) + { + return SteamPowerMain.itemEngine.shiftedIndex; + } + @Override + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockId(par2, par3, par4); + int var6 = par1World.getBlockId(par2, par3+1, par4); + return (var5 == 0 || blocksList[var5].blockMaterial.isGroundCover()) && (var6 == 0 || blocksList[var6].blockMaterial.isGroundCover()); + } +} diff --git a/1.3/common/EUI/SteamPower/turbine/ContainerGenerator.java b/1.3/common/SteamPower/turbine/ContainerGenerator.java similarity index 97% rename from 1.3/common/EUI/SteamPower/turbine/ContainerGenerator.java rename to 1.3/common/SteamPower/turbine/ContainerGenerator.java index 293b2424..d6eb883e 100644 --- a/1.3/common/EUI/SteamPower/turbine/ContainerGenerator.java +++ b/1.3/common/SteamPower/turbine/ContainerGenerator.java @@ -1,4 +1,4 @@ -package EUI.SteamPower.turbine; +package SteamPower.turbine; import net.minecraft.src.*; diff --git a/1.3/common/SteamPower/turbine/ItemEngine.java b/1.3/common/SteamPower/turbine/ItemEngine.java new file mode 100644 index 00000000..1385251b --- /dev/null +++ b/1.3/common/SteamPower/turbine/ItemEngine.java @@ -0,0 +1,66 @@ +package SteamPower.turbine; +import java.util.List; + +import SteamPower.SteamPowerMain; +import net.minecraft.src.Block; +import net.minecraft.src.CreativeTabs; +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.Item; +import net.minecraft.src.ItemStack; +import net.minecraft.src.Material; +import net.minecraft.src.MathHelper; +import net.minecraft.src.World; + +public class ItemEngine extends Item +{ + public ItemEngine(int par1) + { + super(par1); + this.maxStackSize = 5; + this.setTabToDisplayOn(CreativeTabs.tabBlock); + } + @Override + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(this, 1, 0)); + } + public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer ePlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par3World.isRemote) + { + return false; + } + + Block var11 = SteamPowerMain.engine; + int angle = MathHelper.floor_double((ePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + if(par3World.getBlockId(par4, par5, par6) == var11.blockID && par3World.getBlockMetadata(par4, par5, par6) == 15) + { + par3World.editingBlocks = true; + par3World.setBlockAndMetadataWithUpdate(par4, par5, par6, var11.blockID, 14,true); + par3World.notifyBlocksOfNeighborChange(par4, par5, par6, var11.blockID); + ePlayer.sendChatToPlayer(""+par3World.getBlockMetadata(par4, par5, par6)); + par3World.editingBlocks = false; + } + else + { + if (ePlayer.canPlayerEdit(par4, par5, par6)) + { + ++par5; + + if (var11.canPlaceBlockAt(par3World, par4, par5, par6)) + { + par3World.editingBlocks = true; + par3World.setBlockAndMetadataWithNotify(par4, par5, par6, var11.blockID, angle); + par3World.notifyBlocksOfNeighborChange(par4, par5, par6, var11.blockID); + par3World.setBlockAndMetadataWithNotify(par4, par5+1, par6, var11.blockID, 14); + par3World.notifyBlocksOfNeighborChange(par4, par5, par6, var11.blockID); + ePlayer.sendChatToPlayer(""+par3World.getBlockMetadata(par4, par5, par6)); + par3World.editingBlocks = false; + --par1ItemStack.stackSize; + return true; + } + } + } + return false; + } +} diff --git a/1.3/common/EUI/SteamPower/turbine/TileEntityGenerator.java b/1.3/common/SteamPower/turbine/TileEntityGenerator.java similarity index 78% rename from 1.3/common/EUI/SteamPower/turbine/TileEntityGenerator.java rename to 1.3/common/SteamPower/turbine/TileEntityGenerator.java index 50c05594..30fe63d7 100644 --- a/1.3/common/EUI/SteamPower/turbine/TileEntityGenerator.java +++ b/1.3/common/SteamPower/turbine/TileEntityGenerator.java @@ -1,6 +1,4 @@ -package EUI.SteamPower.turbine; - -import com.google.common.io.ByteArrayDataInput; +package SteamPower.turbine; import net.minecraft.src.EntityPlayer; import net.minecraft.src.IInventory; @@ -13,16 +11,17 @@ import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.TileEntity; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; -import universalelectricity.UniversalElectricity; import universalelectricity.Vector3; import universalelectricity.electricity.ElectricityManager; import universalelectricity.extend.IElectricUnit; import universalelectricity.extend.TileEntityConductor; import universalelectricity.network.IPacketReceiver; -import EUI.BasicPipes.pipes.api.ILiquidConsumer; -import EUI.BasicPipes.pipes.api.ILiquidProducer; -import EUI.SteamPower.SteamPower; -import EUI.SteamPower.TileEntityMachine; +import BasicPipes.pipes.api.ILiquidConsumer; +import BasicPipes.pipes.api.ILiquidProducer; +import SteamPower.SteamPowerMain; +import SteamPower.TileEntityMachine; + +import com.google.common.io.ByteArrayDataInput; public class TileEntityGenerator extends TileEntityMachine implements IPacketReceiver, IElectricUnit,ILiquidConsumer,ILiquidProducer, IInventory, ISidedInventory { @@ -31,69 +30,115 @@ public class TileEntityGenerator extends TileEntityMachine implements IPacketRec public int waterStored = 0; public int steamStored = 0; public int steamConsumed = 0; + public float position = 0; + public int count = 0; //Current generation rate based on hull heat. In TICKS. public float generateRate = 0; //public TileEntityConductor connectedWire = null; /** * The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for */ - public int itemCookTime = 0; + public int genTime = 0; /** * The ItemStacks that hold the items currently being used in the battery box */ private ItemStack[] containingItems = new ItemStack[1]; - public TileEntityConductor connectedElectricUnit = null; + public TileEntityConductor connectedElectricUnit = null; + public boolean isConnected = false; + private boolean posT = true; @Override public boolean canConnect(ForgeDirection side) { return true; } - + public int getTickInterval() + { + return 10; + + } /** * 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 void onUpdate(float watts, float voltage, ForgeDirection side) - { if(!this.worldObj.isRemote) - { + { super.onUpdate(watts, voltage, side); - - //Check nearby blocks and see if the conductor is full. If so, then it is connected - TileEntity tileEntity = Vector3.getUEUnitFromSide(this.worldObj, new Vector3(this.xCoord, this.yCoord, this.zCoord), ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite()); - - - if(tileEntity instanceof TileEntityConductor) + count++; + float cPercent = (generateRate/10); + int cCount = 1; + if(cPercent > 25f) { - if(ElectricityManager.electricityRequired(((TileEntityConductor)tileEntity).connectionID) > 0) + cCount = 2; + } + if(cPercent > 50f) + { + cCount = 3; + } + if(cPercent > 75f) + { + cCount = 4; + } + if(generateRate > 0) + { + + if(position < 9f && posT ) { - this.connectedElectricUnit = (TileEntityConductor)tileEntity; + position+= cCount; } else { - this.connectedElectricUnit = null; + posT = false; } + if(position > 1f && !posT ) + { + position-= cCount; + } + else + { + posT = true; + } + count =0; } - else + TileEntity ent = worldObj.getBlockTileEntity(xCoord, yCoord+1, zCoord); + if(ent instanceof TileEntitytopGen) { - this.connectedElectricUnit = null; + isConnected = true; } + this.connectedElectricUnit = null; + //Check nearby blocks and see if the conductor is full. If so, then it is connected + for(int i = 0;i<6;i++) + { + TileEntity tileEntity = Vector3.getUEUnitFromSide(this.worldObj, new Vector3(this.xCoord, this.yCoord, this.zCoord), + ForgeDirection.getOrientation(i)); + if (tileEntity instanceof TileEntityConductor) + { + if (ElectricityManager.electricityRequired(((TileEntityConductor)tileEntity).connectionID) > 0) + { + this.connectedElectricUnit = (TileEntityConductor)tileEntity; + } + } + } + + if(!this.worldObj.isRemote) + { + if(!this.isDisabled()) { //Adds time to runTime by consuming steam - if(this.itemCookTime <= 0) + if(this.genTime <= 0) { if(steamStored > 0) { --steamStored; ++steamConsumed; - if(steamConsumed == SteamPower.steamOutBoiler) + if(steamConsumed >= SteamPowerMain.steamOutBoiler) { ++waterStored; steamConsumed = 0; } - itemCookTime += 65; + genTime += 65; } } @@ -111,17 +156,17 @@ public class TileEntityGenerator extends TileEntityMachine implements IPacketRec } //Starts generating electricity if the device is heated up - if (this.itemCookTime > 0) + if (this.genTime > 0) { - this.itemCookTime --; + this.genTime --; if(this.connectedElectricUnit != null) { - this.generateRate = (float)Math.min(this.generateRate+Math.min((this.generateRate)*0.001+0.0015, 0.05F), this.maxGenerateRate/20); + this.generateRate = (float)Math.min(this.generateRate+Math.min((this.generateRate)*0.01+0.015, 0.05F), this.maxGenerateRate/20); } } - if(this.connectedElectricUnit == null || this.itemCookTime <= 0) + if(this.connectedElectricUnit == null || this.genTime <= 0) { this.generateRate = (float)Math.max(this.generateRate-0.05, 0); } @@ -139,7 +184,7 @@ public class TileEntityGenerator extends TileEntityMachine implements IPacketRec public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); - this.itemCookTime = par1NBTTagCompound.getInteger("itemCookTime"); + this.genTime = par1NBTTagCompound.getInteger("itemCookTime"); this.waterStored = par1NBTTagCompound.getInteger("waterStored"); this.steamConsumed = par1NBTTagCompound.getInteger("steamConsumed"); this.steamStored = par1NBTTagCompound.getInteger("steamStored"); @@ -162,7 +207,7 @@ public class TileEntityGenerator extends TileEntityMachine implements IPacketRec public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); - par1NBTTagCompound.setInteger("itemCookTime", (int)this.itemCookTime); + par1NBTTagCompound.setInteger("itemCookTime", (int)this.genTime); par1NBTTagCompound.setInteger("waterStored", (int)this.waterStored); par1NBTTagCompound.setInteger("steamConsumed", (int)this.steamConsumed); par1NBTTagCompound.setInteger("steamStored", (int)this.steamStored); @@ -273,13 +318,14 @@ public class TileEntityGenerator extends TileEntityMachine implements IPacketRec } @Override - public int onProduceLiquid(int type, int maxVol, ForgeDirection side) { + public int onProduceLiquid(int type, int Vol, ForgeDirection side) { if(type == 1) { if(this.waterStored > 0) { - --waterStored; - return 1; + int rejectedSteam = Math.max(Math.max((this.waterStored - Vol), 0),waterStored); + this.waterStored += waterStored - rejectedSteam; + return rejectedSteam; } } return 0; @@ -334,7 +380,7 @@ public class TileEntityGenerator extends TileEntityMachine implements IPacketRec @Override public Object[] getSendData() { - return new Object[]{(int)facing,(int)waterStored,(int)steamStored,(int)steamConsumed,(int)generateRate,(int)itemCookTime}; + return new Object[]{(int)facing,(int)waterStored,(int)steamStored,(int)steamConsumed,(float)generateRate,(int)genTime}; } @Override @@ -347,8 +393,8 @@ public class TileEntityGenerator extends TileEntityMachine implements IPacketRec waterStored = dataStream.readInt(); steamStored = dataStream.readInt(); steamConsumed = dataStream.readInt(); - generateRate = dataStream.readInt(); - itemCookTime = dataStream.readInt(); + generateRate = dataStream.readFloat(); + genTime = dataStream.readInt(); } catch(Exception e) { diff --git a/1.3/common/SteamPower/turbine/TileEntitytopGen.java b/1.3/common/SteamPower/turbine/TileEntitytopGen.java new file mode 100644 index 00000000..aaf15d88 --- /dev/null +++ b/1.3/common/SteamPower/turbine/TileEntitytopGen.java @@ -0,0 +1,69 @@ +package SteamPower.turbine; + +import com.google.common.io.ByteArrayDataInput; + +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.IInventory; +import net.minecraft.src.ItemStack; +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 universalelectricity.extend.IElectricUnit; +import universalelectricity.network.IPacketReceiver; +import BasicPipes.pipes.api.ILiquidConsumer; +import BasicPipes.pipes.api.ILiquidProducer; +import SteamPower.TileEntityMachine; + +public class TileEntitytopGen extends TileEntityMachine implements IElectricUnit,ILiquidConsumer,ILiquidProducer { +public TileEntityGenerator genB = null; + public void onUpdate(float watts, float voltage, ForgeDirection side) + { + if(!this.worldObj.isRemote) + { + super.onUpdate(watts, voltage, side); + TileEntity ent = worldObj.getBlockTileEntity(xCoord, yCoord-1, xCoord); + if(ent instanceof TileEntityGenerator) + { + genB = (TileEntityGenerator)ent; + } + } + } + @Override + public int onProduceLiquid(int type, int maxVol, ForgeDirection side) { + // TODO Auto-generated method stub + return genB !=null ? genB.onProduceLiquid(type, maxVol, side) : 0; + } + + @Override + public boolean canProduceLiquid(int type, ForgeDirection side) { + // TODO Auto-generated method stub + return genB !=null ? genB.canProduceLiquid(type, side) : false; + } + + @Override + public int onReceiveLiquid(int type, int vol, ForgeDirection side) { + // TODO Auto-generated method stub + return genB !=null ? genB.onReceiveLiquid(type, vol, side) : vol; + } + + @Override + public boolean canRecieveLiquid(int type, ForgeDirection side) { + // TODO Auto-generated method stub + return genB !=null ? genB.canRecieveLiquid(type, side): false; + } + + @Override + public int getStoredLiquid(int type) { + // TODO Auto-generated method stub + return genB !=null ? genB.getStoredLiquid(type): 0; + } + + @Override + public int getLiquidCapacity(int type) { + // TODO Auto-generated method stub + return genB !=null ? genB.getLiquidCapacity(type): 0; + } + +} diff --git a/1.3/minecraft/EUIClient/SteamPower/RenderBoiler.java b/1.3/minecraft/EUIClient/SteamPower/RenderBoiler.java deleted file mode 100644 index b64d662c..00000000 --- a/1.3/minecraft/EUIClient/SteamPower/RenderBoiler.java +++ /dev/null @@ -1,30 +0,0 @@ -package EUIClient.SteamPower; - -import org.lwjgl.opengl.GL11; - -import EUI.SteamPower.SteamPower; - -import net.minecraft.src.*; - -public class RenderBoiler extends TileEntitySpecialRenderer -{ - int type = 0; - private ModelTank model; - - public RenderBoiler(float par1) - { - model = new ModelTank(par1); - } - - - @Override - public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3) { - bindTextureByName(SteamPower.textureFile+"tankTexture.png"); - GL11.glPushMatrix(); - GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - model.generalRender(0.0625F); - GL11.glPopMatrix(); - } - -} \ No newline at end of file diff --git a/1.3/minecraft/EUIClient/Textures/CornerTank.png b/1.3/minecraft/EUIClient/Textures/CornerTank.png new file mode 100644 index 0000000000000000000000000000000000000000..1477442fc608a221711478243884f7abf6ee93f4 GIT binary patch literal 2686 zcmZuzdtB1V79Ws!=+8GA8Y;1_S*s<9DLx7ne3X)wmX9_u6jR%zH3Kt~*nC?)x3pR; zwXn2uedJoYqGnne7M7-K2G(AB8I)xfrkA>pfA0OvoH=v8XXc#weCC`vlN-eF)zvoF z1_0>#`_Z;&IR7i5k(#k*ee{5a!IHQ5dVwnv{0ohM+_lM<1{S}zvmK&R4T9nLg(m}` z*YlNNeMz-38W6SLKah@^K%1Maay2=yFr-&i*$`@wz{@nG9F!63a|OufO`Zwc`*dHa)M4ba>10jR1w3fj<-LZ zd^6aNZE|Z}@z#3Fg9>h%Qj4)8uU#&mbXIm$e42IZ&XUVU0#STj$43tBOL@xWM8Hq` zXk~y^_`JJ-YEMhk2dagn!fhW;#bu>7w6ZAI%QcRd@gw<$3F>tK^z5LqNxxBROXmXDSY% z*_cc1i2(4{Om!FoMo;QKmCc{Ki2@Q-6&8!8YBPPk#}^?Pk}e?-S2gz;StpuTX(I=F>3JP01E*E));W^?v-b#v}o1 zb<=`S6eRulxa(`>v>?aTv(A&|H;fpGaBw`6+&|;K(3v9(EYKJT#`ZU2iAGkXFE0AT z|B7I;Ur+zo_vX!NDY;87ul7l>H-Oc*)F$S;4~c15aOnQSNz zAAX|aXULTWu>wNoLPC$(X-UbyE$Xt5NmpT1ABIVH#y0GX=&ZZ6zUij|{gbGLi z?dCSROI1K>7+E(eZySV^9#V3;=U>~g^fO<^wdz^=VuT`KYp0nc6$r?I4mijGujhcn z^4>j*pEu=JSf3>ygMd2{rda80c1?U@}q#Ote$84(87mc^Q}BZI|iXh?Xh#|D<^{3HU!@@nvQ>{k(g zFHK6ix98Pip=eEk;bFZT&K}zyoP0b2MHrmF9n(m)?0qS|g)8XmW3tO)a~sbr_b*{^ z_ZE?zggM=2?hW^TFfe2{anRdCA6BrM3muTAx0vjp6^~LZ?l6L%xl{x=ZLIqqRNKA_ zOCBc2vxPUYPcFn8!lGB-f?!Zosda8RVL+O>df_3fdBt_XSbf6hWB2ff)t8gv%eIBX zX$ac61#^}w%t=;$0j4cD?Ni(m)|uO#JWe`O>N2CS#uRe)6gnoh`#oPnL-_9!sD@u! zME!6VjJWcYy9oa{?KCrH5BFnsbt{{XG>>#qtooR5_Rbv@=L11ofqF?eSA=LDTTv#6 zsBXRkaa_%M$~)Mz&Vgp=0RAs1j2O|}y=)DfymE(E2&-s3{0AfRUU7xWP3Lz#U8*+} z-eqcF2(Coy8Nc|=U#;2u%Cz4$XeEm#=gr2%HOp)Dz;FMBK z_fDOivrk!@&nHYe|72rYABC-Z3Coe4a*j9!T9;6eA>(8Ipx?NdFp>E*w}RkcAZHh> zo8t3=9COaPAx)(jYHlsY-AQfe!&a4f7Yerf@s}k%;V(VH(^pQoJ0SeremUJN85GfY zn*1PiHD*!%dh)~~bq$99fYRzqa|51eaXw4dCf%Skbd7mC*|Sye-6`0%T%E@OscO-N z7~(1b86wKJ(PZ>IhZz#=`7>_iWYg!7RaoszuX91R*!1qM%cpKh>R9XpLb^$AT5jpRHuB-k)J5S>@s`K(*gMm zs~a~ycTFbx1Lb-D#pqktM)|Jkd+7RL(8BBbXmV?jv*P`^FmHH!@>93_FPhS(t0Hq; z(`~UGz0x7*;QP7T8(UzN^DlIytr@x-#f`>P53>m)xShJ4pPzo5FNF5m!5B6o&C|5O zJ#F1izYhZoohI4M>)wWjuCa%SL?YEBi)`N8l(jD3wi)rYUpWH?XoOXIV;U>QM`~SS z+*H!Sg5Z7q+YDrT40H0luhk&_rP#Dqy!IP#^uIgW0}xeHMfT5OC-SHv_(lsvm<>F5 zU(UCn=(u%0Hk_NJ{PE={tHl}h$pmyr#DN!~;)n7t+~XY8Cssk$k}KR<$&31Ws|6Nt%yIt^y z%VW)26gr?vbrWaY+8D}fykK@#cRhd9L^$u0xnfxW_>|H_c`r}IZ1&TL5%BSf#jZFj z*>KdfmRO*Qaltd=6cN~pYd3O7TwN4|sa(KOJZdu$hJ)U8{w_c?>}T0)ZYX<` z(VZvn%b0gLoWYRa_GUpBRW-hW%=~2Z=7sLTq&ihi_5c+q42A7=-KCas{O#zkEBP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01m?d01m?e$8V@)00007bV*G`2iyo6 z0wFV&H!4*C015s{L_t(|+U;9Qh^0pr{?4iTANTfS9*K`&P}~GTi6Catpn?R!g{wgq zF5G1|J27kBkGM@hH?Bk%vlB#V5Esru0wP(t$tFUCn8|eC=U-LlxTwdid%LH5dV11x zAzg5}_phqI`afTt$9GQsO}JqD_E*2CJL4YXQ4duGGlPgQO4r61IOicE2qBd3rfFcU zg|!AEg0AbZv$F&5Jwgb0`0!&eGk$;g4&e%$z32_&QHN3A!TEq&H}^qAmEaCUgr>3Z z-h-JDLO|DbrC(JcBIx@bZQDRq%V#>9+ z59d6(t_3q|2nIw@V+=wF@ZQtT&JISSo-$||tiEfvAAqiHu)Dj9>2wN!V2pvaQ40V- zL@*llU}hyEW#&Al%nWNSjA1zE0f3sODfcq-_5;wiEf$MK+_AogNQ+00jsO5eQ2_6Q z8l%e0nt*_aC=sPy_XLnS=Wu*{Tx?!Mt{i|1LvD=0(a|xO8H>dNi^VeSssRzf7$epi zF~$fHX=?emWX%u}5D~l&aL%LeJ4~jt?FYbGGxU82?>&q$=(;vJHU%?F`qY985d{EB z5rwpp>SD3f>xO5fR08 z09Api!de4Wg>xQvzVqsK1K^x@A|V)Kl1VU#NR44tg))<es;YugtJg{Pu1Ry? zoQHGn%KgBF0XUvag7-m0q^Ld-D-jC-Ng%{6k1{h*04O*lQ=kZ(VmuyUe}8ZLO~APT z=Nti~Nf2d*h^P>g0#Fbs08-T?JP0d5Qj3ux0U@e708ne~b^|~}Z4jXqgM&s{RaCSH zo`naB1!N`2-lTwHttC}`AHZ^ZnwO4d+cL%p`-zs!AdV7o6Y=&WQ=(-lm z<$%8Lz-+vTSXC8cn4*WLpwOVAOiTn-Qq4{eo7|pM6(I!8X2i?{#5;{KR5{#D2Ml8j zGI^TKX87$N|9+|5fteX?+h7<5s49+*j?pv?7K=stV^JkXqdwh0)))q$NE)mn0w|aW zP*qZZlEW`MpIyMFU?we=tb?)>B%%@?GeZ;+ESF2n=W{HV%V%Q(IsB+9rqe0L;}Pcb zIgXBwQ}(t>U=pLt$fZ0;6;P^FUI~<3KkD7AT|l;dmAIhUd@%3*8c;FEaEUy{5d18t zvo*$~Fyz1-<2wMn@WO3~2->zSW}&KOJTkwS?GX_XBZoW?krE(8WD+5wNRzd!Q_U@X zM1&9mLde|0mcN+=j=aHQ7zP|2PcIKZV6o|T?cQgtH1w}-%(^E}qo*7`2ok}Dy#+2M*W%mJ-$pqFKgb*E|a}IqU zHzAwmr2xowHw@ACaz=JEnc+(>zl2ARj*6X*Mm>lKec!_{qv?C{-m5^hw&Rtj13*}j z|L6oL116%R8WPx!vZKv3JM}|Eim-$8AR-KdI}s+IiU(Zuh97_LHQ)E0Y1`H_GY`Yy zvr7l9_MKL1Qyu@aHsz2fBCHyt%7_2^2)AzDpx^!FAKP0HvDPd_bTpsOwP_kbCis+m zUsV6ic%Rc?T19~z8i@b}b4-V?IvKh!03tG94#SMe>=03t3n8>p_O)cE7G70zg(OjF z5c4V&I_E)GS`&VXTwoadFqnyxquTo?eujJ9cNwMPxYityx$Pd+fwLI&fGGgRZjskOEgIWqs> zUH}XusD37=s)^mzUO$tka&psk?TPibt|nMJ zvMf+8UQ{NLgpBkyR&=5d2q7R9MZs)}kbU2sy8hPI1nZhz?$2YjDZ~<&Pbuw?v?HX# z1{EfF*7{pn6WpxX)k0@e%DW9PLRh^q65keSimBx_&szVJstIzg396#l*LXZG51Iw) zx(?&H4{9^xSKLr`7C25DbG$&QFVAij{_V z@5+g?_W{%C?1|Uks+!Mg9x;jHr&@n2YJz9g>=w&G z061oHBI>;lzHJ)y-g5}S&KJuDKzlTqnJ>Nk5?yrtXI&Hg)VFmK@dnl*eR*T{FU}~U zUgqBC*!a_~0iSvR=pI(8`zG$Kb8oy^*~+HFp-bI+tpV2nTmx_oz%>BZ?YeCl6$bEw zZ+%6rVSM!P2)A$T`PK@K3O1$1&kM8xLLmI zzVizVm%Bf=!=E0i{#tSH<%2aK4u5i}`g6s>7Y?3DDtH2boQmesRQ|t!y6>!Z+52;Q z{a3Hk+kbsqAH4VA)SZ3sp9l1b0FVoltN#b^YklY1)FtnK(suWocb|y{(4FsoO^q=i zCa5Tg2|m3uNa?7$zOH|tHh*(GgmC8kKm7Th^gMllEw88NGkXQwbmK_~>wWe0=Gb}T=gq(O7#QCC&An3}xXv=y*L+-k?Ci{w9%}$_#;*Q84eCUzcwz1hYD55TW_sLheJ_S;NU_nko7d;f-yA=0{wsIx;Eng*JF#o`@BbS_zdZTG_wPro zzH{gF=y3O98bCjM{Z*}BQUU`Od* zM&IOGD9Ox1lufzJCGG3^C%)%>Ua!}Az0Uib_c`yMUUyOMNJ%keF#rH0U7Q^~4>a{( zK!gvNekyqIKtQpcNPD1VSY`RZ2wy&nbOiYS4yl{`;2;sjI{U{0fE4{-fCi!)LJmTa zn=Wn$kr~Jl0Y&vgQ_YxzH4_)dGwAr~)r#OKmH$d+sQXWx)c)9}8q}7Ut)fYM9S}>L z(FpsXL+f=t>JR_y9g@;Y=|VpBasTBYym6}6Ok=Ystiq@;?~7PZ!K?jE(@PZANcAZ@ z$2pEOEI7dTOC^i*qI+M}^rV;T9UD|6!c|m@fSFF={a_<62B_XRWol42R}z@QSpLr( zm%mL;{l)weeRA#{Id6N7C0Gw*FIDq};KVYzszDv8=;u8A+XbxETa@?vav(ho-PF)A zzq_mK>pQ@*sFQ0j%q5n|CtVkb=l?#*;c`Kcm|XUZDi9QErIr`Z<9v?St4pt3m@jK; z(ndqI1iUlKK!79k<^DB)-*cSOdQ6g!H>PhYF7@3q*qgz^+EJD8cpes?m43sOsxYFG z2ak%1qWA8Xc@`8(i+pv@x9FQex!%bN3hJ-lzq9i(-_ z5RXsyKxm#U8C-yOWEOb2qYAcju7%zG?m)|7z7*uJWUR^cQijIc)3PK#CB_HHCl{m~ zR^;vVnV5ojlg3_9R^|=*c!`I`YPKyrt<#xA@tY#x0uCOM3)IP-gKZ?dT9qMcho}Li zHm+3T0dbAsr1mgJAuMrI+KyyMSDM$i8_!biKwk_D97|xP2{uRe1;@R=P?IHd$*3|o zJ~dGeYe3g5G<1a-qb6#3M@*)Y7su-s<7OJ$I0gVN^6XDAXXb zFXmEegu$Q~T7;sxltT|zQ=T1aZMk}L$DIsELt%AsQx5D3q>c*}mD6=B^<;in4U9`i|d&d9Re6N*7M$Rgcl%VBJNiy%K}n;q0OFe6y;afJNM)n z>@We|qETT#d?Lw$kf7SulJRIR`udmTAzOZA*e3a%(%{p%n@m>L+)FG>;{AVUg3fk+K;p$3wEqgBdhD7i+6l z^Cp>~FV$MTblRqg>9)A_YNI#VEdyhGV4^_%*Y?> z1?7KRt4^W`bQU%DGq1Z(PplxOn{`_X#*iND+S zN*)JBz#K2fe30$gU)hk+XLD8U%hj z3sZLEUv?)40PE^%A?*>lTmRj~BT*j}2to zqmk3udUE|LTDln68`B;#rDw-!{GK_sid-BCEoU!q7A{OL@Ggae?1pcJrH19`ozP1? zA2RnrNRTq|$GHS|4+9lF#h+~oOpiU(EvxDuq` z!-k6}cHpTI?eZvpG<-tE(8I635`>S3VIddi`y(QMf2R@uJo+Lp18yM-7K1C{?A}`l z^L{fyS=$DBc>{vK_p1Y$N#J;Y;T3UnnPg9e+X)N&LW!KUYWrqHztU2@xKg-+YJZ#l z*Ib=LQW}jo1MT}8j6=`PLR(vKk9DJi0XI2@h957jXUMSpI z%-k)GKwuJg3MrefE9mwhOp*Yclx! z;%13yC-lno4P)-^7;$+I)IU&9vD__Un_sMT$6zgr0{+sTZH$ ztD_dtY+9Z?S!2UG{>LtiE3#d5Y=UYhHl5{Um=r@HAWC(YjR}lA)4v`ce-`>mje5Z W)Tr2KPyRuf0$dR8jxF{ 0) { @@ -48,6 +48,7 @@ import net.minecraft.src.*; displayText = "No Steam"; } } + else if(tileEntity.generateRate*20 < 20) { displayText = "Warming UP: "+(int)(tileEntity.generateRate*100)+"%"; @@ -69,7 +70,7 @@ import net.minecraft.src.*; */ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - int var4 = this.mc.renderEngine.getTexture(SteamPower.textureFile+"SteamGUI.png"); + int var4 = this.mc.renderEngine.getTexture(SteamPowerMain.textureFile+"SteamGUI.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(var4); containerWidth = (this.width - this.xSize) / 2; diff --git a/1.3/minecraft/EUIClient/SteamPower/GuiBoiler.java b/1.3/minecraft/SteamPower/GuiBoiler.java similarity index 89% rename from 1.3/minecraft/EUIClient/SteamPower/GuiBoiler.java rename to 1.3/minecraft/SteamPower/GuiBoiler.java index dc91a79c..786e4daf 100644 --- a/1.3/minecraft/EUIClient/SteamPower/GuiBoiler.java +++ b/1.3/minecraft/SteamPower/GuiBoiler.java @@ -1,13 +1,14 @@ -package EUIClient.SteamPower; +package SteamPower; import java.text.DecimalFormat; -import net.minecraft.src.*; +import net.minecraft.src.GuiContainer; +import net.minecraft.src.InventoryPlayer; +import net.minecraft.src.StatCollector; import org.lwjgl.opengl.GL11; -import EUI.SteamPower.SteamPower; -import EUI.SteamPower.boiler.ContainerBoiler; -import EUI.SteamPower.boiler.TileEntityBoiler; +import SteamPower.boiler.ContainerBoiler; +import SteamPower.boiler.TileEntityBoiler; public class GuiBoiler extends GuiContainer { @@ -37,7 +38,7 @@ public class GuiBoiler extends GuiContainer */ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - int var4 = this.mc.renderEngine.getTexture(SteamPower.textureFile+"BoilerGui.png"); + int var4 = this.mc.renderEngine.getTexture(SteamPowerMain.textureFile+"BoilerGui.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(var4); int var5 = (this.width - this.xSize) / 2; diff --git a/1.3/minecraft/SteamPower/ModelCenterTank.java b/1.3/minecraft/SteamPower/ModelCenterTank.java new file mode 100644 index 00000000..00f0ef1e --- /dev/null +++ b/1.3/minecraft/SteamPower/ModelCenterTank.java @@ -0,0 +1,59 @@ +// Date: 8/14/2012 1:48:41 AM +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package SteamPower; + +import net.minecraft.src.Entity; +import net.minecraft.src.ModelBase; +import net.minecraft.src.ModelRenderer; + +public class ModelCenterTank extends ModelBase +{ + + ModelRenderer Block; + + public ModelCenterTank(float par1) + { + textureWidth = 128; + textureHeight = 128; + + + //block + Block = new ModelRenderer(this, 0, 0); + Block.addBox(0F, 0F, 0F, 16, 16, 16); + Block.setRotationPoint(-8F, 8F, -8F); + Block.setTextureSize(128, 32); + Block.mirror = true; + setRotation(Block, 0F, 0F, 0F); + } + public void renderBlock(float f5) + { + Block.render(f5); + } + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, 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/1.3/minecraft/SteamPower/ModelCornerTank.java b/1.3/minecraft/SteamPower/ModelCornerTank.java new file mode 100644 index 00000000..87c030fe --- /dev/null +++ b/1.3/minecraft/SteamPower/ModelCornerTank.java @@ -0,0 +1,100 @@ +// Date: 8/14/2012 1:48:41 AM +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package SteamPower; + +import net.minecraft.src.Entity; +import net.minecraft.src.ModelBase; +import net.minecraft.src.ModelRenderer; + +public class ModelCornerTank extends ModelBase +{ + //Corner + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape4; + + public ModelCornerTank(float par1) + { + textureWidth = 128; + textureHeight = 128; + + + //corner + Shape1 = new ModelRenderer(this, 0, 1); + Shape1.addBox(0F, 0F, 0F, 1, 16, 20); + Shape1.setRotationPoint(7F, 8F, -7F); + Shape1.setTextureSize(128, 128); + Shape1.mirror = true; + setRotation(Shape1, 0F, -0.7853982F, 0F); + Shape2 = new ModelRenderer(this, 44, 0); + Shape2.addBox(0F, 0F, 0F, 2, 16, 2); + Shape2.setRotationPoint(-8F, 8F, 6F); + Shape2.setTextureSize(128, 128); + Shape2.mirror = true; + setRotation(Shape2, 0F, 0F, 0F); + Shape3 = new ModelRenderer(this, 44, 0); + Shape3.addBox(0F, 0F, 0F, 2, 16, 2); + Shape3.setRotationPoint(6F, 8F, -8F); + Shape3.setTextureSize(128, 128); + Shape3.mirror = true; + setRotation(Shape3, 0F, 0F, 0F); + Shape6 = new ModelRenderer(this, 0, 44); + Shape6.addBox(0F, 0F, 0F, 1, 15, 13); + Shape6.setRotationPoint(-8F, 9F, -7F); + Shape6.setTextureSize(128, 128); + Shape6.mirror = true; + setRotation(Shape6, 0F, 0F, 0F); + Shape7 = new ModelRenderer(this, 0, 73); + Shape7.addBox(0F, 0F, 0F, 14, 15, 1); + Shape7.setRotationPoint(-8F, 9F, -8F); + Shape7.setTextureSize(128, 128); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + Shape4 = new ModelRenderer(this, 0, 92); + Shape4.addBox(0F, 0F, 0F, 16, 1, 16); + Shape4.setRotationPoint(-8F, 8F, -8F); + Shape4.setTextureSize(128, 128); + Shape4.mirror = true; + setRotation(Shape4, 0F, 0F, 0F); + } + public void renderCorner(float f5) + { + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape4.render(f5); + } + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, 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/1.3/minecraft/SteamPower/ModelEngine.java b/1.3/minecraft/SteamPower/ModelEngine.java new file mode 100644 index 00000000..9d766aae --- /dev/null +++ b/1.3/minecraft/SteamPower/ModelEngine.java @@ -0,0 +1,115 @@ +// Date: 8/24/2012 1:44:37 PM +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package SteamPower; + +import net.minecraft.src.Entity; +import net.minecraft.src.ModelBase; +import net.minecraft.src.ModelRenderer; + +public class ModelEngine extends ModelBase +{ + //fields + ModelRenderer Base; + ModelRenderer top; + ModelRenderer TopPiston; + ModelRenderer BottomPiston; + ModelRenderer center; + ModelRenderer C1; + ModelRenderer C2; + + public ModelEngine() + { + textureWidth = 64; + textureHeight = 64; + + Base = new ModelRenderer(this, 0, 20); + Base.addBox(-6F, 0F, -6F, 12, 8, 12); + Base.setRotationPoint(0F, 16F, 0F); + Base.setTextureSize(64, 64); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + top = new ModelRenderer(this, 0, 0); + top.addBox(-6F, 0F, -6F, 12, 8, 12); + top.setRotationPoint(0F, -8F, 0F); + top.setTextureSize(64, 64); + top.mirror = true; + setRotation(top, 0F, 0F, 0F); + TopPiston = new ModelRenderer(this, 0, 52); + TopPiston.addBox(-2F, 0F, -2F, 4, 8, 4); + TopPiston.setRotationPoint(0F, 0F, 0F); + TopPiston.setTextureSize(64, 64); + TopPiston.mirror = true; + setRotation(TopPiston, 0F, 0F, 0F); + BottomPiston = new ModelRenderer(this, 16, 52); + BottomPiston.addBox(-2F, 0F, -2F, 4, 8, 4); + BottomPiston.setRotationPoint(0F, 8F, 0F); + BottomPiston.setTextureSize(64, 64); + BottomPiston.mirror = true; + setRotation(BottomPiston, 0F, 0F, 0F); + center = new ModelRenderer(this, 32, 52); + center.addBox(-3F, 0F, -3F, 6, 6, 6); + //center.setRotationPoint(0F, 5F, 0F); + center.setTextureSize(64, 64); + center.mirror = true; + setRotation(center, 0F, 0F, 0F); + C1 = new ModelRenderer(this, 0, 41); + C1.addBox(-2F, -3F, 0F, 4, 6, 3); + C1.setRotationPoint(0F, 8F, 3F); + C1.setTextureSize(64, 64); + C1.mirror = true; + setRotation(C1, 0F, 0F, 0F); + C2 = new ModelRenderer(this, 15, 41); + C2.addBox(-2F, -3F, -3F, 4, 6, 3); + C2.setRotationPoint(0F, 8F, -3F); + C2.setTextureSize(64, 64); + C2.mirror = true; + setRotation(C2, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + //renderBot(f5); + //renderTop(f5); + } + public void renderBot(float f5) + { + Base.render(f5); + BottomPiston.render(f5); + } + public void renderTop(float f5) + { + top.render(f5); + TopPiston.render(f5); + C1.render(f5); + C2.render(f5); + } + public void renderMid(float f5,float p) + { + + center.setRotationPoint(0F, p, 0F); + center.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/1.3/minecraft/EUIClient/SteamPower/ModelFurnace.java b/1.3/minecraft/SteamPower/ModelFurnace.java similarity index 98% rename from 1.3/minecraft/EUIClient/SteamPower/ModelFurnace.java rename to 1.3/minecraft/SteamPower/ModelFurnace.java index 37d0e0bd..0546703d 100644 --- a/1.3/minecraft/EUIClient/SteamPower/ModelFurnace.java +++ b/1.3/minecraft/SteamPower/ModelFurnace.java @@ -9,7 +9,7 @@ -package EUIClient.SteamPower; +package SteamPower; import net.minecraft.src.Entity; import net.minecraft.src.ModelBase; diff --git a/1.3/minecraft/EUIClient/SteamPower/ModelTank.java b/1.3/minecraft/SteamPower/ModelTank.java similarity index 98% rename from 1.3/minecraft/EUIClient/SteamPower/ModelTank.java rename to 1.3/minecraft/SteamPower/ModelTank.java index f57c884e..03c6ffa8 100644 --- a/1.3/minecraft/EUIClient/SteamPower/ModelTank.java +++ b/1.3/minecraft/SteamPower/ModelTank.java @@ -9,7 +9,7 @@ -package EUIClient.SteamPower; +package SteamPower; import net.minecraft.src.Entity; import net.minecraft.src.ModelBase; @@ -17,7 +17,7 @@ import net.minecraft.src.ModelRenderer; public class ModelTank extends ModelBase { - //fields + //One Block Tank ModelRenderer TANK_WALL_1; ModelRenderer TANK_WALL_2; ModelRenderer TANK_WALL_3; @@ -121,7 +121,6 @@ public class ModelTank extends ModelBase { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5); - generalRender(f5); } public void generalRender(float f5) { diff --git a/1.3/minecraft/EUIClient/SteamPower/ModelEngine.java b/1.3/minecraft/SteamPower/ModelToyEngine.java similarity index 99% rename from 1.3/minecraft/EUIClient/SteamPower/ModelEngine.java rename to 1.3/minecraft/SteamPower/ModelToyEngine.java index a06fd499..021f4565 100644 --- a/1.3/minecraft/EUIClient/SteamPower/ModelEngine.java +++ b/1.3/minecraft/SteamPower/ModelToyEngine.java @@ -9,13 +9,13 @@ -package EUIClient.SteamPower; +package SteamPower; import net.minecraft.src.Entity; import net.minecraft.src.ModelBase; import net.minecraft.src.ModelRenderer; -public class ModelEngine extends ModelBase +public class ModelToyEngine extends ModelBase { //fields ModelRenderer BASE; @@ -43,7 +43,7 @@ public class ModelEngine extends ModelBase ModelRenderer LEVER_1_CAN_BE_TURNED; ModelRenderer LEVER_2_CAN_BE_TURNED; - public ModelEngine() + public ModelToyEngine() { textureWidth = 128; textureHeight = 128; diff --git a/1.3/minecraft/SteamPower/RenderBoiler.java b/1.3/minecraft/SteamPower/RenderBoiler.java new file mode 100644 index 00000000..8e023391 --- /dev/null +++ b/1.3/minecraft/SteamPower/RenderBoiler.java @@ -0,0 +1,62 @@ +package SteamPower; + +import net.minecraft.src.TileEntity; +import net.minecraft.src.TileEntitySpecialRenderer; + +import org.lwjgl.opengl.GL11; + +import BasicPipes.TradeHelper; +import SteamPower.boiler.TileEntityBoiler; + +public class RenderBoiler extends TileEntitySpecialRenderer +{ + int type = 0; + private ModelTank model; + private ModelCenterTank model2; + private ModelCornerTank model3; + + public RenderBoiler(float par1) + { + model = new ModelTank(par1); + model2 = new ModelCenterTank(par1); + model3 = new ModelCornerTank(par1); + } + + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3) { + + GL11.glPushMatrix(); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); + GL11.glScalef(1.0F, -1F, -1F); + TileEntity[] connected = ((TileEntityBoiler)tileEntity).connectedBlocks; + int meta = 0; + if(connected[5] == null && connected[3] == null && connected[4] == null && connected[2] == null || ((TileEntityBoiler)tileEntity).tankCount < 2 ) + { + bindTextureByName(SteamPowerMain.textureFile+"tankTexture.png"); + model.generalRender(0.0625F); + } + else + if(TradeHelper.corner(tileEntity) == 0 || ((TileEntityBoiler)tileEntity).tankCount > 2) + { + bindTextureByName(SteamPowerMain.textureFile+"tankBlock.png"); + model2.renderBlock(0.0625F); + } + else + { + int corner = TradeHelper.corner(tileEntity); + bindTextureByName(SteamPowerMain.textureFile+"CornerTank.png"); + switch(corner) + { + case 1: GL11.glRotatef(270f, 0f, 1f, 0f);break; + case 2: GL11.glRotatef(0f, 0f, 1f, 0f);break; + case 3: GL11.glRotatef(90f, 0f, 1f, 0f);break; + case 4: GL11.glRotatef(180f, 0f, 1f, 0f);break; + } + model3.renderCorner(0.0625f); + + } + GL11.glPopMatrix(); + } + +} \ No newline at end of file diff --git a/1.3/minecraft/EUIClient/SteamPower/RenderFurnace.java b/1.3/minecraft/SteamPower/RenderFurnace.java similarity index 52% rename from 1.3/minecraft/EUIClient/SteamPower/RenderFurnace.java rename to 1.3/minecraft/SteamPower/RenderFurnace.java index d379048a..42f96d06 100644 --- a/1.3/minecraft/EUIClient/SteamPower/RenderFurnace.java +++ b/1.3/minecraft/SteamPower/RenderFurnace.java @@ -1,10 +1,10 @@ -package EUIClient.SteamPower; +package SteamPower; + +import net.minecraft.src.TileEntity; +import net.minecraft.src.TileEntitySpecialRenderer; import org.lwjgl.opengl.GL11; -import EUI.SteamPower.SteamPower; -import net.minecraft.src.*; - public class RenderFurnace extends TileEntitySpecialRenderer { int type = 0; @@ -18,10 +18,18 @@ public class RenderFurnace extends TileEntitySpecialRenderer @Override public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3) { - bindTextureByName(SteamPower.textureFile+"Furnace.png"); + bindTextureByName(SteamPowerMain.textureFile+"Furnace.png"); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glScalef(1.0F, -1F, -1F); + int meta = ((TileEntityMachine) tileEntity).getDirection(); + switch(meta) + { + case 1:GL11.glRotatef(0f, 0f, 1f, 0f);break; + case 2:GL11.glRotatef(90f, 0f, 1f, 0f);break; + case 3:GL11.glRotatef(180f, 0f, 1f, 0f);break; + case 4:GL11.glRotatef(270f, 0f, 1f, 0f);break; + } model.genRender(0.0625F); GL11.glPopMatrix(); } diff --git a/1.3/minecraft/SteamPower/RenderSteamEngine.java b/1.3/minecraft/SteamPower/RenderSteamEngine.java new file mode 100644 index 00000000..ce9ffdbb --- /dev/null +++ b/1.3/minecraft/SteamPower/RenderSteamEngine.java @@ -0,0 +1,49 @@ +package SteamPower; + +import net.minecraft.src.TileEntity; +import net.minecraft.src.TileEntitySpecialRenderer; + +import org.lwjgl.opengl.GL11; + +import SteamPower.turbine.TileEntityGenerator; + +public class RenderSteamEngine extends TileEntitySpecialRenderer +{ + int type = 0; + private ModelEngine model; + + public RenderSteamEngine() + { + model = new ModelEngine(); + } + + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3) { + bindTextureByName(SteamPowerMain.textureFile+"Engine.png"); + GL11.glPushMatrix(); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); + GL11.glScalef(1.0F, -1F, -1F); + + float p = ((TileEntityGenerator)tileEntity).position; + boolean cc = ((TileEntityGenerator)tileEntity).isConnected; + int meta = ((TileEntityMachine) tileEntity).getDirection(); + switch(meta) + { + case 1:GL11.glRotatef(0f, 0f, 1f, 0f);break; + case 2:GL11.glRotatef(90f, 0f, 1f, 0f);break; + case 3:GL11.glRotatef(180f, 0f, 1f, 0f);break; + case 4:GL11.glRotatef(270f, 0f, 1f, 0f);break; + } + if(cc) + { + model.renderTop(0.0625F); + model.renderMid(0.0625F,p); + } + model.renderBot(0.0625F); + + + GL11.glPopMatrix(); + } + +} \ No newline at end of file diff --git a/1.3/minecraft/EUIClient/SteamPower/RenderSteamEngine.java b/1.3/minecraft/SteamPower/RenderToyEngine.java similarity index 52% rename from 1.3/minecraft/EUIClient/SteamPower/RenderSteamEngine.java rename to 1.3/minecraft/SteamPower/RenderToyEngine.java index 3ad0c5a4..8b760e8f 100644 --- a/1.3/minecraft/EUIClient/SteamPower/RenderSteamEngine.java +++ b/1.3/minecraft/SteamPower/RenderToyEngine.java @@ -1,24 +1,24 @@ -package EUIClient.SteamPower; +package SteamPower; + +import net.minecraft.src.TileEntity; +import net.minecraft.src.TileEntitySpecialRenderer; import org.lwjgl.opengl.GL11; -import EUI.SteamPower.SteamPower; -import net.minecraft.src.*; - -public class RenderSteamEngine extends TileEntitySpecialRenderer +public class RenderToyEngine extends TileEntitySpecialRenderer { int type = 0; - private ModelEngine model; + private ModelToyEngine model; - public RenderSteamEngine() + public RenderToyEngine() { - model = new ModelEngine(); + model = new ModelToyEngine(); } @Override public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3) { - bindTextureByName(SteamPower.textureFile+"tankTexture.png"); + bindTextureByName(SteamPowerMain.textureFile+"tankTexture.png"); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); GL11.glScalef(1.0F, -1F, -1F); diff --git a/1.3/minecraft/EUIClient/SteamPower/SteamClientProxy.java b/1.3/minecraft/SteamPower/SteamClientProxy.java similarity index 59% rename from 1.3/minecraft/EUIClient/SteamPower/SteamClientProxy.java rename to 1.3/minecraft/SteamPower/SteamClientProxy.java index 6fb887e8..efc104e9 100644 --- a/1.3/minecraft/EUIClient/SteamPower/SteamClientProxy.java +++ b/1.3/minecraft/SteamPower/SteamClientProxy.java @@ -1,21 +1,14 @@ -package EUIClient.SteamPower; +package SteamPower; -import EUI.SteamPower.SteamProxy; -import EUI.SteamPower.TileEntityNuller; -import EUI.SteamPower.boiler.TileEntityBoiler; -import EUI.SteamPower.burner.TileEntityFireBox; -import EUI.SteamPower.turbine.TileEntityGenerator; -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.common.network.IGuiHandler; -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.src.EntityPlayer; -import net.minecraft.src.ModelBiped; -import net.minecraft.src.RenderBiped; -import net.minecraft.src.RenderBlocks; -import net.minecraft.src.TileEntity; -import net.minecraft.src.World; +import net.minecraft.src.RenderEngine; import net.minecraftforge.client.MinecraftForgeClient; +import SteamPower.boiler.TileEntityBoiler; +import SteamPower.burner.TileEntityFireBox; +import SteamPower.turbine.TileEntityGenerator; +import SteamPower.turbine.TileEntitytopGen; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.common.registry.GameRegistry; public class SteamClientProxy extends SteamProxy{