Search in sources :

Example 36 with NBTTagString

use of net.minecraft.server.v1_14_R1.NBTTagString in project WildLoaders by BG-Software-LLC.

the class NMSAdapter_v1_8_R3 method setTag.

@Override
public org.bukkit.inventory.ItemStack setTag(org.bukkit.inventory.ItemStack itemStack, String key, String value) {
    ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
    NBTTagCompound tagCompound = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
    tagCompound.set(key, new NBTTagString(value));
    nmsItem.setTag(tagCompound);
    return CraftItemStack.asBukkitCopy(nmsItem);
}
Also used : NBTTagCompound(net.minecraft.server.v1_8_R3.NBTTagCompound) NBTTagString(net.minecraft.server.v1_8_R3.NBTTagString) ItemStack(net.minecraft.server.v1_8_R3.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)

Example 37 with NBTTagString

use of net.minecraft.server.v1_14_R1.NBTTagString in project PaperDev by Kamillaova.

the class CraftMetaKnowledgeBook method applyToItem.

void applyToItem(NBTTagCompound itemData) {
    super.applyToItem(itemData);
    if (hasRecipes()) {
        NBTTagList list = new NBTTagList();
        for (NamespacedKey recipe : this.recipes) {
            list.add(new NBTTagString(recipe.toString()));
        }
        itemData.set(BOOK_RECIPES.NBT, list);
    }
}
Also used : NBTTagList(net.minecraft.server.v1_12_R1.NBTTagList) NamespacedKey(org.bukkit.NamespacedKey) CraftNamespacedKey(org.bukkit.craftbukkit.v1_12_R1.util.CraftNamespacedKey) NBTTagString(net.minecraft.server.v1_12_R1.NBTTagString)

Aggregations

ArrayList (java.util.ArrayList)21 ItemStack (org.bukkit.inventory.ItemStack)21 ItemMeta (org.bukkit.inventory.meta.ItemMeta)21 CompoundTag (com.wasteofplastic.org.jnbt.CompoundTag)20 ListTag (com.wasteofplastic.org.jnbt.ListTag)20 StringTag (com.wasteofplastic.org.jnbt.StringTag)20 Tag (com.wasteofplastic.org.jnbt.Tag)20 Map (java.util.Map)20 TagCompound (de.keyle.knbt.TagCompound)9 InvocationTargetException (java.lang.reflect.InvocationTargetException)9 NBTTagString (net.minecraft.server.v1_12_R1.NBTTagString)9 NBTTagList (net.minecraft.server.v1_12_R1.NBTTagList)7 NBTTagCompound (net.minecraft.server.v1_12_R1.NBTTagCompound)6 CraftItemStack (org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack)5 HashMap (java.util.HashMap)4 NBTTagCompound (net.minecraft.server.v1_7_R4.NBTTagCompound)4 NBTTagString (net.minecraft.server.v1_7_R4.NBTTagString)4 CraftItemStack (org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack)4 NBTTagCompound (net.minecraft.server.v1_10_R1.NBTTagCompound)3 NBTTagList (net.minecraft.server.v1_10_R1.NBTTagList)3