Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-121162

Damage not calculated correctly for custom weapons with both sharpness and attribute modifiers

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • Minecraft 1.12.1
    • None
    • Sierra OSX, 1.12.1 servers, 1.12.1 singleplayer
    • Unconfirmed

      I have been creating custom weapons for my my map and didn't realize until recently that the damage wasn't being calculated correctly. I'm not sure exactly what is going on but here is some examples of the issue:

      I give a sharpness 7 sword:

      /give @p minecraft:golden_sword 1 0 {ench:[{id:16,lvl:7}]}
      

      When I attack a full-health zombie without jumping (no critical) I read its health as: Health:12.128f.

      Now I give the same sword but with an attribute bonus of 2 damage in the offhand or mainhand:

      /give @p minecraft:golden_sword 1 0 {ench:[{id:16,lvl:7}],AttributeModifiers:[{AttributeName:"generic.attackDamage",Name:"generic.attackDamage",Amount:2,Operation:0,UUIDLeast:438301,UUIDMost:924267,Slot:"mainhand"},{AttributeName:"generic.attackDamage",Name:"generic.attackDamage",Amount:2,Operation:0,UUIDLeast:438301,UUIDMost:924267,Slot:"offhand"}]}
      

      I attack a newly summoned zombie 3 times. Every time LESS instead of more health is taken away and the zombie is as: Health:13.1119995f. What I would expect is that the zombie has 2 less health approximately. I am aware that zombies have 2 armor points but it still shouldn't cuase this discrepency right?

      To test if this is just a bug with abnormal values of sharpness I retested with just damage modifiers and sharpness 1. The results were:

      just sharpness I: Health:15.08f
      sharpness I + 2 damage: 16.064f

      So this is definitely bugged. My hypothesis is the damage modifier is canceling some of the bonus of the sharpness.

      Another even odder example, that may be related, with diamond axes and attack speed (not even damage modifier). Adding an attack speed bonus seems to cancel the sharpness bonus as well:

      I give a sharpness 7 diamond axe:

      /give @p minecraft:diamond_axe 1 0 {ench:[{id:16,lvl:7}]}
      

      When I attack a full-health zombie I read its health as: Health:7.207999f.

      Now I give the same axe but with an attribute bonus of 5 attack speed in the offhand or mainhand:

      /give @p minecraft:diamond_axe 1 0 {ench:[{id:16,lvl:7}],AttributeModifiers:[{AttributeName:"generic.attackSpeed",Name:"generic.attackSpeed",Amount:5,Operation:0,UUIDLeast:805601,UUIDMost:190395,Slot:"mainhand"},{AttributeName:"generic.attackSpeed",Name:"generic.attackSpeed",Amount:5,Operation:0,UUIDLeast:805601,UUIDMost:190395,Slot:"offhand"}]}
      

      I attack a newly summoned zombie and its health is MUCH high at 15.08f health. This nerf is even worse then the one with attack damage, possibly because the attack damage partially covered the difference.

      My hypothesis is that whenever you set an attribute on an item sharpness damage bonus stops working. This roughly agrees with the numbers. Can someone confirm or tell me if this is already reported? I could not find it and it seems like something people would realize right away in adventure maps.

            Unassigned Unassigned
            danaphanous Dan Midgett
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: