From 558ed1bda8c5f13d7d4a98bc22bc31274cd07971 Mon Sep 17 00:00:00 2001 From: Rseifert Date: Mon, 24 Dec 2012 00:20:30 -0500 Subject: [PATCH] Face Lift Added: Item Render for Pipe Added: Item Render for Tank Changed: Improve motor model Changed: Tank vol to use global var Disabled: Motor rotation( tempary) Fixed: Pick Block for all blocks except pipe which picks to steam pipe etc etc normal cleanup and derps --- .../dark/BasicUtilities/BPClientProxy.java | 8 +- .../BasicUtilities/BasicUtilitiesMain.java | 8 +- .../BasicUtilities/BlockRenderHelper.java | 72 +++++ .../BasicUtilities/Blocks/BlockEValve.java | 7 + .../BasicUtilities/Blocks/BlockGenerator.java | 40 ++- .../BasicUtilities/Blocks/BlockMachine.java | 70 ----- .../dark/BasicUtilities/Blocks/BlockPipe.java | 13 +- .../Blocks/BlockPipeMachine.java | 144 +++++++++ .../dark/BasicUtilities/Blocks/BlockRod.java | 13 +- .../dark/BasicUtilities/ItemRenderHelper.java | 166 ++++++---- .../BasicUtilities/Items/ItemMachine.java | 15 +- .../BasicUtilities/Tile/TileEntityGen.java | 166 ++++++++-- .../BasicUtilities/Tile/TileEntityPump.java | 71 +++-- .../BasicUtilities/Tile/TileEntityRod.java | 83 ++--- .../BasicUtilities/Tile/TileEntityTank.java | 9 +- minecraft/dark/BasicUtilities/api/Liquid.java | 32 +- .../BasicUtilities/renders/RenderGearRod.java | 86 +++-- .../renders/RenderGenerator.java | 4 +- .../BasicUtilities/renders/RenderPipe.java | 106 ++++--- .../renders/models/ModelGearRod.java | 1 + .../renders/models/ModelGenerator.java | 295 +++++++++++------- .../renders/models/ModelLiquidTank.java | 16 +- .../zResources/mechanical/Generator.png | Bin 1423 -> 643 bytes 23 files changed, 943 insertions(+), 482 deletions(-) create mode 100644 minecraft/dark/BasicUtilities/BlockRenderHelper.java delete mode 100644 minecraft/dark/BasicUtilities/Blocks/BlockMachine.java create mode 100644 minecraft/dark/BasicUtilities/Blocks/BlockPipeMachine.java diff --git a/minecraft/dark/BasicUtilities/BPClientProxy.java b/minecraft/dark/BasicUtilities/BPClientProxy.java index 0b7d8ee8d..636ac21d5 100644 --- a/minecraft/dark/BasicUtilities/BPClientProxy.java +++ b/minecraft/dark/BasicUtilities/BPClientProxy.java @@ -1,12 +1,15 @@ package dark.BasicUtilities; +import net.minecraftforge.client.MinecraftForgeClient; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; +import dark.BasicUtilities.Tile.TileEntityGen; import dark.BasicUtilities.Tile.TileEntityTank; import dark.BasicUtilities.Tile.TileEntityPipe; import dark.BasicUtilities.Tile.TileEntityPump; import dark.BasicUtilities.Tile.TileEntityRod; import dark.BasicUtilities.renders.RenderGearRod; +import dark.BasicUtilities.renders.RenderGenerator; import dark.BasicUtilities.renders.RenderTank; import dark.BasicUtilities.renders.RenderPipe; import dark.BasicUtilities.renders.RenderPump; @@ -25,8 +28,11 @@ public class BPClientProxy extends BPCommonProxy ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPipe.class, new RenderPipe()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPump.class, new RenderPump()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRod.class, new RenderGearRod()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGen.class, new RenderGenerator()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTank.class, new RenderTank()); - RenderingRegistry.registerBlockHandler(new ItemRenderHelper()); + RenderingRegistry.registerBlockHandler(new BlockRenderHelper()); + MinecraftForgeClient.registerItemRenderer(BasicUtilitiesMain.itemPipes.shiftedIndex, new ItemRenderHelper()); + MinecraftForgeClient.registerItemRenderer(BasicUtilitiesMain.itemTank.shiftedIndex, new ItemRenderHelper()); } @Override diff --git a/minecraft/dark/BasicUtilities/BasicUtilitiesMain.java b/minecraft/dark/BasicUtilities/BasicUtilitiesMain.java index 32bf8d24c..31c69bcf5 100644 --- a/minecraft/dark/BasicUtilities/BasicUtilitiesMain.java +++ b/minecraft/dark/BasicUtilities/BasicUtilitiesMain.java @@ -29,7 +29,7 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import dark.BasicUtilities.Blocks.BlockEValve; import dark.BasicUtilities.Blocks.BlockGenerator; -import dark.BasicUtilities.Blocks.BlockMachine; +import dark.BasicUtilities.Blocks.BlockPipeMachine; import dark.BasicUtilities.Blocks.BlockOilFlowing; import dark.BasicUtilities.Blocks.BlockOilStill; import dark.BasicUtilities.Blocks.BlockPipe; @@ -64,7 +64,7 @@ import dark.BasicUtilities.api.Liquid; public class BasicUtilitiesMain extends DummyModContainer { // TODO need changed on release - public static final String VERSION = "0.2.0"; + public static final String VERSION = "0.2.1"; // Constants public static final String NAME = "BasicUtilities"; public static final String CHANNEL = "BPipes"; @@ -153,7 +153,7 @@ public class BasicUtilitiesMain extends DummyModContainer LanguageRegistry.addName((new ItemStack(machine, 1, 0)), "Pump"); LanguageRegistry.addName((new ItemStack(machine, 1, 4)), "WaterCondensor"); - LanguageRegistry.addName((new ItemStack(generator, 1)), "EU Generator"); + LanguageRegistry.addName((new ItemStack(generator, 1)), "ElectricGen"); // mechanical rod LanguageRegistry.addName((new ItemStack(rod, 1)), "GearedRod"); // Tools @@ -287,7 +287,7 @@ public class BasicUtilitiesMain extends DummyModContainer CONFIGURATION.load(); // blocks pipe = new BlockPipe(this.CONFIGURATION.getBlock("Pipe", BLOCK_ID_PREFIX).getInt()); - machine = new BlockMachine(this.CONFIGURATION.getBlock("MachineSetOne", BLOCK_ID_PREFIX + 1).getInt()); + machine = new BlockPipeMachine(this.CONFIGURATION.getBlock("MachineSetOne", BLOCK_ID_PREFIX + 1).getInt()); // valve = new BlockValve(this.CONFIGURATION.getBlock("Valve", // BLOCK_ID_PREFIX + 2).getInt()); rod = new BlockRod(this.CONFIGURATION.getBlock("MechanicalRod", BLOCK_ID_PREFIX + 3).getInt()); diff --git a/minecraft/dark/BasicUtilities/BlockRenderHelper.java b/minecraft/dark/BasicUtilities/BlockRenderHelper.java new file mode 100644 index 000000000..66ed9ef2f --- /dev/null +++ b/minecraft/dark/BasicUtilities/BlockRenderHelper.java @@ -0,0 +1,72 @@ +package dark.BasicUtilities; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.world.IBlockAccess; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import dark.BasicUtilities.renders.models.ModelGearRod; +import dark.BasicUtilities.renders.models.ModelGenerator; +import dark.BasicUtilities.renders.models.ModelPump; + +public class BlockRenderHelper implements ISimpleBlockRenderingHandler { + public static BlockRenderHelper instance = new BlockRenderHelper(); + public static int renderID = RenderingRegistry.getNextAvailableRenderId(); + private ModelPump modelPump = new ModelPump(); + private ModelGearRod modelRod = new ModelGearRod(); + private ModelGenerator modelGen = new ModelGenerator(); + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if(block.blockID == BasicUtilitiesMain.machine.blockID && metadata < 4) + { + GL11.glPushMatrix(); + GL11.glTranslatef((float) 0.0F, (float)1.1F, (float)0.0F); + GL11.glRotatef(180f, 0f, 0f, 1f); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(BasicUtilitiesMain.textureFile+"pumps/Pump.png")); + modelPump.renderMain(0.0725F); + modelPump.renderC1(0.0725F); + modelPump.renderC2(0.0725F); + modelPump.renderC3(0.0725F); + GL11.glPopMatrix(); + } + if(block.blockID == BasicUtilitiesMain.pipe.blockID) + { + + } + if(block.blockID == BasicUtilitiesMain.rod.blockID) + { + GL11.glPushMatrix(); + GL11.glTranslatef((float) 0.0F, (float)1.5F, (float)0.0F); + GL11.glRotatef(180f, 0f, 0f, 1f); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(BasicUtilitiesMain.textureFile+"mechanical/GearRod.png")); + modelRod.render(0.0825F,0); + GL11.glPopMatrix(); + } + if(block.blockID == BasicUtilitiesMain.generator.blockID) + { + GL11.glPushMatrix(); + GL11.glTranslatef((float) 0.0F, (float)1.3F, (float)0.0F); + GL11.glRotatef(180f, 0f, 0f, 1f); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(BasicUtilitiesMain.textureFile+"mechanical/Generator.png")); + modelGen.render(null); + GL11.glPopMatrix(); + } + } + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + return false; + } + + public boolean shouldRender3DInInventory() { + + return true; + } + + public int getRenderId() + { + return renderID; + } +} diff --git a/minecraft/dark/BasicUtilities/Blocks/BlockEValve.java b/minecraft/dark/BasicUtilities/Blocks/BlockEValve.java index a3fd5f42d..e3921f0cc 100644 --- a/minecraft/dark/BasicUtilities/Blocks/BlockEValve.java +++ b/minecraft/dark/BasicUtilities/Blocks/BlockEValve.java @@ -9,6 +9,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import universalelectricity.prefab.implement.IRedstoneReceptor; @@ -89,6 +90,12 @@ public class BlockEValve extends BlockContainer this.checkForPower(par1World, x, y, z); } + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) + { + int meta = world.getBlockMetadata(x, y, z); + return new ItemStack(BasicUtilitiesMain.eValve,1,meta); + } public static void checkForPower(World world, int x, int y, int z) { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); diff --git a/minecraft/dark/BasicUtilities/Blocks/BlockGenerator.java b/minecraft/dark/BasicUtilities/Blocks/BlockGenerator.java index ffc7d3b14..bc69c2626 100644 --- a/minecraft/dark/BasicUtilities/Blocks/BlockGenerator.java +++ b/minecraft/dark/BasicUtilities/Blocks/BlockGenerator.java @@ -2,6 +2,8 @@ package dark.BasicUtilities.Blocks; import java.util.ArrayList; +import universalelectricity.prefab.implement.IRedstoneReceptor; + import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLiving; @@ -9,9 +11,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import dark.BasicUtilities.ItemRenderHelper; +import dark.BasicUtilities.BasicUtilitiesMain; +import dark.BasicUtilities.BlockRenderHelper; import dark.BasicUtilities.PipeTab; +import dark.BasicUtilities.Tile.TileEntityEValve; import dark.BasicUtilities.Tile.TileEntityGen; public class BlockGenerator extends universalelectricity.prefab.BlockMachine { @@ -27,7 +32,12 @@ public class BlockGenerator extends universalelectricity.prefab.BlockMachine { public void addCreativeItems(ArrayList itemList) { itemList.add(new ItemStack(this, 1, 0)); } + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) + { + return new ItemStack(BasicUtilitiesMain.generator,1); + } @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving) { @@ -62,11 +72,37 @@ public class BlockGenerator extends universalelectricity.prefab.BlockMachine { @Override public int getRenderType() { - return ItemRenderHelper.renderID; + return BlockRenderHelper.renderID; } @Override public TileEntity createNewTileEntity(World world) { return new TileEntityGen(); } + + @Override + public void onNeighborBlockChange(World par1World, int x, int y, int z, int side) + { + super.onNeighborBlockChange(par1World, x, y, z, side); + this.checkForPower(par1World, x, y, z); + + } + public static void checkForPower(World world, int x, int y, int z) + { + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + + if (tileEntity instanceof TileEntityGen) + { + boolean powered = ((TileEntityGen) tileEntity).isPowered; + boolean beingPowered = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockGettingPowered(x, y, z); + if (powered && !beingPowered) + { + ((IRedstoneReceptor) world.getBlockTileEntity(x, y, z)).onPowerOff(); + } + else if (!powered && beingPowered) + { + ((IRedstoneReceptor) world.getBlockTileEntity(x, y, z)).onPowerOn(); + } + } + } } diff --git a/minecraft/dark/BasicUtilities/Blocks/BlockMachine.java b/minecraft/dark/BasicUtilities/Blocks/BlockMachine.java deleted file mode 100644 index 7f1cd1d70..000000000 --- a/minecraft/dark/BasicUtilities/Blocks/BlockMachine.java +++ /dev/null @@ -1,70 +0,0 @@ -package dark.BasicUtilities.Blocks; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import dark.BasicUtilities.ItemRenderHelper; -import dark.BasicUtilities.PipeTab; -import dark.BasicUtilities.Tile.TileEntityTank; -import dark.BasicUtilities.Tile.TileEntityPump; - -public class BlockMachine extends BlockContainer -{ - - public BlockMachine(int id) - { - super(id, Material.iron); - this.setBlockName("Machine"); - this.setCreativeTab(PipeTab.INSTANCE); - this.setRequiresSelfNotify(); - this.blockIndexInTexture = 26; - this.setHardness(1f); - this.setResistance(5f); - } - - public boolean isOpaqueCube() - { - return false; - } - - public boolean renderAsNormalBlock() - { - return false; - } - - /** - * The type of render function that is called for this block - */ - public int getRenderType() - { - return ItemRenderHelper.renderID; - } - - public int damageDropped(int meta) - { - if (meta < 4) { return 0; } - return meta; - } - - @Override - public TileEntity createNewTileEntity(World var1, int meta) - { - // TODO Auto-generated method stub - if (meta < 4) { return new TileEntityPump(); } - if (meta == 4) - { - // return new TileEntityCondenser(); - } - if (meta == 5) { return new TileEntityTank(); } - return null; - } - - @Override - public TileEntity createNewTileEntity(World var1) - { - // TODO Auto-generated method stub - return null; - } -} diff --git a/minecraft/dark/BasicUtilities/Blocks/BlockPipe.java b/minecraft/dark/BasicUtilities/Blocks/BlockPipe.java index 34fd5cd9a..7684cb716 100644 --- a/minecraft/dark/BasicUtilities/Blocks/BlockPipe.java +++ b/minecraft/dark/BasicUtilities/Blocks/BlockPipe.java @@ -7,6 +7,7 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import dark.BasicUtilities.BasicUtilitiesMain; import dark.BasicUtilities.Tile.TileEntityPipe; @@ -79,7 +80,17 @@ public class BlockPipe extends BlockContainer // TODO Auto-generated method stub return new TileEntityPipe(); } - + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) + { + TileEntity ent = world.getBlockTileEntity(x, y, z); + int meta = 0; + if(ent instanceof TileEntityPipe) + { + meta = ((TileEntityPipe)ent).type.ordinal(); + } + return new ItemStack(BasicUtilitiesMain.itemPipes,1,0); + } @Override public void breakBlock(World world, int x, int y, int z, int par5, int par6) { diff --git a/minecraft/dark/BasicUtilities/Blocks/BlockPipeMachine.java b/minecraft/dark/BasicUtilities/Blocks/BlockPipeMachine.java new file mode 100644 index 000000000..14a28e25e --- /dev/null +++ b/minecraft/dark/BasicUtilities/Blocks/BlockPipeMachine.java @@ -0,0 +1,144 @@ +package dark.BasicUtilities.Blocks; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.liquids.LiquidContainerRegistry; +import net.minecraftforge.liquids.LiquidStack; +import dark.BasicUtilities.BasicUtilitiesMain; +import dark.BasicUtilities.BlockRenderHelper; +import dark.BasicUtilities.PipeTab; +import dark.BasicUtilities.Tile.TileEntityTank; +import dark.BasicUtilities.Tile.TileEntityPump; +import dark.BasicUtilities.api.Liquid; + +public class BlockPipeMachine extends BlockContainer +{ + + public BlockPipeMachine(int id) + { + super(id, Material.iron); + this.setBlockName("Machine"); + this.setCreativeTab(PipeTab.INSTANCE); + this.setRequiresSelfNotify(); + this.blockIndexInTexture = 26; + this.setHardness(1f); + this.setResistance(5f); + } + + public boolean isOpaqueCube() + { + return false; + } + + public boolean renderAsNormalBlock() + { + return false; + } + /** + * Code thanks to buildcraft src + */ + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ) + { + ItemStack current = entityplayer.inventory.getCurrentItem(); + if (current != null) { + + LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(current); + + TileEntityTank tank = (TileEntityTank) world.getBlockTileEntity(x, y, z); + + // Handle filled containers + if (liquid != null) { + int filled = tank.fill(ForgeDirection.UNKNOWN, liquid, true); + + if (filled != 0 &&!entityplayer.capabilities.isCreativeMode) { + entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, Liquid.consumeItem(current)); + } + + return true; + + // Handle empty containers + } else { + + LiquidStack stack = tank.tank.getLiquid(); + if (stack != null) { + ItemStack liquidItem = LiquidContainerRegistry.fillLiquidContainer(stack, current); + + liquid = LiquidContainerRegistry.getLiquidForFilledItem(liquidItem); + + if (liquid != null) { + if (!entityplayer.capabilities.isCreativeMode) { + if (current.stackSize > 1) { + if (!entityplayer.inventory.addItemStackToInventory(liquidItem)) + return false; + else { + entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, Liquid.consumeItem(current)); + } + } else { + entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, Liquid.consumeItem(current)); + entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem); + } + } + tank.tank.drain(liquid.amount, true); + return true; + } + } + } + } + + return false; + + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return BlockRenderHelper.renderID; + } + + public int damageDropped(int meta) + { + if (meta < 4) { return 0; } + return meta; + } + + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) + { + int meta = world.getBlockMetadata(x, y, z); + if (meta < 4) new ItemStack(BasicUtilitiesMain.machine, 1, 0); + // if(meta == 4) ; + TileEntity ent = world.getBlockTileEntity(x, y, z); + if (ent instanceof TileEntityTank) new ItemStack(BasicUtilitiesMain.itemTank, 1, ((TileEntityTank) ent).type.ordinal()); + return null; + } + + @Override + public TileEntity createNewTileEntity(World var1, int meta) + { + // TODO Auto-generated method stub + if (meta < 4) { return new TileEntityPump(); } + if (meta == 4) + { + // return new TileEntityCondenser(); + } + if (meta == 5) { return new TileEntityTank(); } + return null; + } + + @Override + public TileEntity createNewTileEntity(World var1) + { + // TODO Auto-generated method stub + return null; + } +} diff --git a/minecraft/dark/BasicUtilities/Blocks/BlockRod.java b/minecraft/dark/BasicUtilities/Blocks/BlockRod.java index 4221c5e28..957506203 100644 --- a/minecraft/dark/BasicUtilities/Blocks/BlockRod.java +++ b/minecraft/dark/BasicUtilities/Blocks/BlockRod.java @@ -4,11 +4,14 @@ import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; -import dark.BasicUtilities.ItemRenderHelper; +import dark.BasicUtilities.BasicUtilitiesMain; +import dark.BasicUtilities.BlockRenderHelper; import dark.BasicUtilities.PipeTab; import dark.BasicUtilities.Tile.TileEntityRod; @@ -84,7 +87,11 @@ public class BlockRod extends universalelectricity.prefab.BlockMachine { return false; } - + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) + { + return new ItemStack(BasicUtilitiesMain.rod,1,0); + } /** * If this block doesn't render as an ordinary block it will return False * (examples: signs, buttons, stairs, etc) @@ -99,7 +106,7 @@ public class BlockRod extends universalelectricity.prefab.BlockMachine */ public int getRenderType() { - return ItemRenderHelper.renderID; + return BlockRenderHelper.renderID; } } diff --git a/minecraft/dark/BasicUtilities/ItemRenderHelper.java b/minecraft/dark/BasicUtilities/ItemRenderHelper.java index bf3702619..ec5d76447 100644 --- a/minecraft/dark/BasicUtilities/ItemRenderHelper.java +++ b/minecraft/dark/BasicUtilities/ItemRenderHelper.java @@ -2,67 +2,117 @@ package dark.BasicUtilities; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.world.IBlockAccess; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.IItemRenderer; +import net.minecraftforge.client.IItemRenderer.ItemRenderType; import org.lwjgl.opengl.GL11; import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -import cpw.mods.fml.client.registry.RenderingRegistry; -import dark.BasicUtilities.renders.models.ModelGearRod; -import dark.BasicUtilities.renders.models.ModelGenerator; -import dark.BasicUtilities.renders.models.ModelPump; +import dark.BasicUtilities.renders.models.ModelLargePipe; +import dark.BasicUtilities.renders.models.ModelLiquidTank; -public class ItemRenderHelper implements ISimpleBlockRenderingHandler { - public static ItemRenderHelper instance = new ItemRenderHelper(); - public static int renderID = RenderingRegistry.getNextAvailableRenderId(); - private ModelPump modelPump = new ModelPump(); - private ModelGearRod modelRod = new ModelGearRod(); - private ModelGenerator modelGen = new ModelGenerator(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(block.blockID == BasicUtilitiesMain.machine.blockID && metadata < 4) - { - GL11.glPushMatrix(); - GL11.glTranslatef((float) 0.0F, (float)1.1F, (float)0.0F); - GL11.glRotatef(180f, 0f, 0f, 1f); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(BasicUtilitiesMain.textureFile+"pumps/Pump.png")); - modelPump.renderMain(0.0725F); - modelPump.renderC1(0.0725F); - modelPump.renderC2(0.0725F); - modelPump.renderC3(0.0725F); - GL11.glPopMatrix(); - } - if(block.blockID == BasicUtilitiesMain.rod.blockID) - { - GL11.glPushMatrix(); - GL11.glTranslatef((float) 0.0F, (float)1.5F, (float)0.0F); - GL11.glRotatef(180f, 0f, 0f, 1f); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(BasicUtilitiesMain.textureFile+"mechanical/GearRod.png")); - modelRod.render(0.0825F,0); - GL11.glPopMatrix(); - } - if(block.blockID == BasicUtilitiesMain.generator.blockID) - { - GL11.glPushMatrix(); - GL11.glTranslatef((float) 0.0F, (float)1.3F, (float)0.0F); - GL11.glRotatef(180f, 0f, 0f, 1f); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(BasicUtilitiesMain.textureFile+"mechanical/Generator.png")); - modelGen.RenderMain(0.0725F); - GL11.glPopMatrix(); - } - } - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - public boolean shouldRender3DInInventory() { - - return true; - } - - public int getRenderId() - { - return renderID; - } +/** + * special tanks to Mekanism github + */ +public class ItemRenderHelper implements IItemRenderer +{ + static final ModelLiquidTank model = new ModelLiquidTank(); + static final ModelLargePipe SixPipe = new ModelLargePipe(); + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) + { + return true; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) + { + return true; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) + { + if (item.itemID == BasicUtilitiesMain.itemPipes.shiftedIndex) + { + this.renderPipeItem((RenderBlocks) data[0], item.getItemDamage(), type == ItemRenderType.EQUIPPED); + } + if (item.itemID == BasicUtilitiesMain.itemTank.shiftedIndex) + { + this.rendertankItem((RenderBlocks) data[0], item.getItemDamage(), type == ItemRenderType.EQUIPPED); + } + + } + + public void renderPipeItem(RenderBlocks renderer, int meta, boolean equ) + { + + GL11.glPushMatrix(); + String file = BasicUtilitiesMain.textureFile + "pipes/"; + switch (meta) + { + case 0: + file += "SixSteamPipe.png"; + break; + case 1: + file += "SixWaterPipe.png"; + break; + case 2: + file += "SixLavaPipe.png"; + break; + case 3: + file += "SixOilPipe.png"; + break; + default: + file += "DefaultPipe.png"; + break; + } + GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(file)); + if (!equ) + { + GL11.glTranslatef(0.5F, -0.5F, 0.5F); + SixPipe.renderRight(); + SixPipe.renderLeft(); + SixPipe.renderMiddle(); + } + else + { + GL11.glTranslatef(0.5F, -0.5F, 0.5F); + SixPipe.renderFront(); + SixPipe.renderBack(); + SixPipe.renderMiddle(); + } + + GL11.glPopMatrix(); + } + + public void rendertankItem(RenderBlocks renderer, int meta, boolean equ) + { + + GL11.glPushMatrix(); + + String file = BasicUtilitiesMain.textureFile + "tanks/"; + switch (meta) + { + default: + file += "LiquidTank.png"; + break; + } + + GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(file)); + if (!equ) + { + GL11.glTranslatef(0.5F, -0.5F, 0.5F); + } + else + { + GL11.glTranslatef(0.5F, -0.5F, 0.5F); + } + model.renderMain(null, 0.0625F); + GL11.glPopMatrix(); + } } diff --git a/minecraft/dark/BasicUtilities/Items/ItemMachine.java b/minecraft/dark/BasicUtilities/Items/ItemMachine.java index 549175ea9..0352039b2 100644 --- a/minecraft/dark/BasicUtilities/Items/ItemMachine.java +++ b/minecraft/dark/BasicUtilities/Items/ItemMachine.java @@ -12,6 +12,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import dark.BasicUtilities.BasicUtilitiesMain; import dark.BasicUtilities.PipeTab; +import dark.BasicUtilities.Tile.TileEntityTank; public class ItemMachine extends ItemBlock { @@ -28,6 +29,12 @@ public class ItemMachine extends ItemBlock this.setCreativeTab(PipeTab.INSTANCE); } @Override + public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) + { + if(itemstack.getItemDamage() == 5 ) list.add("Max Vol of "+ TileEntityTank.LMax); + + } + @Override public int getIconFromDamage(int par1) { @@ -38,14 +45,6 @@ public class ItemMachine extends ItemBlock { return itemstack.getItemDamage() == 0 ? "Pump" :"Conderser";//itemstack.getItemDamage() == 4 ? "Condenser":"Unknown"; } - @Override - public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) - { - - par3List.add(new ItemStack(this, 1, 0)); - //par3List.add(new ItemStack(this, 1, 4)); - - } public String getTextureFile() { return BasicUtilitiesMain.ITEM_PNG; } diff --git a/minecraft/dark/BasicUtilities/Tile/TileEntityGen.java b/minecraft/dark/BasicUtilities/Tile/TileEntityGen.java index bd7436720..acc3301cf 100644 --- a/minecraft/dark/BasicUtilities/Tile/TileEntityGen.java +++ b/minecraft/dark/BasicUtilities/Tile/TileEntityGen.java @@ -11,29 +11,39 @@ import universalelectricity.core.electricity.ElectricityConnections; import universalelectricity.core.electricity.ElectricityNetwork; import universalelectricity.core.implement.IConductor; import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.implement.IRedstoneReceptor; import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.tile.TileEntityElectricityProducer; import com.google.common.io.ByteArrayDataInput; +import cpw.mods.fml.common.FMLLog; + import dark.BasicUtilities.BasicUtilitiesMain; +import dark.BasicUtilities.Blocks.BlockEValve; +import dark.BasicUtilities.Blocks.BlockGenerator; import dark.BasicUtilities.api.IForce; import dark.BasicUtilities.api.IReadOut; import dark.BasicUtilities.api.MHelper; +import dark.Library.Util.MetaGroupingHelper; -public class TileEntityGen extends TileEntityElectricityProducer implements IPacketReceiver, IForce, IReadOut +public class TileEntityGen extends TileEntityElectricityProducer implements IPacketReceiver, IForce, IReadOut, IRedstoneReceptor { + public boolean isPowered = false; + ForgeDirection facing = ForgeDirection.DOWN; public int force = 0;// current total force public int aForce = 0;// force this unit can apply public int pos = 0;// current pos of rotation max of 8 public int disableTicks = 0;// time disabled - public double genAmmount = 0;// watt output of machine public int tCount = 0; + double WATTS_PER_TICK = 500; + double joulesReceived = 0; + double genAmmount = 0;// watt output of machine IConductor[] wires = - { null, null, null, null, null, null }; + { null, null, null, null, null, null }; public boolean needUpdate() { @@ -42,16 +52,32 @@ public class TileEntityGen extends TileEntityElectricityProducer implements IPac public void initiate() { - ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.UP)); - ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.DOWN)); + this.registerConnections(); this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, BasicUtilitiesMain.generator.blockID); } + public void registerConnections() + { + int notchMeta = MetaGroupingHelper.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); + ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite(); + ForgeDirection[] dirs = new ForgeDirection[] { ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN }; + ElectricityConnections.registerConnector(this, EnumSet.of(facing.getOpposite())); + for (int i = 2; i < 6; i++) + { + ForgeDirection dir = ForgeDirection.getOrientation(i); + if (dir != facing && dir != facing.getOpposite()) + { + dirs[i] = dir; + } + } + ElectricityConnections.registerConnector(this, EnumSet.of(dirs[0], dirs[1], dirs[2], dirs[3], dirs[4], dirs[5])); + } + @Override public void updateEntity() { - this.genAmmount = force / this.getVoltage(); - + this.genAmmount = Math.abs(force / this.getVoltage()); + // wire count update int wireCount = 0; TileEntity[] ents = MHelper.getSourounding(worldObj, xCoord, yCoord, zCoord); this.wires = new IConductor[6]; @@ -62,21 +88,89 @@ public class TileEntityGen extends TileEntityElectricityProducer implements IPac this.wires[i] = (IConductor) ents[i]; wireCount++; } + }// end wire count + if (tCount-- <= 0) + { + BlockGenerator.checkForPower(worldObj, xCoord, yCoord, zCoord); + tCount = 10; + if (this.force > 0 || this.isPowered) + { + this.pos++; + if (force < 0) pos -= 2; + if (pos >= 8) pos = 0; + } } + int notchMeta = MetaGroupingHelper.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); + facing = ForgeDirection.getOrientation(notchMeta).getOpposite(); + TileEntity ent = worldObj.getBlockTileEntity(xCoord + facing.offsetX, yCoord + facing.offsetY, zCoord + facing.offsetZ); + if (!this.worldObj.isRemote) { - for (int i = 0; i < 6; i++) - { - //TODO set up for other sides - if (i == 0 || i == 1) - { - ForgeDirection outputDirection = ForgeDirection.getOrientation(i); - TileEntity outputTile = Vector3.getConnectorFromSide(this.worldObj, new Vector3(this.xCoord, this.yCoord, this.zCoord), outputDirection); - ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(outputTile, outputDirection); - this.outputEnergy(network, wires[i], outputTile); + if (!this.isPowered) + { + + for (int i = 2; i < 6; i++) + { + ForgeDirection dir = ForgeDirection.getOrientation(i); + if (dir != facing && dir != facing.getOpposite()) + { + + TileEntity outputTile = Vector3.getConnectorFromSide(this.worldObj, new Vector3(this), dir); + ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(outputTile, dir); + if (network != null) + { + if (network.getRequest().getWatts() > 0) + { + network.startProducing(this, (this.genAmmount), this.getVoltage()); + } + else + { + network.stopProducing(this); + } + } + } } } + else + { + for (int i = 2; i < 6; i++) + { + ForgeDirection dir = ForgeDirection.getOrientation(i); + if (dir != facing && dir != facing.getOpposite()) + { + TileEntity inputTile = Vector3.getTileEntityFromSide(this.worldObj, new Vector3(this), dir); + ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(inputTile, dir); + if (network != null) + { + + if (this.joulesReceived < this.WATTS_PER_TICK) + { + network.startRequesting(this, WATTS_PER_TICK / this.getVoltage(), this.getVoltage()); + this.joulesReceived = Math.max(Math.min(this.joulesReceived + network.consumeElectricity(this).getWatts(), WATTS_PER_TICK), 0); + } + else + { + network.stopRequesting(this); + } + } + } + } + if (this.joulesReceived >= this.WATTS_PER_TICK - 50) + { + joulesReceived -= this.WATTS_PER_TICK; + TileEntity rod = Vector3.getTileEntityFromSide(worldObj, new Vector3(this), facing); + if (rod instanceof IForce && ((IForce) rod).canInputSide(facing)) + { + ((IForce) rod).applyForce(10000); + } + else if (rod instanceof IForce && ((IForce) rod).canOutputSide(facing)) + { + ((IForce) rod).applyForce(-10000); + } + } + + } } super.updateEntity(); @@ -114,21 +208,6 @@ public class TileEntityGen extends TileEntityElectricityProducer implements IPac } - /** - * does the basic animation for the model - */ - public void doAnimation() - { - if (worldObj.isRemote) - { - this.pos += 1; - if (pos >= 8 || pos < 0) - { - pos = 0; - } - } - } - // ------------------------------ // Data handling // ------------------------------ @@ -138,6 +217,7 @@ public class TileEntityGen extends TileEntityElectricityProducer implements IPac // TODO Auto-generated method stub } + // ------------------------------ // Mechanics // ------------------------------ @@ -157,14 +237,14 @@ public class TileEntityGen extends TileEntityElectricityProducer implements IPac @Override public boolean canOutputSide(ForgeDirection side) { - if (side == facing.getOpposite()) { return true; } + if (side == facing) { return true; } return false; } @Override public boolean canInputSide(ForgeDirection side) { - if (side == facing) { return true; } + if (side == facing || side == facing.getOpposite()) { return true; } return false; } @@ -206,7 +286,25 @@ public class TileEntityGen extends TileEntityElectricityProducer implements IPac @Override public String getMeterReading(EntityPlayer user, ForgeDirection side) { - return this.force + "N Input " + this.genAmmount + "W output"; + if (this.isPowered) return "Outputing Force " + this.joulesReceived + "J "+"pos "+this.pos; + return this.force + "N Input " + this.genAmmount + "W output "+"pos "+this.pos; + } + + // ------------------------------ + // redSand + // ------------------------------ + @Override + public void onPowerOn() + { + this.isPowered = true; + + } + + @Override + public void onPowerOff() + { + this.isPowered = false; + } } diff --git a/minecraft/dark/BasicUtilities/Tile/TileEntityPump.java b/minecraft/dark/BasicUtilities/Tile/TileEntityPump.java index 8538a0803..be847265c 100644 --- a/minecraft/dark/BasicUtilities/Tile/TileEntityPump.java +++ b/minecraft/dark/BasicUtilities/Tile/TileEntityPump.java @@ -52,22 +52,22 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa this.registerConnections(); this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, BasicUtilitiesMain.machine.blockID); } -//ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.getOrientation(this.getBlockMetadata() - BlockBasicMachine.BATTERY_BOX_METADATA + 2), ForgeDirection.getOrientation(this.getBlockMetadata() - BlockBasicMachine.BATTERY_BOX_METADATA + 2).getOpposite())); + public void registerConnections() { int notchMeta = MetaGroupingHelper.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite(); - ForgeDirection[] dirs = new ForgeDirection[]{ForgeDirection.UNKNOWN,ForgeDirection.UNKNOWN,ForgeDirection.UNKNOWN,ForgeDirection.UNKNOWN,ForgeDirection.UNKNOWN,ForgeDirection.UNKNOWN}; + ForgeDirection[] dirs = new ForgeDirection[] { ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN, ForgeDirection.UNKNOWN }; ElectricityConnections.registerConnector(this, EnumSet.of(facing.getOpposite())); - for(int i = 2; i<6;i++) + for (int i = 2; i < 6; i++) { ForgeDirection dir = ForgeDirection.getOrientation(i); - if(dir != facing) + if (dir != facing) { - dirs[i] = dir; + dirs[i] = dir; } } - ElectricityConnections.registerConnector(this, EnumSet.of(dirs[0],dirs[1],dirs[2],dirs[3],dirs[4],dirs[5])); + ElectricityConnections.registerConnector(this, EnumSet.of(dirs[0], dirs[1], dirs[2], dirs[3], dirs[4], dirs[5])); } @Override @@ -105,45 +105,52 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa } count = 40; } - + if (this.tank.getLiquid() == null) + { + this.tank.setLiquid(Liquid.getStack(this.type, 1)); + } LiquidStack stack = tank.getLiquid(); if (stack != null) { - - if (stack.amount >= 0) + for (int i = 0; i < 6; i++) { - for (int i = 0; i < 6; i++) - { - ForgeDirection dir = ForgeDirection.getOrientation(i); - TileEntity tile = worldObj.getBlockTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ); + ForgeDirection dir = ForgeDirection.getOrientation(i); + TileEntity tile = worldObj.getBlockTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ); - if (tile instanceof ITankContainer) - { - int moved = ((ITankContainer) tile).fill(dir.getOpposite(), stack, true); - tank.drain(moved, true); - if (stack.amount <= 0) break; - } + if (tile instanceof ITankContainer) + { + int moved = ((ITankContainer) tile).fill(dir.getOpposite(), stack, true); + tank.drain(moved, true); + if (stack.amount <= 0) break; } } } - ForgeDirection inputDirection = ForgeDirection.getOrientation(this.getBlockMetadata() + 2); - TileEntity inputTile = Vector3.getTileEntityFromSide(this.worldObj, new Vector3(this), inputDirection); + int notchMeta = MetaGroupingHelper.getFacingMeta(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); + ForgeDirection facing = ForgeDirection.getOrientation(notchMeta).getOpposite(); - ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(inputTile, inputDirection); - - if (network != null) + for (int i = 2; i < 6; i++) { - if (this.canPump(xCoord, yCoord - 1, zCoord)) + ForgeDirection dir = ForgeDirection.getOrientation(i); + if (dir != facing) { - network.startRequesting(this, WATTS_PER_TICK / this.getVoltage(), this.getVoltage()); - this.joulesReceived = Math.max(Math.min(this.joulesReceived + network.consumeElectricity(this).getWatts(), WATTS_PER_TICK), 0); - } - else - { - network.stopRequesting(this); + TileEntity inputTile = Vector3.getTileEntityFromSide(this.worldObj, new Vector3(this), dir); + ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(inputTile, dir); + if (network != null) + { + + if (this.canPump(xCoord, yCoord - 1, zCoord)) + { + network.startRequesting(this, WATTS_PER_TICK / this.getVoltage(), this.getVoltage()); + this.joulesReceived = Math.max(Math.min(this.joulesReceived + network.consumeElectricity(this).getWatts(), WATTS_PER_TICK), 0); + } + else + { + network.stopRequesting(this); + } + } } } if (this.joulesReceived >= this.WATTS_PER_TICK - 50 && this.canPump(xCoord, yCoord - 1, zCoord)) @@ -191,7 +198,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa if (bBlock == Block.lavaMoving.blockID || (bBlock == Block.lavaStill.blockID && meta != 0)) return false; if (bBlock == type.liquid.itemID && this.isValidLiquid(Block.blocksList[bBlock])) { - FMLLog.info("pumping " + bellow.displayerName + " blockID:" + bBlock + " Meta:" + meta); + //FMLLog.info("pumping " + bellow.displayerName + " blockID:" + bBlock + " Meta:" + meta); int f = this.tank.fill(Liquid.getStack(this.type, LiquidContainerRegistry.BUCKET_VOLUME), true); if (f > 0) worldObj.setBlockWithNotify(loc.intX(), loc.intY(), loc.intZ(), 0); percentPumped = 0; diff --git a/minecraft/dark/BasicUtilities/Tile/TileEntityRod.java b/minecraft/dark/BasicUtilities/Tile/TileEntityRod.java index 0789cbe14..a089220c4 100644 --- a/minecraft/dark/BasicUtilities/Tile/TileEntityRod.java +++ b/minecraft/dark/BasicUtilities/Tile/TileEntityRod.java @@ -20,18 +20,13 @@ public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce { public int pos = 0; - private int force = 0; - private int pForce = 0; - public int aForce = 0; - public int forceMax = 1000; + private int currentForce = 0;// current force given to rod + private int pasteForce = 0;// last update force count + public int appliedForce = 0;// force this rod can apply to other things private int tickCount = 0; - private int posCount = 0; + private int posCount = 0;// animation position 0-8 - private ForgeDirection frontDir; - private ForgeDirection backDir; - - private TileEntity bb; - private TileEntity ff; + private ForgeDirection facing = ForgeDirection.UNKNOWN; @Override public void updateEntity() @@ -41,56 +36,28 @@ public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce { tickCount = 0; int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - frontDir = ForgeDirection.getOrientation(meta); - backDir = ForgeDirection.getOrientation(meta).getOpposite(); - bb = worldObj.getBlockTileEntity(xCoord + backDir.offsetX, yCoord, zCoord + backDir.offsetZ); - ff = worldObj.getBlockTileEntity(xCoord + frontDir.offsetX, yCoord, zCoord + frontDir.offsetZ); - if (force > 0) + facing = ForgeDirection.getOrientation(meta); + if (this.currentForce > 0) { - int posCountA = (forceMax / force) & 10; - if (posCount++ >= posCountA) - { - pos++; - if (pos > 7) - { - pos = 0; - } - ; - } - } - if (bb instanceof TileEntityRod) - { - this.pos = ((IForce) bb).getAnimationPos(); + this.pos++; + if (pos >= 8) pos = 0; } if (!worldObj.isRemote) { + TileEntity ent = Vector3.getTileEntityFromSide(worldObj, new Vector3(this), facing); + appliedForce = Math.max(currentForce - 20, 0); + if (ent instanceof IForce && (((IForce) ent).canInputSide(facing))) + { + ((IForce) ent).applyForce(appliedForce); + } - if (ff instanceof IForce) - { - if (((IForce) ff).canInputSide(backDir)) - { - ((IForce) ff).applyForce(aForce); - } - } - if (bb instanceof IForce) - { - if (((IForce) bb).canOutputSide(frontDir)) - { - this.force = ((IForce) bb).getForce(); - } - } - else - { - this.force -= Math.max(force / 10, 0); - } - aForce = Math.max(force - 10, 0); - if (this.force != this.pForce) + if (this.currentForce != this.pasteForce) { Packet packet = PacketManager.getPacket(BasicUtilitiesMain.CHANNEL, this, new Object[] - { force }); + { currentForce }); PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 40); } - this.pForce = this.force; + this.pasteForce = this.currentForce; } } } @@ -98,27 +65,27 @@ public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce @Override public int getForceSide(ForgeDirection side) { - return aForce; + return appliedForce; } @Override public boolean canOutputSide(ForgeDirection side) { - if (side == frontDir) { return true; } + if (side == facing || side == facing.getOpposite()) { return true; } return false; } @Override public boolean canInputSide(ForgeDirection side) { - if (side == backDir) { return true; } + if (side == facing || side == facing.getOpposite()) { return true; } return false; } @Override public int applyForce(int force) { - this.force = force; + this.currentForce = force; return force; } @@ -129,7 +96,7 @@ public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce { try { - this.force = data.readInt(); + this.currentForce = data.readInt(); } catch (Exception e) { @@ -149,12 +116,12 @@ public class TileEntityRod extends TileEntity implements IPacketReceiver, IForce public int getForce() { // TODO Auto-generated method stub - return this.force; + return this.currentForce; } @Override public String getMeterReading(EntityPlayer user, ForgeDirection side) { - return this.aForce + "N Out " + this.force + "N In"; + return this.appliedForce + "N Out " + this.currentForce + "N In"; } } diff --git a/minecraft/dark/BasicUtilities/Tile/TileEntityTank.java b/minecraft/dark/BasicUtilities/Tile/TileEntityTank.java index 853a3813d..54f811d0d 100644 --- a/minecraft/dark/BasicUtilities/Tile/TileEntityTank.java +++ b/minecraft/dark/BasicUtilities/Tile/TileEntityTank.java @@ -27,15 +27,14 @@ import dark.BasicUtilities.api.MHelper; public class TileEntityTank extends TileEntity implements IPacketReceiver, IReadOut, ITankOutputer { - public TileEntity[] cc = - { null, null, null, null, null, null }; + public TileEntity[] cc = { null, null, null, null, null, null }; public Liquid type = Liquid.DEFUALT; - public int LMax = 4; + public static final int LMax = 4; private int count = 0; private int count2 = 0; private boolean doUpdate = true; - public LiquidTank tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * 4); + public LiquidTank tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME * LMax); public void updateEntity() { @@ -53,7 +52,7 @@ public class TileEntityTank extends TileEntity implements IPacketReceiver, IRead { this.tradeDown(); this.tradeArround(); - + Packet packet = PacketManager.getPacket(BasicUtilitiesMain.CHANNEL, this, new Object[] { type.ordinal(), liquid.amount }); PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 20); diff --git a/minecraft/dark/BasicUtilities/api/Liquid.java b/minecraft/dark/BasicUtilities/api/Liquid.java index dfa767f3c..d1c20d006 100644 --- a/minecraft/dark/BasicUtilities/api/Liquid.java +++ b/minecraft/dark/BasicUtilities/api/Liquid.java @@ -3,6 +3,7 @@ package dark.BasicUtilities.api; import dark.BasicUtilities.BasicUtilitiesMain; import net.minecraft.block.Block; import net.minecraft.block.BlockSand; +import net.minecraft.item.ItemStack; import net.minecraftforge.liquids.ILiquid; import net.minecraftforge.liquids.LiquidContainerRegistry; import net.minecraftforge.liquids.LiquidDictionary; @@ -17,12 +18,12 @@ import net.minecraftforge.liquids.LiquidStack; public enum Liquid { // -1 == null || unused - STEAM("Steam", LiquidDictionary.getOrCreateLiquid("steam", new LiquidStack(BasicUtilitiesMain.SteamBlock, 1)), true, 100), - WATER("Water", LiquidDictionary.getOrCreateLiquid("water", new LiquidStack(Block.waterStill, 1)), false, 32), - LAVA("Lava", LiquidDictionary.getOrCreateLiquid("lava", new LiquidStack(Block.lavaStill, 1)), false, 20), - OIL("Oil", LiquidDictionary.getOrCreateLiquid("oil", new LiquidStack(BasicUtilitiesMain.oilStill, 1)), true, 32), - FUEL("Fuel", LiquidDictionary.getOrCreateLiquid("oil", new LiquidStack(BasicUtilitiesMain.oilStill, 1)), false, 40), - DEFUALT("Empty", LiquidDictionary.getOrCreateLiquid("air", new LiquidStack(0, 1)), false, 0); + STEAM("Steam", LiquidDictionary.getOrCreateLiquid("Steam", new LiquidStack(BasicUtilitiesMain.SteamBlock, 1)), true, 100), + WATER("Water", LiquidDictionary.getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, 1)), false, 32), + LAVA("Lava", LiquidDictionary.getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, 1)), false, 20), + OIL("Oil", LiquidDictionary.getOrCreateLiquid("Oil", new LiquidStack(BasicUtilitiesMain.oilStill, 1)), true, 32), + FUEL("Fuel", LiquidDictionary.getOrCreateLiquid("Fuel", new LiquidStack(BasicUtilitiesMain.oilStill, 1)), false, 40), + DEFUALT("Empty", LiquidDictionary.getOrCreateLiquid("Air", new LiquidStack(0, 1)), false, 0); public final boolean doesFlaot; public final String displayerName; @@ -79,8 +80,8 @@ public enum Liquid */ public static Liquid getLiquidTypeByBlock(int bBlock) { - if(bBlock == Block.waterMoving.blockID) return Liquid.DEFUALT; - if(bBlock == Block.lavaMoving.blockID) return Liquid.DEFUALT; + if (bBlock == Block.waterMoving.blockID) return Liquid.DEFUALT; + if (bBlock == Block.lavaMoving.blockID) return Liquid.DEFUALT; for (int i = 0; i < Liquid.values().length - 1; i++) { Liquid selected = Liquid.getLiquid(i); @@ -122,4 +123,19 @@ public enum Liquid if (type.itemID == stack.itemID && type.itemMeta == stack.itemMeta) { return true; } return false; } + + public static ItemStack consumeItem(ItemStack stack) + { + if (stack.stackSize == 1) + { + if (stack.getItem().hasContainerItem()) return stack.getItem().getContainerItemStack(stack); + else return null; + } + else + { + stack.splitStack(1); + + return stack; + } + } } diff --git a/minecraft/dark/BasicUtilities/renders/RenderGearRod.java b/minecraft/dark/BasicUtilities/renders/RenderGearRod.java index 230ec651d..9b90e6cf7 100644 --- a/minecraft/dark/BasicUtilities/renders/RenderGearRod.java +++ b/minecraft/dark/BasicUtilities/renders/RenderGearRod.java @@ -9,38 +9,64 @@ import dark.BasicUtilities.BasicUtilitiesMain; import dark.BasicUtilities.Tile.TileEntityRod; import dark.BasicUtilities.renders.models.ModelGearRod; - public class RenderGearRod extends TileEntitySpecialRenderer { - private ModelGearRod model; - public RenderGearRod() - { - model = new ModelGearRod(); - } - public void renderAModelAt(TileEntityRod tileEntity, double d, double d1, double d2, float f) - { - bindTextureByName(BasicUtilitiesMain.textureFile+"mechanical/GearRod.png"); - GL11.glPushMatrix(); - GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); - switch(meta) - { - case 0: GL11.glRotatef(90f, 1f, 0f, 0f);break; - case 1: GL11.glRotatef(-90f, 1f, 0f, 0f);break; - case 2:GL11.glRotatef(0f, 0f, 1f, 0f);break; - case 5:GL11.glRotatef(90f, 0f, 1f, 0f);break; - case 3:GL11.glRotatef(180f, 0f, 1f, 0f);break; - case 4:GL11.glRotatef(270f, 0f, 1f, 0f);break; - } - model.render(0.0625F,tileEntity.pos); - GL11.glPopMatrix(); - - } + private ModelGearRod model; - @Override - public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) { - this.renderAModelAt((TileEntityRod)tileEntity, var2, var4, var6, var8); - } + public RenderGearRod() + { + model = new ModelGearRod(); + } + + public void renderAModelAt(TileEntityRod tileEntity, double d, double d1, double d2, float f) + { + bindTextureByName(BasicUtilitiesMain.textureFile + "mechanical/GearRod.png"); + GL11.glPushMatrix(); + + int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); + if (meta == 0) + { + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 0.5F, (float) d2 + 1.5F); + }else if(meta == 1) + { + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 0.5F, (float) d2 - 0.5F); + } + else + { + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); + } + GL11.glScalef(1.0F, -1F, -1F); + switch (meta) + { + case 0: + GL11.glRotatef(90f, 1f, 0f, 0f); + break; + case 1: + GL11.glRotatef(-90f, 1f, 0f, 0f); + break; + + case 2: + GL11.glRotatef(0f, 0f, 1f, 0f); + break; + case 5: + GL11.glRotatef(90f, 0f, 1f, 0f); + break; + case 3: + GL11.glRotatef(180f, 0f, 1f, 0f); + break; + case 4: + GL11.glRotatef(270f, 0f, 1f, 0f); + break; + } + model.render(0.0625F, tileEntity.pos); + GL11.glPopMatrix(); + + } + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) + { + this.renderAModelAt((TileEntityRod) tileEntity, var2, var4, var6, var8); + } } \ No newline at end of file diff --git a/minecraft/dark/BasicUtilities/renders/RenderGenerator.java b/minecraft/dark/BasicUtilities/renders/RenderGenerator.java index f8bf07f12..fdffb4fd0 100644 --- a/minecraft/dark/BasicUtilities/renders/RenderGenerator.java +++ b/minecraft/dark/BasicUtilities/renders/RenderGenerator.java @@ -23,7 +23,7 @@ public class RenderGenerator extends TileEntitySpecialRenderer public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3) { bindTextureByName(BasicUtilitiesMain.textureFile+"mechanical/Generator.png"); GL11.glPushMatrix(); - GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.45F, (float) d2 + 0.5F); GL11.glScalef(1.0F, -1F, -1F); int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); switch(meta) @@ -33,7 +33,7 @@ public class RenderGenerator extends TileEntitySpecialRenderer case 2:GL11.glRotatef(180f, 0f, 1f, 0f);break; case 3:GL11.glRotatef(270f, 0f, 1f, 0f);break; } - model.RenderMain(0.0625F); + model.render(tileEntity); GL11.glPopMatrix(); } diff --git a/minecraft/dark/BasicUtilities/renders/RenderPipe.java b/minecraft/dark/BasicUtilities/renders/RenderPipe.java index bd5d1267e..6abb55bfc 100644 --- a/minecraft/dark/BasicUtilities/renders/RenderPipe.java +++ b/minecraft/dark/BasicUtilities/renders/RenderPipe.java @@ -12,54 +12,70 @@ import dark.BasicUtilities.api.Liquid; import dark.BasicUtilities.renders.models.ModelLargePipe; import dark.BasicUtilities.renders.models.ModelPipe; - public class RenderPipe extends TileEntitySpecialRenderer { - Liquid type; - int size = 6; - - private ModelPipe fourPipe; - private ModelLargePipe SixPipe; - private ModelBase model = fourPipe; - - public RenderPipe() - { - fourPipe = new ModelPipe(); - SixPipe = new ModelLargePipe(); - } + private Liquid type = Liquid.DEFUALT; + private ModelPipe fourPipe; + private ModelLargePipe SixPipe; + private TileEntity[] ents = new TileEntity[6]; - public void renderAModelAt(TileEntityPipe tileEntity, double d, double d1, double d2, float f) - { - //Texture file - - type = tileEntity.getType(); - - - GL11.glPushMatrix(); - GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - switch(type.ordinal()) - { - case 0: bindTextureByName(BasicUtilitiesMain.textureFile+"pipes/SixSteamPipe.png");break; - case 1: bindTextureByName(BasicUtilitiesMain.textureFile+"pipes/SixWaterPipe.png");break; - case 2: bindTextureByName(BasicUtilitiesMain.textureFile+"pipes/SixLavaPipe.png");break; - case 3: bindTextureByName(BasicUtilitiesMain.textureFile+"pipes/SixOilPipe.png");break; - default:bindTextureByName(BasicUtilitiesMain.textureFile+"pipes/DefaultPipe.png"); break; - } - if(tileEntity.connectedBlocks[0] != null) SixPipe.renderBottom(); - if(tileEntity.connectedBlocks[1] != null) SixPipe.renderTop(); - if(tileEntity.connectedBlocks[3] != null) SixPipe.renderFront(); - if(tileEntity.connectedBlocks[2] != null) SixPipe.renderBack(); - if(tileEntity.connectedBlocks[5] != null) SixPipe.renderRight(); - if(tileEntity.connectedBlocks[4] != null) SixPipe.renderLeft(); - SixPipe.renderMiddle(); - GL11.glPopMatrix(); - - } + public RenderPipe() + { + fourPipe = new ModelPipe(); + SixPipe = new ModelLargePipe(); + } - @Override - public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) { - this.renderAModelAt((TileEntityPipe)tileEntity, var2, var4, var6, var8); - } + public void renderAModelAt(TileEntity te, double d, double d1, double d2, float f) + { + // Texture file + GL11.glPushMatrix(); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); + GL11.glScalef(1.0F, -1F, -1F); + if (te instanceof TileEntityPipe) + { + type = ((TileEntityPipe) te).getType(); + ents = ((TileEntityPipe) te).connectedBlocks; + } + this.render(type, ents); + GL11.glPopMatrix(); + + } + + public void render(Liquid type, TileEntity[] ents) + { + + switch (type.ordinal()) + { + case 0: + bindTextureByName(BasicUtilitiesMain.textureFile + "pipes/SixSteamPipe.png"); + break; + case 1: + bindTextureByName(BasicUtilitiesMain.textureFile + "pipes/SixWaterPipe.png"); + break; + case 2: + bindTextureByName(BasicUtilitiesMain.textureFile + "pipes/SixLavaPipe.png"); + break; + case 3: + bindTextureByName(BasicUtilitiesMain.textureFile + "pipes/SixOilPipe.png"); + break; + default: + bindTextureByName(BasicUtilitiesMain.textureFile + "pipes/DefaultPipe.png"); + break; + } + if (ents[0] != null) SixPipe.renderBottom(); + if (ents[1] != null) SixPipe.renderTop(); + if (ents[3] != null) SixPipe.renderFront(); + if (ents[2] != null) SixPipe.renderBack(); + if (ents[5] != null) SixPipe.renderRight(); + if (ents[4] != null) SixPipe.renderLeft(); + SixPipe.renderMiddle(); + + } + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) + { + this.renderAModelAt((TileEntityPipe) tileEntity, var2, var4, var6, var8); + } } \ No newline at end of file diff --git a/minecraft/dark/BasicUtilities/renders/models/ModelGearRod.java b/minecraft/dark/BasicUtilities/renders/models/ModelGearRod.java index 860513615..3184d7ef6 100644 --- a/minecraft/dark/BasicUtilities/renders/models/ModelGearRod.java +++ b/minecraft/dark/BasicUtilities/renders/models/ModelGearRod.java @@ -113,6 +113,7 @@ public class ModelGearRod extends ModelBase Rod.rotateAngleZ= 45 * r; Rod2.rotateAngleZ= Rod.rotateAngleZ + 45; + Rod.render(f5); Rod2.render(f5); //TODO add rotation to rods diff --git a/minecraft/dark/BasicUtilities/renders/models/ModelGenerator.java b/minecraft/dark/BasicUtilities/renders/models/ModelGenerator.java index 708248c6d..8c442c6cb 100644 --- a/minecraft/dark/BasicUtilities/renders/models/ModelGenerator.java +++ b/minecraft/dark/BasicUtilities/renders/models/ModelGenerator.java @@ -1,131 +1,194 @@ -// Date: 8/27/2012 3:20:21 PM +// Date: 12/23/2012 8:44:55 PM // Template version 1.1 // Java generated by Techne // Keep in mind that you still need to fill in some blanks // - ZeuX - - - - - package dark.BasicUtilities.renders.models; +import cpw.mods.fml.common.FMLLog; +import dark.BasicUtilities.Tile.TileEntityGen; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntity; public class ModelGenerator extends ModelBase { - //fields - ModelRenderer BasePlate; - ModelRenderer LeftConnection; - ModelRenderer RightConnection; - ModelRenderer Mid; - ModelRenderer Mid2; - ModelRenderer front; - ModelRenderer front2; - ModelRenderer front3; - ModelRenderer Mid3; - ModelRenderer FrontConnector; - - public ModelGenerator() - { - textureWidth = 128; - textureHeight = 128; - - BasePlate = new ModelRenderer(this, 0, 0); - BasePlate.addBox(-7F, 0F, -7F, 14, 1, 14); - BasePlate.setRotationPoint(0F, 23F, 0F); - BasePlate.setTextureSize(128, 128); - BasePlate.mirror = true; - setRotation(BasePlate, 0F, 0F, 0F); - LeftConnection = new ModelRenderer(this, 0, 112); - LeftConnection.addBox(-2F, -2F, -2F, 2, 4, 4); - LeftConnection.setRotationPoint(-6F, 16F, 0F); - LeftConnection.setTextureSize(128, 128); - LeftConnection.mirror = true; - setRotation(LeftConnection, 0F, 0F, 0F); - RightConnection = new ModelRenderer(this, 12, 112); - RightConnection.addBox(0F, -2F, -2F, 2, 4, 4); - RightConnection.setRotationPoint(6F, 16F, 0F); - RightConnection.setTextureSize(128, 128); - RightConnection.mirror = true; - setRotation(RightConnection, 0F, 0F, 0F); - Mid = new ModelRenderer(this, 0, 29); - Mid.addBox(-4F, 0F, -6F, 8, 12, 12); - Mid.setRotationPoint(0F, 10F, 0F); - Mid.setTextureSize(128, 128); - Mid.mirror = true; - setRotation(Mid, 0F, 0F, 0F); - Mid2 = new ModelRenderer(this, 0, 53); - Mid2.addBox(-6F, 0F, -6F, 12, 8, 12); - Mid2.setRotationPoint(0F, 12F, 0F); - Mid2.setTextureSize(128, 128); - Mid2.mirror = true; - setRotation(Mid2, 0F, 0F, 0F); - front = new ModelRenderer(this, 20, 15); - front.addBox(-2F, -4F, 0F, 4, 8, 1); - front.setRotationPoint(0F, 16F, -7F); - front.setTextureSize(128, 128); - front.mirror = true; - setRotation(front, 0F, 0F, 0F); - front2 = new ModelRenderer(this, 0, 24); - front2.addBox(-4F, -2F, 0F, 8, 4, 1); - front2.setRotationPoint(0F, 16F, -7F); - front2.setTextureSize(128, 128); - front2.mirror = true; - setRotation(front2, 0F, 0F, 0F); - front3 = new ModelRenderer(this, 0, 16); - front3.addBox(-3F, -3F, 0F, 6, 6, 1); - front3.setRotationPoint(0F, 16F, -7F); - front3.setTextureSize(128, 128); - front3.mirror = true; - setRotation(front3, 0F, 0F, 0F); - Mid3 = new ModelRenderer(this, 40, 29); - Mid3.addBox(-5F, -1F, -6F, 10, 10, 12); - Mid3.setRotationPoint(0F, 12F, 0F); - Mid3.setTextureSize(128, 128); - Mid3.mirror = true; - setRotation(Mid3, 0F, 0F, 0F); - FrontConnector = new ModelRenderer(this, 0, 120); - FrontConnector.addBox(-2F, 0F, -2F, 4, 4, 4); - FrontConnector.setRotationPoint(0F, 14F, -6F); - FrontConnector.setTextureSize(128, 128); - FrontConnector.mirror = true; - setRotation(FrontConnector, 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, entity); - - } - public void RenderMain(float f5) - { - BasePlate.render(f5); - Mid.render(f5); - Mid2.render(f5); - front.render(f5); - front2.render(f5); - front3.render(f5); - Mid3.render(f5); - FrontConnector.render(f5); - } - public void RenderLeft(float f5) - { - LeftConnection.render(f5); - } - public void RenderRight(float f5) - { - RightConnection.render(f5); - } - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + // fields + ModelRenderer Bottom; + ModelRenderer Left; + ModelRenderer CenterRod; + ModelRenderer Right; + ModelRenderer RightTopCorner; + ModelRenderer LeftTopCorner; + ModelRenderer LeftBottomCorner; + ModelRenderer RightBottomCorner; + ModelRenderer BottomCase; + ModelRenderer TopCase; + ModelRenderer LeftBrace; + ModelRenderer RightBrace; + ModelRenderer BackBracer; + ModelRenderer FrontBracer; + ModelRenderer FrontDisc; + ModelRenderer FrontDisc2; + ModelRenderer BackDisc; + ModelRenderer BackDisc2; + + public ModelGenerator() + { + textureWidth = 128; + textureHeight = 128; + + Bottom = new ModelRenderer(this, 0, 74); + Bottom.addBox(-7F, -1F, -7F, 14, 2, 14); + Bottom.setRotationPoint(0F, 23F, 0F); + Bottom.setTextureSize(128, 128); + Bottom.mirror = true; + setRotation(Bottom, 0F, 0F, 0F); + Left = new ModelRenderer(this, 17, 49); + Left.addBox(-1F, -4F, -3F, 2, 8, 6); + Left.setRotationPoint(7F, 15F, 0F); + Left.setTextureSize(128, 128); + Left.mirror = true; + setRotation(Left, 0F, 0F, 0F); + CenterRod = new ModelRenderer(this, 62, 0); + CenterRod.addBox(-1.5F, -1.5F, -8F, 3, 3, 16); + CenterRod.setRotationPoint(0F, 15F, 0F); + CenterRod.setTextureSize(128, 128); + CenterRod.mirror = true; + setRotation(CenterRod, 0F, 0F, 0F); + Right = new ModelRenderer(this, 0, 49); + Right.addBox(-1F, -4F, -3F, 2, 8, 6); + Right.setRotationPoint(-7F, 15F, 0F); + Right.setTextureSize(128, 128); + Right.mirror = true; + setRotation(Right, 0F, 0F, 0F); + RightTopCorner = new ModelRenderer(this, 0, 35); + RightTopCorner.addBox(-2F, -6F, -3F, 2, 6, 6); + RightTopCorner.setRotationPoint(-7F, 13F, 0F); + RightTopCorner.setTextureSize(128, 128); + RightTopCorner.mirror = true; + setRotation(RightTopCorner, 0F, 0F, 1.047198F); + LeftTopCorner = new ModelRenderer(this, 17, 35); + LeftTopCorner.addBox(0F, -6F, -3F, 2, 6, 6); + LeftTopCorner.setRotationPoint(7F, 13F, 0F); + LeftTopCorner.setTextureSize(128, 128); + LeftTopCorner.mirror = true; + setRotation(LeftTopCorner, 0F, 0F, -1.047198F); + LeftBottomCorner = new ModelRenderer(this, 17, 91); + LeftBottomCorner.addBox(0F, 0F, -3F, 2, 6, 6); + LeftBottomCorner.setRotationPoint(7F, 17F, 0F); + LeftBottomCorner.setTextureSize(128, 128); + LeftBottomCorner.mirror = true; + setRotation(LeftBottomCorner, 0F, 0F, 1.047198F); + RightBottomCorner = new ModelRenderer(this, 0, 91); + RightBottomCorner.addBox(-2F, 0F, -3F, 2, 6, 6); + RightBottomCorner.setRotationPoint(-7F, 17F, 0F); + RightBottomCorner.setTextureSize(128, 128); + RightBottomCorner.mirror = true; + setRotation(RightBottomCorner, 0F, 0F, -1.047198F); + BottomCase = new ModelRenderer(this, 3, 64); + BottomCase.addBox(0F, 0F, -3F, 6, 2, 6); + BottomCase.setRotationPoint(-3F, 20F, 0F); + BottomCase.setTextureSize(128, 128); + BottomCase.mirror = true; + setRotation(BottomCase, 0F, 0F, 0F); + TopCase = new ModelRenderer(this, 3, 26); + TopCase.addBox(0F, 0F, -3F, 6, 2, 6); + TopCase.setRotationPoint(-3F, 8F, 0F); + TopCase.setTextureSize(128, 128); + TopCase.mirror = true; + setRotation(TopCase, 0F, 0F, 0F); + LeftBrace = new ModelRenderer(this, 44, 64); + LeftBrace.addBox(0F, 0F, -1.5F, 3, 6, 3); + LeftBrace.setRotationPoint(3F, 17F, 0F); + LeftBrace.setTextureSize(128, 128); + LeftBrace.mirror = true; + setRotation(LeftBrace, 0F, 0F, 0F); + RightBrace = new ModelRenderer(this, 31, 64); + RightBrace.addBox(0F, 0F, -1.5F, 3, 6, 3); + RightBrace.setRotationPoint(-6F, 17F, 0F); + RightBrace.setTextureSize(128, 128); + RightBrace.mirror = true; + setRotation(RightBrace, 0F, 0F, 0F); + BackBracer = new ModelRenderer(this, 50, 0); + BackBracer.addBox(-2F, -3F, 5F, 4, 10, 1); + BackBracer.setRotationPoint(0F, 15F, 0F); + BackBracer.setTextureSize(128, 128); + BackBracer.mirror = true; + setRotation(BackBracer, 0F, 0F, 0F); + FrontBracer = new ModelRenderer(this, 50, 0); + FrontBracer.addBox(-2F, -3F, -6F, 4, 10, 1); + FrontBracer.setRotationPoint(0F, 15F, 0F); + FrontBracer.setTextureSize(128, 128); + FrontBracer.mirror = true; + setRotation(FrontBracer, 0F, 0F, 0F); + FrontDisc = new ModelRenderer(this, 65, 25); + FrontDisc.addBox(-5F, -5F, -5F, 10, 10, 2); + FrontDisc.setRotationPoint(0F, 15F, 0F); + FrontDisc.setTextureSize(128, 128); + FrontDisc.mirror = true; + setRotation(FrontDisc, 0F, 0F, 0.7853982F); + FrontDisc2 = new ModelRenderer(this, 65, 25); + FrontDisc2.addBox(-5F, -5F, -5F, 10, 10, 2); + FrontDisc2.setRotationPoint(0F, 15F, 0F); + FrontDisc2.setTextureSize(128, 128); + FrontDisc2.mirror = true; + setRotation(FrontDisc2, 0F, 0F, 0F); + BackDisc = new ModelRenderer(this, 65, 25); + BackDisc.addBox(-5F, -5F, 3F, 10, 10, 2); + BackDisc.setRotationPoint(0F, 15F, 0F); + BackDisc.setTextureSize(128, 128); + BackDisc.mirror = true; + setRotation(BackDisc, 0F, 0F, 0.7853982F); + BackDisc2 = new ModelRenderer(this, 65, 25); + BackDisc2.addBox(-5F, -5F, 3F, 10, 10, 2); + BackDisc2.setRotationPoint(0F, 15F, 0F); + BackDisc2.setTextureSize(128, 128); + BackDisc2.mirror = true; + setRotation(BackDisc2, 0F, 0F, 0F); + } + + public void render(TileEntity ent) + { + float f5 = 0.0625F; + // noMoving renderParts + Bottom.render(f5); + Left.render(f5); + CenterRod.render(f5); + Right.render(f5); + RightTopCorner.render(f5); + LeftTopCorner.render(f5); + LeftBottomCorner.render(f5); + RightBottomCorner.render(f5); + BottomCase.render(f5); + TopCase.render(f5); + LeftBrace.render(f5); + RightBrace.render(f5); + BackBracer.render(f5); + FrontBracer.render(f5); + // Moving parts + float pos = 0; + if (ent instanceof TileEntityGen) pos = 45 * ((TileEntityGen) ent).getAnimationPos(); + + //change + FrontDisc.rotateAngleZ = (float) Math.toRadians(pos); + FrontDisc2.rotateAngleZ = (float) Math.toRadians(pos+45); + BackDisc.rotateAngleZ = (float) Math.toRadians(pos); + BackDisc2.rotateAngleZ = (float) Math.toRadians(pos+45); + + FrontDisc.render(f5); + FrontDisc2.render(f5); + BackDisc.render(f5); + BackDisc2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } } diff --git a/minecraft/dark/BasicUtilities/renders/models/ModelLiquidTank.java b/minecraft/dark/BasicUtilities/renders/models/ModelLiquidTank.java index e1ddff75d..84bfce9be 100644 --- a/minecraft/dark/BasicUtilities/renders/models/ModelLiquidTank.java +++ b/minecraft/dark/BasicUtilities/renders/models/ModelLiquidTank.java @@ -8,6 +8,7 @@ package dark.BasicUtilities.renders.models; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; +import net.minecraft.tileentity.TileEntity; import dark.BasicUtilities.Tile.TileEntityTank; import dark.BasicUtilities.Tile.TileEntityPipe; @@ -332,8 +333,13 @@ public class ModelLiquidTank extends ModelBase setRotation(CCTop, 0F, 0F, 0F); } - public void renderMain(TileEntityTank te, float f5) + public void renderMain(TileEntity tee, float f5) { + TileEntity[] ents = new TileEntity[6]; + if(tee instanceof TileEntityTank) + { + ents = ((TileEntityTank) tee).cc; + } // render regardless of sides Mid.render(f5); Corner.render(f5); @@ -351,7 +357,7 @@ public class ModelLiquidTank extends ModelBase CCTop.render(f5); CCBottom.render(f5); // Front - if (te.cc[2] instanceof TileEntityPipe) + if (ents[2] instanceof TileEntityPipe) { CCFront.render(f5); } @@ -365,7 +371,7 @@ public class ModelLiquidTank extends ModelBase GuageL.render(f5); } // back - if (te.cc[3] instanceof TileEntityPipe) + if (ents[3] instanceof TileEntityPipe) { CCBack.render(f5); } @@ -379,7 +385,7 @@ public class ModelLiquidTank extends ModelBase GuageL3.render(f5); } // right - if (te.cc[4] instanceof TileEntityPipe) + if (ents[4] instanceof TileEntityPipe) { CCRight.render(f5); } @@ -393,7 +399,7 @@ public class ModelLiquidTank extends ModelBase GuageL4.render(f5); } // left - if (te.cc[5] instanceof TileEntityPipe) + if (ents[5] instanceof TileEntityPipe) { CCLeft.render(f5); } diff --git a/minecraft/dark/BasicUtilities/zResources/mechanical/Generator.png b/minecraft/dark/BasicUtilities/zResources/mechanical/Generator.png index 3d52662b4363867c2de6b1000143900a1f2fffc5..32a3ae904c3efc7942b89d8d03c0ef83ae1afabc 100644 GIT binary patch delta 559 zcmeC@Zf2bjU(X}KsA#n3|EY@%3{1?PE{-7;x8B~3&TDdzU<)|5LwK=&?)FPdUK-6- z%VVv$v}4-0lgCyl1URHUo8$gb=;7ydJ%ctS#rf~$?Q?JM|8_rd&H1Y8%DulMQ)63a ze7mVNz4`uE%bk%oS(zFb6c{)denu|;z2)~e|z}2#~P+Bp-fj5 zn;A;}woWg7x?;IRgJFB+Rz?8^76wLz(wk;;W3_$QHk?rlF8_mv! zcT_gL+m*cT`ECB?$&Y3Bth`yV=55ob zi#lpCY}9?TgbCz+We(r$=cSS_t>^T)MusoU{kwPDcgy_C)&UTwIxsNINS9fV*?iL> z7vyvY1_6ekx2!XGLtyeCADwVs&NyRV{cgLIgyk>m<^FEFy{&Bz+j0h$hRw_G$=*rL zoOb&8lv2^QJ;xHmfcoU-G5y;1?e{k+pWk{m4F6KCKQsKLV z$Z60JMo<@mXHA(!3B&I4Ukq)kix-{2jXg* V&wl+IviLqo%+uA+Wt~$(69BtM>i_@% delta 1345 zcmaKq{WsGK0EfTxw(m73ju?@ljooXJ%5)e}Obxe^l`Jxqyyd+Z#z?3n&Lk$6GW4=g zY>{bEb}P+m49iP53@wIQL#EsPrE`C{=YF1l;PagGWT@uB@&jm~p_a0~Jv#FM0H|sb zT=x(uqPfw7A;=@Z%f)dRK9J!Y>HvPFvx;i79V;oAO#Gr1ex@q3U#*4cddzZQi+e^B zz30k>hy8f1ByYH01~ha7Oag~rNggs9R^QTx(1y1NKIfa?j5KGU{&>t_NTKQxI}%Y+ zg;;SDg*Bk{O}2kNIz97#!3lZM3a_gL{5S1Ic2ZW-bS~=>1Ojqf^PE;6)H$at{FQ7Y z0QDt}Z6VHLz~m>F_&XL@+s1@#fuaP$E<3M=(Rmk#;y^j1c@DOmnPp-Y0xpDy7?j%q zG!Qsx47_C26GPk0(-odQqCC3@QsrViQXb%QruUppD))JwDg%pbxG{ovuRy0) z4SLkGj>ZpYr=h~6kR_ib6_eK^NLmqqN(6tMhi~+So{C8c9F{k<74Wg~cQ+}400?M@ zzu#jms3HG27#PK=*L5HR715AjPPf}JT&ksP^>}r{{>O9CflYdc=7S75tyif)yf^?$ zXZu*m8_NRLeXIJ;N~AS4;~e&voG4IKr%I`15rwp={P^lmYis`AG>a-xhm6g>uFmu} z$_*m-_zE4kwzfR%${L1VIXfG1ghl&S=Fgc}YVkWj3h)U#Q_VbVI5mo0q26a6Hkw}Q zY1^t3$?_Y6Idoxku7|0G$9bQyxI8W{VlHOSXI&-Uqcq1L zOZARebasezeYv#0Z~P*6Iw!ZB<&$ii${Zm|7F_F;9{Be%_rdl+2|^1F7vs-`Q)arZ zv3ZED91ESu#=Qpp%CGbjYcZXjGOt?nDTDNgucXUhtL!pqpJsk%>P8AFIrBn`yV-&u ztju2%;djVV&`H=8wc(4_po~7Oy!`v!W_YRtFX_!2nq!9tr_16yq0r{IMJS(CbBv`I z_hbQcn^YJ%O4qY~*r*BN7yH?V)F_qg{NRMqRaozg`)DRyj(f&pf%Ei zB}PS`Zw(sYie}=Tk>3edx8mkJhi{pYCw(CJxU7RC(Y-;F%F!tm)d?lRXF)_ZQCPAw z2s%syW7(q#+X@k6&B{lw-*&s@4}t35BaJ7KPc&Sq8p+#V^^a?eg@*GK%{*-?9LN8S zP+z*JX9Ly0u2`LY<+WUUYpHHj{_)-Tc?sf4M=GOA%-pR){1NH;Y0{bAFK4Ou7H{W> zxlzUlN8)_dW^DPSowKaY0&6TYC2Or