Search in sources :

Example 1 with NBTTagDouble

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

Aggregations

NBTTagCompound (net.minecraft.server.v1_12_R1.NBTTagCompound)1 NBTTagDouble (net.minecraft.server.v1_12_R1.NBTTagDouble)1 NBTTagInt (net.minecraft.server.v1_12_R1.NBTTagInt)1 NBTTagLong (net.minecraft.server.v1_12_R1.NBTTagLong)1 NBTTagString (net.minecraft.server.v1_12_R1.NBTTagString)1