mojira.dev
MC-89938

Mobs won't attack if target isn't in the middle of a block

Zombies and some other mobs (slimes, silverfish, endermites...) sometimes don't succeed in hitting you if you aren't in the middle of a block. Instead they will try to hit the middle of the block.

Steps to reproduce:

  1. Create a superflat world with cheats enabled

  2. Run the command /tp @p 0 ~ 0.9

  3. Run the command /gamerule doMobSpawning false

  4. Run the command /time set night

  5. Run the command /summon Zombie ~ ~ ~-5
    This does not always seem to work, tough.

Or an easier method:

  1. Place down a wall an walk as close to it as you can

  2. Spawn a zombie in front of you and note how it doesn't succeed in hitting you

EDIT:
Now mostly happens with baby zombies. Also see @unknown's comment.


Code analysis by @unknown can be found in this comment.

Linked issues

MC-90037 During a game I played I witnessed a bug with a monster that could not attack me. Resolved MC-90408 Zombies (and baby Zombies) don't hit all the time Resolved MC-90689 Minecraft zombie bug Resolved MC-91087 Baby Zombies cannot attack Resolved MC-91230 mobs have issues with melee combat Resolved

Attachments

Comments 21

[media]

[^Minecraft 15w41b =7_10_2015= 17_31_43 [PM].mp4]

[media]

I've done some research, and it seems the problem is that Zombies are acting as if the Player is at the center of whatever block they are on. To easily reproduce:

1. Start a Creative Superflat world
2. Run the command /tp @p 0 ~ 0.9
3. Run the command /gamemode s
4. Run the command /summon Zombie ~ ~ ~-5

The Zombie will walk up and start attacking the center of the block you are on, while you sit safely on the far side. I suspect that this bug has something to do with Dinnerbone's changes to Player packets, but it could be something else.

May I ask why you changed the "steps to reproduce" so that the Player would be closer to the center of the block, and then added that it didn't always work? I had 100% success at reproducing it with the /tp coordinates set to 0 ~ 0.9, which is as far from the center of the block as the Player will go with one digit. If you increased it to 0.999 or otherwise changed the setup I would understand, but it looks like you just chose a random coordinate with less chance of working and said, "This doesn't always work," and I'm just a bit confused as to why.

@Sol Toder For me it seemed to work more often this way, but maybe I was mistaken. I will change it back.

11 more comments

Can anyone still reproduce this? @unknown how did you do this?

The Steps to reproduce don't seem to work in 18w31a. The Zombie certainly does damage. Even when the player stands against the wall, the zombie is able to hit, just not as fast as in an open area. A subject to interpretation if this Issue can be closed.

@unknown Not that it matters too much but as this was a real issue Fixed would be a more accurate resolution in this case, right? Or are we not sure this is fixed yet?

This bug applies to baby zombies again in 1.15-pre1.

Please create a new ticket if you think this or a similar issue still exists (in case noone else has reported it yet of course).

Steven W.d.V.

migrated

Confirmed

attack, attacking, attacks, babyzombie, hit, mob

Minecraft 15w41b, Minecraft 15w42a, Minecraft 15w43a, Minecraft 15w43b, Minecraft 15w43c, ..., Minecraft 1.9.4, Minecraft 1.10, Minecraft 1.10.2, Minecraft 16w40a, Minecraft 16w41a

Minecraft 15w45a, Minecraft 1.13

Retrieved