Search in sources :

Example 26 with ItemStack

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

the class NMSAdapter_v1_12_R1 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_12_R1.NBTTagCompound) NBTTagString(net.minecraft.server.v1_12_R1.NBTTagString) CraftItemStack(org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_12_R1.ItemStack)

Example 27 with ItemStack

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

the class NMSAdapter_v1_12_R1 method getTag.

@Override
public long getTag(org.bukkit.inventory.ItemStack itemStack, String key, long def) {
    ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
    NBTTagCompound tagCompound = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
    if (!tagCompound.hasKeyOfType(key, 4))
        return def;
    return tagCompound.getLong(key);
}
Also used : NBTTagCompound(net.minecraft.server.v1_12_R1.NBTTagCompound) CraftItemStack(org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_12_R1.ItemStack)

Example 28 with ItemStack

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

the class NMSAdapter_v1_8_R3 method getTag.

@Override
public String getTag(org.bukkit.inventory.ItemStack itemStack, String key, String def) {
    ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
    NBTTagCompound tagCompound = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
    if (!tagCompound.hasKeyOfType(key, 8))
        return def;
    return tagCompound.getString(key);
}
Also used : NBTTagCompound(net.minecraft.server.v1_8_R3.NBTTagCompound) ItemStack(net.minecraft.server.v1_8_R3.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)

Example 29 with ItemStack

use of net.minecraft.server.v1_14_R1.ItemStack 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, long value) {
    ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
    NBTTagCompound tagCompound = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
    tagCompound.set(key, new NBTTagLong(value));
    nmsItem.setTag(tagCompound);
    return CraftItemStack.asBukkitCopy(nmsItem);
}
Also used : NBTTagCompound(net.minecraft.server.v1_8_R3.NBTTagCompound) ItemStack(net.minecraft.server.v1_8_R3.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack) NBTTagLong(net.minecraft.server.v1_8_R3.NBTTagLong)

Example 30 with ItemStack

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

the class NMSAdapter_v1_8_R3 method getTag.

@Override
public long getTag(org.bukkit.inventory.ItemStack itemStack, String key, long def) {
    ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
    NBTTagCompound tagCompound = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
    if (!tagCompound.hasKeyOfType(key, 4))
        return def;
    return tagCompound.getLong(key);
}
Also used : NBTTagCompound(net.minecraft.server.v1_8_R3.NBTTagCompound) ItemStack(net.minecraft.server.v1_8_R3.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)

Aggregations

ItemStack (net.minecraft.server.v1_8_R3.ItemStack)26 ItemStack (net.minecraft.server.v1_12_R1.ItemStack)24 CraftItemStack (org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack)20 ItemStack (net.minecraft.server.v1_16_R3.ItemStack)19 IconMenuItem (de.Keyle.MyPet.api.gui.IconMenuItem)18 CraftItemStack (org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)17 CraftItemStack (org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack)16 ItemStack (net.minecraft.server.v1_11_R1.ItemStack)13 ItemStack (net.minecraft.server.v1_7_R4.ItemStack)12 NBTTagCompound (net.minecraft.server.v1_12_R1.NBTTagCompound)11 ItemStack (net.minecraft.server.v1_10_R1.ItemStack)10 NBTTagCompound (net.minecraft.server.v1_8_R3.NBTTagCompound)10 CraftItemStack (org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack)10 TagCompound (de.keyle.knbt.TagCompound)9 InvocationTargetException (java.lang.reflect.InvocationTargetException)9 NBTTagCompound (net.minecraft.server.v1_16_R3.NBTTagCompound)9 Field (java.lang.reflect.Field)8 ItemStack (net.minecraft.server.v1_13_R2.ItemStack)8 ItemStack (net.minecraft.server.v1_15_R1.ItemStack)8 ItemStack (net.minecraft.server.v1_9_R2.ItemStack)8