public String[] getLore() { if (nmsStack == null) { return null; } if (nmsStack.getTag() == null) { return null; } NBTTagCompound displayCompound = nmsStack.getTag().getCompound("display"); if (displayCompound == null) { return null; } NBTTagList loreList = displayCompound.getList("Lore", NBTStaticHelper.TAG_STRING); if (loreList == null) { return null; } if (loreList.size() < 1) { return null; } String[] lore = new String[loreList.size()]; for (int i = 0; i < loreList.size(); i++) { lore[i] = loreList.getString(i).replace("\"", ""); ; } return lore; }
public void setLore(String[] strings) { // this.lore.add(str); NBTTagCompound displayCompound = nmsStack.getTag().getCompound("display"); if (displayCompound == null) { displayCompound = new NBTTagCompound(); } NBTTagList loreList = new NBTTagList(); for (String str : strings) { loreList.add(new NBTTagString(str)); } displayCompound.set("Lore", loreList); nmsStack.getTag().set("display", displayCompound); }
/** * Retrieve the modified item stack. * * @return The modified item stack. */ public ItemStack getStack() { if (nmsStack == null) { return ItemManager.createItemStack(CivData.WOOL, 0); } if (nmsStack.getTag() != null) { if (attributes.size() == 0) { parent.remove("AttributeModifiers"); } } return CraftItemStack.asCraftMirror(nmsStack); }
public void addLore(String str) { if (nmsStack == null) { return; } if (nmsStack.getTag() == null) { nmsStack.setTag(new NBTTagCompound()); } // this.lore.add(str); NBTTagCompound displayCompound = nmsStack.getTag().getCompound("display"); if (displayCompound == null) { displayCompound = new NBTTagCompound(); } NBTTagList loreList = displayCompound.getList("Lore", NBTStaticHelper.TAG_STRING); if (loreList == null) { loreList = new NBTTagList(); } loreList.add(new NBTTagString(str)); displayCompound.set("Lore", loreList); nmsStack.getTag().set("display", displayCompound); }
/** * Retrieve the attribute at a given index. * * @param index - the index to look up. * @return The attribute at that index. */ public Attribute get(int index) { return new Attribute((NBTTagCompound) attributes.get(index)); }
/** * Add a new attribute to the list. * * @param attribute - the new attribute. */ public void add(Attribute attribute) { attributes.add(attribute.data); }
/** * Retrieve the number of attributes. * * @return Number of attributes. */ public int size() { return attributes.size(); }