diff --git a/src/main/java/noppes/npcs/NBTTags.java b/src/main/java/noppes/npcs/NBTTags.java index e3a4448d0..88a6d80f1 100644 --- a/src/main/java/noppes/npcs/NBTTags.java +++ b/src/main/java/noppes/npcs/NBTTags.java @@ -113,6 +113,30 @@ public class NBTTags { return list; } + public static HashMap getIntegerByteMap( + NBTTagList tagList) { + HashMap list = new HashMap(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + list.put(nbttagcompound.getInteger("Slot"), nbttagcompound.getByte("Byte")); + } + return list; + } + + public static NBTTagList nbtIntegerByteMap(Map lines) { + NBTTagList nbttaglist = new NBTTagList(); + if(lines == null) + return nbttaglist; + for (int slot : lines.keySet()) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Slot", slot); + nbttagcompound.setByte("Byte", lines.get(slot)); + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + public static NBTTagList nbtStringSet(HashSet collection) { NBTTagList nbttaglist = new NBTTagList(); if(collection == null)