Search in sources :

Example 31 with ItemStack

use of net.minecraft.server.v1_15_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)

Example 32 with ItemStack

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

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

Example 33 with ItemStack

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

the class NMSAdapter_v1_7_R4 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_7_R4.NBTTagCompound) ItemStack(net.minecraft.server.v1_7_R4.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack)

Example 34 with ItemStack

use of net.minecraft.server.v1_15_R1.ItemStack in project WildChests by BG-Software-LLC.

the class NMSAdapter_v1_16_R3 method dropItemAsPlayer.

@Override
public void dropItemAsPlayer(HumanEntity humanEntity, org.bukkit.inventory.ItemStack bukkitItem) {
    EntityHuman entityHuman = ((CraftHumanEntity) humanEntity).getHandle();
    ItemStack itemStack = CraftItemStack.asNMSCopy(bukkitItem);
    entityHuman.drop(itemStack, false);
}
Also used : EntityHuman(net.minecraft.server.v1_16_R3.EntityHuman) CraftHumanEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftHumanEntity) CraftItemStack(org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_16_R3.ItemStack)

Example 35 with ItemStack

use of net.minecraft.server.v1_15_R1.ItemStack in project WildChests by BG-Software-LLC.

the class NMSAdapter_v1_16_R3 method getChestName.

@Override
public String getChestName(org.bukkit.inventory.ItemStack itemStack) {
    ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
    NBTTagCompound tagCompound = nmsItem.getTag();
    return tagCompound == null || !tagCompound.hasKey("chest-name") ? null : tagCompound.getString("chest-name");
}
Also used : NBTTagCompound(net.minecraft.server.v1_16_R3.NBTTagCompound) CraftItemStack(org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_16_R3.ItemStack)

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 CraftItemStack (org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack)11 ItemStack (net.minecraft.server.v1_10_R1.ItemStack)10 NBTTagCompound (net.minecraft.server.v1_8_R3.NBTTagCompound)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 NBTTagCompound (net.minecraft.server.v1_15_R1.NBTTagCompound)8