From 4d0e0e8de72bda8543a888082a93b1e56f13856b Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Sat, 8 Feb 2014 03:03:22 +0200 Subject: Added a new block and implemented an on/off "switch" for the rings that give buffs, also working on balancing the rings --- .../darkknight/jewelrycraft/util/JewelryNBT.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'common/darkknight/jewelrycraft/util/JewelryNBT.java') diff --git a/common/darkknight/jewelrycraft/util/JewelryNBT.java b/common/darkknight/jewelrycraft/util/JewelryNBT.java index aa11e8d..606ea4a 100644 --- a/common/darkknight/jewelrycraft/util/JewelryNBT.java +++ b/common/darkknight/jewelrycraft/util/JewelryNBT.java @@ -3,6 +3,7 @@ package darkknight.jewelrycraft.util; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -175,6 +176,20 @@ public class JewelryNBT itemStackData.removeTag(tag); } + public static boolean hasTag(ItemStack item, String tag) + { + NBTTagCompound itemStackData; + if (item.hasTagCompound()) + itemStackData = item.getTagCompound(); + else + { + itemStackData = new NBTTagCompound(); + item.setTagCompound(itemStackData); + } + if(itemStackData.hasKey(tag)) return true; + return false; + } + public static void removeEntity(ItemStack item) { JewelryNBT.removeNBT(item, "entityID"); @@ -231,6 +246,14 @@ public class JewelryNBT return false; } + public static boolean isModifierEffectType(ItemStack stack) + { + if(modifier(stack) != null && (isModifierX(stack, new ItemStack(Item.blazePowder)) || isModifierX(stack, new ItemStack(Item.sugar)) + || isModifierX(stack, new ItemStack(Item.pickaxeIron)) || isModifierX(stack, new ItemStack(Item.feather)) + || isModifierX(stack, new ItemStack(Item.potion, 1, 8270)))) return true; + return false; + } + public static ItemStack ingot(ItemStack stack) { if(stack != null && stack != new ItemStack(0, 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingot")) -- cgit v1.2.3