diff --git a/resources/tinkertextures/ConstructBlocks.png b/resources/tinkertextures/ConstructBlocks.png index 7f69c769..cfeb5066 100644 Binary files a/resources/tinkertextures/ConstructBlocks.png and b/resources/tinkertextures/ConstructBlocks.png differ diff --git a/tinker/tconstruct/TContent.java b/tinker/tconstruct/TContent.java index 438c6764..2c26a9e1 100644 --- a/tinker/tconstruct/TContent.java +++ b/tinker/tconstruct/TContent.java @@ -154,17 +154,18 @@ public class TContent implements IFuelHandler GameRegistry.registerBlock(craftedSoil, tinker.tconstruct.items.CraftedSoilItemBlock.class, "CraftedSoil"); //Smeltery - smeltery = new SmelteryBlock(PHConstruct.smeltery); - GameRegistry.registerBlock(smeltery, "Smeltery"); + smeltery = new SmelteryBlock(PHConstruct.smeltery).setBlockName("Smeltery"); + GameRegistry.registerBlock(smeltery, SmelteryItemBlock.class, "Smeltery"); GameRegistry.registerTileEntity(tinker.tconstruct.logic.SmelteryLogic.class, "TConstruct.Smeltery"); - //GameRegistry.registerTileEntity(tinker.tconstruct.logic.SmelteryLogic.class, "TConstruct.Smeltery"); + GameRegistry.registerTileEntity(tinker.tconstruct.logic.SmelteryDrainLogic.class, "TConstruct.SmelteryDrain"); + GameRegistry.registerTileEntity(tinker.tconstruct.logic.MultiServantLogic.class, "TConstruct.Servants"); lavaTank = new LavaTankBlock(PHConstruct.lavaTank); GameRegistry.registerBlock(lavaTank, "LavaTank"); GameRegistry.registerTileEntity(tinker.tconstruct.logic.LavaTankLogic.class, "TConstruct.LavaTank"); - searedBrick = new SearedBrick(PHConstruct.searedBrick, 80, Material.iron, 10.0F, 6); - GameRegistry.registerBlock(searedBrick, tinker.tconstruct.items.SearedBrickItemBlock.class, "SearedBrick"); + searedBrick = new MetalOre(PHConstruct.searedBrick, 80, Material.iron, 10.0F, 6); + GameRegistry.registerBlock(searedBrick, tinker.tconstruct.items.MetalOreItemBlock.class, "SearedBrick"); MinecraftForge.setBlockHarvestLevel(searedBrick, 0, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(searedBrick, 1, "pickaxe", 4); MinecraftForge.setBlockHarvestLevel(searedBrick, 2, "pickaxe", 4); diff --git a/tinker/tconstruct/blocks/LavaTankBlock.java b/tinker/tconstruct/blocks/LavaTankBlock.java index 5926dcd1..9a591f52 100644 --- a/tinker/tconstruct/blocks/LavaTankBlock.java +++ b/tinker/tconstruct/blocks/LavaTankBlock.java @@ -5,10 +5,12 @@ import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.liquids.LiquidContainerRegistry; import net.minecraftforge.liquids.LiquidStack; import tinker.tconstruct.TConstruct; +import tinker.tconstruct.TContent; import tinker.tconstruct.client.TankRender; import tinker.tconstruct.logic.LavaTankLogic; @@ -16,7 +18,7 @@ public class LavaTankBlock extends BlockContainer { public LavaTankBlock(int id) { - super(id, 49, Material.iron); + super(id, 38, Material.iron); setCreativeTab(TConstruct.blockTab); setBlockName("TConstruct.LavaTank"); setStepSound(Block.soundGlassFootstep); @@ -34,11 +36,41 @@ public class LavaTankBlock extends BlockContainer return false; } + @Override + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + if (par5 == 0) + return super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + return true; + } + + @Override + public String getTextureFile () + { + return TContent.blockTexture; + } + @Override public int getRenderType () { return TankRender.tankModelID; } + + public int getBlockTextureFromSideAndMetadata (int side, int meta) + { + if (side == 0 || side == 1) + { + return blockIndexInTexture + 1 + meta * 3; + } + /*else if (side == 1) + { + return blockIndexInTexture + 1 + meta * 3; + }*/ + else + { + return blockIndexInTexture + meta * 3; + } + } @Override public TileEntity createNewTileEntity (World world, int metadata) @@ -71,46 +103,4 @@ public class LavaTankBlock extends BlockContainer { return createNewTileEntity(world, 0); } - - /*public void addCollidingBlockToList (World world, int x, int y, int z, AxisAlignedBB box, List list, Entity entity) - { - int meta = world.getBlockMetadata(x, y, z); - - if (meta < 5) - { - setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); - super.addCollidingBlockToList(world, x, y, z, box, list, entity); - } - - if (meta != 2 && meta != 4 && meta != 7 && meta != 9) - { - setBlockBounds(0.0F, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F); - super.addCollidingBlockToList(world, x, y, z, box, list, entity); - } - - if (meta != 3 && meta != 4 && meta != 8 && meta != 9) - { - setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.125F); - super.addCollidingBlockToList(world, x, y, z, box, list, entity); - } - - if (meta != 3 && meta != 1 && meta != 8 && meta != 6) - { - setBlockBounds(0.875F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - super.addCollidingBlockToList(world, x, y, z, box, list, entity); - } - - if (meta != 1 && meta != 2 && meta != 6 && meta != 7) - { - setBlockBounds(0.0F, 0.0F, 0.875F, 1.0F, 1.0F, 1.0F); - super.addCollidingBlockToList(world, x, y, z, box, list, entity); - } - - setBlockBoundsForItemRender(); - } - - public void setBlockBoundsForItemRender () - { - setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - }*/ } diff --git a/tinker/tconstruct/blocks/SearedBrick.java b/tinker/tconstruct/blocks/MetalOre.java similarity index 74% rename from tinker/tconstruct/blocks/SearedBrick.java rename to tinker/tconstruct/blocks/MetalOre.java index 325044ef..f8dce84a 100644 --- a/tinker/tconstruct/blocks/SearedBrick.java +++ b/tinker/tconstruct/blocks/MetalOre.java @@ -3,9 +3,9 @@ package tinker.tconstruct.blocks; import net.minecraft.block.material.Material; import net.minecraft.world.World; -public class SearedBrick extends TConstructBlock +public class MetalOre extends TConstructBlock { - public SearedBrick(int id, int tex, Material material, float hardness, int sub) + public MetalOre(int id, int tex, Material material, float hardness, int sub) { super(id, tex, material, hardness, sub); } diff --git a/tinker/tconstruct/blocks/SmelteryBlock.java b/tinker/tconstruct/blocks/SmelteryBlock.java index 0f10be49..ff926e28 100644 --- a/tinker/tconstruct/blocks/SmelteryBlock.java +++ b/tinker/tconstruct/blocks/SmelteryBlock.java @@ -1,10 +1,13 @@ package tinker.tconstruct.blocks; +import java.util.List; import java.util.Random; 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.world.IBlockAccess; import net.minecraft.world.World; @@ -15,6 +18,8 @@ import tinker.tconstruct.TConstruct; import tinker.tconstruct.TContent; import tinker.tconstruct.TGuiHandler; import tinker.tconstruct.client.SmelteryRender; +import tinker.tconstruct.logic.MultiServantLogic; +import tinker.tconstruct.logic.SmelteryDrainLogic; import tinker.tconstruct.logic.SmelteryLogic; public class SmelteryBlock extends InventoryBlock @@ -31,13 +36,14 @@ public class SmelteryBlock extends InventoryBlock this.setCreativeTab(TConstruct.blockTab); this.setBlockName("tconstruct.Smeltery"); } - + @Override public int getRenderType () { return SmelteryRender.smelteryModel; } + @Override public String getTextureFile () { return TContent.blockTexture; @@ -45,23 +51,35 @@ public class SmelteryBlock extends InventoryBlock public int getBlockTextureFromSideAndMetadata (int side, int meta) { - /*if (side == 0 || side == 1) + if (meta < 2) { - return blockIndexInTexture + 3 + meta * 4; - }*/ - if (side == 3) + if (side == 3) + { + return blockIndexInTexture + 1 + meta * 3; + } + else + { + return blockIndexInTexture + meta * 3; + } + } + else if (meta < 4) { - return blockIndexInTexture + 1 + meta * 3; + return blockIndexInTexture + meta + 4; } else { - return blockIndexInTexture + meta * 3; + if (side == 0) + return blockIndexInTexture + meta*3 - 2; + else if (side == 1) + return blockIndexInTexture + meta*3 - 1; + else + return blockIndexInTexture + meta*3 - 3; } } public int getBlockTexture (IBlockAccess world, int x, int y, int z, int side) { - InventoryLogic logic = (InventoryLogic) world.getBlockTileEntity(x, y, z); + TileEntity logic = world.getBlockTileEntity(x, y, z); short direction = (logic instanceof IFacingLogic) ? ((IFacingLogic) logic).getDirection() : 0; int meta = world.getBlockMetadata(x, y, z); if (meta == 0) //Smeltery @@ -89,15 +107,24 @@ public class SmelteryBlock extends InventoryBlock if (meta == 1) { if (side == direction) - return blockIndexInTexture + 1 + 3; - else if (side / 2 == direction / 2) return blockIndexInTexture + 2 + 3; + else if (side / 2 == direction / 2) + return blockIndexInTexture + 1 + 3; else return blockIndexInTexture + 3; } + else if (meta < 4) + { + return blockIndexInTexture + meta + 4; + } else { - return blockIndexInTexture + meta +4; + if (side == 0) + return blockIndexInTexture + meta*3 - 2; + else if (side == 1) + return blockIndexInTexture + meta*3 - 1; + else + return blockIndexInTexture + meta*3 - 3; } } @@ -121,12 +148,12 @@ public class SmelteryBlock extends InventoryBlock { if (isActive(world, x, y, z)) { - InventoryLogic logic = (InventoryLogic) world.getBlockTileEntity(x, y, z); + TileEntity logic = world.getBlockTileEntity(x, y, z); byte face = 0; if (logic instanceof IFacingLogic) - face = ((IFacingLogic)logic).getDirection(); + face = ((IFacingLogic) logic).getDirection(); float f = (float) x + 0.5F; - float f1 = (float) y + 0.0F + (random.nextFloat() * 6F) / 16F; + float f1 = (float) y + 0.5F + (random.nextFloat() * 6F) / 16F; float f2 = (float) z + 0.5F; float f3 = 0.52F; float f4 = random.nextFloat() * 0.6F - 0.3F; @@ -174,29 +201,63 @@ public class SmelteryBlock extends InventoryBlock { return TConstruct.instance; } + + @Override + public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ) + { + if (player.isSneaking() || world.getBlockMetadata(x, y, z) != 0) + return false; + + Integer integer = getGui(world, x, y, z, player); + if (integer == null || integer == -1) + { + return false; + } + else + { + player.openGui(getModInstance(), integer, world, x, y, z); + return true; + } + } @Override - public TileEntity createNewTileEntity(World world, int metadata) + public TileEntity createNewTileEntity (World world, int metadata) { - return new SmelteryLogic(); + switch (metadata) + { + case 0: return new SmelteryLogic(); + case 1: return new SmelteryDrainLogic(); + case 2: return new MultiServantLogic(); + default: return null; + } } - + @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving) + public void onBlockPlacedBy (World world, int x, int y, int z, EntityLiving entityliving) { super.onBlockPlacedBy(world, x, y, z, entityliving); - onBlockPlacedElsewhere(world, x, y, z, entityliving); + if (world.getBlockMetadata(x, y, z) == 0) + onBlockPlacedElsewhere(world, x, y, z, entityliving); } - - public void onBlockPlacedElsewhere(World world, int x, int y, int z, EntityLiving entityliving) + + public void onBlockPlacedElsewhere (World world, int x, int y, int z, EntityLiving entityliving) { SmelteryLogic logic = (SmelteryLogic) world.getBlockTileEntity(x, y, z); logic.checkValidPlacement(); } - + @Override public void breakBlock (World world, int x, int y, int z, int par5, int par6) //Don't drop inventory { world.removeBlockTileEntity(x, y, z); } + + @Override + public void getSubBlocks (int id, CreativeTabs tab, List list) + { + for (int iter = 0; iter < 3; iter++) + { + list.add(new ItemStack(id, 1, iter)); + } + } } diff --git a/tinker/tconstruct/blocks/ToolStationBlock.java b/tinker/tconstruct/blocks/ToolStationBlock.java index 967ce018..855258c9 100644 --- a/tinker/tconstruct/blocks/ToolStationBlock.java +++ b/tinker/tconstruct/blocks/ToolStationBlock.java @@ -30,6 +30,7 @@ public class ToolStationBlock extends InventoryBlock this.setHardness(2f); } + /* Rendering */ public String getTextureFile () { return TContent.blockTexture; @@ -96,33 +97,103 @@ public class ToolStationBlock extends InventoryBlock return true; } + public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z) + { + int metadata = world.getBlockMetadata(x, y, z); + if (metadata == 5) + return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125, (double) z + this.maxZ); + return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ); + } + + /* Activation */ + @Override + public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ) + { + int md = world.getBlockMetadata(x, y, z); + if (md == 14) + { + return activateCastingTable(world, x, y, z, player); + } + else + return super.onBlockActivated(world, x, y, z, player, side, clickX, clickY, clickZ); + } + + boolean activateCastingTable (World world, int x, int y, int z, EntityPlayer player) + { + if (!world.isRemote) + { + System.out.println("Castses"); + CastingTableLogic logic = (CastingTableLogic) world.getBlockTileEntity(x, y, z); + if (!logic.isStackInSlot(0)) + { + ItemStack stack = player.getCurrentEquippedItem(); + stack = player.inventory.decrStackSize(player.inventory.currentItem, 1); + logic.setInventorySlotContents(0, stack); + } + else + { + /*ItemStack insideStack = logic.takeItemInColumn(0); + + if (insideStack == null) + {r + insideStack = logic.takeItemInColumn(1 - 0); + } + + if (insideStack != null) + { + this.spawnItem(world, x, y, z, insideStack); + }*/ + } + + world.markBlockForUpdate(x, y, z); + } + return true; + } + + /* Data */ public int damageDropped (int meta) { return meta; } public TileEntity createNewTileEntity (World world, int metadata) - { + { switch (metadata) { - case 0: return new ToolStationLogic(); - case 1: return new PartCrafterLogic(); - case 2: return new PartCrafterLogic(); - case 3: return new PartCrafterLogic(); - case 4: return new PartCrafterLogic(); - case 5: return new PatternChestLogic(); - case 6: return new PatternChestLogic(); - case 7: return new PatternChestLogic(); - case 8: return new PatternChestLogic(); - case 9: return new PatternChestLogic(); - case 10: return new PatternShaperLogic(); - case 11: return new PatternShaperLogic(); - case 12: return new PatternShaperLogic(); - case 13: return new PatternShaperLogic(); - case 14: return new CastingTableLogic(); - default: return null; - } - } + case 0: + return new ToolStationLogic(); + case 1: + return new PartCrafterLogic(); + case 2: + return new PartCrafterLogic(); + case 3: + return new PartCrafterLogic(); + case 4: + return new PartCrafterLogic(); + case 5: + return new PatternChestLogic(); + case 6: + return new PatternChestLogic(); + case 7: + return new PatternChestLogic(); + case 8: + return new PatternChestLogic(); + case 9: + return new PatternChestLogic(); + case 10: + return new PatternShaperLogic(); + case 11: + return new PatternShaperLogic(); + case 12: + return new PatternShaperLogic(); + case 13: + return new PatternShaperLogic(); + case 14: + return new CastingTableLogic(); + default: + return null; + } + } @Override public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer) @@ -153,18 +224,10 @@ public class ToolStationBlock extends InventoryBlock { list.add(new ItemStack(id, 1, iter)); } - + for (int iter = 10; iter < 15; iter++) { list.add(new ItemStack(id, 1, iter)); } } - - public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z) - { - int metadata = world.getBlockMetadata(x, y, z); - if (metadata == 5) - return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125, (double) z + this.maxZ); - return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ); - } } diff --git a/tinker/tconstruct/client/CastingTableSpecialRenderer.java b/tinker/tconstruct/client/CastingTableSpecialRenderer.java new file mode 100644 index 00000000..8eb53872 --- /dev/null +++ b/tinker/tconstruct/client/CastingTableSpecialRenderer.java @@ -0,0 +1,128 @@ +package tinker.tconstruct.client; + +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.texturefx.TextureCompassFX; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityItemFrame; +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.Direction; +import net.minecraft.util.MathHelper; +import net.minecraft.world.storage.MapData; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import tinker.tconstruct.logic.CastingTableLogic; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/* Special renderer, only used for drawing tools */ + +@SideOnly(Side.CLIENT) +public class CastingTableSpecialRenderer extends TileEntitySpecialRenderer +{ + @Override + public void renderTileEntityAt(TileEntity logic, double var2, double var4, double var6, float var8) + { + //System.out.println("Render!!!"); + this.render((CastingTableLogic)logic, var2, var4, var6, var8); + } + + public void render(CastingTableLogic logic, double posX, double posY, double posZ, float var8) + { + GL11.glPushMatrix(); + float var10 = (float) (posX - 0.5F); + float var11 = (float) (posY - 0.5F); + float var12 = (float) (posZ - 0.5F); + GL11.glTranslatef(var10, var11, var12); + this.func_82402_b(logic); + GL11.glPopMatrix(); + } + + private void func_82402_b(CastingTableLogic logic) + { + ItemStack stack = logic.getStackInSlot(0); + + if (stack != null) + { + EntityItem entityitem = new EntityItem(logic.worldObj, 0.0D, 0.0D, 0.0D, stack); + entityitem.func_92014_d().stackSize = 1; + entityitem.hoverStart = 0.0F; + GL11.glPushMatrix(); + GL11.glTranslatef(1F, 1.4375F, 0.61F); + GL11.glRotatef(90F, 1, 0F, 0F); + GL11.glScalef(1.94F, 1.94F, 1.94F); + /*GL11.glTranslatef(-0.453125F * (float)Direction.offsetX[logic.hangingDirection], -0.18F, -0.453125F * (float)Direction.offsetZ[logic.hangingDirection]); + GL11.glRotatef(180.0F + logic.rotationYaw, 0.0F, 1.0F, 0.0F); + GL11.glRotatef((float)(-90 * logic.getRotation()), 0.0F, 0.0F, 1.0F); + + switch (logic.getRotation()) + { + case 1: + GL11.glTranslatef(-0.16F, -0.16F, 0.0F); + break; + case 2: + GL11.glTranslatef(0.0F, -0.32F, 0.0F); + break; + case 3: + GL11.glTranslatef(0.16F, -0.16F, 0.0F); + }*/ + + /*if (var3.func_92014_d().getItem() == Item.map) + { + this.renderManager.renderEngine.bindTexture(this.renderManager.renderEngine.getTexture("/misc/mapbg.png")); + Tessellator var4 = Tessellator.instance; + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glScalef(0.00390625F, 0.00390625F, 0.00390625F); + GL11.glTranslatef(-65.0F, -107.0F, -3.0F); + GL11.glNormal3f(0.0F, 0.0F, -1.0F); + var4.startDrawingQuads(); + byte var5 = 7; + var4.addVertexWithUV((double)(0 - var5), (double)(128 + var5), 0.0D, 0.0D, 1.0D); + var4.addVertexWithUV((double)(128 + var5), (double)(128 + var5), 0.0D, 1.0D, 1.0D); + var4.addVertexWithUV((double)(128 + var5), (double)(0 - var5), 0.0D, 1.0D, 0.0D); + var4.addVertexWithUV((double)(0 - var5), (double)(0 - var5), 0.0D, 0.0D, 0.0D); + var4.draw(); + MapData var6 = Item.map.getMapData(var3.func_92014_d(), logic.worldObj); + + if (var6 != null) + { + this.renderManager.itemRenderer.mapItemRenderer.renderMap((EntityPlayer)null, this.renderManager.renderEngine, var6); + } + } + else*/ + //{ + /*if (var3.func_92014_d().getItem() == Item.compass) + { + double var8 = TextureCompassFX.field_82391_c.field_76868_i; + double var9 = TextureCompassFX.field_82391_c.field_76866_j; + TextureCompassFX.field_82391_c.field_76868_i = 0.0D; + TextureCompassFX.field_82391_c.field_76866_j = 0.0D; + TextureCompassFX.func_82390_a(logic.xCoord, logic.zCoord, (double)MathHelper.wrapAngleTo180_float((float)(180)), false, true); + TextureCompassFX.field_82391_c.field_76868_i = var8; + TextureCompassFX.field_82391_c.field_76866_j = var9; + this.renderManager.renderEngine.updateDynamicTexture(TextureCompassFX.field_82391_c, -1); + }*/ + + RenderItem.field_82407_g = true; + RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); + RenderItem.field_82407_g = false; + + /*if (var3.func_92014_d().getItem() == Item.compass) + { + TextureCompassFX.field_82391_c.onTick(); + this.renderManager.renderEngine.updateDynamicTexture(TextureCompassFX.field_82391_c, -1); + }*/ + //} + + GL11.glPopMatrix(); + } + } +} diff --git a/tinker/tconstruct/client/SmelteryRender.java b/tinker/tconstruct/client/SmelteryRender.java index a2cd23a5..e51b4114 100644 --- a/tinker/tconstruct/client/SmelteryRender.java +++ b/tinker/tconstruct/client/SmelteryRender.java @@ -26,7 +26,7 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler { if (modelID == smelteryModel) { - renderDo(renderer, block, metadata); + renderStandardInvBlock(renderer, block, metadata); } } @@ -35,11 +35,10 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler { if (modelID == smelteryModel) { - switch (world.getBlockMetadata(x, y, z)) - { - case 0: return renderSmeltery(world, x, y, z, block, modelID, renderer); - case 1: - } + if (world.getBlockMetadata(x, y, z) == 0) + return renderSmeltery(world, x, y, z, block, modelID, renderer); + else + renderer.renderStandardBlock(block, x, y, z); } return false; } @@ -116,7 +115,7 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler return smelteryModel; } - private void renderDo(RenderBlocks renderblocks, Block block, int meta) + private void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta) { Tessellator tessellator = Tessellator.instance; GL11.glTranslatef(-0.5F, -0.5F, -0.5F); diff --git a/tinker/tconstruct/client/TProxyClient.java b/tinker/tconstruct/client/TProxyClient.java index b059bdb0..bfe0dfda 100644 --- a/tinker/tconstruct/client/TProxyClient.java +++ b/tinker/tconstruct/client/TProxyClient.java @@ -17,8 +17,10 @@ import org.w3c.dom.Document; import tinker.tconstruct.*; import tinker.tconstruct.client.entityrender.*; import tinker.tconstruct.client.liquidrender.*; -import tinker.tconstruct.tools.ToolCore; +import tinker.tconstruct.logic.*; +import tinker.tconstruct.tools.*; import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @@ -71,9 +73,13 @@ public class TProxyClient extends TProxyCommon MinecraftForgeClient.registerItemRenderer(tool.itemID, render); } + //Special Renderers + ClientRegistry.bindTileEntitySpecialRenderer(CastingTableLogic.class, new CastingTableSpecialRenderer()); + //Entities RenderingRegistry.registerEntityRenderingHandler(tinker.tconstruct.entity.CartEntity.class, new CartRender()); RenderingRegistry.registerEntityRenderingHandler(tinker.tconstruct.entity.Skyla.class, new SkylaRender()); + //RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class, new PlayerArmorRender()); // <-- Works, woo! } @@ -96,17 +102,24 @@ public class TProxyClient extends TProxyCommon LanguageRegistry.instance().addStringLocalization("ToolStation.Parts.name", "Part Builder"); LanguageRegistry.instance().addStringLocalization("ToolStation.PatternChest.name", "Pattern Chest"); LanguageRegistry.instance().addStringLocalization("ToolStation.PatternShaper.name", "Stencil Table"); - LanguageRegistry.instance().addStringLocalization("ToolStation.PatternShaper.name", "Casting Table"); + LanguageRegistry.instance().addStringLocalization("ToolStation.CastingTable.name", "Casting Table"); LanguageRegistry.instance().addStringLocalization("CraftedSoil.Slime.name", "Slimy Mud"); LanguageRegistry.instance().addStringLocalization("CraftedSoil.Grout.name", "Grout"); - LanguageRegistry.instance().addStringLocalization("SearedBrick.Brick.name", "Seared Bricks"); - LanguageRegistry.instance().addStringLocalization("SearedBrick.Cobalt.name", "Cobalt Ore"); - LanguageRegistry.instance().addStringLocalization("SearedBrick.Ardite.name", "Ardite Ore"); - LanguageRegistry.instance().addStringLocalization("SearedBrick.Copper.name", "Copper Ore"); - LanguageRegistry.instance().addStringLocalization("SearedBrick.Tin.name", "Tin Ore"); - LanguageRegistry.instance().addStringLocalization("SearedBrick.Aluminum.name", "Aluminum Ore"); - LanguageRegistry.instance().addStringLocalization("SearedBrick.Slag.name", "Slag"); + + LanguageRegistry.instance().addStringLocalization("MetalOre.NetherSlag.name", "Netherack Slag"); + LanguageRegistry.instance().addStringLocalization("MetalOre.Cobalt.name", "Cobalt Ore"); + LanguageRegistry.instance().addStringLocalization("MetalOre.Ardite.name", "Ardite Ore"); + LanguageRegistry.instance().addStringLocalization("MetalOre.Copper.name", "Copper Ore"); + LanguageRegistry.instance().addStringLocalization("MetalOre.Tin.name", "Tin Ore"); + LanguageRegistry.instance().addStringLocalization("MetalOre.Aluminum.name", "Aluminum Ore"); + LanguageRegistry.instance().addStringLocalization("MetalOre.Slag.name", "Stone Slag"); + + LanguageRegistry.instance().addStringLocalization("Smeltery.Controller.name", "Smeltery"); + LanguageRegistry.instance().addStringLocalization("Smeltery.Drain.name", "Smeltery Drain"); + LanguageRegistry.instance().addStringLocalization("Smeltery.Brick.name", "Seared Bricks"); + LanguageRegistry.instance().addStringLocalization("Smeltery.Gague.name", "Seared Glass"); + LanguageRegistry.instance().addStringLocalization("Smeltery.Window.name", "Seared Window"); for (int mat = 0; mat < materialTypes.length; mat++) { @@ -139,7 +152,6 @@ public class TProxyClient extends TProxyCommon LanguageRegistry.instance().addStringLocalization(internalName, "en_US", visibleName); } - LanguageRegistry.addName(TContent.smeltery, "Smeltery"); LanguageRegistry.addName(TContent.manualBook, "Tinker's Log"); LanguageRegistry.addName(TContent.blankPattern, "Blank Pattern"); LanguageRegistry.addName(TContent.pickaxe, "Pickaxe"); diff --git a/tinker/tconstruct/client/TankRender.java b/tinker/tconstruct/client/TankRender.java index f66479bd..3e63ef80 100644 --- a/tinker/tconstruct/client/TankRender.java +++ b/tinker/tconstruct/client/TankRender.java @@ -4,6 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.world.IBlockAccess; +import net.minecraftforge.client.ForgeHooksClient; import org.lwjgl.opengl.GL11; @@ -20,6 +21,8 @@ public class TankRender implements ISimpleBlockRenderingHandler if (modelID == tankModelID) { renderDo(renderer, block, metadata); + renderer.setRenderBounds(0.1875, 0, 0.1875, 0.8125, 0.125, 0.8125); + renderDoRe(renderer, block, metadata); } } @@ -28,6 +31,9 @@ public class TankRender implements ISimpleBlockRenderingHandler { if (modelID == tankModelID) { + renderer.setRenderBounds(0.1875, 0, 0.1875, 0.8125, 0.125, 0.8125); + renderer.renderStandardBlock(block, x, y+1, z); + renderer.setRenderBounds(0, 0, 0, 1, 1, 1); renderer.renderStandardBlock(block, x, y, z); LavaTankLogic logic = (LavaTankLogic) world.getBlockTileEntity(x, y, z); if (logic.getLiquidAmount() > 0) @@ -35,6 +41,7 @@ public class TankRender implements ISimpleBlockRenderingHandler Block liquidBlock = Block.blocksList[logic.liquid.itemID]; if (liquidBlock != null) { + ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0); renderer.setRenderBounds(0.03, 0.03, 0.03, 0.97, logic.getLiquidAmount()/4020f, 0.97); renderer.renderStandardBlock(liquidBlock, x, y, z); } @@ -85,4 +92,35 @@ public class TankRender implements ISimpleBlockRenderingHandler tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); } + + private void renderDoRe(RenderBlocks renderblocks, Block block, int meta) + { + Tessellator tessellator = Tessellator.instance; + GL11.glTranslatef(-0.5F, 0.5F, -0.5F); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, -1F, 0.0F); + renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 0.0F); + renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, -1F); + renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, 1.0F); + renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(-1F, 0.0F, 0.0F); + renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(1.0F, 0.0F, 0.0F); + renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, meta)); + tessellator.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } } diff --git a/tinker/tconstruct/client/entityrender/PlayerArmorRender.java b/tinker/tconstruct/client/entityrender/PlayerArmorRender.java new file mode 100644 index 00000000..28f50ade --- /dev/null +++ b/tinker/tconstruct/client/entityrender/PlayerArmorRender.java @@ -0,0 +1,115 @@ +package tinker.tconstruct.client.entityrender; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumArmorMaterial; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.IArmorModelProvider; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class PlayerArmorRender extends RenderPlayer +{ + private ModelBiped modelBipedMain; + private ModelBiped modelArmorChestplate; + private ModelBiped modelArmor; + public static String[] armorFilenamePrefix = new String[] {"cloth", "chain", "iron", "diamond", "gold"}; + public static float NAME_TAG_RANGE = 64.0f; + public static float NAME_TAG_RANGE_SNEAK = 32.0f; + + public PlayerArmorRender() + { + super(); + this.modelBipedMain = (ModelBiped)this.mainModel; + this.modelArmorChestplate = new ModelBiped(1.0F); + this.modelArmor = new ModelBiped(0.5F); + } + + /** + * Set the specified armor model as the player model. Args: player, armorSlot, partialTick + */ + protected int setArmorModel(EntityPlayer par1EntityPlayer, int slot, float par3) + { + ItemStack stack = par1EntityPlayer.inventory.armorItemInSlot(3 - slot); + + if (stack != null) + { + Item armoritem = stack.getItem(); + + if (armoritem instanceof ItemArmor) + { + ItemArmor var6 = (ItemArmor)armoritem; + this.loadTexture(ForgeHooksClient.getArmorTexture(stack, "/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (slot == 2 ? 2 : 1) + ".png")); + ModelBiped var7; + if (armoritem instanceof IArmorModelProvider) + { + var7 = ((IArmorModelProvider) armoritem).provideArmorModel(slot); + } + else + { + var7 = slot == 2 ? this.modelArmor : this.modelArmorChestplate; + var7.bipedHead.showModel = slot == 0; + var7.bipedHeadwear.showModel = slot == 0; + var7.bipedBody.showModel = slot == 1 || slot == 2; + var7.bipedRightArm.showModel = slot == 1; + var7.bipedLeftArm.showModel = slot == 1; + var7.bipedRightLeg.showModel = slot == 2 || slot == 3; + var7.bipedLeftLeg.showModel = slot == 2 || slot == 3; + } + this.setRenderPassModel(var7); + + if (var7 != null) + { + var7.onGround = this.mainModel.onGround; + } + + if (var7 != null) + { + var7.isRiding = this.mainModel.isRiding; + } + + if (var7 != null) + { + var7.isChild = this.mainModel.isChild; + } + + float var8 = 1.0F; + + if (var6.getArmorMaterial() == EnumArmorMaterial.CLOTH) + { + int var9 = var6.getColor(stack); + float var10 = (float)(var9 >> 16 & 255) / 255.0F; + float var11 = (float)(var9 >> 8 & 255) / 255.0F; + float var12 = (float)(var9 & 255) / 255.0F; + GL11.glColor3f(var8 * var10, var8 * var11, var8 * var12); + + if (stack.isItemEnchanted()) + { + return 31; + } + + return 16; + } + + GL11.glColor3f(var8, var8, var8); + + if (stack.isItemEnchanted()) + { + return 15; + } + + return 1; + } + } + + return -1; + } +} diff --git a/tinker/tconstruct/items/SearedBrickItemBlock.java b/tinker/tconstruct/items/MetalOreItemBlock.java similarity index 58% rename from tinker/tconstruct/items/SearedBrickItemBlock.java rename to tinker/tconstruct/items/MetalOreItemBlock.java index ecc6b80f..ed7f31fd 100644 --- a/tinker/tconstruct/items/SearedBrickItemBlock.java +++ b/tinker/tconstruct/items/MetalOreItemBlock.java @@ -3,14 +3,14 @@ package tinker.tconstruct.items; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class SearedBrickItemBlock extends ItemBlock +public class MetalOreItemBlock extends ItemBlock { public static final String blockType[] = { - "Brick", "Cobalt", "Ardite", "Copper", "Tin", "Aluminum", "Slag" + "NetherSlag", "Cobalt", "Ardite", "Copper", "Tin", "Aluminum", "Slag" }; - public SearedBrickItemBlock(int id) + public MetalOreItemBlock(int id) { super(id); setMaxDamage(0); @@ -24,6 +24,6 @@ public class SearedBrickItemBlock extends ItemBlock public String getItemNameIS(ItemStack itemstack) { - return (new StringBuilder()).append("SearedBrick.").append(blockType[itemstack.getItemDamage()]).toString(); + return (new StringBuilder()).append("MetalOre.").append(blockType[itemstack.getItemDamage()]).toString(); } } diff --git a/tinker/tconstruct/items/SmelteryItemBlock.java b/tinker/tconstruct/items/SmelteryItemBlock.java new file mode 100644 index 00000000..37891718 --- /dev/null +++ b/tinker/tconstruct/items/SmelteryItemBlock.java @@ -0,0 +1,29 @@ +package tinker.tconstruct.items; + +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class SmelteryItemBlock extends ItemBlock +{ + public static final String blockType[] = + { + "Controller", "Drain", "Brick", "Gague", "Window" + }; + + public SmelteryItemBlock(int id) + { + super(id); + setMaxDamage(0); + setHasSubtypes(true); + } + + public int getMetadata(int meta) + { + return meta; + } + + public String getItemNameIS(ItemStack itemstack) + { + return (new StringBuilder()).append("Smeltery.").append(blockType[itemstack.getItemDamage()]).toString(); + } +} diff --git a/tinker/tconstruct/items/TArmor.java b/tinker/tconstruct/items/TArmor.java index 1e2ee9d1..008a4ba2 100644 --- a/tinker/tconstruct/items/TArmor.java +++ b/tinker/tconstruct/items/TArmor.java @@ -1,17 +1,20 @@ package tinker.tconstruct.items; +import net.minecraft.client.model.ModelBiped; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.IArmorModelProvider; import net.minecraftforge.common.IArmorTextureProvider; public class TArmor extends ItemArmor - implements IArmorTextureProvider + implements IArmorTextureProvider, IArmorModelProvider { - + private ModelBiped modelArmorChestplate; public TArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) { super(par1, par2EnumArmorMaterial, par3, par4); + this.modelArmorChestplate = new ModelBiped(4.0F); } @Override @@ -20,4 +23,17 @@ public class TArmor extends ItemArmor return "/tinkertextures/armor/wood_1.png"; } + @Override + public ModelBiped provideArmorModel (int armorSlot) + { + /*modelArmorChestplate.bipedHead.showModel = armorSlot == 0; + modelArmorChestplate.bipedHeadwear.showModel = armorSlot == 0; + modelArmorChestplate.bipedBody.showModel = armorSlot == 1 || armorSlot == 2; + modelArmorChestplate.bipedRightArm.showModel = armorSlot == 1; + modelArmorChestplate.bipedLeftArm.showModel = armorSlot == 1; + modelArmorChestplate.bipedRightLeg.showModel = armorSlot == 2 || armorSlot == 3; + modelArmorChestplate.bipedLeftLeg.showModel = armorSlot == 2 || armorSlot == 3;*/ + return modelArmorChestplate; + } + } diff --git a/tinker/tconstruct/logic/CastingTableLogic.java b/tinker/tconstruct/logic/CastingTableLogic.java index 204f16c9..1af846d5 100644 --- a/tinker/tconstruct/logic/CastingTableLogic.java +++ b/tinker/tconstruct/logic/CastingTableLogic.java @@ -2,6 +2,10 @@ package tinker.tconstruct.logic; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.INetworkManager; +import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.Packet132TileEntityData; import net.minecraft.world.World; import tinker.common.InventoryLogic; @@ -25,4 +29,19 @@ public class CastingTableLogic extends InventoryLogic return null; } + /* Packets */ + @Override + public Packet getDescriptionPacket () + { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); + return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag); + } + + @Override + public void onDataPacket (INetworkManager net, Packet132TileEntityData packet) + { + readFromNBT(packet.customParam1); + worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); + } } diff --git a/tinker/tconstruct/logic/MultiblockLogic.java b/tinker/tconstruct/logic/MultiServantLogic.java similarity index 95% rename from tinker/tconstruct/logic/MultiblockLogic.java rename to tinker/tconstruct/logic/MultiServantLogic.java index 20df9f74..d6380da8 100644 --- a/tinker/tconstruct/logic/MultiblockLogic.java +++ b/tinker/tconstruct/logic/MultiServantLogic.java @@ -4,7 +4,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import tinker.common.CoordTuple; -public class MultiblockLogic extends TileEntity +public class MultiServantLogic extends TileEntity { boolean hasMaster; CoordTuple master; diff --git a/tinker/tconstruct/logic/SmelteryDrainLogic.java b/tinker/tconstruct/logic/SmelteryDrainLogic.java index a01b1689..01e949d7 100644 --- a/tinker/tconstruct/logic/SmelteryDrainLogic.java +++ b/tinker/tconstruct/logic/SmelteryDrainLogic.java @@ -3,14 +3,14 @@ package tinker.tconstruct.logic; import net.minecraftforge.liquids.ILiquidTank; import net.minecraftforge.liquids.LiquidStack; -public class SmelteryDrainLogic extends MultiblockLogic +public class SmelteryDrainLogic extends MultiServantLogic implements ILiquidTank { boolean isDrain; - public SmelteryDrainLogic(boolean drain) + public SmelteryDrainLogic() { - isDrain = drain; + isDrain = true; } @Override diff --git a/tinker/tconstruct/logic/SmelteryLogic.java b/tinker/tconstruct/logic/SmelteryLogic.java index 8b80f792..d714b61a 100644 --- a/tinker/tconstruct/logic/SmelteryLogic.java +++ b/tinker/tconstruct/logic/SmelteryLogic.java @@ -329,7 +329,7 @@ public class SmelteryLogic extends InventoryLogic hasLavaTank = true; } - if (eastID == TContent.searedBrick.blockID) + if (eastID == TContent.smeltery.blockID) numBricks++; else if (eastID == TContent.lavaTank.blockID) {