summaryrefslogtreecommitdiff
path: root/common/darkknight/jewelrycraft/util/JewelryNBT.java
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-23 22:03:06 +0200
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-23 22:03:06 +0200
commit198677e5b01009a65d243da1d25a14f879df659c (patch)
tree512da4c4fbccc40fdcfc79a6f6cbf0f4eb0efd50 /common/darkknight/jewelrycraft/util/JewelryNBT.java
parentb01cf1aa1d3480ad52ee7940f213596bfe6a2090 (diff)
Changed lots of stuff, added new features. Ender Rings!!!
Diffstat (limited to 'common/darkknight/jewelrycraft/util/JewelryNBT.java')
-rw-r--r--common/darkknight/jewelrycraft/util/JewelryNBT.java73
1 files changed, 73 insertions, 0 deletions
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);
+ }
+
+}