Search in sources :

Example 1 with NBTTagLong

use of net.minecraft.server.v1_12_R1.NBTTagLong 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 2 with NBTTagLong

use of net.minecraft.server.v1_12_R1.NBTTagLong in project custom-items-gradle by knokko.

the class ItemAttributes method setAttribute.

private static void setAttribute(NBTTagList modifiers, String name, double value, String slot, int operation) {
    NBTTagCompound damage = new NBTTagCompound();
    damage.set("AttributeName", new NBTTagString(name));
    damage.set("Name", new NBTTagString(name));
    damage.set("Amount", new NBTTagDouble(value));
    damage.set("Operation", new NBTTagInt(operation));
    long most = modifiers.size() + 1 + slot.hashCode() * name.hashCode();
    long least = modifiers.size() + 1 + slot.hashCode() + name.hashCode();
    if (most == 0)
        most = -8;
    if (least == 0)
        least = 12;
    damage.set("UUIDLeast", new NBTTagLong(least));
    damage.set("UUIDMost", new NBTTagLong(most));
    damage.set("Slot", new NBTTagString(slot));
    modifiers.add(damage);
}
Also used : NBTTagInt(net.minecraft.server.v1_12_R1.NBTTagInt) NBTTagCompound(net.minecraft.server.v1_12_R1.NBTTagCompound) NBTTagString(net.minecraft.server.v1_12_R1.NBTTagString) NBTTagDouble(net.minecraft.server.v1_12_R1.NBTTagDouble) NBTTagLong(net.minecraft.server.v1_12_R1.NBTTagLong)

Example 3 with NBTTagLong

use of net.minecraft.server.v1_12_R1.NBTTagLong 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, 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_7_R4.NBTTagCompound) ItemStack(net.minecraft.server.v1_7_R4.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack) NBTTagLong(net.minecraft.server.v1_7_R4.NBTTagLong)

Example 4 with NBTTagLong

use of net.minecraft.server.v1_12_R1.NBTTagLong 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, 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_12_R1.NBTTagCompound) CraftItemStack(org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_12_R1.ItemStack) NBTTagLong(net.minecraft.server.v1_12_R1.NBTTagLong)

Aggregations

NBTTagCompound (net.minecraft.server.v1_12_R1.NBTTagCompound)2 NBTTagLong (net.minecraft.server.v1_12_R1.NBTTagLong)2 ItemStack (net.minecraft.server.v1_12_R1.ItemStack)1 NBTTagDouble (net.minecraft.server.v1_12_R1.NBTTagDouble)1 NBTTagInt (net.minecraft.server.v1_12_R1.NBTTagInt)1 NBTTagString (net.minecraft.server.v1_12_R1.NBTTagString)1 ItemStack (net.minecraft.server.v1_7_R4.ItemStack)1 NBTTagCompound (net.minecraft.server.v1_7_R4.NBTTagCompound)1 NBTTagLong (net.minecraft.server.v1_7_R4.NBTTagLong)1 ItemStack (net.minecraft.server.v1_8_R3.ItemStack)1 NBTTagCompound (net.minecraft.server.v1_8_R3.NBTTagCompound)1 NBTTagLong (net.minecraft.server.v1_8_R3.NBTTagLong)1 CraftItemStack (org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack)1 CraftItemStack (org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack)1 CraftItemStack (org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)1