diff options
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java')
| -rwxr-xr-x | src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java b/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java index 17090ab..d7eff3a 100755 --- a/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java +++ b/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java @@ -70,6 +70,48 @@ public class JewelryNBT { itemStackData.setTag("gem", gemNBT);
}
}
+
+ /**
+ * @param item
+ * The item you want to add the NBT data on
+ * @param prefix
+ * The prefix you want to add on the item
+ */
+ public static void addPrefix(ItemStack item, String prefix) {
+ if (prefix != null) {
+ NBTTagCompound itemStackData;
+
+ if (item.hasTagCompound()) {
+ itemStackData = item.getTagCompound();
+ } else {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+
+ itemStackData.setString("prefix", prefix);
+ }
+ }
+
+ /**
+ * @param item
+ * The item you want to add the NBT data on
+ * @param suffix
+ * The suffix you want to add on the item
+ */
+ public static void addSuffix(ItemStack item, String suffix) {
+ if (suffix != null) {
+ NBTTagCompound itemStackData;
+
+ if (item.hasTagCompound()) {
+ itemStackData = item.getTagCompound();
+ } else {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+
+ itemStackData.setString("suffix", suffix);
+ }
+ }
/**
* @param item
@@ -276,6 +318,30 @@ public class JewelryNBT { return null;
}
+
+ public static String prefix(ItemStack stack) {
+ if (stack != null) {
+ if (stack != new ItemStack(Item.getItemById(0), 0, 0)) {
+ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("prefix")) {
+ return stack.getTagCompound().getString("prefix");
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public static String suffix(ItemStack stack) {
+ if (stack != null) {
+ if (stack != new ItemStack(Item.getItemById(0), 0, 0)) {
+ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("suffix")) {
+ return stack.getTagCompound().getString("suffix");
+ }
+ }
+ }
+
+ return null;
+ }
/**
* @param stack
|
