From 20bef6e26d948698398bd16aeab8c9e6b89110e4 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 22 Aug 2019 20:01:40 -0400 Subject: Format/import cleanup --- .../jewelrycraft/block/BlockCrystal.java | 32 +- .../jewelrycraft/block/BlockDisplayer.java | 166 +++------ .../jewelrycraft/block/BlockHandPedestal.java | 39 +- .../jewelrycraft/block/BlockItemCrystal.java | 8 +- .../block/BlockJewelersCraftingTable.java | 97 ++--- .../darkknight/jewelrycraft/block/BlockList.java | 172 +++------ .../jewelrycraft/block/BlockMidasTouch.java | 24 +- .../darkknight/jewelrycraft/block/BlockMolder.java | 109 ++---- .../jewelrycraft/block/BlockMoltenMetal.java | 362 ++++--------------- .../darkknight/jewelrycraft/block/BlockShadow.java | 32 +- .../jewelrycraft/block/BlockShadowEye.java | 20 +- .../jewelrycraft/block/BlockShadowHand.java | 30 +- .../jewelrycraft/block/BlockSmelter.java | 399 ++++++--------------- .../block/render/BlockCrystalRenderer.java | 212 ++++------- 14 files changed, 451 insertions(+), 1251 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/block') diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java b/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java index 98416c2..136d502 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java @@ -26,12 +26,8 @@ import net.minecraft.world.World; * */ public class BlockCrystal extends Block implements ITileEntityProvider { - public static int[] colors = { - 1973019, 11743532, 3887386, 5320730, 2437522, - 8073150, 2651799, 11250603, 4408131, 14188952, - 4312372, 14602026, 6719955, 12801229, 15435844, - 15790320 - }; + public static int[] colors = { 1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, + 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320 }; protected BlockCrystal() { super(Material.glass); @@ -75,8 +71,7 @@ public class BlockCrystal extends Block implements ITileEntityProvider { @Override @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess world, int i, int j, - int k) { + public int colorMultiplier(IBlockAccess world, int i, int j, int k) { return colors[world.getBlockMetadata(i, j, k)]; } @@ -86,32 +81,23 @@ public class BlockCrystal extends Block implements ITileEntityProvider { } @Override - public void breakBlock(World world, int x, int y, int z, - Block block, int meta) { + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { super.breakBlock(world, x, y, z, block, meta); world.removeTileEntity(x, y, z); } @Override - public boolean onBlockEventReceived(World world, int x, int y, - int z, int eventNo, int arg) { + public boolean onBlockEventReceived(World world, int x, int y, int z, int eventNo, int arg) { super.onBlockEventReceived(world, x, y, z, eventNo, arg); TileEntity tileentity = world.getTileEntity(x, y, z); - return tileentity != null - ? tileentity.receiveClientEvent(eventNo, - arg) - : false; + return tileentity != null ? tileentity.receiveClientEvent(eventNo, arg) : false; } @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int x, int y, int z, - Random rand) { + public void randomDisplayTick(World world, int x, int y, int z, Random rand) { if (ConfigHandler.CRYSTAL_PARTICLES) - world.spawnParticle("instantSpell", - x + rand.nextFloat(), - y + rand.nextFloat(), - z + rand.nextFloat(), 0.0D, -1.0D, - 0.0D); + world.spawnParticle("instantSpell", x + rand.nextFloat(), y + rand.nextFloat(), z + rand.nextFloat(), 0.0D, + -1.0D, 0.0D); } } diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java b/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java index d84cbf7..2547149 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java @@ -54,8 +54,7 @@ public class BlockDisplayer extends BlockContainer { * @return whether to render the specified side */ @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, - int i, int j, int k, int l) { + public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) { return false; } @@ -88,98 +87,57 @@ public class BlockDisplayer extends BlockContainer { * @return whether to activate the item on the block */ @Override - public boolean onBlockActivated(World world, int i, int j, int k, - EntityPlayer entityPlayer, int par6, float par7, + public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) { - TileEntityDisplayer te = (TileEntityDisplayer) world - .getTileEntity(i, j, k); + TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k); ItemStack item = entityPlayer.inventory.getCurrentItem(); if (te != null) { - if (item != null && item != new ItemStack( - Item.getItemById(0), 0, 0) - && !world.isRemote) { + if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote) { if (!te.hasObject) { te.object = item.copy(); te.quantity += item.stackSize; te.object.stackSize = 1; te.hasObject = true; if (!entityPlayer.capabilities.isCreativeMode) - entityPlayer.inventory - .decrStackSize(entityPlayer.inventory.currentItem, - item.stackSize); + entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize); te.isDirty = true; - } else if (te.object.getItem() == item - .getItem() - && te.object != null - && te.object != new ItemStack( - Item.getItemById( - 0), - 0, 0) - && te.object.getItemDamage() == item - .getItemDamage()) - if (te.object.hasTagCompound() - && item.hasTagCompound() - && te.object.getTagCompound() - .equals(item.getTagCompound())) { + } else if (te.object.getItem() == item.getItem() && te.object != null + && te.object != new ItemStack(Item.getItemById(0), 0, 0) + && te.object.getItemDamage() == item.getItemDamage()) + if (te.object.hasTagCompound() && item.hasTagCompound() + && te.object.getTagCompound().equals(item.getTagCompound())) { te.quantity += item.stackSize; if (!entityPlayer.capabilities.isCreativeMode) - entityPlayer.inventory - .decrStackSize(entityPlayer.inventory.currentItem, - item.stackSize); + entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize); te.isDirty = true; - } else if (!te.object - .hasTagCompound() - && !item.hasTagCompound()) { + } else if (!te.object.hasTagCompound() && !item.hasTagCompound()) { te.quantity += item.stackSize; if (!entityPlayer.capabilities.isCreativeMode) - entityPlayer.inventory - .decrStackSize(entityPlayer.inventory.currentItem, - item.stackSize); + entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize); te.isDirty = true; } - } else if (item == null || item == new ItemStack( - Item.getItemById(0), 0, 0)) + } else if (item == null || item == new ItemStack(Item.getItemById(0), 0, 0)) if (!entityPlayer.capabilities.isCreativeMode) - for (int inv = 0; inv < entityPlayer.inventory - .getSizeInventory(); inv++) { - item = entityPlayer.inventory - .getStackInSlot(inv); - if (item != null && te.object - .getItem() == item - .getItem() - && te.object != null - && te.object != new ItemStack( - Item.getItemById( - 0), - 0, - 0) - && te.object.getItemDamage() == item - .getItemDamage()) - if (te.object.hasTagCompound() - && item.hasTagCompound() - && te.object.getTagCompound() - .equals(item.getTagCompound())) { + for (int inv = 0; inv < entityPlayer.inventory.getSizeInventory(); inv++) { + item = entityPlayer.inventory.getStackInSlot(inv); + if (item != null && te.object.getItem() == item.getItem() && te.object != null + && te.object != new ItemStack(Item.getItemById(0), 0, 0) + && te.object.getItemDamage() == item.getItemDamage()) + if (te.object.hasTagCompound() && item.hasTagCompound() + && te.object.getTagCompound().equals(item.getTagCompound())) { te.quantity += item.stackSize; if (!entityPlayer.capabilities.isCreativeMode) - entityPlayer.inventory - .decrStackSize(inv, - item.stackSize); + entityPlayer.inventory.decrStackSize(inv, item.stackSize); te.isDirty = true; te.markDirty(); - } else if (!te.object - .hasTagCompound() - && !item.hasTagCompound()) { + } else if (!te.object.hasTagCompound() && !item.hasTagCompound()) { te.quantity += item.stackSize; if (!entityPlayer.capabilities.isCreativeMode) - entityPlayer.inventory - .decrStackSize(inv, - item.stackSize); + entityPlayer.inventory.decrStackSize(inv, item.stackSize); te.isDirty = true; } } - else if (entityPlayer.capabilities.isCreativeMode - && te.hasObject - && te.object.getItem() != null) { + else if (entityPlayer.capabilities.isCreativeMode && te.hasObject && te.object.getItem() != null) { te.quantity += 64; te.isDirty = true; } @@ -196,61 +154,38 @@ public class BlockDisplayer extends BlockContainer { * @param player */ @Override - public void onBlockClicked(World world, int i, int j, int k, - EntityPlayer player) { - TileEntityDisplayer te = (TileEntityDisplayer) world - .getTileEntity(i, j, k); + public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) { + TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k); if (te != null && !world.isRemote) - if (te.hasObject && te.object != null - && te.object != new ItemStack( - Item.getItemById( - 0), - 0, 0) - && player.inventory - .addItemStackToInventory( - te.object)) + if (te.hasObject && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) + && player.inventory.addItemStackToInventory(te.object)) if (!player.isSneaking()) { - if (te.quantity > te.object - .getMaxStackSize()) { - te.object.stackSize = te.object - .getMaxStackSize() - - 1; - player.inventory.addItemStackToInventory( - te.object); + if (te.quantity > te.object.getMaxStackSize()) { + te.object.stackSize = te.object.getMaxStackSize() - 1; + player.inventory.addItemStackToInventory(te.object); te.object.stackSize = 1; - te.quantity -= te.object - .getMaxStackSize(); + te.quantity -= te.object.getMaxStackSize(); te.isDirty = true; } else { - te.object.stackSize = te.quantity - - 1; - player.inventory.addItemStackToInventory( - te.object); + te.object.stackSize = te.quantity - 1; + player.inventory.addItemStackToInventory(te.object); te.hasObject = false; - te.object = new ItemStack( - Item.getItemById( - 0), - 0, 0); + te.object = new ItemStack(Item.getItemById(0), 0, 0); te.quantity = 0; te.isDirty = true; } te.isDirty = true; } else { if (te.quantity >= 2) { - player.inventory.addItemStackToInventory( - te.object); + player.inventory.addItemStackToInventory(te.object); te.object.stackSize = 1; te.quantity--; te.isDirty = true; } else { - player.inventory.addItemStackToInventory( - te.object); + player.inventory.addItemStackToInventory(te.object); te.object.stackSize = 1; te.hasObject = false; - te.object = new ItemStack( - Item.getItemById( - 0), - 0, 0); + te.object = new ItemStack(Item.getItemById(0), 0, 0); te.quantity = 0; te.isDirty = true; } @@ -265,10 +200,8 @@ public class BlockDisplayer extends BlockContainer { * @param z * @param stack */ - public void dropItem(World world, double x, double y, double z, - ItemStack stack) { - EntityItem entityitem = new EntityItem(world, x + 0.5D, - y + 1.5D, z + 0.5D, stack); + public void dropItem(World world, double x, double y, double z, ItemStack stack) { + EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack); entityitem.motionX = 0; entityitem.motionZ = 0; entityitem.motionY = 0.11000000298023224D; @@ -284,14 +217,11 @@ public class BlockDisplayer extends BlockContainer { * @param par6 */ @Override - public void breakBlock(World world, int i, int j, int k, - Block block, int par6) { - TileEntityDisplayer te = (TileEntityDisplayer) world - .getTileEntity(i, j, k); + public void breakBlock(World world, int i, int j, int k, Block block, int par6) { + TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k); if (te != null && te.hasObject) { te.object.stackSize = te.quantity; - dropItem(te.getWorldObj(), te.xCoord, te.yCoord, - te.zCoord, te.object); + dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.object); world.removeTileEntity(i, j, k); } super.breakBlock(world, i, j, k, block, par6); @@ -306,13 +236,9 @@ public class BlockDisplayer extends BlockContainer { * @param par6ItemStack */ @Override - public void onBlockPlacedBy(World world, int i, int j, int k, - EntityLivingBase entityLiving, + public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) { - int rotation = MathHelper - .floor_double(entityLiving.rotationYaw - * 4.0F / 360.0F + 0.5D) - & 3; + int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(i, j, k, rotation, 2); } diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java b/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java index 2cfe437..2cd8788 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java @@ -51,8 +51,7 @@ public class BlockHandPedestal extends BlockContainer { * @return */ @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, - int i, int j, int k, int l) { + public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) { return false; } @@ -85,24 +84,18 @@ public class BlockHandPedestal extends BlockContainer { * @return */ @Override - public boolean onBlockActivated(World world, int i, int j, int k, - EntityPlayer entityPlayer, int par6, float par7, + public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) { - TileEntityHandPedestal te = (TileEntityHandPedestal) world - .getTileEntity(i, j, k); + TileEntityHandPedestal te = (TileEntityHandPedestal) world.getTileEntity(i, j, k); ItemStack item = entityPlayer.inventory.getCurrentItem(); if (te != null) { - if (!world.isRemote - && te.getHeldItemStack() == null - && item != null) { + if (!world.isRemote && te.getHeldItemStack() == null && item != null) { te.setHeldItemStack(item.copy()); if (!entityPlayer.capabilities.isCreativeMode) item.stackSize--; te.markDirty(); } else if (entityPlayer.isSneaking()) - if (entityPlayer.inventory - .addItemStackToInventory(te - .getHeldItemStack())) { + if (entityPlayer.inventory.addItemStackToInventory(te.getHeldItemStack())) { te.removeHeldItemStack(); } te.markDirty(); @@ -117,10 +110,8 @@ public class BlockHandPedestal extends BlockContainer { * @param z * @param stack */ - public void dropItem(World world, double x, double y, double z, - ItemStack stack) { - EntityItem entityitem = new EntityItem(world, x + 0.5, - y + 1.5, z + 0.5, stack); + public void dropItem(World world, double x, double y, double z, ItemStack stack) { + EntityItem entityitem = new EntityItem(world, x + 0.5, y + 1.5, z + 0.5, stack); entityitem.motionX = 0; entityitem.motionZ = 0; entityitem.motionY = 0.11000000298023224D; @@ -136,13 +127,10 @@ public class BlockHandPedestal extends BlockContainer { * @param par6 */ @Override - public void breakBlock(World world, int i, int j, int k, - Block block, int par6) { - TileEntityHandPedestal te = (TileEntityHandPedestal) world - .getTileEntity(i, j, k); + public void breakBlock(World world, int i, int j, int k, Block block, int par6) { + TileEntityHandPedestal te = (TileEntityHandPedestal) world.getTileEntity(i, j, k); if (te != null && te.getHeldItemStack() != null) { - dropItem(te.getWorldObj(), te.xCoord, te.yCoord, - te.zCoord, te.getHeldItemStack()); + dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack()); world.removeTileEntity(i, j, k); } super.breakBlock(world, i, j, k, block, par6); @@ -157,12 +145,9 @@ public class BlockHandPedestal extends BlockContainer { * @param par6ItemStack */ @Override - public void onBlockPlacedBy(World world, int i, int j, int k, - EntityLivingBase entityLiving, + public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) { - int rotation = MathHelper.floor_double( - entityLiving.rotationYaw * 8 / 360 + 0.5) - & 7; + int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8 / 360 + 0.5) & 7; world.setBlockMetadataWithNotify(i, j, k, rotation, 2); } diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java b/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java index 2b76784..2d2058c 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java @@ -19,17 +19,13 @@ public class BlockItemCrystal extends ItemBlock { @Override public String getUnlocalizedName(ItemStack itemstack) { - return getUnlocalizedName() + "." - + itemstack.getItemDamage(); + return getUnlocalizedName() + "." + itemstack.getItemDamage(); } @Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack stack, int pass) { - return stack.getItemDamage() < 16 - ? BlockCrystal.colors[stack - .getItemDamage()] - : 0; + return stack.getItemDamage() < 16 ? BlockCrystal.colors[stack.getItemDamage()] : 0; } } \ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java b/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java index 2bd78ac..4209a86 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java @@ -40,43 +40,32 @@ public class BlockJewelersCraftingTable extends BlockContainer { } @Override - public boolean onBlockActivated(World world, int i, int j, int k, - EntityPlayer entityPlayer, int par6, float par7, + public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) { - TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world - .getTileEntity(i, j, k); + TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k); ItemStack item = entityPlayer.inventory.getCurrentItem(); if (te != null && !world.isRemote) { if (te.hasEndItem && item != null) - entityPlayer.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".table.hasenditem"))); - if (!te.hasEndItem && !te.hasJewelry - && item != null && JewelrycraftUtil - .isJewelry(item)) { + entityPlayer.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".table.hasenditem"))); + if (!te.hasEndItem && !te.hasJewelry && item != null && JewelrycraftUtil.isJewelry(item)) { te.setJewelryItemStack(item); if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; } - if (!te.hasEndItem && !te.hasGem && item != null - && JewelrycraftUtil.isGem(item)) { + if (!te.hasEndItem && !te.hasGem && item != null && JewelrycraftUtil.isGem(item)) { te.setGemItemStack(item); if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; } - if (!te.hasEndItem && te.hasJewelry && te.hasGem - && !te.crafting) + if (!te.hasEndItem && te.hasJewelry && te.hasGem && !te.crafting) te.setCrafting(); } return true; } - public void dropItem(World world, double x, double y, double z, - ItemStack stack) { - EntityItem entityitem = new EntityItem(world, x + 0.5D, - y + 1D, z + 0.5D, stack); + public void dropItem(World world, double x, double y, double z, ItemStack stack) { + EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1D, z + 0.5D, stack); entityitem.motionX = 0; entityitem.motionZ = 0; entityitem.motionY = 0.21000000298023224D; @@ -84,43 +73,30 @@ public class BlockJewelersCraftingTable extends BlockContainer { } @Override - public void breakBlock(World world, int i, int j, int k, - Block par5, int par6) { - TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world - .getTileEntity(i, j, k); + public void breakBlock(World world, int i, int j, int k, Block par5, int par6) { + TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k); if (te != null) { if (te.hasJewelry) - dropItem(world, te.xCoord, te.yCoord, - te.zCoord, - te.jewelry.copy()); + dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.jewelry.copy()); if (te.hasGem) - dropItem(world, te.xCoord, te.yCoord, - te.zCoord, te.gem.copy()); + dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.gem.copy()); if (te.hasEndItem) - dropItem(te.getWorldObj(), te.xCoord, - te.yCoord, te.zCoord, - te.endItem.copy()); + dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.endItem.copy()); world.removeTileEntity(i, j, k); } super.breakBlock(world, i, j, k, par5, par6); } @Override - public void onBlockPlacedBy(World world, int i, int j, int k, - EntityLivingBase entityLiving, + public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) { - int rotation = MathHelper - .floor_double(entityLiving.rotationYaw - * 4.0F / 360.0F + 0.5D) - & 3; + int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(i, j, k, rotation, 2); } @Override - public void onBlockClicked(World world, int i, int j, int k, - EntityPlayer player) { - TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world - .getTileEntity(i, j, k); + public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) { + TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k); if (te != null && !world.isRemote) if (player.isSneaking()) { if (te.hasJewelry) @@ -129,38 +105,21 @@ public class BlockJewelersCraftingTable extends BlockContainer { te.removeGem(); } else if (te.hasEndItem) te.removeResult(); - else if (te.hasJewelry && te.hasGem - && te.carving > 0 - && te.jewelry != null) - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocalFormatted( - "chatmessage." + Variables.MODID - + ".table.iscrafting", - te.jewelry.getDisplayName()) - + " (" - + (ConfigHandler.GEM_PLACEMENT_TIME - - te.carving) - * 100 - / ConfigHandler.GEM_PLACEMENT_TIME - + "%)")); + else if (te.hasJewelry && te.hasGem && te.carving > 0 && te.jewelry != null) + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted( + "chatmessage." + Variables.MODID + ".table.iscrafting", te.jewelry.getDisplayName()) + " (" + + (ConfigHandler.GEM_PLACEMENT_TIME - te.carving) * 100 / ConfigHandler.GEM_PLACEMENT_TIME + + "%)")); else if (!te.hasGem) - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".table.missinggem"))); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".table.missinggem"))); else if (!te.hasJewelry) - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".table.missingjewelry"))); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".table.missingjewelry"))); } @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, - int i, int j, int k, int l) { + public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) { return false; } diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockList.java b/src/main/java/darkknight/jewelrycraft/block/BlockList.java index 5fe71d5..f9ebf7c 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockList.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockList.java @@ -3,17 +3,7 @@ package darkknight.jewelrycraft.block; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; import darkknight.jewelrycraft.JewelrycraftMod; -import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow; -import darkknight.jewelrycraft.tileentity.TileEntityCrystal; -import darkknight.jewelrycraft.tileentity.TileEntityDisplayer; -import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal; -import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable; -import darkknight.jewelrycraft.tileentity.TileEntityMidasTouch; -import darkknight.jewelrycraft.tileentity.TileEntityMolder; -import darkknight.jewelrycraft.tileentity.TileEntityMoltenMetal; -import darkknight.jewelrycraft.tileentity.TileEntityShadowEye; -import darkknight.jewelrycraft.tileentity.TileEntityShadowHand; -import darkknight.jewelrycraft.tileentity.TileEntitySmelter; +import darkknight.jewelrycraft.tileentity.*; import darkknight.jewelrycraft.util.Variables; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -23,140 +13,74 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.oredict.OreDictionary; public class BlockList { - public static Block shadowOre, smelter, molder, - displayer, jewelCraftingTable, shadowBlock, - shadowEye, handPedestal, shadowHand, - midasTouchBlock, crystal; - public static BlockMoltenMetal moltenMetal; - public static Fluid moltenMetalFluid; + public static Block shadowOre, smelter, molder, displayer, jewelCraftingTable, shadowBlock, shadowEye, handPedestal, + shadowHand, midasTouchBlock, crystal; + public static BlockMoltenMetal moltenMetal; + public static Fluid moltenMetalFluid; public static void preInit(FMLPreInitializationEvent e) { - shadowOre = new BlockJCOre().setHardness(3.0F) - .setResistance(5.0F) - .setStepSound(Block.soundTypePiston) - .setBlockTextureName(Variables.MODID - + ":oreShadow") - .setBlockName(Variables.MODID - + ".oreShadow") + shadowOre = new BlockJCOre().setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundTypePiston) + .setBlockTextureName(Variables.MODID + ":oreShadow").setBlockName(Variables.MODID + ".oreShadow") .setCreativeTab(JewelrycraftMod.jewelrycraft); - smelter = new BlockSmelter().setHardness(5.0F) - .setResistance(6.0F) - .setStepSound(Block.soundTypePiston) - .setBlockName(Variables.MODID + ".smelter") + smelter = new BlockSmelter().setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston) + .setBlockName(Variables.MODID + ".smelter").setCreativeTab(JewelrycraftMod.jewelrycraft); + molder = new BlockMolder(Material.rock).setHardness(5.0F).setResistance(6.0F) + .setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".molder") .setCreativeTab(JewelrycraftMod.jewelrycraft); - molder = new BlockMolder(Material.rock).setHardness(5.0F) - .setResistance(6.0F) - .setStepSound(Block.soundTypePiston) - .setBlockName(Variables.MODID + ".molder") + displayer = new BlockDisplayer(Material.iron).setHardness(5.0F).setResistance(6.0F) + .setStepSound(Block.soundTypeMetal).setBlockName(Variables.MODID + ".displayer") .setCreativeTab(JewelrycraftMod.jewelrycraft); - displayer = new BlockDisplayer(Material.iron) - .setHardness(5.0F).setResistance(6.0F) - .setStepSound(Block.soundTypeMetal) - .setBlockName(Variables.MODID - + ".displayer") + jewelCraftingTable = new BlockJewelersCraftingTable(Material.rock).setHardness(3.0F).setResistance(5.0F) + .setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".jewelCraftingTable") .setCreativeTab(JewelrycraftMod.jewelrycraft); - jewelCraftingTable = new BlockJewelersCraftingTable( - Material.rock).setHardness(3.0F) - .setResistance(5.0F) - .setStepSound(Block.soundTypePiston) - .setBlockName(Variables.MODID - + ".jewelCraftingTable") - .setCreativeTab(JewelrycraftMod.jewelrycraft); - shadowBlock = new BlockShadow().setHardness(5.0F) - .setResistance(7.0F) - .setStepSound(Block.soundTypeMetal) - .setBlockTextureName(Variables.MODID - + ":blockShadow") - .setBlockName(Variables.MODID - + ".blockShadow") + shadowBlock = new BlockShadow().setHardness(5.0F).setResistance(7.0F).setStepSound(Block.soundTypeMetal) + .setBlockTextureName(Variables.MODID + ":blockShadow").setBlockName(Variables.MODID + ".blockShadow") .setCreativeTab(JewelrycraftMod.jewelrycraft); - shadowEye = new BlockShadowEye().setHardness(5.0F) - .setResistance(6.0F) - .setStepSound(Block.soundTypePiston) - .setBlockName(Variables.MODID - + ".shadowEye") + shadowEye = new BlockShadowEye().setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston) + .setBlockName(Variables.MODID + ".shadowEye").setCreativeTab(JewelrycraftMod.jewelrycraft); + handPedestal = new BlockHandPedestal(Material.rock).setHardness(5.0F).setResistance(6.0F) + .setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".handPedestal") .setCreativeTab(JewelrycraftMod.jewelrycraft); - handPedestal = new BlockHandPedestal(Material.rock) - .setHardness(5.0F).setResistance(6.0F) - .setStepSound(Block.soundTypePiston) - .setBlockName(Variables.MODID - + ".handPedestal") - .setCreativeTab(JewelrycraftMod.jewelrycraft); - shadowHand = new BlockShadowHand(Material.rock) - .setStepSound(Block.soundTypePiston) - .setBlockName(Variables.MODID - + ".shadowHand") - .setCreativeTab(JewelrycraftMod.jewelrycraft) + shadowHand = new BlockShadowHand(Material.rock).setStepSound(Block.soundTypePiston) + .setBlockName(Variables.MODID + ".shadowHand").setCreativeTab(JewelrycraftMod.jewelrycraft) .setBlockUnbreakable(); - midasTouchBlock = new BlockMidasTouch(Material.iron) - .setHardness(3.0F).setResistance(10.0F) - .setStepSound(Block.soundTypeMetal) - .setBlockName(Variables.MODID - + ".midasTouchBlock"); - moltenMetalFluid = new Fluid("metal.molten") - .setLuminosity(15).setDensity(3000) - .setTemperature(2000).setViscosity(6000); + midasTouchBlock = new BlockMidasTouch(Material.iron).setHardness(3.0F).setResistance(10.0F) + .setStepSound(Block.soundTypeMetal).setBlockName(Variables.MODID + ".midasTouchBlock"); + moltenMetalFluid = new Fluid("metal.molten").setLuminosity(15).setDensity(3000).setTemperature(2000) + .setViscosity(6000); if (!FluidRegistry.registerFluid(moltenMetalFluid)) - moltenMetalFluid = FluidRegistry - .getFluid("metal.molten"); - moltenMetal = new BlockMoltenMetal(moltenMetalFluid, - Material.lava); + moltenMetalFluid = FluidRegistry.getFluid("metal.molten"); + moltenMetal = new BlockMoltenMetal(moltenMetalFluid, Material.lava); moltenMetalFluid.setBlock(moltenMetal); - crystal = new BlockCrystal().setHardness(2.0F) - .setResistance(5.0F) - .setStepSound(Block.soundTypeGlass) - .setBlockTextureName(Variables.MODID - + ":blockCrystal") - .setBlockName(Variables.MODID - + ".blockCrystal") + crystal = new BlockCrystal().setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeGlass) + .setBlockTextureName(Variables.MODID + ":blockCrystal").setBlockName(Variables.MODID + ".blockCrystal") .setCreativeTab(JewelrycraftMod.jewelrycraft); GameRegistry.registerBlock(shadowOre, "shadowOre"); GameRegistry.registerBlock(shadowBlock, "shadowBlock"); GameRegistry.registerBlock(smelter, "Smelter"); GameRegistry.registerBlock(molder, "Molder"); - GameRegistry.registerBlock(jewelCraftingTable, - "jewelCraftingTable"); + GameRegistry.registerBlock(jewelCraftingTable, "jewelCraftingTable"); GameRegistry.registerBlock(displayer, "Displayer"); GameRegistry.registerBlock(shadowEye, "Shadow Eye"); - GameRegistry.registerBlock(handPedestal, - "Stone Bricks Pedestal"); + GameRegistry.registerBlock(handPedestal, "Stone Bricks Pedestal"); GameRegistry.registerBlock(shadowHand, "Shadow Hand"); - GameRegistry.registerBlock(midasTouchBlock, - "Midas Touch Block"); - GameRegistry.registerBlock(moltenMetal, - "moltenMetalLiquid"); - GameRegistry.registerBlock(crystal, BlockItemCrystal.class, - "crystalBlock"); + GameRegistry.registerBlock(midasTouchBlock, "Midas Touch Block"); + GameRegistry.registerBlock(moltenMetal, "moltenMetalLiquid"); + GameRegistry.registerBlock(crystal, BlockItemCrystal.class, "crystalBlock"); - GameRegistry.registerTileEntity(TileEntitySmelter.class, - Variables.MODID + ":smelter"); - GameRegistry.registerTileEntity(TileEntityMolder.class, - Variables.MODID + ":molder"); - GameRegistry.registerTileEntity( - TileEntityJewelrsCraftingTable.class, - Variables.MODID + ":table"); - GameRegistry.registerTileEntity(TileEntityDisplayer.class, - Variables.MODID + ":displayer"); - GameRegistry.registerTileEntity( - TileEntityBlockShadow.class, - Variables.MODID + ":blockShadow"); - GameRegistry.registerTileEntity(TileEntityShadowEye.class, - Variables.MODID + ":shadowEye"); - GameRegistry.registerTileEntity( - TileEntityHandPedestal.class, - Variables.MODID + ":handPedestal"); - GameRegistry.registerTileEntity(TileEntityShadowHand.class, - Variables.MODID + ":shadowHand"); - GameRegistry.registerTileEntity(TileEntityMidasTouch.class, - Variables.MODID + ":midsaTouch"); - GameRegistry.registerTileEntity(TileEntityCrystal.class, - Variables.MODID + ":crystalBlock"); - GameRegistry.registerTileEntity( - TileEntityMoltenMetal.class, - Variables.MODID + ":moltenMetalTE"); + GameRegistry.registerTileEntity(TileEntitySmelter.class, Variables.MODID + ":smelter"); + GameRegistry.registerTileEntity(TileEntityMolder.class, Variables.MODID + ":molder"); + GameRegistry.registerTileEntity(TileEntityJewelrsCraftingTable.class, Variables.MODID + ":table"); + GameRegistry.registerTileEntity(TileEntityDisplayer.class, Variables.MODID + ":displayer"); + GameRegistry.registerTileEntity(TileEntityBlockShadow.class, Variables.MODID + ":blockShadow"); + GameRegistry.registerTileEntity(TileEntityShadowEye.class, Variables.MODID + ":shadowEye"); + GameRegistry.registerTileEntity(TileEntityHandPedestal.class, Variables.MODID + ":handPedestal"); + GameRegistry.registerTileEntity(TileEntityShadowHand.class, Variables.MODID + ":shadowHand"); + GameRegistry.registerTileEntity(TileEntityMidasTouch.class, Variables.MODID + ":midsaTouch"); + GameRegistry.registerTileEntity(TileEntityCrystal.class, Variables.MODID + ":crystalBlock"); + GameRegistry.registerTileEntity(TileEntityMoltenMetal.class, Variables.MODID + ":moltenMetalTE"); - OreDictionary.registerOre("oreShadow", - new ItemStack(BlockList.shadowOre)); + OreDictionary.registerOre("oreShadow", new ItemStack(BlockList.shadowOre)); } } diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java b/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java index 8713796..522289e 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java @@ -30,8 +30,7 @@ public class BlockMidasTouch extends BlockContainer { } @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, - int i, int j, int k, int l) { + public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) { return false; } @@ -56,27 +55,18 @@ public class BlockMidasTouch extends BlockContainer { } @Override - public void onBlockHarvested(World world, int i, int j, int k, - int meta, EntityPlayer player) { + public void onBlockHarvested(World world, int i, int j, int k, int meta, EntityPlayer player) { // Do nothing } @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, - int y, int z) { + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); if (((TileEntityMidasTouch) tile).target != null) - this.setBlockBounds(0.5f - - ((TileEntityMidasTouch) tile).target.width - / 2, - 0F, - 0.5f - ((TileEntityMidasTouch) tile).target.width - / 2, - 0.5f + ((TileEntityMidasTouch) tile).target.width - / 2, - ((TileEntityMidasTouch) tile).target.height, - 0.5f + ((TileEntityMidasTouch) tile).target.width - / 2); + this.setBlockBounds(0.5f - ((TileEntityMidasTouch) tile).target.width / 2, 0F, + 0.5f - ((TileEntityMidasTouch) tile).target.width / 2, + 0.5f + ((TileEntityMidasTouch) tile).target.width / 2, ((TileEntityMidasTouch) tile).target.height, + 0.5f + ((TileEntityMidasTouch) tile).target.width / 2); } @Override diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java b/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java index 4f763ad..7f2bec4 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java @@ -41,49 +41,34 @@ public class BlockMolder extends BlockContainer { } @Override - public boolean onBlockActivated(World world, int i, int j, int k, - EntityPlayer entityPlayer, int par6, float par7, + public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) { - TileEntityMolder te = (TileEntityMolder) world - .getTileEntity(i, j, k); + TileEntityMolder te = (TileEntityMolder) world.getTileEntity(i, j, k); ItemStack item = entityPlayer.inventory.getCurrentItem(); if (te != null && !world.isRemote) { - if (item != null && !te.hasMold && item - .getItem() == ItemList.molds) { + if (item != null && !te.hasMold && item.getItem() == ItemList.molds) { te.mold = item.copy(); te.hasMold = true; if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; - entityPlayer.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocalFormatted( - "chatmessage." + Variables.MODID - + ".molder.addedmold", - te.mold.getDisplayName()))); + entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted( + "chatmessage." + Variables.MODID + ".molder.addedmold", te.mold.getDisplayName()))); te.isDirty = true; } - if (te.hasMold && entityPlayer.isSneaking() - && !te.hasMoltenMetal) { - dropItem(world, te.xCoord, te.yCoord, - te.zCoord, te.mold.copy()); - te.mold = new ItemStack( - Item.getItemById(0), 0, 0); + if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal) { + dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy()); + te.mold = new ItemStack(Item.getItemById(0), 0, 0); te.hasMold = false; te.isDirty = true; } else if (te.hasMoltenMetal) - entityPlayer.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".molder.hasmoltenmetal"))); + entityPlayer.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.hasmoltenmetal"))); } return true; } - public void dropItem(World world, double x, double y, double z, - ItemStack stack) { - EntityItem entityitem = new EntityItem(world, x + 0.5D, - y + 0.5D, z + 0.5D, stack); + public void dropItem(World world, double x, double y, double z, ItemStack stack) { + EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack); entityitem.motionX = 0; entityitem.motionZ = 0; entityitem.motionY = 0.11000000298023224D; @@ -91,79 +76,51 @@ public class BlockMolder extends BlockContainer { } @Override - public void breakBlock(World world, int i, int j, int k, - Block par5, int par6) { - TileEntityMolder te = (TileEntityMolder) world - .getTileEntity(i, j, k); + public void breakBlock(World world, int i, int j, int k, Block par5, int par6) { + TileEntityMolder te = (TileEntityMolder) world.getTileEntity(i, j, k); if (te != null) { if (te.hasJewelBase) - dropItem(te.getWorldObj(), te.xCoord, - te.yCoord, te.zCoord, - te.jewelBase.copy()); + dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.jewelBase.copy()); if (te.hasMold) - dropItem(world, te.xCoord, te.yCoord, - te.zCoord, te.mold.copy()); + dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy()); world.removeTileEntity(i, j, k); } super.breakBlock(world, i, j, k, par5, par6); } @Override - public void onBlockPlacedBy(World world, int i, int j, int k, - EntityLivingBase entityLiving, + public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) { - int rotation = MathHelper - .floor_double(entityLiving.rotationYaw - * 4.0F / 360.0F + 0.5D) - & 3; + int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(i, j, k, rotation, 2); } @Override - public void onBlockClicked(World world, int i, int j, int k, - EntityPlayer player) { - TileEntityMolder me = (TileEntityMolder) world - .getTileEntity(i, j, k); + public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) { + TileEntityMolder me = (TileEntityMolder) world.getTileEntity(i, j, k); if (me != null && !world.isRemote) { if (me.hasJewelBase) { - dropItem(me.getWorldObj(), me.xCoord, - me.yCoord, me.zCoord, - me.jewelBase.copy()); - me.jewelBase = new ItemStack( - Item.getItemById(0), 0, 0); + dropItem(me.getWorldObj(), me.xCoord, me.yCoord, me.zCoord, me.jewelBase.copy()); + me.jewelBase = new ItemStack(Item.getItemById(0), 0, 0); me.hasJewelBase = false; } else if (me.hasMoltenMetal && me.cooling >= 0) - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".molder.metaliscooling") - + " (" - + (ConfigHandler.INGOT_COOLING_TIME - - me.cooling) - * 100 - / ConfigHandler.INGOT_COOLING_TIME - + "%)")); - else if (me.mold.getItem() == ItemList.molds - && !me.hasMoltenMetal) - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".molder.moldisempty"))); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.metaliscooling") + + " (" + (ConfigHandler.INGOT_COOLING_TIME - me.cooling) * 100 + / ConfigHandler.INGOT_COOLING_TIME + + "%)")); + else if (me.mold.getItem() == ItemList.molds && !me.hasMoltenMetal) + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.moldisempty"))); else if (me.mold.getItem() != ItemList.molds) - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".molder.moldismissing"))); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.moldismissing"))); me.isDirty = true; } } @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, - int i, int j, int k, int l) { + public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) { return false; } diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java index 6d88443..35381c3 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java @@ -22,12 +22,11 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; -public class BlockMoltenMetal extends BlockFluidClassic - implements ITileEntityProvider { +public class BlockMoltenMetal extends BlockFluidClassic implements ITileEntityProvider { @SideOnly(Side.CLIENT) - protected IIcon stillIcon; + protected IIcon stillIcon; @SideOnly(Side.CLIENT) - protected IIcon flowingIcon; + protected IIcon flowingIcon; public BlockMoltenMetal(Fluid fluid, Material material) { super(fluid, material); @@ -45,31 +44,26 @@ public class BlockMoltenMetal extends BlockFluidClassic @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister register) { - stillIcon = register.registerIcon( - Variables.MODID + ":moltenMetalStill"); - flowingIcon = register.registerIcon( - Variables.MODID + ":moltenMetalFlow"); + stillIcon = register.registerIcon(Variables.MODID + ":moltenMetalStill"); + flowingIcon = register.registerIcon(Variables.MODID + ":moltenMetalFlow"); } @Override - public boolean canDisplace(IBlockAccess world, int x, int y, - int z) { + public boolean canDisplace(IBlockAccess world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.canDisplace(world, x, y, z); } @Override - public boolean displaceIfPossible(World world, int x, int y, - int z) { + public boolean displaceIfPossible(World world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.displaceIfPossible(world, x, y, z); } @Override - protected boolean canFlowInto(IBlockAccess world, int x, int y, - int z) { + protected boolean canFlowInto(IBlockAccess world, int x, int y, int z) { if (world.getBlock(x, y, z).isAir(world, x, y, z)) return true; Block block = world.getBlock(x, y, z); @@ -78,8 +72,7 @@ public class BlockMoltenMetal extends BlockFluidClassic if (displacements.containsKey(block)) return displacements.get(block); Material material = block.getMaterial(); - if (material.blocksMovement() || material == Material.water - || material == Material.lava + if (material.blocksMovement() || material == Material.water || material == Material.lava || material == Material.portal) return false; int densty = getDensity(world, x, y, z); @@ -93,8 +86,7 @@ public class BlockMoltenMetal extends BlockFluidClassic @Override @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess world, int i, int j, - int k) { + public int colorMultiplier(IBlockAccess world, int i, int j, int k) { try { return color(world, i, j, k, false, null); } catch (IOException e) { @@ -104,212 +96,55 @@ public class BlockMoltenMetal extends BlockFluidClassic } @Override - public void updateTick(World world, int x, int y, int z, - Random rand) { - if (getTileEntity(world, x, y, z) == null - || (getTileEntity(world, x, y, z) - .getMetal() == null)) + public void updateTick(World world, int x, int y, int z, Random rand) { + if (getTileEntity(world, x, y, z) == null || (getTileEntity(world, x, y, z).getMetal() == null)) world.setBlockToAir(x, y, z); else { - int quantaRemaining = quantaPerBlock - - world.getBlockMetadata(x, y, z); + int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z); int expQuanta = -101; // check adjacent block levels if non-source if (quantaRemaining < quantaPerBlock) { int y2 = y - densityDir; - if ((world.getBlock(x, y2, z) == this - && getTileEntity(world, x, - y2, - z) != null - && getTileEntity(world, x, - y, - z) != null - && areMetalsEqual(world, x, - y2, z, x, - y, z)) - || (world.getBlock(x - 1, - y2, - z) == this - && getTileEntity( - world, - x - 1, - y2, - z) != null - && getTileEntity( - world, - x, - y, - z) != null - && areMetalsEqual( - world, - x - 1, - y2, - z, - x, - y, - z)) - || (world.getBlock(x + 1, - y2, - z) == this - && getTileEntity( - world, - x + 1, - y2, - z) != null - && getTileEntity( - world, - x, - y, - z) != null - && areMetalsEqual( - world, - x + 1, - y2, - z, - x, - y, - z)) - || (world.getBlock(x, y2, z - - 1) == this - && getTileEntity( - world, - x, - y2, - z - 1) != null - && getTileEntity( - world, - x, - y, - z) != null - && areMetalsEqual( - world, - x, - y2, - z - 1, - x, - y, - z)) - || (world.getBlock(x, y2, z - + 1) == this - && getTileEntity( - world, - x, - y2, - z + 1) != null - && getTileEntity( - world, - x, - y, - z) != null - && areMetalsEqual( - world, - x, - y2, - z + 1, - x, - y, - z))) + if ((world.getBlock(x, y2, z) == this && getTileEntity(world, x, y2, z) != null + && getTileEntity(world, x, y, z) != null && areMetalsEqual(world, x, y2, z, x, y, z)) + || (world.getBlock(x - 1, y2, z) == this && getTileEntity(world, x - 1, y2, z) != null + && getTileEntity(world, x, y, z) != null + && areMetalsEqual(world, x - 1, y2, z, x, y, z)) + || (world.getBlock(x + 1, y2, z) == this && getTileEntity(world, x + 1, y2, z) != null + && getTileEntity(world, x, y, z) != null + && areMetalsEqual(world, x + 1, y2, z, x, y, z)) + || (world.getBlock(x, y2, z - 1) == this && getTileEntity(world, x, y2, z - 1) != null + && getTileEntity(world, x, y, z) != null + && areMetalsEqual(world, x, y2, z - 1, x, y, z)) + || (world.getBlock(x, y2, z + 1) == this && getTileEntity(world, x, y2, z + 1) != null + && getTileEntity(world, x, y, z) != null + && areMetalsEqual(world, x, y2, z + 1, x, y, z))) expQuanta = quantaPerBlock - 1; else { int maxQuanta = -100; - if (getTileEntity(world, x, y, - z) != null - && getTileEntity( - world, - x - 1, - y, - z) != null - && areMetalsEqual( - world, - x, - y, - z, - x - 1, - y, - z)) - maxQuanta = getLargerQuanta( - world, - x - 1, y, - z, - maxQuanta); - if (getTileEntity(world, x, y, - z) != null - && getTileEntity( - world, - x + 1, - y, - z) != null - && areMetalsEqual( - world, - x, - y, - z, - x + 1, - y, - z)) - maxQuanta = getLargerQuanta( - world, - x + 1, y, - z, - maxQuanta); - if (getTileEntity(world, x, y, - z) != null - && getTileEntity( - world, - x, - y, - z - 1) != null - && areMetalsEqual( - world, - x, - y, - z, - x, - y, - z - 1)) - maxQuanta = getLargerQuanta( - world, x, - y, z - 1, - maxQuanta); - if (getTileEntity(world, x, y, - z) != null - && getTileEntity( - world, - x, - y, - z + 1) != null - && areMetalsEqual( - world, - x, - y, - z, - x, - y, - z + 1)) - maxQuanta = getLargerQuanta( - world, x, - y, z + 1, - maxQuanta); + if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x - 1, y, z) != null + && areMetalsEqual(world, x, y, z, x - 1, y, z)) + maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta); + if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x + 1, y, z) != null + && areMetalsEqual(world, x, y, z, x + 1, y, z)) + maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta); + if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x, y, z - 1) != null + && areMetalsEqual(world, x, y, z, x, y, z - 1)) + maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta); + if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x, y, z + 1) != null + && areMetalsEqual(world, x, y, z, x, y, z + 1)) + maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta); expQuanta = maxQuanta - 1; } // decay calculation if (expQuanta != quantaRemaining) { quantaRemaining = expQuanta; if (expQuanta <= 0) - world.setBlock(x, y, z, - Blocks.air); + world.setBlock(x, y, z, Blocks.air); else { - world.setBlockMetadataWithNotify( - x, y, z, - quantaPerBlock - expQuanta, - 3); - world.scheduleBlockUpdate( - x, y, z, - this, - tickRate); - world.notifyBlocksOfNeighborChange( - x, y, z, - this); + world.setBlockMetadataWithNotify(x, y, z, quantaPerBlock - expQuanta, 3); + world.scheduleBlockUpdate(x, y, z, this, tickRate); + world.notifyBlocksOfNeighborChange(x, y, z, this); } } } @@ -317,126 +152,65 @@ public class BlockMoltenMetal extends BlockFluidClassic // send a // server only update else if (quantaRemaining >= quantaPerBlock) - world.setBlockMetadataWithNotify(x, y, z, - 0, 2); + world.setBlockMetadataWithNotify(x, y, z, 0, 2); // Flow vertically if possible if (canDisplace(world, x, y + densityDir, z)) { - if (getTileEntity(world, x, y + densityDir, - z) != null - && getTileEntity(world, x, - y, - z) != null) - BlockMoltenMetal.getTileEntity( - world, x, - y + densityDir, z) - .setMetal(getTileEntity( - world, - x, - y, - z).getMetal()); - flowIntoBlock(world, x, y + densityDir, z, - 1, - getTileEntity(world, x, y, - z).getMetal()); + if (getTileEntity(world, x, y + densityDir, z) != null && getTileEntity(world, x, y, z) != null) + BlockMoltenMetal.getTileEntity(world, x, y + densityDir, z) + .setMetal(getTileEntity(world, x, y, z).getMetal()); + flowIntoBlock(world, x, y + densityDir, z, 1, getTileEntity(world, x, y, z).getMetal()); return; } // Flow outward if possible - int flowMeta = quantaPerBlock - quantaRemaining - + 1; + int flowMeta = quantaPerBlock - quantaRemaining + 1; if (flowMeta >= quantaPerBlock) return; - if (isSourceBlock(world, x, y, z) - || !isFlowingVertically(world, x, - y, z)) { - if (world.getBlock(x, y - densityDir, - z) == this - && getTileEntity(world, x, - y, - z) != null - && getTileEntity(world, x, - y - densityDir, - z) != null - && areMetalsEqual(world, x, - y, z, x, - y - densityDir, - z)) + if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z)) { + if (world.getBlock(x, y - densityDir, z) == this && getTileEntity(world, x, y, z) != null + && getTileEntity(world, x, y - densityDir, z) != null + && areMetalsEqual(world, x, y, z, x, y - densityDir, z)) flowMeta = 1; - boolean flowTo[] = getOptimalFlowDirections( - world, x, y, z); + boolean flowTo[] = getOptimalFlowDirections(world, x, y, z); if (flowTo[0]) - flowIntoBlock(world, x - 1, y, z, - flowMeta, - getTileEntity(world, - x, - y, - z).getMetal()); + flowIntoBlock(world, x - 1, y, z, flowMeta, getTileEntity(world, x, y, z).getMetal()); if (flowTo[1]) - flowIntoBlock(world, x + 1, y, z, - flowMeta, - getTileEntity(world, - x, - y, - z).getMetal()); + flowIntoBlock(world, x + 1, y, z, flowMeta, getTileEntity(world, x, y, z).getMetal()); if (flowTo[2]) - flowIntoBlock(world, x, y, z - 1, - flowMeta, - getTileEntity(world, - x, - y, - z).getMetal()); + flowIntoBlock(world, x, y, z - 1, flowMeta, getTileEntity(world, x, y, z).getMetal()); if (flowTo[3]) - flowIntoBlock(world, x, y, z + 1, - flowMeta, - getTileEntity(world, - x, - y, - z).getMetal()); + flowIntoBlock(world, x, y, z + 1, flowMeta, getTileEntity(world, x, y, z).getMetal()); } } } - public void flowIntoBlock(World world, int x, int y, int z, - int meta, ItemStack metal) { + public void flowIntoBlock(World world, int x, int y, int z, int meta, ItemStack metal) { if (meta < 0 || world.isRemote) return; if (displaceIfPossible(world, x, y, z)) { world.setBlock(x, y, z, this, meta, 3); if (getTileEntity(world, x, y, z) != null) - getTileEntity(world, x, y, z) - .setMetal(metal); + getTileEntity(world, x, y, z).setMetal(metal); } } - public static TileEntityMoltenMetal getTileEntity(World world, - int x, int y, int z) { + public static TileEntityMoltenMetal getTileEntity(World world, int x, int y, int z) { TileEntity moltenLiquid = world.getTileEntity(x, y, z); - if (moltenLiquid != null - && moltenLiquid instanceof TileEntityMoltenMetal) + if (moltenLiquid != null && moltenLiquid instanceof TileEntityMoltenMetal) return (TileEntityMoltenMetal) moltenLiquid; return null; } - public static boolean areMetalsEqual(World world, int x1, int y1, - int z1, int x2, int y2, int z2) { - return ItemStack.areItemStacksEqual( - getTileEntity(world, x1, y1, z1) - .getMetal(), - getTileEntity(world, x2, y2, z2) - .getMetal()); + public static boolean areMetalsEqual(World world, int x1, int y1, int z1, int x2, int y2, int z2) { + return ItemStack.areItemStacksEqual(getTileEntity(world, x1, y1, z1).getMetal(), + getTileEntity(world, x2, y2, z2).getMetal()); } @SideOnly(Side.CLIENT) - public static int color(IBlockAccess world, int i, int j, int k, - boolean forcecolor, Item itemC) + public static int color(IBlockAccess world, int i, int j, int k, boolean forcecolor, Item itemC) throws IOException { TileEntity te = world.getTileEntity(i, j, k); - if (te instanceof TileEntityMoltenMetal - && ((TileEntityMoltenMetal) te) - .getMetal() != null) - return JewelrycraftUtil.getColor( - ((TileEntityMoltenMetal) te) - .getMetal() - .copy()); + if (te instanceof TileEntityMoltenMetal && ((TileEntityMoltenMetal) te).getMetal() != null) + return JewelrycraftUtil.getColor(((TileEntityMoltenMetal) te).getMetal().copy()); return 16777215; } diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java index dff2a94..b817b80 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java @@ -44,8 +44,7 @@ public class BlockShadow extends BlockContainer { * @param beaconZ * @return */ - public boolean isBeaconBase(World worldObj, int x, int y, int z, - int beaconX, int beaconY, int beaconZ) { + public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { return true; } @@ -73,8 +72,7 @@ public class BlockShadow extends BlockContainer { * @param side * @return */ - public boolean isBlockSolidOnSide(World world, int x, int y, int z, - ForgeDirection side) { + public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) { return false; } @@ -103,8 +101,7 @@ public class BlockShadow extends BlockContainer { public void registerBlockIcons(IIconRegister par1IconRegister) { iconArray = new IIcon[16]; for (int i = 0; i < iconArray.length; ++i) - iconArray[i] = par1IconRegister.registerIcon( - getTextureName() + (15 - i)); + iconArray[i] = par1IconRegister.registerIcon(getTextureName() + (15 - i)); } /** @@ -115,12 +112,10 @@ public class BlockShadow extends BlockContainer { * @return */ @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, - int x, int y, int z) { + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { if (world.getBlockMetadata(x, y, z) == 15) return null; - return super.getCollisionBoundingBoxFromPool(world, x, y, - z); + return super.getCollisionBoundingBoxFromPool(world, x, y, z); } /** @@ -130,9 +125,7 @@ public class BlockShadow extends BlockContainer { * @param par4 */ @Override - public void setBlockBoundsBasedOnState( - IBlockAccess par1IBlockAccess, int par2, int par3, - int par4) { + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } @@ -145,18 +138,14 @@ public class BlockShadow extends BlockContainer { * @return */ @Override - public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, - int p_149646_2_, int p_149646_3_, int p_149646_4_, + public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { - Block block = p_149646_1_.getBlock(p_149646_2_, - p_149646_3_, p_149646_4_); + Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_); if (this == BlockList.shadowBlock) if (block == this) return false; return block == this ? false - : super.shouldSideBeRendered(p_149646_1_, - p_149646_2_, p_149646_3_, - p_149646_4_, p_149646_5_); + : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_); } /** @@ -176,8 +165,7 @@ public class BlockShadow extends BlockContainer { * @return */ @Override - public int getComparatorInputOverride(World world, int x, int y, - int z, int meta) { + public int getComparatorInputOverride(World world, int x, int y, int z, int meta) { return world.getBlockMetadata(x, y, z); } diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java index 553ab05..1e306d2 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java @@ -48,8 +48,7 @@ public class BlockShadowEye extends BlockContainer { * @return */ @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, - int i, int j, int k, int l) { + public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) { return false; } @@ -82,11 +81,9 @@ public class BlockShadowEye extends BlockContainer { * @return */ @Override - public boolean onBlockActivated(World world, int i, int j, int k, - EntityPlayer entityPlayer, int par6, float par7, + public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) { - TileEntityShadowEye tile = (TileEntityShadowEye) world - .getTileEntity(i, j, k); + TileEntityShadowEye tile = (TileEntityShadowEye) world.getTileEntity(i, j, k); if (!tile.active && tile.opening == 1) { tile.active = true; tile.target = entityPlayer; @@ -103,8 +100,7 @@ public class BlockShadowEye extends BlockContainer { * @param player */ @Override - public void onBlockClicked(World world, int i, int j, int k, - EntityPlayer player) { + public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) { // Do nothing } @@ -117,13 +113,9 @@ public class BlockShadowEye extends BlockContainer { * @param par6ItemStack */ @Override - public void onBlockPlacedBy(World world, int i, int j, int k, - EntityLivingBase entityLiving, + public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) { - int rotation = MathHelper - .floor_double(entityLiving.rotationYaw - * 4.0F / 360.0F + 0.5D) - & 3; + int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(i, j, k, rotation, 2); } diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java index 0d9ceb4..44bb2c6 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java @@ -49,8 +49,7 @@ public class BlockShadowHand extends BlockContainer { * @return */ @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, - int i, int j, int k, int l) { + public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) { return false; } @@ -77,10 +76,8 @@ public class BlockShadowHand extends BlockContainer { * @param z * @param stack */ - public void dropItem(World world, double x, double y, double z, - ItemStack stack) { - EntityItem entityitem = new EntityItem(world, x + 0.5D, - y + 1.5D, z + 0.5D, stack); + public void dropItem(World world, double x, double y, double z, ItemStack stack) { + EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack); entityitem.motionX = 0; entityitem.motionZ = 0; entityitem.motionY = 0.11000000298023224D; @@ -96,16 +93,11 @@ public class BlockShadowHand extends BlockContainer { * @param par6 */ @Override - public void breakBlock(World world, int i, int j, int k, - Block block, int par6) { - if (world.getTileEntity(i, j, - k) instanceof TileEntityShadowHand) { - TileEntityShadowHand te = (TileEntityShadowHand) world - .getTileEntity(i, j, k); + public void breakBlock(World world, int i, int j, int k, Block block, int par6) { + if (world.getTileEntity(i, j, k) instanceof TileEntityShadowHand) { + TileEntityShadowHand te = (TileEntityShadowHand) world.getTileEntity(i, j, k); if (te != null && te.getHeldItemStack() != null) { - dropItem(te.getWorldObj(), te.xCoord, - te.yCoord, te.zCoord, - te.getHeldItemStack()); + dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack()); world.removeTileEntity(i, j, k); } } @@ -121,13 +113,9 @@ public class BlockShadowHand extends BlockContainer { * @param par6ItemStack */ @Override - public void onBlockPlacedBy(World world, int i, int j, int k, - EntityLivingBase entityLiving, + public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) { - int rotation = MathHelper - .floor_double(entityLiving.rotationYaw - * 8.0F / 360.0F + 0.5D) - & 7; + int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8.0F / 360.0F + 0.5D) & 7; world.setBlockMetadataWithNotify(i, j, k, rotation, 2); } diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java index 4da1037..5486908 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java @@ -45,10 +45,8 @@ public class BlockSmelter extends BlockContainer { return false; } - public void dropItem(World world, double x, double y, double z, - ItemStack stack) { - EntityItem entityitem = new EntityItem(world, x + 0.5D, - y + 1.3D, z + 0.5D, stack); + public void dropItem(World world, double x, double y, double z, ItemStack stack) { + EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.3D, z + 0.5D, stack); entityitem.motionX = 0; entityitem.motionZ = 0; entityitem.motionY = 0.11000000298023224D; @@ -57,29 +55,19 @@ public class BlockSmelter extends BlockContainer { } @Override - public void breakBlock(World world, int i, int j, int k, - Block block, int meta) { - TileEntitySmelter te = (TileEntitySmelter) world - .getTileEntity(i, j, k); + public void breakBlock(World world, int i, int j, int k, Block block, int meta) { + TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k); if (te != null) { if (te.hasMetal) dropItem(world, i, j, k, te.metal.copy()); - if (te.hasMoltenMetal && te.moltenMetal != null - && Item.getIdFromItem( - te.moltenMetal.getItem()) > 0) { + if (te.hasMoltenMetal && te.moltenMetal != null && Item.getIdFromItem(te.moltenMetal.getItem()) > 0) { int quant = (int) (te.quantity * 10); - ItemStack metalBucket = new ItemStack( - ItemList.bucket); - JewelryNBT.addMetal(metalBucket, - te.moltenMetal.copy()); + ItemStack metalBucket = new ItemStack(ItemList.bucket); + JewelryNBT.addMetal(metalBucket, te.moltenMetal.copy()); if (quant == 9) { - dropItem(world, i, j, k, - new ItemStack(Blocks.cobblestone, - 6)); - dropItem(world, i, j, k, - new ItemStack(Items.lava_bucket)); - dropItem(world, i, j, k, - metalBucket); + dropItem(world, i, j, k, new ItemStack(Blocks.cobblestone, 6)); + dropItem(world, i, j, k, new ItemStack(Items.lava_bucket)); + dropItem(world, i, j, k, metalBucket); } } world.removeTileEntity(i, j, k); @@ -87,146 +75,75 @@ public class BlockSmelter extends BlockContainer { } @Override - public boolean onBlockActivated(World world, int i, int j, int k, - EntityPlayer entityPlayer, int par6, float par7, + public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) { - TileEntitySmelter te = (TileEntitySmelter) world - .getTileEntity(i, j, k); + TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k); ItemStack item = entityPlayer.inventory.getCurrentItem(); - if (te != null && te.hasMoltenMetal && te.quantity >= .9f - && !te.pouring && item != null + if (te != null && te.hasMoltenMetal && te.quantity >= .9f && !te.pouring && item != null && item.getItem() == Items.bucket) { te.quantity = 0f; te.hasMoltenMetal = false; - ItemStack metalBucket = new ItemStack( - ItemList.bucket, 1); + ItemStack metalBucket = new ItemStack(ItemList.bucket, 1); ItemStack ingot = te.moltenMetal.copy(); JewelryNBT.addMetal(metalBucket, ingot); --item.stackSize; - entityPlayer.inventory.addItemStackToInventory( - metalBucket); + entityPlayer.inventory.addItemStackToInventory(metalBucket); te.isDirty = true; return true; } if (te != null && !world.isRemote) { if (te.hasMetal && entityPlayer.isSneaking()) { - dropItem(world, te.xCoord, te.yCoord, - te.zCoord, - te.metal.copy()); + dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.metal.copy()); te.hasMetal = false; te.melting = -1; te.isDirty = true; } - if (item != null && item.getItem() != null - && !(item.getItem() instanceof ItemMoltenMetalBucket)) { + if (item != null && item.getItem() != null && !(item.getItem() instanceof ItemMoltenMetalBucket)) { int index = -1; - for (int a = 0; a < JewelrycraftUtil.jamcraftPlayers - .size(); a++) - if (entityPlayer.getUniqueID() - .toString() - .equals(JewelrycraftUtil.jamcraftPlayers - .get(a))) + for (int a = 0; a < JewelrycraftUtil.jamcraftPlayers.size(); a++) + if (entityPlayer.getUniqueID().toString().equals(JewelrycraftUtil.jamcraftPlayers.get(a))) index = a; if (entityPlayer.capabilities.isCreativeMode) index = 1; - boolean canPlace = JewelrycraftUtil - .isMetal(item) - || JewelrycraftUtil.isOre( - item) - || index >= 0 - || JewelryNBT.ingot( - item) != null; - boolean isOre = false, - oreCoincidesWithMetal = false, - itemCoincidesWithMetal = false, - itemCoincidesWithMoltenMetal = false, - overflow = false; + boolean canPlace = JewelrycraftUtil.isMetal(item) || JewelrycraftUtil.isOre(item) || index >= 0 + || JewelryNBT.ingot(item) != null; + boolean isOre = false, oreCoincidesWithMetal = false, itemCoincidesWithMetal = false, + itemCoincidesWithMoltenMetal = false, overflow = false; isOre = JewelrycraftUtil.isOre(item); - if (te.metal != null && te.metal - .getItem() != null) { + if (te.metal != null && te.metal.getItem() != null) { if (JewelryNBT.ingot(item) == null) - itemCoincidesWithMetal = item - .getItem() - .equals(te.metal.getItem()) - && item.getItemDamage() == te.metal - .getItemDamage(); + itemCoincidesWithMetal = item.getItem().equals(te.metal.getItem()) + && item.getItemDamage() == te.metal.getItemDamage(); else - itemCoincidesWithMetal = item - .getItem() - .equals(te.metal.getItem()) - && item.getItemDamage() == te.metal - .getItemDamage() - && JewelryNBT.ingot( - item) - .getItem() - .equals(JewelryNBT - .ingot(te.metal) - .getItem()) - && JewelryNBT.ingot( - item) - .getItemDamage() == JewelryNBT - .ingot(te.metal) - .getItemDamage(); + itemCoincidesWithMetal = item.getItem().equals(te.metal.getItem()) + && item.getItemDamage() == te.metal.getItemDamage() + && JewelryNBT.ingot(item).getItem().equals(JewelryNBT.ingot(te.metal).getItem()) + && JewelryNBT.ingot(item).getItemDamage() == JewelryNBT.ingot(te.metal).getItemDamage(); } - if (te.moltenMetal != null - && te.moltenMetal - .getItem() != null) { + if (te.moltenMetal != null && te.moltenMetal.getItem() != null) { if (JewelryNBT.ingot(item) == null) - itemCoincidesWithMoltenMetal = item - .getItem() - .equals(te.moltenMetal - .getItem()) - && item.getItemDamage() == te.moltenMetal - .getItemDamage(); + itemCoincidesWithMoltenMetal = item.getItem().equals(te.moltenMetal.getItem()) + && item.getItemDamage() == te.moltenMetal.getItemDamage(); else - itemCoincidesWithMoltenMetal = JewelryNBT - .ingot(item) - .getItem() - .equals(te.moltenMetal - .getItem()) - && JewelryNBT.ingot( - item) - .getItemDamage() == te.moltenMetal - .getItemDamage(); + itemCoincidesWithMoltenMetal = JewelryNBT.ingot(item).getItem().equals(te.moltenMetal.getItem()) + && JewelryNBT.ingot(item).getItemDamage() == te.moltenMetal.getItemDamage(); if (isOre) - oreCoincidesWithMetal = te.moltenMetal - .getItem() - .equals(JewelrycraftUtil - .getIngotFromOre( - item) - .getItem()) - && te.moltenMetal - .getItemDamage() == JewelrycraftUtil - .getIngotFromOre( - item) - .getItemDamage(); + oreCoincidesWithMetal = te.moltenMetal.getItem() + .equals(JewelrycraftUtil.getIngotFromOre(item).getItem()) + && te.moltenMetal.getItemDamage() == JewelrycraftUtil.getIngotFromOre(item) + .getItemDamage(); } - overflow = isOre ? te.metal.stackSize - * 0.2f + te.quantity < 0.8f - : te.metal.stackSize * 0.1f - + te.quantity < 0.9f; - boolean isValid = te.hasMoltenMetal ? isOre - ? oreCoincidesWithMetal - : itemCoincidesWithMoltenMetal + overflow = isOre ? te.metal.stackSize * 0.2f + te.quantity < 0.8f + : te.metal.stackSize * 0.1f + te.quantity < 0.9f; + boolean isValid = te.hasMoltenMetal ? isOre ? oreCoincidesWithMetal : itemCoincidesWithMoltenMetal : true; - if (te.quantity < 0.9f && !te.pouring - && canPlace && isValid) { - boolean check = isOre - ? oreCoincidesWithMetal - && te.quantity < 0.8f - : itemCoincidesWithMoltenMetal; - boolean check2 = isOre - ? oreCoincidesWithMetal - : itemCoincidesWithMetal; - if (!te.hasMetal && !te.hasMoltenMetal - || !te.hasMetal && te.hasMoltenMetal - && check) { - entityPlayer.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocalFormatted( - "chatmessage." + Variables.MODID - + ".smelter.nowsmeltingingot", - item.getDisplayName()))); + if (te.quantity < 0.9f && !te.pouring && canPlace && isValid) { + boolean check = isOre ? oreCoincidesWithMetal && te.quantity < 0.8f : itemCoincidesWithMoltenMetal; + boolean check2 = isOre ? oreCoincidesWithMetal : itemCoincidesWithMetal; + if (!te.hasMetal && !te.hasMoltenMetal || !te.hasMetal && te.hasMoltenMetal && check) { + entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted( + "chatmessage." + Variables.MODID + ".smelter.nowsmeltingingot", + item.getDisplayName()))); te.metal = item.copy(); te.metal.stackSize = 1; te.hasMetal = true; @@ -234,23 +151,11 @@ public class BlockSmelter extends BlockContainer { if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; te.isDirty = true; - } else if (te.hasMetal - && te.hasMoltenMetal - && check2 - && overflow - || te.hasMetal && !te.hasMoltenMetal - && itemCoincidesWithMetal - && overflow) { + } else if (te.hasMetal && te.hasMoltenMetal && check2 && overflow + || te.hasMetal && !te.hasMoltenMetal && itemCoincidesWithMetal && overflow) { entityPlayer.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocalFormatted( - "Smelting extra " - + (isOre ? "ores" - : "ingots") - + " (" - + (te.metal.stackSize - + 1) - + ")"))); + new ChatComponentText(StatCollector.translateToLocalFormatted("Smelting extra " + + (isOre ? "ores" : "ingots") + " (" + (te.metal.stackSize + 1) + ")"))); te.metal.stackSize++; te.hasMetal = true; te.melting += ConfigHandler.INGOT_MELTING_TIME; @@ -259,43 +164,21 @@ public class BlockSmelter extends BlockContainer { te.isDirty = true; } te.isDirty = true; - } else if ((te.hasMetal - || te.hasMoltenMetal) - && !itemCoincidesWithMoltenMetal - && te.quantity < .9f) - entityPlayer.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".smelter.contentdoesnotmatch"))); - else if (!item.getUnlocalizedName() - .toLowerCase() - .contains("ingot") - && item.getDisplayName() - .toLowerCase() - .contains("ingot") - && te.quantity < .9f) - entityPlayer.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".smelter.itemrenamedtoingot"))); + } else if ((te.hasMetal || te.hasMoltenMetal) && !itemCoincidesWithMoltenMetal && te.quantity < .9f) + entityPlayer.addChatMessage(new ChatComponentText(StatCollector + .translateToLocal("chatmessage." + Variables.MODID + ".smelter.contentdoesnotmatch"))); + else if (!item.getUnlocalizedName().toLowerCase().contains("ingot") + && item.getDisplayName().toLowerCase().contains("ingot") && te.quantity < .9f) + entityPlayer.addChatMessage(new ChatComponentText(StatCollector + .translateToLocal("chatmessage." + Variables.MODID + ".smelter.itemrenamedtoingot"))); else if (te.quantity >= .9f) - entityPlayer.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".smelter.full"))); + entityPlayer.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.full"))); else - entityPlayer.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".smelter.cannotsmelt"))); - } else if (item != null && item.getItem() != null - && item.getItem() instanceof ItemMoltenMetalBucket - && !te.hasMoltenMetal - && !te.hasMetal) { + entityPlayer.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.cannotsmelt"))); + } else if (item != null && item.getItem() != null && item.getItem() instanceof ItemMoltenMetalBucket + && !te.hasMoltenMetal && !te.hasMetal) { te.hasMoltenMetal = true; ItemStack ingot = JewelryNBT.ingot(item); te.moltenMetal = ingot; @@ -303,146 +186,84 @@ public class BlockSmelter extends BlockContainer { te.isDirty = true; if (!entityPlayer.capabilities.isCreativeMode) { --item.stackSize; - dropItem(world, entityPlayer.posX, - entityPlayer.posY, - entityPlayer.posZ, + dropItem(world, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, new ItemStack(Items.bucket)); } - } else if (item == null && te.hasMoltenMetal - && te.moltenMetal - .getItem() != null) - entityPlayer.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocalFormatted( - "chatmessage." + Variables.MODID - + ".smelter.hasmolteningot", - te.moltenMetal.getDisplayName() - .replace(" Ingot", - "")))); + } else if (item == null && te.hasMoltenMetal && te.moltenMetal.getItem() != null) + entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted( + "chatmessage." + Variables.MODID + ".smelter.hasmolteningot", + te.moltenMetal.getDisplayName().replace(" Ingot", "")))); world.setTileEntity(i, j, k, te); } return true; } @Override - public void onBlockClicked(World world, int i, int j, int k, - EntityPlayer player) { - TileEntitySmelter te = (TileEntitySmelter) world - .getTileEntity(i, j, k); + public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) { + TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k); TileEntityMolder me = null; - if (world.getBlockMetadata(i, j, k) == 0 - && world.getTileEntity(i, j, k - 1) != null - && world.getTileEntity(i, j, k - - 1) instanceof TileEntityMolder) - me = (TileEntityMolder) world.getTileEntity(i, j, - k - 1); - else if (world.getBlockMetadata(i, j, k) == 1 - && world.getTileEntity(i + 1, j, k) != null - && world.getTileEntity(i + 1, j, - k) instanceof TileEntityMolder) - me = (TileEntityMolder) world.getTileEntity(i + 1, - j, k); - else if (world.getBlockMetadata(i, j, k) == 2 - && world.getTileEntity(i, j, k + 1) != null - && world.getTileEntity(i, j, k - + 1) instanceof TileEntityMolder) - me = (TileEntityMolder) world.getTileEntity(i, j, - k + 1); - else if (world.getBlockMetadata(i, j, k) == 3 - && world.getTileEntity(i - 1, j, k) != null - && world.getTileEntity(i - 1, j, - k) instanceof TileEntityMolder) - me = (TileEntityMolder) world.getTileEntity(i - 1, - j, k); + if (world.getBlockMetadata(i, j, k) == 0 && world.getTileEntity(i, j, k - 1) != null + && world.getTileEntity(i, j, k - 1) instanceof TileEntityMolder) + me = (TileEntityMolder) world.getTileEntity(i, j, k - 1); + else if (world.getBlockMetadata(i, j, k) == 1 && world.getTileEntity(i + 1, j, k) != null + && world.getTileEntity(i + 1, j, k) instanceof TileEntityMolder) + me = (TileEntityMolder) world.getTileEntity(i + 1, j, k); + else if (world.getBlockMetadata(i, j, k) == 2 && world.getTileEntity(i, j, k + 1) != null + && world.getTileEntity(i, j, k + 1) instanceof TileEntityMolder) + me = (TileEntityMolder) world.getTileEntity(i, j, k + 1); + else if (world.getBlockMetadata(i, j, k) == 3 && world.getTileEntity(i - 1, j, k) != null + && world.getTileEntity(i - 1, j, k) instanceof TileEntityMolder) + me = (TileEntityMolder) world.getTileEntity(i - 1, j, k); if (te != null && me != null && !world.isRemote) - if (te.hasMoltenMetal - && isConnectedToMolder(world, i, j, - k) - && me.hasMold && !me.hasMoltenMetal + if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k) && me.hasMold && !me.hasMoltenMetal && !me.hasJewelBase) { te.pouring = true; te.isDirty = true; } else if (te.hasMetal && te.melting > 0) - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocalFormatted( - "chatmessage." + Variables.MODID - + ".smelter.metalismelting", - te.metal.getDisplayName()) - + " (" - + (ConfigHandler.INGOT_MELTING_TIME - * te.metal.stackSize - - te.melting) - * 100 - / (ConfigHandler.INGOT_MELTING_TIME - * te.metal.stackSize) - + "%)")); - else if (te.hasMoltenMetal - && !isConnectedToMolder(world, i, - j, k)) - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".smelter.molderismissing"))); + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted( + "chatmessage." + Variables.MODID + ".smelter.metalismelting", te.metal.getDisplayName()) + " (" + + (ConfigHandler.INGOT_MELTING_TIME * te.metal.stackSize - te.melting) * 100 + / (ConfigHandler.INGOT_MELTING_TIME * te.metal.stackSize) + + "%)")); + else if (te.hasMoltenMetal && !isConnectedToMolder(world, i, j, k)) + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.molderismissing"))); else if (!me.hasMold && te.hasMoltenMetal) - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".smelter.molderhasnomold"))); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.molderhasnomold"))); else if (me.hasMoltenMetal && te.hasMoltenMetal) - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".smelter.molderhasmoltenmetal"))); + player.addChatMessage(new ChatComponentText(StatCollector + .translateToLocal("chatmessage." + Variables.MODID + ".smelter.molderhasmoltenmetal"))); else if (me.hasJewelBase && te.hasMoltenMetal) - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".smelter.modlerhasitem"))); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.modlerhasitem"))); else - player.addChatMessage( - new ChatComponentText( - StatCollector.translateToLocal( - "chatmessage." + Variables.MODID - + ".smelter.empty"))); + player.addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.empty"))); } - public boolean isConnectedToMolder(World world, int i, int j, - int k) { + public boolean isConnectedToMolder(World world, int i, int j, int k) { int blockMeta = world.getBlockMetadata(i, j, k); - if (blockMeta == 0 && world.getBlock(i, j, - k - 1) instanceof BlockMolder) + if (blockMeta == 0 && world.getBlock(i, j, k - 1) instanceof BlockMolder) return true; - else if (blockMeta == 1 && world.getBlock(i + 1, j, - k) instanceof BlockMolder) + else if (blockMeta == 1 && world.getBlock(i + 1, j, k) instanceof BlockMolder) return true; - else if (blockMeta == 2 && world.getBlock(i, j, - k + 1) instanceof BlockMolder) + else if (blockMeta == 2 && world.getBlock(i, j, k + 1) instanceof BlockMolder) return true; - else if (blockMeta == 3 && world.getBlock(i - 1, j, - k) instanceof BlockMolder) + else if (blockMeta == 3 && world.getBlock(i - 1, j, k) instanceof BlockMolder) return true; return false; } @Override - public void onBlockPlacedBy(World world, int i, int j, int k, - EntityLivingBase entityLiving, + public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) { - int rotation = MathHelper - .floor_double(entityLiving.rotationYaw - * 4.0F / 360.0F + 0.5D) - & 3; + int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(i, j, k, rotation, 2); } @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, - int i, int j, int k, int l) { + public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) { return false; } diff --git a/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java b/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java index f8344b6..e3bba43 100755 --- a/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java +++ b/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java @@ -26,19 +26,15 @@ import net.minecraft.world.IBlockAccess; @SideOnly(Side.CLIENT) public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { @Override - public void renderInventoryBlock(Block block, int metadata, - int modelID, RenderBlocks renderer) { + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); tessellator.startDrawingQuads(); if (metadata < 16) - tessellator.setColorRGBA_I( - BlockCrystal.colors[metadata], - 100); + tessellator.setColorRGBA_I(BlockCrystal.colors[metadata], 100); GL11.glTranslatef(-0.5f, -0.5f, -0.5f); - this.renderWorldBlock(null, 0, 0, 0, block, modelID, - renderer); + this.renderWorldBlock(null, 0, 0, 0, block, modelID, renderer); tessellator.draw(); GL11.glTranslatef(0.5f, 0.5f, 0.5f); GL11.glEnable(GL11.GL_LIGHTING); @@ -46,8 +42,7 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { } @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, - int z, Block block, int modelId, + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { int crystals = 5; Random rnd = new Random(); @@ -58,13 +53,8 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { double umax = icon.getMaxU(); double vmax = icon.getMaxV(); tessellator.addTranslation(x, y, z); - if (world != null && world.getTileEntity(x, y, z) != null - && ConfigHandler.CRYSTAL_GLOW) - tessellator.setBrightness( - ((TileEntityCrystal) world - .getTileEntity(x, - y, - z)).shine); + if (world != null && world.getTileEntity(x, y, z) != null && ConfigHandler.CRYSTAL_GLOW) + tessellator.setBrightness(((TileEntityCrystal) world.getTileEntity(x, y, z)).shine); else tessellator.setBrightness(230); // 37435, 76464 @@ -73,164 +63,88 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { else rnd.setSeed(76464); if (world != null && world.getBlockMetadata(x, y, z) < 16) - tessellator.setColorRGBA_I( - BlockCrystal.colors[world - .getBlockMetadata( - x, - y, - z)], - 100); - crystal(tessellator, umin, vmin, umax, vmax, 0.8D, 0.2D, - 0D, 0D, 0D, 0.0D, 0.0D); + tessellator.setColorRGBA_I(BlockCrystal.colors[world.getBlockMetadata(x, y, z)], 100); + crystal(tessellator, umin, vmin, umax, vmax, 0.8D, 0.2D, 0D, 0D, 0D, 0.0D, 0.0D); for (int i = 0; i < crystals; i++) { double rotation = Math.PI * 2.0f / crystals * i; - double xp1 = Math.sin(rotation) - * ((0.15F + rnd.nextFloat()) / 2f); - double zp1 = Math.cos(rotation) - * ((0.15F + rnd.nextFloat()) / 2f); + double xp1 = Math.sin(rotation) * ((0.15F + rnd.nextFloat()) / 2f); + double zp1 = Math.cos(rotation) * ((0.15F + rnd.nextFloat()) / 2f); double height = 0.2f + rnd.nextFloat(); double topHeight = 0.1f + rnd.nextFloat() / 2f; - crystal(tessellator, umin, vmin, umax, vmax, - height, topHeight, -xp1, 0D, zp1, - xp1, zp1); + crystal(tessellator, umin, vmin, umax, vmax, height, topHeight, -xp1, 0D, zp1, xp1, zp1); } if (world != null) { crystals = 4; for (int i = 0; i < crystals; i++) { - double rotation = Math.PI * 2F / crystals - * i; - double xp1 = Math.sin(rotation) * ((0.15F - + rnd.nextFloat()) / 2f); - double zp1 = Math.cos(rotation) * ((0.15F - + rnd.nextFloat()) / 2f); + double rotation = Math.PI * 2F / crystals * i; + double xp1 = Math.sin(rotation) * ((0.15F + rnd.nextFloat()) / 2f); + double zp1 = Math.cos(rotation) * ((0.15F + rnd.nextFloat()) / 2f); double height = 0.1f + rnd.nextFloat(); - double topHeight = 0.1f - + rnd.nextFloat() / 2f; - float xOff = (rnd.nextFloat() * 1.5f - - 0.5f) - * (rnd.nextFloat() / 2f); - float zOff = (rnd.nextFloat() * 1.5f - - 0.5f) - * (rnd.nextFloat() / 2f); - crystal(tessellator, umin, vmin, umax, - vmax, height, topHeight, - xOff, 0D, zOff, xp1, zp1); + double topHeight = 0.1f + rnd.nextFloat() / 2f; + float xOff = (rnd.nextFloat() * 1.5f - 0.5f) * (rnd.nextFloat() / 2f); + float zOff = (rnd.nextFloat() * 1.5f - 0.5f) * (rnd.nextFloat() / 2f); + crystal(tessellator, umin, vmin, umax, vmax, height, topHeight, xOff, 0D, zOff, xp1, zp1); } } tessellator.addTranslation(-x, -y, -z); return true; } - private static void crystal(Tessellator tessellator, double umin, - double vmin, double umax, double vmax, - double height, double topHeight, double posX, - double posY, double posZ, double rotX, - double rotZ) { + private static void crystal(Tessellator tessellator, double umin, double vmin, double umax, double vmax, + double height, double topHeight, double posX, double posY, double posZ, double rotX, double rotZ) { // Negative X - tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, - 0.6 - rotZ + posZ, umin, vmin); - tessellator.addVertexWithUV(0.4 - rotX + posX, - height + posY, 0.6 + rotZ + posZ, umin, - vmax); - tessellator.addVertexWithUV(0.4 - rotX + posX, - height + posY, 0.4 + rotZ + posZ, umax, - vmax); - tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, - 0.4 - rotZ + posZ, umax, vmin); + tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin); + tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmax); + tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmax); + tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmin); // Positive X - tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, - 0.4 - rotZ + posZ, umin, vmin); - tessellator.addVertexWithUV(0.6 - rotX + posX, - height + posY, 0.4 + rotZ + posZ, umin, - vmax); - tessellator.addVertexWithUV(0.6 - rotX + posX, - height + posY, 0.6 + rotZ + posZ, umax, - vmax); - tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, - 0.6 - rotZ + posZ, umax, vmin); + tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmin); + tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmax); + tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmax); + tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin); // Negative Z - tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, - 0.4 - rotZ + posZ, umin, vmin); - tessellator.addVertexWithUV(0.4 - rotX + posX, - height + posY, 0.4 + rotZ + posZ, umin, - vmax); - tessellator.addVertexWithUV(0.6 - rotX + posX, - height + posY, 0.4 + rotZ + posZ, umax, - vmax); - tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, - 0.4 - rotZ + posZ, umax, vmin); + tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmin); + tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmax); + tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmax); + tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmin); // Positive Z - tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, - 0.6 - rotZ + posZ, umin, vmin); - tessellator.addVertexWithUV(0.6 - rotX + posX, - height + posY, 0.6 + rotZ + posZ, umin, + tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin); + tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmax); + tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmax); + tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin); + // Top -X + tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmin); + tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax); - tessellator.addVertexWithUV(0.4 - rotX + posX, - height + posY, 0.6 + rotZ + posZ, umax, + tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax); - tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, - 0.6 - rotZ + posZ, umax, vmin); - // Top -X - tessellator.addVertexWithUV(0.4 - rotX + posX, - height + posY, 0.6 + rotZ + posZ, umin, - vmin); - tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, - height + topHeight + posY, - 0.5 + rotZ + rotZ + posZ, umin, vmax); - tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, - height + topHeight + posY, - 0.5 + rotZ + rotZ + posZ, umax, vmax); - tessellator.addVertexWithUV(0.4 - rotX + posX, - height + posY, 0.4 + rotZ + posZ, umax, - vmin); + tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmin); // Top +X - tessellator.addVertexWithUV(0.6 - rotX + posX, - height + posY, 0.4 + rotZ + posZ, umin, - vmin); - tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, - height + topHeight + posY, - 0.5 + rotZ + rotZ + posZ, umin, vmax); - tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, - height + topHeight + posY, - 0.5 + rotZ + rotZ + posZ, umax, vmax); - tessellator.addVertexWithUV(0.6 - rotX + posX, - height + posY, 0.6 + rotZ + posZ, umax, - vmin); + tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmin); + tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, + vmax); + tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, + vmax); + tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmin); // Top +Z - tessellator.addVertexWithUV(0.6 - rotX + posX, - height + posY, 0.6 + rotZ + posZ, umin, - vmin); - tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, - height + topHeight + posY, - 0.5 + rotZ + rotZ + posZ, umin, vmax); - tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, - height + topHeight + posY, - 0.5 + rotZ + rotZ + posZ, umax, vmax); - tessellator.addVertexWithUV(0.4 - rotX + posX, - height + posY, 0.6 + rotZ + posZ, umax, - vmin); + tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmin); + tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, + vmax); + tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, + vmax); + tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmin); // Top -Z - tessellator.addVertexWithUV(0.4 - rotX + posX, - height + posY, 0.4 + rotZ + posZ, umin, - vmin); - tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, - height + topHeight + posY, - 0.5 + rotZ + rotZ + posZ, umin, vmax); - tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, - height + topHeight + posY, - 0.5 + rotZ + rotZ + posZ, umax, vmax); - tessellator.addVertexWithUV(0.6 - rotX + posX, - height + posY, 0.4 + rotZ + posZ, umax, - vmin); + tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmin); + tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, + vmax); + tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, + vmax); + tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmin); // Bottom - tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, - 0.6 - rotZ + posZ, umin, vmin); - tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, - 0.4 - rotZ + posZ, umin, vmax); - tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, - 0.4 - rotZ + posZ, umax, vmax); - tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, - 0.6 - rotZ + posZ, umax, vmin); + tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin); + tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmax); + tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmax); + tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin); } @Override -- cgit v1.2.3