Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5298

EntityEquipment (armour, hand) drop chances are systematically wrong by -0.1.


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • git-Spigot-065a373-6ed8a18 (MC: 1.14.4) (build 2459)
    • Yes

      Spigot CraftEntityEquipment deliberately decreases drop chances by 0.1 on set and adds 0.1 on get.

          private void setDropChance(EnumItemSlot slot, float chance) {
              if (slot == EnumItemSlot.MAINHAND || slot == EnumItemSlot.OFFHAND) {
                  ((EntityInsentient) entity.getHandle()).dropChanceHand[slot.b()] = chance - 0.1F;
              } else {
                  ((EntityInsentient) entity.getHandle()).dropChanceArmor[slot.b()] = chance - 0.1F;
          private float getDropChance(EnumItemSlot slot) {
              if (slot == EnumItemSlot.MAINHAND || slot == EnumItemSlot.OFFHAND) {
                  return ((EntityInsentient) entity.getHandle()).dropChanceHand[slot.b()] + 0.1F;
              } else {
                  return ((EntityInsentient) entity.getHandle()).dropChanceArmor[slot.b()] + 0.1F;

      You can use the provided test plugin (https://github.com/totemo/TestDropChances) to spawn mobs with known armour and hand drop chances.

      If you spawn mobs with `/testdropchances 0.099` note that they will not drop their equipment on death ever when killed with a non-looting sword.

      The NBT fields of the mob are incorrect by the 0.1 offset, as can be verified by vanilla commands:

      /data get entity @e[type=minecraft:wither_skeleton,distance=..20,limit=1] ArmorDropChances
      /data get entity @e[type=minecraft:wither_skeleton,distance=..20,limit=1] HandDropChances

      When the mob dies, these 0.1 offsets are not taken into account by CraftBukkit n.m.s.EntityInsentient.dropEquipment() and Spigot-Server n.m.s.EntityInsentient.dropDeathLoot().

      The relevant drop chance arrays are initialised to expected vanilla drop chances:

              Arrays.fill(this.dropChanceArmor, 0.085F);
              Arrays.fill(this.dropChanceHand, 0.085F);

      This is the situation in the current build but also applied about 5 or 6 months ago in Spigot 1.13.2. I didn't follow up on it at the time thinking it was a temporary situation.

      The offsets in CraftEntityEquipment are clearly deliberate, but I would liken them to junk DNA. Taking them out would probably resolve this.

            Unassigned Unassigned
            totemoresearch@gmail.com totemo
            0 Vote for this issue
            3 Start watching this issue