From c19aeae6ae51ca9019f8051f83ab7eb52f4a1608 Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Thu, 30 Apr 2015 01:25:36 +0100 Subject: - Hand Pedestals no longer close the palm when you put something in - Fixed the ritual crashing - Fixed the Liquids Tab from crashing --- .../jewelrycraft/block/BlockHandPedestal.java | 2 -- .../jewelrycraft/item/ItemBaseJewelry.java | 1 + .../jewelrycraft/item/ItemMoltenMetal.java | 9 ++++++-- .../tileentity/TileEntityShadowEye.java | 26 ++++++++++++---------- .../darkknight/jewelrycraft/util/Variables.java | 2 +- src/main/resources/mcmod.info | 2 +- 6 files changed, 24 insertions(+), 18 deletions(-) (limited to 'src/main') diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java b/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java index 6fe5b7f..f88048e 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java @@ -98,12 +98,10 @@ public class BlockHandPedestal extends BlockContainer if (te != null){ if (!world.isRemote && te.getHeldItemStack() == null && item != null){ te.setHeldItemStack(item.copy()); - te.closeHand(); if (!entityPlayer.capabilities.isCreativeMode) item.stackSize--; te.markDirty(); }else if (entityPlayer.isSneaking()) if (entityPlayer.inventory.addItemStackToInventory(te.getHeldItemStack())){ te.removeHeldItemStack(); - te.openHand(); } te.markDirty(); } diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java b/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java index 0d97e22..f5c7848 100644 --- a/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java @@ -17,6 +17,7 @@ import net.minecraft.client.resources.IResourceManager; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java index 29e678f..09054db 100644 --- a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java @@ -22,7 +22,6 @@ import darkknight.jewelrycraft.util.Variables; public class ItemMoltenMetal extends Item { - /** * */ @@ -68,9 +67,15 @@ public class ItemMoltenMetal extends Item public static int color(ItemStack stack, int pass) throws IOException { IResourceManager rm = Minecraft.getMinecraft().getResourceManager(); + ResourceLocation ingot; BufferedImage icon; if (stack != null && JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0 && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215){ - ResourceLocation ingot = ItemBaseJewelry.getLocation(JewelryNBT.ingot(stack), stack, false); + try{ + ingot = ItemBaseJewelry.getLocation(JewelryNBT.ingot(stack), stack, false); + } + catch(Exception e){ + ingot = new ResourceLocation("textures/items/apple.png"); + } icon = ImageIO.read(rm.getResource(ingot).getInputStream()); int height = icon.getHeight(); int width = icon.getWidth(); diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java index 1f7371c..1e56431 100644 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java @@ -77,9 +77,8 @@ public class TileEntityShadowEye extends TileEntity boolean canStartRitual = valid && ((TileEntityHandPedestal)worldObj.getTileEntity(xCoord, yCoord - 3, zCoord)).heldItemStack != null && getNumberOfItems(worldObj, xCoord, yCoord, zCoord) > 0; if (active){ timer--; - if(canStartRitual && canChangePedestals(worldObj, xCoord, yCoord, zCoord) && opening == 4) changePedestals(worldObj, xCoord, yCoord, zCoord); + if (canStartRitual && canChangePedestals(worldObj, xCoord, yCoord, zCoord) && opening == 4) changePedestals(worldObj, xCoord, yCoord, zCoord); } - if (active && target != null && this.getDistanceFrom(target.posX, target.posY, target.posZ) > 30D){ active = false; timer = -1; @@ -303,11 +302,13 @@ public class TileEntityShadowEye extends TileEntity int l = world.getBlockMetadata(x, y, z); world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(world.getBlock(x, y, z))); TileEntityShadowHand tile = new TileEntityShadowHand(); - if(((TileEntityHandPedestal)world.getTileEntity(x, y, z)).heldItemStack != null) tile.setHeldItemStack(((TileEntityHandPedestal)world.getTileEntity(x, y, z)).heldItemStack.copy()); - if(tile.heldItemStack != null) tile.closeHand(); - ((TileEntityHandPedestal)world.getTileEntity(x, y, z)).removeHeldItemStack(); - world.setBlock(x, y, z, BlockList.shadowHand, l, 2); - world.setTileEntity(x, y, z, tile); + if (world.getTileEntity(x, y, z) instanceof TileEntityHandPedestal){ + if (((TileEntityHandPedestal)world.getTileEntity(x, y, z)).heldItemStack != null) tile.setHeldItemStack(((TileEntityHandPedestal)world.getTileEntity(x, y, z)).heldItemStack.copy()); + if (tile.heldItemStack != null) tile.closeHand(); + ((TileEntityHandPedestal)world.getTileEntity(x, y, z)).removeHeldItemStack(); + world.setBlock(x, y, z, BlockList.shadowHand, l, 2); + world.setTileEntity(x, y, z, tile); + } } public void revertPedestals(World world, int x, int y, int z) @@ -333,11 +334,12 @@ public class TileEntityShadowEye extends TileEntity world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(BlockList.handPedestal)); world.playSoundEffect(x, y + 0.5F, z, "step.wood", 1F, 1F); TileEntityHandPedestal tile = new TileEntityHandPedestal(); - if(((TileEntityShadowHand)world.getTileEntity(x, y, z)).heldItemStack != null) tile.setHeldItemStack(((TileEntityShadowHand)world.getTileEntity(x, y, z)).heldItemStack.copy()); - if(tile.heldItemStack != null) tile.closeHand(); - ((TileEntityShadowHand)world.getTileEntity(x, y, z)).removeHeldItemStack(); - world.setBlock(x, y, z, BlockList.handPedestal, l, 2); - world.setTileEntity(x, y, z, tile); + if (world.getTileEntity(x, y, z) instanceof TileEntityShadowHand){ + if (((TileEntityShadowHand)world.getTileEntity(x, y, z)).heldItemStack != null) tile.setHeldItemStack(((TileEntityShadowHand)world.getTileEntity(x, y, z)).heldItemStack.copy()); + ((TileEntityShadowHand)world.getTileEntity(x, y, z)).removeHeldItemStack(); + world.setBlock(x, y, z, BlockList.handPedestal, l, 2); + world.setTileEntity(x, y, z, tile); + } } /** diff --git a/src/main/java/darkknight/jewelrycraft/util/Variables.java b/src/main/java/darkknight/jewelrycraft/util/Variables.java index 14d1795..7e915de 100644 --- a/src/main/java/darkknight/jewelrycraft/util/Variables.java +++ b/src/main/java/darkknight/jewelrycraft/util/Variables.java @@ -6,7 +6,7 @@ public class Variables { public static final String MODID = "jewelrycraft2"; public static final String MODNAME = "Jewelrycraft 2"; - public static final String VERSION = "1.0.3"; + public static final String VERSION = "1.0.4"; public static final String PACKET_CHANNEL = "jewelrycraft2"; public static final String CONFIG_GUI = "darkknight.jewelrycraft.config.ConfigGuiFactory"; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 95917f1..d97d210 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -4,7 +4,7 @@ "modid": "jewelrycraft2", "name": "Jewelrycraft 2", "description": "Jewelrycraft 2 is a mod about creating jewellery and imbuing them with mystical powers. However, they have both positives and negatives. There are also curses, some good, some bad. Maybe acquiring some wouldn't be that bad.", - "version": "1.0.3", + "version": "1.0.4", "mcversion": "1.7.10", "url": "http://www.minecraftforum.net/forums/topic/2414865", "updateUrl": "", -- cgit v1.2.3