Merge pull request #258 from hilburn/master

Fixes Harvest Level of Deactivated Items
This commit is contained in:
WayofTime 2015-02-18 14:59:41 -05:00
commit 72312f2cdf
3 changed files with 12 additions and 12 deletions

View file

@ -227,13 +227,13 @@ public class BoundAxe extends ItemAxe implements IBindable
public boolean getActivated(ItemStack par1ItemStack) public boolean getActivated(ItemStack par1ItemStack)
{ {
NBTTagCompound itemTag = par1ItemStack.getTagCompound(); if (!par1ItemStack.hasTagCompound())
if (itemTag == null)
{ {
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
return itemTag.getBoolean("isActive"); return itemTag.getBoolean("isActive");
} }
@ -321,7 +321,7 @@ public class BoundAxe extends ItemAxe implements IBindable
@Override @Override
public int getHarvestLevel(ItemStack stack, String toolClass) public int getHarvestLevel(ItemStack stack, String toolClass)
{ {
if ("axe".equals(toolClass)) if (getActivated(stack) && "axe".equals(toolClass))
{ {
return 5; return 5;
} }

View file

@ -235,13 +235,13 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable
public boolean getActivated(ItemStack par1ItemStack) public boolean getActivated(ItemStack par1ItemStack)
{ {
NBTTagCompound itemTag = par1ItemStack.getTagCompound(); if (!par1ItemStack.hasTagCompound())
if (itemTag == null)
{ {
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
return itemTag.getBoolean("isActive"); return itemTag.getBoolean("isActive");
} }
@ -331,7 +331,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable
@Override @Override
public int getHarvestLevel(ItemStack stack, String toolClass) public int getHarvestLevel(ItemStack stack, String toolClass)
{ {
if ("pickaxe".equals(toolClass)) if (getActivated(stack) && "pickaxe".equals(toolClass))
{ {
return 5; return 5;
} }

View file

@ -233,13 +233,13 @@ public class BoundShovel extends ItemSpade implements IBindable
public boolean getActivated(ItemStack par1ItemStack) public boolean getActivated(ItemStack par1ItemStack)
{ {
NBTTagCompound itemTag = par1ItemStack.getTagCompound(); if (!par1ItemStack.hasTagCompound())
if (itemTag == null)
{ {
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
return itemTag.getBoolean("isActive"); return itemTag.getBoolean("isActive");
} }
@ -330,7 +330,7 @@ public class BoundShovel extends ItemSpade implements IBindable
@Override @Override
public int getHarvestLevel(ItemStack stack, String toolClass) public int getHarvestLevel(ItemStack stack, String toolClass)
{ {
if ("shovel".equals(toolClass)) if (getActivated(stack) && "shovel".equals(toolClass))
{ {
return 5; return 5;
} }