diff --git a/1.3/common/EUI/SteamPower/BlockMachine.java b/1.3/common/EUI/SteamPower/BlockMachine.java new file mode 100644 index 00000000..6a5ac1bf --- /dev/null +++ b/1.3/common/EUI/SteamPower/BlockMachine.java @@ -0,0 +1,289 @@ +package EUI.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; + +public class BlockMachine extends universalelectricity.extend.BlockMachine +{ + + private Random furnaceRand = new Random(); + private static boolean keepFurnaceInventory = true; + + public BlockMachine(int par1) + { + super("machine", par1, Material.iron); + this.setRequiresSelfNotify(); + this.setCreativeTab(CreativeTabs.tabBlock); + + } + @Override + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + + 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 + protected int damageDropped(int metadata) + { + return metadata; + } + @Override + public void randomDisplayTick(World par1World, int x, int y, int z, Random par5Random) + { + TileEntity tileEntity = par1World.getBlockTileEntity(x, y, z); + + if(tileEntity instanceof TileEntityFireBox) + { + if(((TileEntityFireBox)tileEntity).generateRate > 0) + { + int var6 = ((TileEntityFireBox) tileEntity).getDirection(); + float var7 = (float)x + 0.5F; + float var8 = (float)y + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F; + float var9 = (float)z + 0.5F; + float var10 = 0.52F; + float var11 = par5Random.nextFloat() * 0.6F - 0.3F; + + if (var6 == 5) + { + 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) + { + 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) + { + 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) + { + 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); + } + } + } + } + @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) + { + TileEntityMachine tileEntity = (TileEntityMachine)par1World.getBlockTileEntity(par2, par3, par4); + + //Reorient the block + switch(tileEntity.getDirection()) + { + case 2: tileEntity.setDirection(5); break; + case 5: tileEntity.setDirection(3); break; + case 3: tileEntity.setDirection(4); break; + case 4: tileEntity.setDirection(2); break; + } + + return true; + } + /** + * Called upon block activation (left or right click on the block.). The three integers represent x,y,z of the + * block. + */ + @Override + 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 TileEntityBoiler) + { + TileEntity var6 = (TileEntityBoiler)par1World.getBlockTileEntity(x, y, z); + par5EntityPlayer.openGui(SteamPower.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); + } + } + + return true; + } + } + @Override + public TileEntity createNewTileEntity(World var1,int meta) + { + switch(meta) + { + case 1: return new TileEntityBoiler(); + case 2: return new TileEntityFireBox(); + case 3: return new TileEntityGenerator(); + case 15: return new TileEntityNuller(); + } + return null; + } + + /** + * Called when the block is placed in the world. + */ + @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(5); break; + case 1: tileEntity.setDirection(3); break; + case 2: tileEntity.setDirection(4); break; + case 3: tileEntity.setDirection(2); break; + } + } + /** + * Called whenever the block is removed. + */ + @Override + public void breakBlock(World par1World, int par2, int par3, int par4,int par5, int par6){ + if (!keepFurnaceInventory) + { + TileEntityMachine var5 = null; + TileEntity entityBox = par1World.getBlockTileEntity(par2, par3, par4); + if(entityBox instanceof TileEntityFireBox) + { + var5 = (TileEntityFireBox)entityBox; + } + else if(entityBox instanceof TileEntityBoiler) + { + var5 = (TileEntityBoiler)entityBox; + } + if (var5 != null) + { + for (int var6 = 0; var6 < var5.getSizeInventory(); ++var6) + { + ItemStack var7 = var5.getStackInSlot(var6); + + if (var7 != null) + { + float var8 = this.furnaceRand.nextFloat() * 0.8F + 0.1F; + float var9 = this.furnaceRand.nextFloat() * 0.8F + 0.1F; + float var10 = this.furnaceRand.nextFloat() * 0.8F + 0.1F; + + while (var7.stackSize > 0) + { + int var11 = this.furnaceRand.nextInt(21) + 10; + + if (var11 > var7.stackSize) + { + var11 = var7.stackSize; + } + + var7.stackSize -= var11; + EntityItem var12 = new EntityItem(par1World, (double)((float)par2 + var8), (double)((float)par3 + var9), (double)((float)par4 + var10), new ItemStack(var7.itemID, var11, var7.getItemDamage())); + + if (var7.hasTagCompound()) + { + var12.item.setTagCompound((NBTTagCompound)var7.getTagCompound().copy()); + } + + float var13 = 0.05F; + var12.motionX = (double)((float)this.furnaceRand.nextGaussian() * var13); + var12.motionY = (double)((float)this.furnaceRand.nextGaussian() * var13 + 0.2F); + var12.motionZ = (double)((float)this.furnaceRand.nextGaussian() * var13); + par1World.spawnEntityInWorld(var12); + } + } + } + } + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + @Override + public String getTextureFile() + { + return "/EUIClient/textures/blocks/blocks.png"; + } + @Override + public boolean isOpaqueCube() + { + return false; + } + @Override + public boolean renderAsNormalBlock() + { + return false; + } + @Override + public int getRenderType() + { + return -1; + } +} diff --git a/1.3/common/EUI/SteamPower/ItemCoalFuel.java b/1.3/common/EUI/SteamPower/ItemCoalFuel.java new file mode 100644 index 00000000..8a25c219 --- /dev/null +++ b/1.3/common/EUI/SteamPower/ItemCoalFuel.java @@ -0,0 +1,59 @@ +package EUI.SteamPower; + +import java.util.ArrayList; + +import net.minecraft.src.*; + +public class ItemCoalFuel extends Item +{ + + public ItemCoalFuel(int par1) + { + super(par1); + this.setItemName("CoalDust"); + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setMaxStackSize(64); + } + @Override + public int getIconFromDamage(int par1) + { + switch(par1) + { + case 0: return 0; + case 1: return 1; + case 2: return 2; + } + return this.iconIndex; + } + @Override + public String getTextureFile() { + // TODO Auto-generated method stub + return "/eui/Items.png"; + } + public String getItemName() + { + return "CoalDust"; + } + + + + public String getItemNameIS(ItemStack par1ItemStack) + { + int var3 = par1ItemStack.getItemDamage(); + switch(var3) + { + case 0: return "CoalNuggets"; + case 1: return "CoalPellets"; + case 2: return "CoalDust"; + } + return this.getItemName(); + } + public void addCreativeItems(ArrayList itemList) { + + itemList.add(new ItemStack(this, 1,0)); + itemList.add(new ItemStack(this, 1,1)); + itemList.add(new ItemStack(this, 1,2)); + + } +} diff --git a/1.3/common/EUI/SteamPower/ItemMachine.java b/1.3/common/EUI/SteamPower/ItemMachine.java new file mode 100644 index 00000000..5a41ce2d --- /dev/null +++ b/1.3/common/EUI/SteamPower/ItemMachine.java @@ -0,0 +1,49 @@ +package EUI.SteamPower; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.src.*; + +public class ItemMachine extends ItemBlock { + + public ItemMachine(int id) { + super(id); + setMaxDamage(0); + setHasSubtypes(true); + this.setTabToDisplayOn(CreativeTabs.tabBlock); + } + @Override + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + + 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 + public int getMetadata(int metadata) + { + return metadata; + } + @Override + public String getItemName() + { + return "Machine"; + } + @Override + public String getItemNameIS(ItemStack par1ItemStack) + { + int var3 = par1ItemStack.getItemDamage(); + switch(var3) + { + case 0: return "CoalProcessor"; + case 1: return "Boiler"; + case 2: return "FireBox"; + case 3: return "SteamGen"; + case 15: return "EnergyNuller"; + } + return this.getItemName(); + } + } + diff --git a/1.3/common/EUI/SteamPower/ItemParts.java b/1.3/common/EUI/SteamPower/ItemParts.java new file mode 100644 index 00000000..22255215 --- /dev/null +++ b/1.3/common/EUI/SteamPower/ItemParts.java @@ -0,0 +1,70 @@ +package EUI.SteamPower; + +import java.util.ArrayList; + +import net.minecraft.src.Item; +import net.minecraft.src.ItemStack; + +public class ItemParts extends Item{ + + public ItemParts(int par1) + { + super(par1); + this.setItemName("Parts"); + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setMaxStackSize(64); + } + @Override + public int getIconFromDamage(int par1) + { + switch(par1) + { + case 0: return 3; + case 1: return 4; + case 2: return 5; + case 3: return 6; + case 4: return 7; + case 5: return 8; + case 6: return 9; + } + return this.iconIndex; + } + @Override + public String getTextureFile() { + // TODO Auto-generated method stub + return "/eui/Items.png"; + } + public String getItemName() + { + return "parts"; + } + + + + public String getItemNameIS(ItemStack par1ItemStack) + { + int var3 = par1ItemStack.getItemDamage(); + switch(var3) + { + case 1: return "Tank"; + case 3: return "Valve"; + case 4: return "Tube"; + case 5: return "Seal"; + case 6: return "Rivits"; + } + return this.getItemName(); + } + public void addCreativeItems(ArrayList itemList) + { + itemList.add(new ItemStack(this, 1,1)); + itemList.add(new ItemStack(this, 1,3)); + itemList.add(new ItemStack(this, 1,4)); + itemList.add(new ItemStack(this, 1,5)); + itemList.add(new ItemStack(this, 1,6)); + + } +} + + + diff --git a/1.3/common/EUI/SteamPower/SteamPower.java b/1.3/common/EUI/SteamPower/SteamPower.java new file mode 100644 index 00000000..ede15267 --- /dev/null +++ b/1.3/common/EUI/SteamPower/SteamPower.java @@ -0,0 +1,113 @@ +package EUI.SteamPower; +import net.minecraft.client.Minecraft; +import net.minecraft.src.Block; +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 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.PreInit; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +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") +@NetworkMod(channels = { "SPpack" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class) + +public class SteamPower{ + static Configuration config = new Configuration((new File(Minecraft.getMinecraftDir(), "config/EUIndustry/SteamPower.cfg"))); + private static int BlockID= configurationProperties(); + 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"); + @Instance + public static SteamPower instance; + + @SidedProxy(clientSide = "EUIClient.SteamPower.SteamClientProxy", serverSide = "EUI.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); + 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); + fireOutput = Integer.parseInt(config.getOrCreateIntProperty("fireBoxOutKJMax", Configuration.CATEGORY_GENERAL,250).value); + config.save(); + return BlockID; + } + @PreInit + public void preInit(FMLPreInitializationEvent event) + { + instance = this; + NetworkRegistry.instance().registerGuiHandler(this, this.proxy); + proxy.preInit(); + GameRegistry.registerBlock(machine, ItemMachine.class); + } + @Init + public void load(FMLInitializationEvent evt) + { + proxy.init(); + GameRegistry.registerTileEntity(TileEntityNuller.class, "EUNuller"); + //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(machine, 1, 15)), "EUVampire"); + + + } + @PostInit + public void postInit(FMLPostInitializationEvent event) + { + proxy.postInit(); + UniversalElectricity.registerMod(this,"SteamPower", "0.5.1"); + //Crafting + /** + * case 0: return new TileEntityGrinder(); <-Removed + case 1: return new TileEntityBoiler(); + case 2: return new TileEntityFireBox(); + case 3: return new TileEntityGenerator(); + case 14: return new TileEntityCondenser();<-Removed + 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), + '@',new ItemStack(BasicComponents.itemSteelPlate), + 'O',new ItemStack(BasicPipes.parts, 1,1), + 'V',new ItemStack(BasicPipes.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), + '@',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/EUI/SteamPower/SteamProxy.java new file mode 100644 index 00000000..c82623ac --- /dev/null +++ b/1.3/common/EUI/SteamPower/SteamProxy.java @@ -0,0 +1,72 @@ +package EUI.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; + +public class SteamProxy implements IGuiHandler{ + + public void preInit() + { + + } + public void init() + { + GameRegistry.registerTileEntity(TileEntityBoiler.class, "boiler"); + GameRegistry.registerTileEntity(TileEntityFireBox.class, "fireBox"); + GameRegistry.registerTileEntity(TileEntityGenerator.class, "generator"); + + } + public void postInit() + { + + } + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + { + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + + if (tileEntity != null) + { + switch(ID) + { + case 0: return new GUIFireBox(player.inventory, ((TileEntityFireBox)tileEntity)); + case 1: return new GuiBoiler(player.inventory, ((TileEntityBoiler)tileEntity)); + case 2: return new GUIGenerator(player.inventory, ((TileEntityGenerator)tileEntity)); + } + } + + return null; + } + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + { + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + + if (tileEntity != null) + { + switch(ID) + { + case 0: return new ContainerFireBox(player.inventory, ((TileEntityFireBox)tileEntity)); + case 1: return new ContainerBoiler(player.inventory, ((TileEntityBoiler)tileEntity)); + case 2: return new ContainerGenerator(player.inventory, ((TileEntityGenerator)tileEntity)); + } + } + + return null; + } +} diff --git a/1.3/common/EUI/SteamPower/TileEntityMachine.java b/1.3/common/EUI/SteamPower/TileEntityMachine.java new file mode 100644 index 00000000..a57975dd --- /dev/null +++ b/1.3/common/EUI/SteamPower/TileEntityMachine.java @@ -0,0 +1,136 @@ +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/TileEntityNuller.java b/1.3/common/EUI/SteamPower/TileEntityNuller.java new file mode 100644 index 00000000..28ceb6c9 --- /dev/null +++ b/1.3/common/EUI/SteamPower/TileEntityNuller.java @@ -0,0 +1,29 @@ +package EUI.SteamPower; + +import net.minecraftforge.common.ForgeDirection; +import universalelectricity.extend.IElectricUnit; + +public class TileEntityNuller extends TileEntityMachine implements IElectricUnit { + + public float electricityRequest() + { + return 100; + } + @Override + public boolean canReceiveFromSide(ForgeDirection side) + { + return true; + } + public float getVoltage() + { + return 1000; + } + public int getTickInterval() + { + return 1; + } + public boolean canConnect(ForgeDirection side) + { + return true; + } +} diff --git a/1.3/common/EUI/SteamPower/api/IHeatConsumer.java b/1.3/common/EUI/SteamPower/api/IHeatConsumer.java new file mode 100644 index 00000000..6b5e1c28 --- /dev/null +++ b/1.3/common/EUI/SteamPower/api/IHeatConsumer.java @@ -0,0 +1,22 @@ +package EUI.SteamPower.api; + +/** + * The IHeatConsumer interface is an interface that must be applied to all tile entities that can receive heat joules. + * @author Darkguardsman code sourced from Calclavia + * + */ +public interface IHeatConsumer +{ + /** + * onRecieveSteam is called whenever a Steam transmitter sends a packet of electricity to the consumer (which is this block). + * @param vol - The amount of steam this block received + * @param side - The side of the block in which the electricity came from. + * @return vol - The amount of rejected steam to be sent to back + */ + public float onReceiveHeat(float jouls, int side); + + /** + * @return Return the stored electricity in this consumer. Called by conductors to spread electricity to this unit. + */ + public float getStoredHeat(); +} \ No newline at end of file diff --git a/1.3/common/EUI/SteamPower/api/IHeatProducer.java b/1.3/common/EUI/SteamPower/api/IHeatProducer.java new file mode 100644 index 00000000..1c8e33db --- /dev/null +++ b/1.3/common/EUI/SteamPower/api/IHeatProducer.java @@ -0,0 +1,14 @@ +package EUI.SteamPower.api; + + +public interface IHeatProducer +{ + /** + * onProduceElectricity is called when a conductor is connected to the producer block in which the conductor will demand power from the producer + * block. + * @param jouls - The maximum jouls can be transfered + * @param side - The side of block in which the conductor is on + * @return jouls - Return jouls to consumer + */ + public float onProduceHeat(float jouls, int side); +} \ No newline at end of file diff --git a/1.3/common/EUI/SteamPower/boiler/ContainerBoiler.java b/1.3/common/EUI/SteamPower/boiler/ContainerBoiler.java new file mode 100644 index 00000000..af6599f5 --- /dev/null +++ b/1.3/common/EUI/SteamPower/boiler/ContainerBoiler.java @@ -0,0 +1,59 @@ +package EUI.SteamPower.boiler; +import net.minecraft.src.*; + +public class ContainerBoiler extends Container +{ + private TileEntityBoiler boiler; + private int lastCookTime = 0; + private int lastBurnTime = 0; + private int lastItemBurnTime = 0; + + public ContainerBoiler(InventoryPlayer par1InventoryPlayer, TileEntityBoiler par2TileEntityboiler) + { + this.boiler = par2TileEntityboiler; + this.addSlotToContainer(new Slot(par2TileEntityboiler, 0, 56, 17)); + int var3; + + for (var3 = 0; var3 < 3; ++var3) + { + for (int var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); + } + } + + for (var3 = 0; var3 < 9; ++var3) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142)); + } + } + + + + public void updateProgressBar(int par1, int par2) + { + if (par1 == 0) + { + // this.boiler.furnaceCookTime = par2; + } + + if (par1 == 1) + { + //this.boiler.boilerRunTime = par2; + } + + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.boiler.isUseableByPlayer(par1EntityPlayer); + } + + /** + * Called to transfer a stack from one inventory to the other eg. when shift clicking. + */ + public ItemStack transferStackInSlot(int par1) + { + return null; + } +} diff --git a/1.3/common/EUI/SteamPower/boiler/TileEntityBoiler.java b/1.3/common/EUI/SteamPower/boiler/TileEntityBoiler.java new file mode 100644 index 00000000..46ad17aa --- /dev/null +++ b/1.3/common/EUI/SteamPower/boiler/TileEntityBoiler.java @@ -0,0 +1,540 @@ +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/ContainerFireBox.java b/1.3/common/EUI/SteamPower/burner/ContainerFireBox.java new file mode 100644 index 00000000..20918815 --- /dev/null +++ b/1.3/common/EUI/SteamPower/burner/ContainerFireBox.java @@ -0,0 +1,42 @@ +package EUI.SteamPower.burner; + +import net.minecraft.src.*; + +public class ContainerFireBox extends Container +{ + private TileEntityFireBox tileEntity; + + public ContainerFireBox(InventoryPlayer par1InventoryPlayer, TileEntityFireBox tileEntity) + { + this.tileEntity = tileEntity; + this.addSlotToContainer(new Slot(tileEntity, 0, 33, 34)); + int var3; + + for (var3 = 0; var3 < 3; ++var3) + { + for (int var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); + } + } + + for (var3 = 0; var3 < 9; ++var3) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142)); + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.tileEntity.isUseableByPlayer(par1EntityPlayer); + } + + /** + * Called to transfer a stack from one inventory to the other eg. when shift clicking. + */ + public ItemStack transferStackInSlot(int par1) + { + + return null; + } +} diff --git a/1.3/common/EUI/SteamPower/burner/TileEntityFireBox.java b/1.3/common/EUI/SteamPower/burner/TileEntityFireBox.java new file mode 100644 index 00000000..c07c5fd2 --- /dev/null +++ b/1.3/common/EUI/SteamPower/burner/TileEntityFireBox.java @@ -0,0 +1,301 @@ +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/turbine/ContainerGenerator.java b/1.3/common/EUI/SteamPower/turbine/ContainerGenerator.java new file mode 100644 index 00000000..293b2424 --- /dev/null +++ b/1.3/common/EUI/SteamPower/turbine/ContainerGenerator.java @@ -0,0 +1,41 @@ +package EUI.SteamPower.turbine; + +import net.minecraft.src.*; + +public class ContainerGenerator extends Container +{ + private TileEntityGenerator tileEntity; + + public ContainerGenerator(InventoryPlayer par1InventoryPlayer, TileEntityGenerator tileEntity) + { + this.tileEntity = tileEntity; + this.addSlotToContainer(new Slot(tileEntity, 0, 33, 34)); + int var3; + + for (var3 = 0; var3 < 3; ++var3) + { + for (int var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); + } + } + + for (var3 = 0; var3 < 9; ++var3) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142)); + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.tileEntity.isUseableByPlayer(par1EntityPlayer); + } + + /** + * Called to transfer a stack from one inventory to the other eg. when shift clicking. + */ + public ItemStack transferStackInSlot(int par1) + { + return null; + } +} diff --git a/1.3/common/EUI/SteamPower/turbine/TileEntityGenerator.java b/1.3/common/EUI/SteamPower/turbine/TileEntityGenerator.java new file mode 100644 index 00000000..50c05594 --- /dev/null +++ b/1.3/common/EUI/SteamPower/turbine/TileEntityGenerator.java @@ -0,0 +1,359 @@ +package EUI.SteamPower.turbine; + +import com.google.common.io.ByteArrayDataInput; + +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.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; + +public class TileEntityGenerator extends TileEntityMachine implements IPacketReceiver, IElectricUnit,ILiquidConsumer,ILiquidProducer, IInventory, ISidedInventory +{ + //Maximum possible generation rate of watts in SECONDS + public int maxGenerateRate = 1000; + public int waterStored = 0; + public int steamStored = 0; + public int steamConsumed = 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; + /** + * The ItemStacks that hold the items currently being used in the battery box + */ + private ItemStack[] containingItems = new ItemStack[1]; + public TileEntityConductor connectedElectricUnit = null; + @Override + public boolean canConnect(ForgeDirection side) + { + return true; + } + + /** + * 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) + { + if(ElectricityManager.electricityRequired(((TileEntityConductor)tileEntity).connectionID) > 0) + { + this.connectedElectricUnit = (TileEntityConductor)tileEntity; + } + else + { + this.connectedElectricUnit = null; + } + } + else + { + this.connectedElectricUnit = null; + } + + + if(!this.isDisabled()) + { + //Adds time to runTime by consuming steam + if(this.itemCookTime <= 0) + { + if(steamStored > 0) + { + --steamStored; + ++steamConsumed; + if(steamConsumed == SteamPower.steamOutBoiler) + { + ++waterStored; + steamConsumed = 0; + } + itemCookTime += 65; + } + } + + //Empties water from tank to buckets + if (this.containingItems[0] != null) + { + if(this.containingItems[0].getItem().shiftedIndex == Item.bucketEmpty.shiftedIndex) + { + if(this.waterStored > 0) + { + this.containingItems[0] = new ItemStack(Item.bucketWater,1); + --waterStored; + } + } + } + + //Starts generating electricity if the device is heated up + if (this.itemCookTime > 0) + { + this.itemCookTime --; + + if(this.connectedElectricUnit != null) + { + this.generateRate = (float)Math.min(this.generateRate+Math.min((this.generateRate)*0.001+0.0015, 0.05F), this.maxGenerateRate/20); + } + } + + if(this.connectedElectricUnit == null || this.itemCookTime <= 0) + { + this.generateRate = (float)Math.max(this.generateRate-0.05, 0); + } + + if(this.generateRate > 1) + { + ElectricityManager.produceElectricity(this.connectedElectricUnit, this.generateRate*this.getTickInterval(), this.getVoltage()); + } + } + } + } + /** + * Reads a tile entity from NBT. + */ + public void readFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readFromNBT(par1NBTTagCompound); + this.itemCookTime = par1NBTTagCompound.getInteger("itemCookTime"); + this.waterStored = par1NBTTagCompound.getInteger("waterStored"); + this.steamConsumed = par1NBTTagCompound.getInteger("steamConsumed"); + this.steamStored = par1NBTTagCompound.getInteger("steamStored"); + this.generateRate = par1NBTTagCompound.getFloat("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("waterStored", (int)this.waterStored); + par1NBTTagCompound.setInteger("steamConsumed", (int)this.steamConsumed); + par1NBTTagCompound.setInteger("steamStored", (int)this.steamStored); + par1NBTTagCompound.setFloat("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) + { + return 0; + } + @Override + public int getSizeInventorySide(ForgeDirection side) { return 0; } + @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 "SteamGen"; + } + @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 void onDisable(int duration) { + // TODO Auto-generated method stub + + } + + @Override + public boolean isDisabled() { + // TODO Auto-generated method stub + return false; + } + + @Override + public int onProduceLiquid(int type, int maxVol, ForgeDirection side) { + if(type == 1) + { + if(this.waterStored > 0) + { + --waterStored; + return 1; + } + } + return 0; + } + + @Override + public boolean canProduceLiquid(int type, ForgeDirection side) { + if(type == 1) + { + return true; + } + return false; + } + + @Override + public int onReceiveLiquid(int type, int vol, ForgeDirection side) { + if(type == 0) + { + int rejectedSteam = Math.max((this.steamStored + vol) - 100, 0); + this.steamStored += vol - rejectedSteam; + return rejectedSteam; + } + return vol; + } + + @Override + public boolean canRecieveLiquid(int type, ForgeDirection side) { + if(type == 0) + { + return true; + } + return false; + } + + @Override + public int getStoredLiquid(int type) { + if(type == 0) + { + return this.steamStored; + } + return 0; + } + + @Override + public int getLiquidCapacity(int type) { + if(type == 0) + { + return 100; + } + return 0; + } + @Override + public Object[] getSendData() + { + return new Object[]{(int)facing,(int)waterStored,(int)steamStored,(int)steamConsumed,(int)generateRate,(int)itemCookTime}; + } + + @Override + public void handlePacketData(NetworkManager network, + Packet250CustomPayload packet, EntityPlayer player, + ByteArrayDataInput dataStream) { + try + { + facing = dataStream.readInt(); + waterStored = dataStream.readInt(); + steamStored = dataStream.readInt(); + steamConsumed = dataStream.readInt(); + generateRate = dataStream.readInt(); + itemCookTime = dataStream.readInt(); + } + catch(Exception e) + { + e.printStackTrace(); + } + + } +} diff --git a/1.3/minecraft/EUIClient/SteamPower/GUIFireBox.java b/1.3/minecraft/EUIClient/SteamPower/GUIFireBox.java new file mode 100644 index 00000000..816f7383 --- /dev/null +++ b/1.3/minecraft/EUIClient/SteamPower/GUIFireBox.java @@ -0,0 +1,91 @@ +package EUIClient.SteamPower; + +import org.lwjgl.opengl.GL11; + +import EUI.SteamPower.SteamPower; +import EUI.SteamPower.burner.ContainerFireBox; +import EUI.SteamPower.burner.TileEntityFireBox; + +import java.math.*; +import java.text.DecimalFormat; +import java.lang.Integer; +import net.minecraft.src.*; + +public class GUIFireBox extends GuiContainer +{ + private TileEntityFireBox tileEntity; + + private int containerWidth; + private int containerHeight; + + public GUIFireBox(InventoryPlayer par1InventoryPlayer, TileEntityFireBox tileEntity) + { + super(new ContainerFireBox(par1InventoryPlayer, tileEntity)); + this.tileEntity = tileEntity; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer() + { + this.fontRenderer.drawString("FireBox", 55, 6, 4210752); + this.fontRenderer.drawString("HeatOut", 90, 33, 4210752); + String displayText = ""; + if(!tileEntity.isConnected) + { + displayText = "No Boiler"; + } + else if(tileEntity.containingItems[0] != null) + { + if(tileEntity.containingItems[0].getItem().shiftedIndex != Item.coal.shiftedIndex) + { + displayText = "No Coal"; + } + else{ + if(tileEntity.generateRate*20 < 20) + { + displayText = "Hull Heat: "+(tileEntity.generateRate*100)+"%"; + } + else + { + displayText = getWattDisplay((tileEntity.generateRate*20)); + } + } + } + this.fontRenderer.drawString(displayText, (int)(105-displayText.length()*1.25), 45, 4210752); + this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + int var4 = this.mc.renderEngine.getTexture(SteamPower.textureFile+"SteamGUI.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(var4); + containerWidth = (this.width - this.xSize) / 2; + containerHeight = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize); + } + public static String getWattDisplay(int watts) + { + String displayWatt; + if(watts > 1000) + { + displayWatt = roundTwoDecimals((double)watts/1000)+" MJ"; + } + else + { + displayWatt = watts+" KJ"; + } + + return displayWatt; + } + public static double roundTwoDecimals(double d) + { + DecimalFormat twoDForm = new DecimalFormat("#.##"); + return Double.valueOf(twoDForm.format(d)); + } +} diff --git a/1.3/minecraft/EUIClient/SteamPower/GUIGenerator.java b/1.3/minecraft/EUIClient/SteamPower/GUIGenerator.java new file mode 100644 index 00000000..e6b7adbb --- /dev/null +++ b/1.3/minecraft/EUIClient/SteamPower/GUIGenerator.java @@ -0,0 +1,79 @@ +package EUIClient.SteamPower; + +import org.lwjgl.opengl.GL11; + +import EUI.SteamPower.SteamPower; +import EUI.SteamPower.turbine.ContainerGenerator; +import EUI.SteamPower.turbine.TileEntityGenerator; + +import java.math.*; +import java.lang.Integer; +import net.minecraft.src.*; + + public class GUIGenerator extends GuiContainer + { + private TileEntityGenerator tileEntity; + + private int containerWidth; + private int containerHeight; + + public GUIGenerator(InventoryPlayer par1InventoryPlayer, TileEntityGenerator tileEntity) + { + super(new ContainerGenerator(par1InventoryPlayer, tileEntity)); + this.tileEntity = tileEntity; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer() + { + this.fontRenderer.drawString("Steam Engine MkI", 55, 6, 4210752); + this.fontRenderer.drawString("MeterReadings", 90, 33, 4210752); + String displayText = ""; + String displayText2 = ""; + String displayText3 = ""; + if(tileEntity.connectedElectricUnit == null) + { + displayText = "Not Connected"; + } + else if(tileEntity.generateRate*20 <= 0) + { + if(tileEntity.steamStored> 0) + { + displayText = "Power Full"; + } + if(tileEntity.steamStored<= 0) + { + displayText = "No Steam"; + } + } + else if(tileEntity.generateRate*20 < 20) + { + displayText = "Warming UP: "+(int)(tileEntity.generateRate*100)+"%"; + } + else + { + displayText = universalelectricity.UniversalElectricity.getWattDisplay((int)(tileEntity.generateRate*20)); + } + displayText2 = "water" + "-" + tileEntity.waterStored; + displayText3 = "steam" + "-" + tileEntity.steamStored; + this.fontRenderer.drawString(displayText, (int)(105-displayText.length()*1), 45, 4210752); + this.fontRenderer.drawString(displayText2, (int)(105-displayText.length()*1), 55, 4210752); + this.fontRenderer.drawString(displayText3, (int)(105-displayText.length()*1), 65, 4210752); + this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + int var4 = this.mc.renderEngine.getTexture(SteamPower.textureFile+"SteamGUI.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(var4); + containerWidth = (this.width - this.xSize) / 2; + containerHeight = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize); + } + } diff --git a/1.3/minecraft/EUIClient/SteamPower/GuiBoiler.java b/1.3/minecraft/EUIClient/SteamPower/GuiBoiler.java new file mode 100644 index 00000000..dc91a79c --- /dev/null +++ b/1.3/minecraft/EUIClient/SteamPower/GuiBoiler.java @@ -0,0 +1,88 @@ +package EUIClient.SteamPower; +import java.text.DecimalFormat; + +import net.minecraft.src.*; + +import org.lwjgl.opengl.GL11; + +import EUI.SteamPower.SteamPower; +import EUI.SteamPower.boiler.ContainerBoiler; +import EUI.SteamPower.boiler.TileEntityBoiler; + +public class GuiBoiler extends GuiContainer +{ + private TileEntityBoiler boilerInventory; + + public GuiBoiler(InventoryPlayer par1InventoryPlayer, TileEntityBoiler par2TileEntityGrinder) + { + super(new ContainerBoiler(par1InventoryPlayer, par2TileEntityGrinder)); + this.boilerInventory = par2TileEntityGrinder; + } + + /** + * Draw the foreground layer for the GuiContainer (everythin in front of the items) + */ + protected void drawGuiContainerForegroundLayer() + { + this.fontRenderer.drawString("Boiler", 60, 6, 4210752); + this.fontRenderer.drawString("Inventory", 8, this.ySize - 96 + 2, 4210752); if(boilerInventory.hullHeat >=10000) + { + this.fontRenderer.drawString("Heat Danger", (int)(105), 50, 4210752); + } + this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + int var4 = this.mc.renderEngine.getTexture(SteamPower.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; + int var6 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize-1, this.ySize); + int var7; + int var8; + int var9; + int var10; + if (this.boilerInventory.waterStored > 0) + { + var7 = boilerInventory.getStoredLiquid(1)*4 + 1; + this.drawTexturedModalRect(var5 + 29, var6 + 72 - var7, 176, 148 - var7, 23, var7); + } + if (this.boilerInventory.steamStored > 0) + { + var8 = boilerInventory.steamStored/14*4 + 1; + this.drawTexturedModalRect(var5 + 108, var6 + 72 - var8, 176, 90 - var8, 23, var8); + } + + float precentH = Math.min(boilerInventory.hullHeat/1000 + 1, 10); + var9 = (int) Math.min(precentH*3.0F,30); + this.drawTexturedModalRect(var5 + 59, var6 + 70 - var9, 199, 71 - var9, 9, var9); + float precentSH = this.boilerInventory.heatStored/1000; + var10 = (int) Math.round(precentSH*5.33); + this.drawTexturedModalRect(var5 + 78, var6 + 16, 176, 14, var10, 16); + + } + public static String getWattDisplay(int watts) + { + String displayWatt; + if(watts > 1000) + { + displayWatt = roundTwoDecimals((double)watts/1000)+" MJ"; + } + else + { + displayWatt = watts+" kJ"; + } + + return displayWatt; + } + public static double roundTwoDecimals(double d) + { + DecimalFormat twoDForm = new DecimalFormat("#.##"); + return Double.valueOf(twoDForm.format(d)); + } +} diff --git a/1.3/minecraft/EUIClient/SteamPower/ModelEngine.java b/1.3/minecraft/EUIClient/SteamPower/ModelEngine.java new file mode 100644 index 00000000..a06fd499 --- /dev/null +++ b/1.3/minecraft/EUIClient/SteamPower/ModelEngine.java @@ -0,0 +1,242 @@ +// Date: 8/14/2012 3:20:15 AM +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package EUIClient.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 PISTON_WALL_1; + ModelRenderer PISTON_HEAD_MOVES; + ModelRenderer PISTON_TURNER_MOVES; + ModelRenderer PISTON_ARM_MOVES; + ModelRenderer GEAR_A_NECK; + ModelRenderer PISTON_WALL_2; + ModelRenderer PISTON_WALL_3; + ModelRenderer PISTON_WALL_4; + ModelRenderer PISTON_SUPPORT_1; + ModelRenderer PISTON_SUPPORT_2; + ModelRenderer FORCE_CONDUCTOR_BOX; + ModelRenderer GEAR_A_TEETH_1_ROTATES; + ModelRenderer GEAR_A_TEETH_2_ROTATES; + ModelRenderer GEAR_A_TEETH_3_ROTATES; + ModelRenderer FORCE_TRANSMITTER_ROTATES; + ModelRenderer GEAR_B_TEETH_1_ROTATES; + ModelRenderer GEAR_B_TEETH_2_ROTATES; + ModelRenderer GEAR_B_TEETH_3_ROTATES; + ModelRenderer SUPPORT_PLATE; + ModelRenderer ORNAMENT_1; + ModelRenderer ORNAMENT_2; + ModelRenderer LEVER_1_CAN_BE_TURNED; + ModelRenderer LEVER_2_CAN_BE_TURNED; + + public ModelEngine() + { + textureWidth = 128; + textureHeight = 128; + + BASE = new ModelRenderer(this, 0, 0); + BASE.addBox(0F, 0F, 0F, 16, 1, 16); + BASE.setRotationPoint(-8F, 23F, -8F); + BASE.setTextureSize(128, 128); + BASE.mirror = true; + setRotation(BASE, 0F, 0F, 0F); + PISTON_WALL_1 = new ModelRenderer(this, 0, 18); + PISTON_WALL_1.addBox(0F, 0F, 0F, 7, 1, 4); + PISTON_WALL_1.setRotationPoint(0F, 22F, 1F); + PISTON_WALL_1.setTextureSize(128, 128); + PISTON_WALL_1.mirror = true; + setRotation(PISTON_WALL_1, 1.570796F, 0F, 0F); + PISTON_HEAD_MOVES = new ModelRenderer(this, 0, 24); + PISTON_HEAD_MOVES.addBox(0F, -2F, -2F, 4, 4, 4); + PISTON_HEAD_MOVES.setRotationPoint(0F, 20F, 4F); + PISTON_HEAD_MOVES.setTextureSize(128, 128); + PISTON_HEAD_MOVES.mirror = true; + setRotation(PISTON_HEAD_MOVES, 0F, 0F, 0F); + PISTON_TURNER_MOVES = new ModelRenderer(this, 0, 33); + PISTON_TURNER_MOVES.addBox(0F, -1F, -1F, 1, 2, 2); + PISTON_TURNER_MOVES.setRotationPoint(-1F, 20F, 4F); + PISTON_TURNER_MOVES.setTextureSize(128, 128); + PISTON_TURNER_MOVES.mirror = true; + setRotation(PISTON_TURNER_MOVES, 0F, 0F, 0F); + PISTON_ARM_MOVES = new ModelRenderer(this, 0, 38); + PISTON_ARM_MOVES.addBox(0F, 0F, -1F, 4, 1, 1); + PISTON_ARM_MOVES.setRotationPoint(-5F, 19F, 4F); + PISTON_ARM_MOVES.setTextureSize(128, 128); + PISTON_ARM_MOVES.mirror = true; + setRotation(PISTON_ARM_MOVES, 0F, 0F, 0F); + GEAR_A_NECK = new ModelRenderer(this, 65, 25); + GEAR_A_NECK.addBox(-1F, -1F, 0F, 2, 2, 1); + GEAR_A_NECK.setRotationPoint(-4F, 19F, -4F); + GEAR_A_NECK.setTextureSize(128, 128); + GEAR_A_NECK.mirror = true; + setRotation(GEAR_A_NECK, 0F, 0F, 0F); + PISTON_WALL_2 = new ModelRenderer(this, 0, 18); + PISTON_WALL_2.addBox(0F, 0F, 0F, 7, 1, 4); + PISTON_WALL_2.setRotationPoint(0F, 17F, 2F); + PISTON_WALL_2.setTextureSize(128, 128); + PISTON_WALL_2.mirror = true; + setRotation(PISTON_WALL_2, 0F, 0F, 0F); + PISTON_WALL_3 = new ModelRenderer(this, 0, 18); + PISTON_WALL_3.addBox(0F, 0F, 0F, 7, 1, 4); + PISTON_WALL_3.setRotationPoint(0F, 22F, 2F); + PISTON_WALL_3.setTextureSize(128, 128); + PISTON_WALL_3.mirror = true; + setRotation(PISTON_WALL_3, 0F, 0F, 0F); + PISTON_WALL_4 = new ModelRenderer(this, 0, 18); + PISTON_WALL_4.addBox(0F, 0F, 0F, 7, 1, 4); + PISTON_WALL_4.setRotationPoint(0F, 22F, 6F); + PISTON_WALL_4.setTextureSize(128, 128); + PISTON_WALL_4.mirror = true; + setRotation(PISTON_WALL_4, 1.570796F, 0F, 0F); + PISTON_SUPPORT_1 = new ModelRenderer(this, 0, 41); + PISTON_SUPPORT_1.addBox(0F, 0F, 0F, 1, 8, 6); + PISTON_SUPPORT_1.setRotationPoint(7F, 15F, 1F); + PISTON_SUPPORT_1.setTextureSize(128, 128); + PISTON_SUPPORT_1.mirror = true; + setRotation(PISTON_SUPPORT_1, 0F, 0F, 0F); + PISTON_SUPPORT_2 = new ModelRenderer(this, 0, 57); + PISTON_SUPPORT_2.addBox(0F, 0F, 0F, 1, 4, 4); + PISTON_SUPPORT_2.setRotationPoint(7F, 12F, 4F); + PISTON_SUPPORT_2.setTextureSize(128, 128); + PISTON_SUPPORT_2.mirror = true; + setRotation(PISTON_SUPPORT_2, -0.7853982F, 0F, 0F); + FORCE_CONDUCTOR_BOX = new ModelRenderer(this, 65, 0); + FORCE_CONDUCTOR_BOX.addBox(0F, 0F, 0F, 4, 5, 6); + FORCE_CONDUCTOR_BOX.setRotationPoint(-6F, 18F, -3F); + FORCE_CONDUCTOR_BOX.setTextureSize(128, 128); + FORCE_CONDUCTOR_BOX.mirror = true; + setRotation(FORCE_CONDUCTOR_BOX, 0F, 0F, 0F); + GEAR_A_TEETH_1_ROTATES = new ModelRenderer(this, 93, 0); + GEAR_A_TEETH_1_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 1); + GEAR_A_TEETH_1_ROTATES.setRotationPoint(-4F, 19F, -5F); + GEAR_A_TEETH_1_ROTATES.setTextureSize(128, 128); + GEAR_A_TEETH_1_ROTATES.mirror = true; + setRotation(GEAR_A_TEETH_1_ROTATES, 0F, 0F, 0F); + GEAR_A_TEETH_2_ROTATES = new ModelRenderer(this, 93, 0); + GEAR_A_TEETH_2_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 1); + GEAR_A_TEETH_2_ROTATES.setRotationPoint(-4F, 19F, -5F); + GEAR_A_TEETH_2_ROTATES.setTextureSize(128, 128); + GEAR_A_TEETH_2_ROTATES.mirror = true; + setRotation(GEAR_A_TEETH_2_ROTATES, 0F, 0F, 1.047198F); + GEAR_A_TEETH_3_ROTATES = new ModelRenderer(this, 93, 0); + GEAR_A_TEETH_3_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 1); + GEAR_A_TEETH_3_ROTATES.setRotationPoint(-4F, 19F, -5F); + GEAR_A_TEETH_3_ROTATES.setTextureSize(128, 128); + GEAR_A_TEETH_3_ROTATES.mirror = true; + setRotation(GEAR_A_TEETH_3_ROTATES, 0F, 0F, -1.047198F); + FORCE_TRANSMITTER_ROTATES = new ModelRenderer(this, 65, 25); + FORCE_TRANSMITTER_ROTATES.addBox(-1F, -1F, 0F, 2, 2, 1); + FORCE_TRANSMITTER_ROTATES.setRotationPoint(0F, 17F, -8F); + FORCE_TRANSMITTER_ROTATES.setTextureSize(128, 128); + FORCE_TRANSMITTER_ROTATES.mirror = true; + setRotation(FORCE_TRANSMITTER_ROTATES, 0F, 0F, 0F); + GEAR_B_TEETH_1_ROTATES = new ModelRenderer(this, 93, 5); + GEAR_B_TEETH_1_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 3); + GEAR_B_TEETH_1_ROTATES.setRotationPoint(0F, 17F, -7F); + GEAR_B_TEETH_1_ROTATES.setTextureSize(128, 128); + GEAR_B_TEETH_1_ROTATES.mirror = true; + setRotation(GEAR_B_TEETH_1_ROTATES, 0F, 0F, 0F); + GEAR_B_TEETH_2_ROTATES = new ModelRenderer(this, 93, 5); + GEAR_B_TEETH_2_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 3); + GEAR_B_TEETH_2_ROTATES.setRotationPoint(0F, 17F, -7F); + GEAR_B_TEETH_2_ROTATES.setTextureSize(128, 128); + GEAR_B_TEETH_2_ROTATES.mirror = true; + setRotation(GEAR_B_TEETH_2_ROTATES, 0F, 0F, 1.047198F); + GEAR_B_TEETH_3_ROTATES = new ModelRenderer(this, 93, 5); + GEAR_B_TEETH_3_ROTATES.addBox(-3F, -1F, 0F, 6, 2, 3); + GEAR_B_TEETH_3_ROTATES.setRotationPoint(0F, 17F, -7F); + GEAR_B_TEETH_3_ROTATES.setTextureSize(128, 128); + GEAR_B_TEETH_3_ROTATES.mirror = true; + setRotation(GEAR_B_TEETH_3_ROTATES, 0F, 0F, -1.047198F); + SUPPORT_PLATE = new ModelRenderer(this, 65, 12); + SUPPORT_PLATE.addBox(0F, 0F, 0F, 9, 8, 4); + SUPPORT_PLATE.setRotationPoint(-1F, 15F, -4F); + SUPPORT_PLATE.setTextureSize(128, 128); + SUPPORT_PLATE.mirror = true; + setRotation(SUPPORT_PLATE, 0F, 0F, 0F); + ORNAMENT_1 = new ModelRenderer(this, 86, 0); + ORNAMENT_1.addBox(0F, 0F, 0F, 1, 4, 2); + ORNAMENT_1.setRotationPoint(6F, 19F, -5F); + ORNAMENT_1.setTextureSize(128, 128); + ORNAMENT_1.mirror = true; + setRotation(ORNAMENT_1, -0.2094395F, 0F, 0F); + ORNAMENT_2 = new ModelRenderer(this, 86, 0); + ORNAMENT_2.addBox(0F, 0F, 0F, 1, 4, 2); + ORNAMENT_2.setRotationPoint(4F, 19F, -5F); + ORNAMENT_2.setTextureSize(128, 128); + ORNAMENT_2.mirror = true; + setRotation(ORNAMENT_2, -0.2094395F, 0F, 0F); + LEVER_1_CAN_BE_TURNED = new ModelRenderer(this, 0, 0); + LEVER_1_CAN_BE_TURNED.addBox(0F, -6F, 0F, 1, 6, 1); + LEVER_1_CAN_BE_TURNED.setRotationPoint(6F, 16F, -3F); + LEVER_1_CAN_BE_TURNED.setTextureSize(128, 128); + LEVER_1_CAN_BE_TURNED.mirror = true; + setRotation(LEVER_1_CAN_BE_TURNED, 0F, 0F, 0F); + LEVER_2_CAN_BE_TURNED = new ModelRenderer(this, 0, 0); + LEVER_2_CAN_BE_TURNED.addBox(0F, -6F, 0F, 1, 6, 1); + LEVER_2_CAN_BE_TURNED.setRotationPoint(4F, 16F, -3F); + LEVER_2_CAN_BE_TURNED.setTextureSize(128, 128); + LEVER_2_CAN_BE_TURNED.mirror = true; + setRotation(LEVER_2_CAN_BE_TURNED, 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); + genRender(f5); + } + public void genRender(float f5) + { + BASE.render(f5); + PISTON_WALL_1.render(f5); + PISTON_HEAD_MOVES.render(f5); + PISTON_TURNER_MOVES.render(f5); + PISTON_ARM_MOVES.render(f5); + GEAR_A_NECK.render(f5); + PISTON_WALL_2.render(f5); + PISTON_WALL_3.render(f5); + PISTON_WALL_4.render(f5); + PISTON_SUPPORT_1.render(f5); + PISTON_SUPPORT_2.render(f5); + FORCE_CONDUCTOR_BOX.render(f5); + GEAR_A_TEETH_1_ROTATES.render(f5); + GEAR_A_TEETH_2_ROTATES.render(f5); + GEAR_A_TEETH_3_ROTATES.render(f5); + FORCE_TRANSMITTER_ROTATES.render(f5); + GEAR_B_TEETH_1_ROTATES.render(f5); + GEAR_B_TEETH_2_ROTATES.render(f5); + GEAR_B_TEETH_3_ROTATES.render(f5); + SUPPORT_PLATE.render(f5); + ORNAMENT_1.render(f5); + ORNAMENT_2.render(f5); + LEVER_1_CAN_BE_TURNED.render(f5); + LEVER_2_CAN_BE_TURNED.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/EUIClient/SteamPower/ModelFurnace.java new file mode 100644 index 00000000..37d0e0bd --- /dev/null +++ b/1.3/minecraft/EUIClient/SteamPower/ModelFurnace.java @@ -0,0 +1,82 @@ +// Date: 8/14/2012 3:02:31 AM +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package EUIClient.SteamPower; + +import net.minecraft.src.Entity; +import net.minecraft.src.ModelBase; +import net.minecraft.src.ModelRenderer; + +public class ModelFurnace extends ModelBase +{ + //fields + ModelRenderer Body; + ModelRenderer top; + ModelRenderer bottom; + ModelRenderer Shape1; + + public ModelFurnace() + { + textureWidth = 256; + textureHeight = 256; + + Body = new ModelRenderer(this, 0, 0); + Body.addBox(-8F, -8F, -8F, 14, 14, 12); + Body.setRotationPoint(1F, 18F, 1F); + Body.setTextureSize(256, 256); + Body.mirror = true; + setRotation(Body, 0F, 0F, 0F); + top = new ModelRenderer(this, 80, 20); + top.addBox(-8F, 0F, -8F, 16, 2, 16); + top.setRotationPoint(0F, 8F, 0F); + top.setTextureSize(256, 256); + top.mirror = true; + setRotation(top, 0F, 0F, 0F); + bottom = new ModelRenderer(this, 80, 0); + bottom.addBox(-8F, 22F, -8F, 16, 2, 16); + bottom.setRotationPoint(0F, 0F, 0F); + bottom.setTextureSize(256, 256); + bottom.mirror = true; + setRotation(bottom, 0F, 0F, 0F); + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(-4F, -4F, 0F, 10, 8, 1); + Shape1.setRotationPoint(-1F, 16F, 5F); + Shape1.setTextureSize(256, 256); + Shape1.mirror = true; + setRotation(Shape1, 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); + genRender(f5); + } + public void genRender(float f5) + { + Body.render(f5); + top.render(f5); + bottom.render(f5); + Shape1.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/ModelTank.java b/1.3/minecraft/EUIClient/SteamPower/ModelTank.java new file mode 100644 index 00000000..f57c884e --- /dev/null +++ b/1.3/minecraft/EUIClient/SteamPower/ModelTank.java @@ -0,0 +1,155 @@ +// 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 EUIClient.SteamPower; + +import net.minecraft.src.Entity; +import net.minecraft.src.ModelBase; +import net.minecraft.src.ModelRenderer; + +public class ModelTank extends ModelBase +{ + //fields + ModelRenderer TANK_WALL_1; + ModelRenderer TANK_WALL_2; + ModelRenderer TANK_WALL_3; + ModelRenderer TANK_WALL_4; + ModelRenderer TANK_SUPPORT_1; + ModelRenderer TANK_TOP_1; + ModelRenderer TANK_WALL_5; + ModelRenderer TANK_SUPPORT_2; + ModelRenderer TANK_SUPPORT_3; + ModelRenderer TANK_WALL_6; + ModelRenderer TANK_TOP_2; + ModelRenderer TANK_TOP_3; + ModelRenderer TANK_VALVE; + + public ModelTank(float par1) + { + textureWidth = 128; + textureHeight = 128; + + TANK_WALL_1 = new ModelRenderer(this, 0, 49); + TANK_WALL_1.addBox(0F, 0F, 0F, 1, 12, 8,par1); + TANK_WALL_1.setRotationPoint(6F, 12F, -4F); + TANK_WALL_1.setTextureSize(128, 128); + TANK_WALL_1.mirror = true; + setRotation(TANK_WALL_1, 0F, 0F, 0F); + TANK_WALL_2 = new ModelRenderer(this, 0, 70); + TANK_WALL_2.addBox(0F, 0F, 0F, 1, 12, 7,par1); + TANK_WALL_2.setRotationPoint(-8F, 12F, -4F); + TANK_WALL_2.setTextureSize(128, 128); + TANK_WALL_2.mirror = true; + setRotation(TANK_WALL_2, 0F, 0F, 0F); + TANK_WALL_3 = new ModelRenderer(this, 0, 34); + TANK_WALL_3.addBox(0F, 0F, 0F, 8, 12, 1,par1); + TANK_WALL_3.setRotationPoint(0F, 12F, 8F); + TANK_WALL_3.setTextureSize(128, 128); + TANK_WALL_3.mirror = true; + setRotation(TANK_WALL_3, 0F, 2.617994F, 0F); + TANK_WALL_4 = new ModelRenderer(this, 0, 34); + TANK_WALL_4.addBox(0F, 0F, 0F, 8, 12, 1,par1); + TANK_WALL_4.setRotationPoint(0F, 12F, -8F); + TANK_WALL_4.setTextureSize(128, 128); + TANK_WALL_4.mirror = true; + setRotation(TANK_WALL_4, 0F, -0.5235988F, 0F); + TANK_SUPPORT_1 = new ModelRenderer(this, 43, 22); + TANK_SUPPORT_1.addBox(-1F, 0F, -8F, 2, 14, 16,par1); + TANK_SUPPORT_1.setRotationPoint(0F, 10F, 0F); + TANK_SUPPORT_1.setTextureSize(128, 128); + TANK_SUPPORT_1.mirror = true; + setRotation(TANK_SUPPORT_1, 0F, 0F, 0F); + TANK_TOP_1 = new ModelRenderer(this, 43, 11); + TANK_TOP_1.addBox(-8F, 0F, -4F, 16, 2, 8,par1); + TANK_TOP_1.setRotationPoint(0F, 10F, 0F); + TANK_TOP_1.setTextureSize(128, 128); + TANK_TOP_1.mirror = true; + setRotation(TANK_TOP_1, 0F, 0F, 0F); + TANK_WALL_5 = new ModelRenderer(this, 0, 34); + TANK_WALL_5.addBox(0F, 0F, 0F, 8, 12, 1,par1); + TANK_WALL_5.setRotationPoint(0F, 12F, -7F); + TANK_WALL_5.setTextureSize(128, 128); + TANK_WALL_5.mirror = true; + setRotation(TANK_WALL_5, 0F, -2.617994F, 0F); + TANK_SUPPORT_2 = new ModelRenderer(this, 0, 0); + TANK_SUPPORT_2.addBox(-1F, 0F, -9F, 2, 14, 18,par1); + TANK_SUPPORT_2.setRotationPoint(0F, 10F, 0F); + TANK_SUPPORT_2.setTextureSize(128, 128); + TANK_SUPPORT_2.mirror = true; + setRotation(TANK_SUPPORT_2, 0F, 1.047198F, 0F); + TANK_SUPPORT_3 = new ModelRenderer(this, 0, 0); + TANK_SUPPORT_3.addBox(-1F, 0F, -9F, 2, 14, 18,par1); + TANK_SUPPORT_3.setRotationPoint(0F, 10F, 0F); + TANK_SUPPORT_3.setTextureSize(128, 128); + TANK_SUPPORT_3.mirror = true; + setRotation(TANK_SUPPORT_3, 0F, -1.047198F, 0F); + TANK_WALL_6 = new ModelRenderer(this, 0, 34); + TANK_WALL_6.addBox(0F, 0F, 0F, 8, 12, 1,par1); + TANK_WALL_6.setRotationPoint(0F, 12F, 7F); + TANK_WALL_6.setTextureSize(128, 128); + TANK_WALL_6.mirror = true; + setRotation(TANK_WALL_6, 0F, 0.5235988F, 0F); + TANK_TOP_2 = new ModelRenderer(this, 43, 0); + TANK_TOP_2.addBox(-6F, 0F, -4F, 12, 2, 8,par1); + TANK_TOP_2.setRotationPoint(0F, 10F, 0F); + TANK_TOP_2.setTextureSize(128, 128); + TANK_TOP_2.mirror = true; + setRotation(TANK_TOP_2, 0F, 1.047198F, 0F); + TANK_TOP_3 = new ModelRenderer(this, 43, 0); + TANK_TOP_3.addBox(-6F, 0F, -4F, 12, 2, 8,par1); + TANK_TOP_3.setRotationPoint(0F, 10F, 0F); + TANK_TOP_3.setTextureSize(128, 128); + TANK_TOP_3.mirror = true; + setRotation(TANK_TOP_3, 0F, -1.047198F, 0F); + TANK_VALVE = new ModelRenderer(this, 84, 0); + TANK_VALVE.addBox(0F, 0F, 0F, 2, 1, 2,par1); + TANK_VALVE.setRotationPoint(-1F, 9F, -1F); + TANK_VALVE.setTextureSize(128, 128); + TANK_VALVE.mirror = true; + setRotation(TANK_VALVE, 0F, 0F, 0F); + } + @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); + generalRender(f5); + } + public void generalRender(float f5) + { + TANK_WALL_1.render(f5); + TANK_WALL_2.render(f5); + TANK_WALL_3.render(f5); + TANK_WALL_4.render(f5); + TANK_SUPPORT_1.render(f5); + TANK_TOP_1.render(f5); + TANK_WALL_5.render(f5); + TANK_SUPPORT_2.render(f5); + TANK_SUPPORT_3.render(f5); + TANK_WALL_6.render(f5); + TANK_TOP_2.render(f5); + TANK_TOP_3.render(f5); + TANK_VALVE.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/RenderBoiler.java b/1.3/minecraft/EUIClient/SteamPower/RenderBoiler.java new file mode 100644 index 00000000..b64d662c --- /dev/null +++ b/1.3/minecraft/EUIClient/SteamPower/RenderBoiler.java @@ -0,0 +1,30 @@ +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/SteamPower/RenderFurnace.java b/1.3/minecraft/EUIClient/SteamPower/RenderFurnace.java new file mode 100644 index 00000000..d379048a --- /dev/null +++ b/1.3/minecraft/EUIClient/SteamPower/RenderFurnace.java @@ -0,0 +1,29 @@ +package EUIClient.SteamPower; + +import org.lwjgl.opengl.GL11; + +import EUI.SteamPower.SteamPower; +import net.minecraft.src.*; + +public class RenderFurnace extends TileEntitySpecialRenderer +{ + int type = 0; + private ModelFurnace model; + + public RenderFurnace() + { + model = new ModelFurnace(); + } + + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3) { + bindTextureByName(SteamPower.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); + model.genRender(0.0625F); + GL11.glPopMatrix(); + } + +} \ No newline at end of file diff --git a/1.3/minecraft/EUIClient/SteamPower/RenderSteamEngine.java b/1.3/minecraft/EUIClient/SteamPower/RenderSteamEngine.java new file mode 100644 index 00000000..3ad0c5a4 --- /dev/null +++ b/1.3/minecraft/EUIClient/SteamPower/RenderSteamEngine.java @@ -0,0 +1,29 @@ +package EUIClient.SteamPower; + +import org.lwjgl.opengl.GL11; + +import EUI.SteamPower.SteamPower; +import net.minecraft.src.*; + +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(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.genRender(0.0625F); + GL11.glPopMatrix(); + } + +} \ No newline at end of file diff --git a/1.3/minecraft/EUIClient/SteamPower/SteamClientProxy.java b/1.3/minecraft/EUIClient/SteamPower/SteamClientProxy.java new file mode 100644 index 00000000..6fb887e8 --- /dev/null +++ b/1.3/minecraft/EUIClient/SteamPower/SteamClientProxy.java @@ -0,0 +1,39 @@ +package EUIClient.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.minecraftforge.client.MinecraftForgeClient; + +public class SteamClientProxy extends SteamProxy{ + + public void preInit() + { + MinecraftForgeClient.preloadTexture("/EUIClient/textures/blocks.png"); + MinecraftForgeClient.preloadTexture("/EUIClient/textures/Items.png"); + } + @Override + public void init() + { + ClientRegistry.registerTileEntity(TileEntityBoiler.class, "boiler", new RenderBoiler(0f)); + ClientRegistry.registerTileEntity(TileEntityFireBox.class, "fireBox", new RenderFurnace()); + ClientRegistry.registerTileEntity(TileEntityGenerator.class, "generator", new RenderSteamEngine()); + } + public void postInit() + { + + } + +} diff --git a/1.3/minecraft/EUIClient/Textures/BoilerGui.png b/1.3/minecraft/EUIClient/Textures/BoilerGui.png new file mode 100644 index 00000000..2eb1fa5c Binary files /dev/null and b/1.3/minecraft/EUIClient/Textures/BoilerGui.png differ diff --git a/1.3/minecraft/EUIClient/Textures/CopperWire.png b/1.3/minecraft/EUIClient/Textures/CopperWire.png new file mode 100644 index 00000000..5f4bb528 Binary files /dev/null and b/1.3/minecraft/EUIClient/Textures/CopperWire.png differ diff --git a/1.3/minecraft/EUIClient/Textures/DefaultPipe.png b/1.3/minecraft/EUIClient/Textures/DefaultPipe.png new file mode 100644 index 00000000..05cb6ff1 Binary files /dev/null and b/1.3/minecraft/EUIClient/Textures/DefaultPipe.png differ diff --git a/1.3/minecraft/EUIClient/Textures/Furnace.png b/1.3/minecraft/EUIClient/Textures/Furnace.png new file mode 100644 index 00000000..6fc3a34a Binary files /dev/null and b/1.3/minecraft/EUIClient/Textures/Furnace.png differ diff --git a/1.3/minecraft/EUIClient/Textures/GrinderGUI.png b/1.3/minecraft/EUIClient/Textures/GrinderGUI.png new file mode 100644 index 00000000..498818ae Binary files /dev/null and b/1.3/minecraft/EUIClient/Textures/GrinderGUI.png differ diff --git a/1.3/minecraft/EUIClient/Textures/Items.png b/1.3/minecraft/EUIClient/Textures/Items.png new file mode 100644 index 00000000..2ac4a810 Binary files /dev/null and b/1.3/minecraft/EUIClient/Textures/Items.png differ diff --git a/1.3/minecraft/EUIClient/Textures/SteamGUI.png b/1.3/minecraft/EUIClient/Textures/SteamGUI.png new file mode 100644 index 00000000..ac811713 Binary files /dev/null and b/1.3/minecraft/EUIClient/Textures/SteamGUI.png differ diff --git a/1.3/minecraft/EUIClient/Textures/SteamPipe.png b/1.3/minecraft/EUIClient/Textures/SteamPipe.png new file mode 100644 index 00000000..5f4bb528 Binary files /dev/null and b/1.3/minecraft/EUIClient/Textures/SteamPipe.png differ diff --git a/1.3/minecraft/EUIClient/Textures/WaterPipe.png b/1.3/minecraft/EUIClient/Textures/WaterPipe.png new file mode 100644 index 00000000..eab6d097 Binary files /dev/null and b/1.3/minecraft/EUIClient/Textures/WaterPipe.png differ diff --git a/1.3/minecraft/EUIClient/Textures/blocks.png b/1.3/minecraft/EUIClient/Textures/blocks.png new file mode 100644 index 00000000..a2286ff2 Binary files /dev/null and b/1.3/minecraft/EUIClient/Textures/blocks.png differ diff --git a/1.3/minecraft/EUIClient/Textures/tankTexture.png b/1.3/minecraft/EUIClient/Textures/tankTexture.png new file mode 100644 index 00000000..82b85311 Binary files /dev/null and b/1.3/minecraft/EUIClient/Textures/tankTexture.png differ