From 39b407adba0d389ed4e911af477c86a112d94c78 Mon Sep 17 00:00:00 2001 From: bspkrs Date: Mon, 16 Dec 2013 15:28:12 -0500 Subject: fixed a few NPEs --- common/darkknight/jewelrycraft/block/BlockMolder.java | 8 ++++---- common/darkknight/jewelrycraft/block/BlockSmelter.java | 2 +- common/darkknight/jewelrycraft/item/ItemRing.java | 7 ------- 3 files changed, 5 insertions(+), 12 deletions(-) (limited to 'common') 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; -- cgit v1.2.3