diff options
| author | bspkrs <bspkrs@gmail.com> | 2013-12-16 15:28:12 -0500 |
|---|---|---|
| committer | bspkrs <bspkrs@gmail.com> | 2013-12-16 15:28:12 -0500 |
| commit | 39b407adba0d389ed4e911af477c86a112d94c78 (patch) | |
| tree | 78f2197d8ccc86e127498581bb21da5542837faf | |
| parent | 80ec62513742ba5515fc0ba3f6ab2f3429176a8b (diff) | |
fixed a few NPEs
| -rw-r--r-- | common/darkknight/jewelrycraft/block/BlockMolder.java | 8 | ||||
| -rw-r--r-- | common/darkknight/jewelrycraft/block/BlockSmelter.java | 2 | ||||
| -rw-r--r-- | common/darkknight/jewelrycraft/item/ItemRing.java | 7 |
3 files changed, 5 insertions, 12 deletions
diff --git a/common/darkknight/jewelrycraft/block/BlockMolder.java b/common/darkknight/jewelrycraft/block/BlockMolder.java index 795a689..ac10ca4 100644 --- a/common/darkknight/jewelrycraft/block/BlockMolder.java +++ b/common/darkknight/jewelrycraft/block/BlockMolder.java @@ -47,10 +47,10 @@ public class BlockMolder extends BlockContainer ItemStack item = entityPlayer.inventory.getCurrentItem(); if (te != null && item != null && !te.hasMold && item.itemID == ItemList.molds.itemID) { - entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.molder.addedmold", te.mold.getDisplayName())); te.mold = item; te.hasMold = true; --item.stackSize; + entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.molder.addedmold", te.mold.getDisplayName())); } if (te.hasMold && entityPlayer.isSneaking()) { @@ -125,7 +125,7 @@ public class BlockMolder extends BlockContainer public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) { TileEntityMolder me = (TileEntityMolder) world.getBlockTileEntity(i, j, k); - if (me != null) + if (me != null && !world.isRemote) { if (me.hasJewelBase) { @@ -135,9 +135,9 @@ public class BlockMolder extends BlockContainer } else if (me.hasMoltenMetal && me.cooling > 0) player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.molder.metaliscooling")); - else if (me.hasMold && !me.hasMoltenMetal) + else if (me.mold.itemID == ItemList.molds.itemID && !me.hasMoltenMetal) player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.molder.moldisempty")); - else if (!me.hasMold) + else if (me.mold.itemID != ItemList.molds.itemID) player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.molder.moldismissing")); } } diff --git a/common/darkknight/jewelrycraft/block/BlockSmelter.java b/common/darkknight/jewelrycraft/block/BlockSmelter.java index 3ac4e45..9764ac5 100644 --- a/common/darkknight/jewelrycraft/block/BlockSmelter.java +++ b/common/darkknight/jewelrycraft/block/BlockSmelter.java @@ -119,7 +119,7 @@ public class BlockSmelter extends BlockContainer else if (world.getBlockMetadata(i, j, k) == 3) me = (TileEntityMolder) world.getBlockTileEntity(i - 1, j, k); - if (te.hasMoltenMetal && me != null) + if (te.hasMoltenMetal && me != null && !world.isRemote) { if (isConnectedToMolder(world, i, j, k) && me.hasMold && !me.hasMoltenMetal && !me.hasJewelBase) { diff --git a/common/darkknight/jewelrycraft/item/ItemRing.java b/common/darkknight/jewelrycraft/item/ItemRing.java index f05b146..ba16dd5 100644 --- a/common/darkknight/jewelrycraft/item/ItemRing.java +++ b/common/darkknight/jewelrycraft/item/ItemRing.java @@ -16,13 +16,6 @@ public class ItemRing extends ItemBase this.setMaxStackSize(1); } - NBTTagCompound tag = new NBTTagCompound(); - - public String getMetal(ItemStack stack) - { - return tag.getString("ingot"); - } - public static void addMetal(ItemStack item, ItemStack metal) { NBTTagCompound itemStackData; |
