Solved NBT Tag Attribute Set

Discussion in 'Spigot Plugin Development' started by WiseHollow, Sep 8, 2018.

Thread Status:
Not open for further replies.
  1. In my plugin, I'm making an item with custom attributes. The way I'm setting them is...
    Code (Text):

    damage.set("AttributeName", new NBTTagString("generic.attackDamage"));
    damage.set("Name", new NBTTagString("generic.attackDamage"));
    damage.set("Amount", new NBTTagInt(11));
    damage.set("Operation", new NBTTagInt(0));
    damage.set("UUIDLeast", new NBTTagInt(894654));
    damage.set("UUIDMost", new NBTTagInt(2872));
    damage.set("Slot", new NBTTagString("mainhand"));

    NBTTagCompound speed = new NBTTagCompound();
    speed.set("AttributeName", new NBTTagString("generic.attackSpeed"));
    speed.set("Name", new NBTTagString("generic.attackSpeed"));
    speed.set("Amount", new NBTTagDouble(1.1));
    speed.set("Operation", new NBTTagInt(0));
    speed.set("UUIDLeast", new NBTTagInt(3927450));
    speed.set("UUIDMost", new NBTTagInt(12872));
    speed.set("Slot", new NBTTagString("mainhand"));
    The problem is, the attributes are being added to the player's stats instead of setting them as in normal weapons. Does anyone know how to change this?

  2. Unfortunately, that's the way AttributeModifiers work, they modify the attribute of a player. The attack damage and speed you see on normal items is just client side, and are basic information it provides.
  3. Wow I wish I knew that earlier. :oops: Good to know. Do these attributes with "+" add onto the already given stats from the material, or does it overwrite the default values?
  4. Well, I am fairly sure that is only on 1.9+. It still works like before on 1.8, eventually test it out with my library Attributes (works on 1.8 - 1.12).
Thread Status:
Not open for further replies.