From 9a4d1e95ea7784f0f98ea2913701a3a3c28aefaa Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 24 May 2018 16:03:42 -0400 Subject: Formatting pass --- .../jewelrycraft/block/BlockCrystal.java | 32 +- .../jewelrycraft/block/BlockDisplayer.java | 165 +++++---- .../jewelrycraft/block/BlockHandPedestal.java | 40 +- .../jewelrycraft/block/BlockItemCrystal.java | 7 +- .../block/BlockJewelersCraftingTable.java | 103 +++--- .../darkknight/jewelrycraft/block/BlockList.java | 110 +++--- .../jewelrycraft/block/BlockMidasTouch.java | 18 +- .../darkknight/jewelrycraft/block/BlockMolder.java | 115 +++--- .../jewelrycraft/block/BlockMoltenMetal.java | 361 +++++++++++++----- .../darkknight/jewelrycraft/block/BlockShadow.java | 25 +- .../jewelrycraft/block/BlockShadowEye.java | 21 +- .../jewelrycraft/block/BlockShadowHand.java | 31 +- .../jewelrycraft/block/BlockSmelter.java | 405 ++++++++++++--------- .../block/render/BlockCrystalRenderer.java | 184 ++++++---- 14 files changed, 1010 insertions(+), 607 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 3ecbcd6..98416c2 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java @@ -26,9 +26,12 @@ 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); @@ -72,7 +75,8 @@ 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)]; } @@ -82,19 +86,21 @@ 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; + ? tileentity.receiveClientEvent(eventNo, + arg) + : false; } @Override @@ -102,8 +108,10 @@ public class BlockCrystal extends Block implements ITileEntityProvider { 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 eff1f6d..d84cbf7 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java @@ -54,8 +54,8 @@ 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; } @@ -89,14 +89,14 @@ public class BlockDisplayer extends BlockContainer { */ @Override 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); + EntityPlayer entityPlayer, int par6, float par7, + float par8, float par9) { + 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) + if (item != null && item != new ItemStack( + Item.getItemById(0), 0, 0) && !world.isRemote) { if (!te.hasObject) { te.object = item.copy(); @@ -104,68 +104,82 @@ public class BlockDisplayer extends BlockContainer { 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() + } else if (te.object.getItem() == item + .getItem() && te.object != null - && te.object != new ItemStack(Item.getItemById(0), + && te.object != new ItemStack( + Item.getItemById( + 0), 0, 0) && te.object.getItemDamage() == item .getItemDamage()) - if (te.object.hasTagCompound() && item.hasTagCompound() + 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() + } 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() + 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) + Item.getItemById( + 0), + 0, + 0) && te.object.getItemDamage() == item .getItemDamage()) if (te.object.hasTagCompound() && item.hasTagCompound() - && te.object.getTagCompound().equals( - item.getTagCompound())) { + && 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() + } 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) { + && te.hasObject + && te.object.getItem() != null) { te.quantity += 64; te.isDirty = true; } @@ -184,47 +198,59 @@ public class BlockDisplayer extends BlockContainer { @Override public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) { - TileEntityDisplayer te = - (TileEntityDisplayer) world.getTileEntity(i, j, k); + 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)) + && 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; } @@ -241,8 +267,8 @@ public class BlockDisplayer extends BlockContainer { */ 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 entityitem = new EntityItem(world, x + 0.5D, + y + 1.5D, z + 0.5D, stack); entityitem.motionX = 0; entityitem.motionZ = 0; entityitem.motionY = 0.11000000298023224D; @@ -258,14 +284,14 @@ 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); @@ -281,9 +307,12 @@ public class BlockDisplayer extends BlockContainer { */ @Override 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; + EntityLivingBase entityLiving, + ItemStack par6ItemStack) { + 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 e4b8efc..2cfe437 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java @@ -51,8 +51,8 @@ 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; } @@ -86,13 +86,14 @@ public class BlockHandPedestal extends BlockContainer { */ @Override 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); + EntityPlayer entityPlayer, int par6, float par7, + float par8, float par9) { + TileEntityHandPedestal te = (TileEntityHandPedestal) world + .getTileEntity(i, j, k); ItemStack item = entityPlayer.inventory.getCurrentItem(); if (te != null) { - if (!world.isRemote && te.getHeldItemStack() == null + if (!world.isRemote + && te.getHeldItemStack() == null && item != null) { te.setHeldItemStack(item.copy()); if (!entityPlayer.capabilities.isCreativeMode) @@ -100,7 +101,8 @@ public class BlockHandPedestal extends BlockContainer { te.markDirty(); } else if (entityPlayer.isSneaking()) if (entityPlayer.inventory - .addItemStackToInventory(te.getHeldItemStack())) { + .addItemStackToInventory(te + .getHeldItemStack())) { te.removeHeldItemStack(); } te.markDirty(); @@ -117,8 +119,8 @@ public class BlockHandPedestal extends BlockContainer { */ 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 entityitem = new EntityItem(world, x + 0.5, + y + 1.5, z + 0.5, stack); entityitem.motionX = 0; entityitem.motionZ = 0; entityitem.motionY = 0.11000000298023224D; @@ -134,13 +136,13 @@ 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); @@ -156,9 +158,11 @@ public class BlockHandPedestal extends BlockContainer { */ @Override public void onBlockPlacedBy(World world, int i, int j, int k, - EntityLivingBase entityLiving, ItemStack par6ItemStack) { + EntityLivingBase entityLiving, + ItemStack par6ItemStack) { int rotation = MathHelper.floor_double( - entityLiving.rotationYaw * 8 / 360 + 0.5) & 7; + 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 6a82701..2b76784 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java @@ -19,14 +19,17 @@ 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; + ? 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 e8a1431..2bd78ac 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java @@ -41,19 +41,21 @@ public class BlockJewelersCraftingTable extends BlockContainer { @Override 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); + EntityPlayer entityPlayer, int par6, float par7, + float par8, float par9) { + 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; @@ -73,8 +75,8 @@ public class BlockJewelersCraftingTable extends BlockContainer { 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 entityitem = new EntityItem(world, x + 0.5D, + y + 1D, z + 0.5D, stack); entityitem.motionX = 0; entityitem.motionZ = 0; entityitem.motionY = 0.21000000298023224D; @@ -82,20 +84,21 @@ 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, + 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, + dropItem(te.getWorldObj(), te.xCoord, + te.yCoord, te.zCoord, te.endItem.copy()); world.removeTileEntity(i, j, k); } @@ -104,18 +107,20 @@ public class BlockJewelersCraftingTable extends BlockContainer { @Override 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; + EntityLivingBase entityLiving, + ItemStack par6ItemStack) { + 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); + TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world + .getTileEntity(i, j, k); if (te != null && !world.isRemote) if (player.isSneaking()) { if (te.hasJewelry) @@ -124,30 +129,38 @@ public class BlockJewelersCraftingTable extends BlockContainer { te.removeGem(); } else if (te.hasEndItem) te.removeResult(); - else if (te.hasJewelry && te.hasGem && te.carving > 0 + 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 - + "%)")); + 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 cd928b8..5fe71d5 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockList.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockList.java @@ -23,70 +23,92 @@ 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 Block shadowOre, smelter, molder, + displayer, jewelCraftingTable, shadowBlock, + shadowEye, handPedestal, shadowHand, + midasTouchBlock, crystal; public static BlockMoltenMetal moltenMetal; - public static Fluid moltenMetalFluid; + public static Fluid moltenMetalFluid; - public static void preInit( - FMLPreInitializationEvent e) { - shadowOre = new BlockJCOre().setHardness(3.0F).setResistance(5.0F) + 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") + .setBlockTextureName(Variables.MODID + + ":oreShadow") + .setBlockName(Variables.MODID + + ".oreShadow") .setCreativeTab(JewelrycraftMod.jewelrycraft); - smelter = new BlockSmelter().setHardness(5.0F).setResistance(6.0F) + 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) + .setResistance(6.0F) + .setStepSound(Block.soundTypePiston) .setBlockName(Variables.MODID + ".molder") .setCreativeTab(JewelrycraftMod.jewelrycraft); - displayer = new BlockDisplayer(Material.iron).setHardness(5.0F) - .setResistance(6.0F).setStepSound(Block.soundTypeMetal) - .setBlockName(Variables.MODID + ".displayer") - .setCreativeTab(JewelrycraftMod.jewelrycraft); - jewelCraftingTable = new BlockJewelersCraftingTable(Material.rock) - .setHardness(3.0F).setResistance(5.0F) - .setStepSound(Block.soundTypePiston) - .setBlockName(Variables.MODID + ".jewelCraftingTable") + displayer = new BlockDisplayer(Material.iron) + .setHardness(5.0F).setResistance(6.0F) + .setStepSound(Block.soundTypeMetal) + .setBlockName(Variables.MODID + + ".displayer") .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") + .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") + .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") + .setBlockName(Variables.MODID + + ".handPedestal") .setCreativeTab(JewelrycraftMod.jewelrycraft); shadowHand = new BlockShadowHand(Material.rock) .setStepSound(Block.soundTypePiston) - .setBlockName(Variables.MODID + ".shadowHand") + .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); + .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) + crystal = new BlockCrystal().setHardness(2.0F) + .setResistance(5.0F) .setStepSound(Block.soundTypeGlass) - .setBlockTextureName(Variables.MODID + ":blockCrystal") - .setBlockName(Variables.MODID + ".blockCrystal") + .setBlockTextureName(Variables.MODID + + ":blockCrystal") + .setBlockName(Variables.MODID + + ".blockCrystal") .setCreativeTab(JewelrycraftMod.jewelrycraft); GameRegistry.registerBlock(shadowOre, "shadowOre"); @@ -97,10 +119,13 @@ public class BlockList { "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(midasTouchBlock, + "Midas Touch Block"); + GameRegistry.registerBlock(moltenMetal, + "moltenMetalLiquid"); GameRegistry.registerBlock(crystal, BlockItemCrystal.class, "crystalBlock"); @@ -113,11 +138,13 @@ public class BlockList { Variables.MODID + ":table"); GameRegistry.registerTileEntity(TileEntityDisplayer.class, Variables.MODID + ":displayer"); - GameRegistry.registerTileEntity(TileEntityBlockShadow.class, + GameRegistry.registerTileEntity( + TileEntityBlockShadow.class, Variables.MODID + ":blockShadow"); GameRegistry.registerTileEntity(TileEntityShadowEye.class, Variables.MODID + ":shadowEye"); - GameRegistry.registerTileEntity(TileEntityHandPedestal.class, + GameRegistry.registerTileEntity( + TileEntityHandPedestal.class, Variables.MODID + ":handPedestal"); GameRegistry.registerTileEntity(TileEntityShadowHand.class, Variables.MODID + ":shadowHand"); @@ -125,7 +152,8 @@ public class BlockList { Variables.MODID + ":midsaTouch"); GameRegistry.registerTileEntity(TileEntityCrystal.class, Variables.MODID + ":crystalBlock"); - GameRegistry.registerTileEntity(TileEntityMoltenMetal.class, + GameRegistry.registerTileEntity( + TileEntityMoltenMetal.class, Variables.MODID + ":moltenMetalTE"); OreDictionary.registerOre("oreShadow", diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java b/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java index 19e0190..8713796 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java @@ -30,8 +30,8 @@ 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; } @@ -66,13 +66,17 @@ public class BlockMidasTouch extends BlockContainer { 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, + this.setBlockBounds(0.5f + - ((TileEntityMidasTouch) tile).target.width + / 2, 0F, - 0.5f - ((TileEntityMidasTouch) tile).target.width / 2, - 0.5f + ((TileEntityMidasTouch) tile).target.width / 2, + 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); + 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 7d7b34d..4f763ad 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java @@ -42,45 +42,48 @@ public class BlockMolder extends BlockContainer { @Override 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); + EntityPlayer entityPlayer, int par6, float par7, + float par8, float par9) { + 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); + 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); + 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; @@ -88,17 +91,18 @@ 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, + 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); @@ -106,47 +110,60 @@ public class BlockMolder extends BlockContainer { @Override 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; + EntityLivingBase entityLiving, + ItemStack par6ItemStack) { + 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); + 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, + dropItem(me.getWorldObj(), me.xCoord, + me.yCoord, me.zCoord, me.jewelBase.copy()); - me.jewelBase = new ItemStack(Item.getItemById(0), 0, 0); + 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 - + "%)")); + 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.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 088a5e2..6d88443 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java @@ -45,21 +45,23 @@ 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); @@ -91,7 +93,8 @@ 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) { @@ -101,67 +104,191 @@ public class BlockMoltenMetal extends BlockFluidClassic } @Override - public void updateTick(World world, int x, int y, int z, Random rand) { + 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)) + || (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, + && 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 - && 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, + && 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, + && 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, + && 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))) + && 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, + 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, + 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, + 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, + 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; } @@ -169,75 +296,119 @@ public class BlockMoltenMetal extends BlockFluidClassic 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); } } } - // This is a "source" block, set meta to zero, and send a + // This is a "source" block, set meta to zero, and + // 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, + || !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)) + && 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) @@ -248,18 +419,24 @@ public class BlockMoltenMetal extends BlockFluidClassic 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()); + 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) throws IOException { + boolean forcecolor, Item itemC) + throws IOException { TileEntity te = world.getTileEntity(i, j, k); if (te instanceof TileEntityMoltenMetal - && ((TileEntityMoltenMetal) te).getMetal() != null) + && ((TileEntityMoltenMetal) te) + .getMetal() != null) return JewelrycraftUtil.getColor( - ((TileEntityMoltenMetal) te).getMetal().copy()); + ((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 a311c1f..dff2a94 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java @@ -103,8 +103,8 @@ 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)); } /** @@ -119,7 +119,8 @@ public class BlockShadow extends BlockContainer { 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); } /** @@ -129,8 +130,9 @@ 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); } @@ -146,14 +148,15 @@ public class BlockShadow extends BlockContainer { 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_); } /** @@ -173,8 +176,8 @@ 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 85c552d..553ab05 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java @@ -48,8 +48,8 @@ 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; } @@ -83,10 +83,10 @@ public class BlockShadowEye extends BlockContainer { */ @Override 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); + EntityPlayer entityPlayer, int par6, float par7, + float par8, float par9) { + TileEntityShadowEye tile = (TileEntityShadowEye) world + .getTileEntity(i, j, k); if (!tile.active && tile.opening == 1) { tile.active = true; tile.target = entityPlayer; @@ -118,9 +118,12 @@ public class BlockShadowEye extends BlockContainer { */ @Override 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; + EntityLivingBase entityLiving, + ItemStack par6ItemStack) { + 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 6d4cee1..0d9ceb4 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java @@ -49,8 +49,8 @@ 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; } @@ -79,8 +79,8 @@ public class BlockShadowHand extends BlockContainer { */ 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 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,13 +96,15 @@ 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, + dropItem(te.getWorldObj(), te.xCoord, + te.yCoord, te.zCoord, te.getHeldItemStack()); world.removeTileEntity(i, j, k); } @@ -120,9 +122,12 @@ public class BlockShadowHand extends BlockContainer { */ @Override 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; + EntityLivingBase entityLiving, + ItemStack par6ItemStack) { + 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 ea5e991..4da1037 100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java @@ -47,8 +47,8 @@ public class BlockSmelter extends BlockContainer { 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 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,24 +57,29 @@ 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) { + && 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)); + 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, + metalBucket); } } world.removeTileEntity(i, j, k); @@ -83,115 +88,145 @@ public class BlockSmelter extends BlockContainer { @Override 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); + EntityPlayer entityPlayer, int par6, float par7, + float par8, float par9) { + 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 && 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, + 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, + 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) { + && te.moltenMetal + .getItem() != null) { if (JewelryNBT.ingot(item) == null) - itemCoincidesWithMoltenMetal = item.getItem() - .equals(te.moltenMetal.getItem()) + 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() + oreCoincidesWithMetal = te.moltenMetal + .getItem() .equals(JewelrycraftUtil - .getIngotFromOre(item).getItem()) + .getIngotFromOre( + item) + .getItem()) && te.moltenMetal .getItemDamage() == JewelrycraftUtil - .getIngotFromOre(item) + .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 - : true; - if (te.quantity < 0.9f && !te.pouring && canPlace - && isValid) { + 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 + ? oreCoincidesWithMetal + && te.quantity < 0.8f : itemCoincidesWithMoltenMetal; - boolean check2 = isOre ? oreCoincidesWithMetal + 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.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; @@ -199,19 +234,23 @@ public class BlockSmelter extends BlockContainer { if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; te.isDirty = true; - } else if (te.hasMetal && te.hasMoltenMetal && check2 + } 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) - + ")"))); + entityPlayer.addChatMessage( + 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; @@ -220,34 +259,43 @@ public class BlockSmelter extends BlockContainer { te.isDirty = true; } te.isDirty = true; - } else if ((te.hasMetal || te.hasMoltenMetal) + } 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() + entityPlayer.addChatMessage( + new ChatComponentText( + StatCollector.translateToLocal( + "chatmessage." + Variables.MODID + + ".smelter.contentdoesnotmatch"))); + else if (!item.getUnlocalizedName() + .toLowerCase() .contains("ingot") - && item.getDisplayName().toLowerCase() + && item.getDisplayName() + .toLowerCase() .contains("ingot") && te.quantity < .9f) - entityPlayer.addChatMessage(new ChatComponentText( - StatCollector.translateToLocal("chatmessage." - + Variables.MODID - + ".smelter.itemrenamedtoingot"))); + 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"))); + 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 + && !te.hasMetal) { te.hasMoltenMetal = true; ItemStack ingot = JewelryNBT.ingot(item); te.moltenMetal = ingot; @@ -255,18 +303,22 @@ public class BlockSmelter extends BlockContainer { te.isDirty = true; if (!entityPlayer.capabilities.isCreativeMode) { --item.stackSize; - dropItem(world, entityPlayer.posX, entityPlayer.posY, + 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", "")))); + && 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; @@ -275,99 +327,122 @@ public class BlockSmelter extends BlockContainer { @Override public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) { - TileEntitySmelter te = - (TileEntitySmelter) world.getTileEntity(i, j, k); + 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); + && 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); + 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); + && 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); + me = (TileEntityMolder) world.getTileEntity(i - 1, + j, k); if (te != null && me != null && !world.isRemote) - if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k) + 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) - + "%)")); + 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"))); + && !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, ItemStack par6ItemStack) { - int rotation = MathHelper.floor_double( - entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + EntityLivingBase entityLiving, + ItemStack par6ItemStack) { + 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 a60c8cc..f8344b6 100755 --- a/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java +++ b/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java @@ -33,9 +33,12 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { 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); @@ -44,7 +47,8 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, - int z, Block block, int modelId, RenderBlocks renderer) { + int z, Block block, int modelId, + RenderBlocks renderer) { int crystals = 5; Random rnd = new Random(); Tessellator tessellator = Tessellator.instance; @@ -56,8 +60,11 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { 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); + tessellator.setBrightness( + ((TileEntityCrystal) world + .getTileEntity(x, + y, + z)).shine); else tessellator.setBrightness(230); // 37435, 76464 @@ -67,37 +74,47 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { rnd.setSeed(76464); if (world != null && world.getBlockMetadata(x, y, z) < 16) tessellator.setColorRGBA_I( - BlockCrystal.colors[world.getBlockMetadata(x, y, z)], + 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); + 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) + 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) + float zOff = (rnd.nextFloat() * 1.5f + - 0.5f) * (rnd.nextFloat() / 2f); - crystal(tessellator, umin, vmin, umax, vmax, height, - topHeight, xOff, 0D, zOff, xp1, zp1); + crystal(tessellator, umin, vmin, umax, + vmax, height, topHeight, + xOff, 0D, zOff, xp1, zp1); } } tessellator.addTranslation(-x, -y, -z); @@ -105,89 +122,106 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { } 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) { + 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, + 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, + 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.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, vmax); - tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, - 0.6 + rotZ + posZ, umax, vmax); + 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.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); + 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); + height + topHeight + posY, + 0.5 + rotZ + rotZ + posZ, umax, vmax); + 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.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); + 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); + 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.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); + 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); + 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.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); + 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); + 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); -- cgit v1.2.3