From 198677e5b01009a65d243da1d25a14f879df659c Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Mon, 23 Dec 2013 22:03:06 +0200 Subject: Changed lots of stuff, added new features. Ender Rings!!! --- .../darkknight/jewelrycraft/util/JewelryNBT.java | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 common/darkknight/jewelrycraft/util/JewelryNBT.java (limited to 'common/darkknight/jewelrycraft/util/JewelryNBT.java') diff --git a/common/darkknight/jewelrycraft/util/JewelryNBT.java b/common/darkknight/jewelrycraft/util/JewelryNBT.java new file mode 100644 index 0000000..b6140b7 --- /dev/null +++ b/common/darkknight/jewelrycraft/util/JewelryNBT.java @@ -0,0 +1,73 @@ +package darkknight.jewelrycraft.util; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class JewelryNBT +{ + + public static void addMetal(ItemStack item, ItemStack metal) + { + NBTTagCompound itemStackData; + if (item.hasTagCompound()) + itemStackData = item.getTagCompound(); + else + { + itemStackData = new NBTTagCompound(); + item.setTagCompound(itemStackData); + } + NBTTagCompound ingotNBT = new NBTTagCompound(); + metal.writeToNBT(ingotNBT); + itemStackData.setTag("ingot", ingotNBT); + } + + public static void addJewel(ItemStack item, ItemStack jewel) + { + NBTTagCompound itemStackData; + if (item.hasTagCompound()) + itemStackData = item.getTagCompound(); + else + { + itemStackData = new NBTTagCompound(); + item.setTagCompound(itemStackData); + } + NBTTagCompound jewelNBT = new NBTTagCompound(); + jewel.writeToNBT(jewelNBT); + itemStackData.setTag("jewel", jewelNBT); + } + + public static void addModifier(ItemStack item, ItemStack modifier) + { + NBTTagCompound itemStackData; + if (item.hasTagCompound()) + itemStackData = item.getTagCompound(); + else + { + itemStackData = new NBTTagCompound(); + item.setTagCompound(itemStackData); + } + NBTTagCompound modifierNBT = new NBTTagCompound(); + modifier.writeToNBT(modifierNBT); + itemStackData.setTag("modifier", modifierNBT); + } + + public static void addCoordonates(ItemStack item, double x, double y, double z) + { + NBTTagCompound itemStackData; + if (item.hasTagCompound()) + itemStackData = item.getTagCompound(); + else + { + itemStackData = new NBTTagCompound(); + item.setTagCompound(itemStackData); + } + NBTTagCompound coords = new NBTTagCompound(); + coords.setDouble("x", x); + coords.setDouble("y", y); + coords.setDouble("z", z); + itemStackData.setTag("x", coords); + itemStackData.setTag("y", coords); + itemStackData.setTag("z", coords); + } + +} -- cgit v1.2.3