mojira.dev
MC-16279

Mobs lose Attribute Modifiers when the player ventures too far from them

When a mob is given a weapon, they inherit the Attribute Modifiers on it. This includes the vanilla modifier for weapon strength, and any custom modifiers. However, when a player ventures too far from that mob, these modifiers are lost.

Steps to Reproduce:

  1. Give a zombie a diamond sword. You must have mobGriefing set to true, and must be playing in Normal or Hard mode.

  2. When it attacks you, you should experience normal damage - on Normal difficulty, this will be 5 hearts.

  3. Move far away from this mob. Using "/tp ~0 ~150 ~0" and letting yourself fall (in Creative!) will distance you enough for this bug to occur.

  4. When you let the mob attack you again, it will deal only 1.5 hearts instead of the previous 5.

I have attached a schematic of a bugged zombie, holding an AttributeModifier-laden sword but not bearing its effects. The zombie picked up this sword in-game, and I ventured too far from it. I have also attached a test world of zombies which have lost their Attribute Modifiers for the same reason.

Linked issues

Attachments

Comments 19

I can not confirm this in 13w21a and 13w21b. I did not laod your shematic, i modified some swords via mcedit and gave it to zombies. I added modifier for speed and damage. I can tell it is working by the speed of the zombie, but also by the damage the zombie is dealing. Operation:0 Amount:20 and u are a one hit kill. But i found out, that these modifiers sometimes losing their effect, so the zombie return to his normal speed and damage. I don´t know whats causing it, but re-entering the world is fixing it.

I gave a zombie pigman a +9001 damage weapon, he oneshotted me!

Same when I threw a +9004 wooden sword to a zombie.

Was not fun at all.

9001 damage is not a vanilla weapon.

I have given a zombie a diamond sword on 13w24b, and it is still only dealing 1.5 hearts of damage per hit. I have no mods, no armor, no Attribute Modifiers on myself, and no status effects. Note that I gave the item to the zombie in-game, without the use of any editors.

I'll attach a GIF and a testing world where this occurs. Perhaps the bug was fixed for non-vanilla modifiers, but a zombie with a diamond sword should not be dealing 1.5 hearts of damage to an unarmored player.

Sorry, my GIF may have broken the attachment renderer.

Anyways, I've attached a fully functional test world. All zombies in the test world have picked up their weapons. Observe that enchantments work, but Attribute Modifiers do not.

Despite each zombie wielding a diamond sword, they only do 1.5 hearts of damage per hit. This even applies when the modifier is +100 Attack Damage, with a unique UUID. Although the player can 1-hit-kill mobs with it, a zombie wielding the item does not make use of its damage boost.

This is still a problem in 13w24b.

Despite the JIRA renderer breaking, the attachments can still be accessed from the History tab.

Grum, can you provide a sample world as well? What mode were you on when throwing the item to your zombie? Was it Normal, like me, or Hard?

While you could argue that I may have done something wrong with the NBT for the custom items (it seems even if UUIDLeast is nonzero, UUIDMost must also be nonzero), there is no reason for a vanilla Minecraft, unmodified item, such as the leftmost diamond sword in the test world, to not work.

For clarification, the following was my exact procedure for creating all of those zombies:
Steps to Reproduce:

  1. Dig a hole, and cover it with a block so skylight cannot enter.

  2. Spawn a few dozen zombies.

  3. Drop in a diamond sword and diamond helmet. Check that a single zombie picked them up.

  4. Break the blocks, allowing the zombies to burn.

  5. /tp ~0 ~150 ~0, so the unequipped zombies despawn because you're too far away, and you fall back.

  6. Allow the zombie to come out of the hole, and patch it up.

  7. Switch to Survival Mode.

  8. Observe that each attack only does 1.5 hearts of damage, regardless of your equipment.

9 more comments

However, it happens instantly if you teleport away from the mob and back - without time passing.

Teleporting away (tried even ~ 200 ~) did not work, however I determined that on avarage after 30 seconds attribute runs out.

Possibly related to MC-16467, which I see Gerrard has commented may be related to this. Anyone have ideas on how to determine why this is happening? Are the attributes no longer present on the entity, or just no longer functional? Matthias's comment on MC-16467 would suggest that the attributes are being saved, because they reactivate when reloading the world. So some random, regular event is recalculating the final stats inappropriately or overwriting them.

I've managed to reproduce attributes vanishing over time and returning upon world reload. I've also reproduced an entity which did not lose its attributes even after I teleported away and back. I have no idea why it didn't happen before - perhaps the issue is just incredibly random.

I suppose MC-16467 is the correct bug then; as long as the version tags on that are updated, this can be closed as a duplicate unless somebody can find evidence that distance does make entities more likely to lose their attributes.

Resolved on request.

WolfieMario

Nathan Adams

Unconfirmed

Snapshot 13w21a, Snapshot 13w24b, Snapshot 13w25a, Snapshot 13w25b, Snapshot 13w25c

Retrieved