mojira.dev
MC-2310

Wrong attack radius calculation damages/kills entities through blocks and corners

The bug

Mobs can attack you through blocks and corners due to miscalculation of attack radius.

How to reproduce

  1. Build a completely sealed off house with no windows or doors from opaque blocks like planks or cobblestone or the like, leave some blocks in the inventory for you to place in step 7.

  2. Make a two-block tall one-block wide empty doorway in the wall for you to go through and to seal off with blocks in step 7.

  3. Outside the house, spawn a Ravager.

  4. Switch to survival mode.

  5. The Ravager should start going for you.

  6. Run in the house, let it hit you once through the empty doorway.

  7. Seal off the doorway with two blocks.

Result: The Ravager is still able to hit the player, from about two blocks away, with a complete wall every possible place in between.

Expected: The Ravager can't attack the player any more.

Example

An example can be seen in this comment.

Old example

I just created a villager in MCEdit with the Create Shops filter to have a custom shop. I saved it and launched MC. The villager started to run around normally in his house but then he went to the door where a zombie was knocking at (wooden door on normal difficulty) and the villager blinked red and got damage and after a few hits he died. The zombie killed him through a closed door and the villager did not run away he always came back to the door until he died.

Additional informations

From @unknown:
There are a number of bug reports about attack radius that are all very similar. MC-2310, MC-18326, MC-50668, MC-63965, MC-71834, and MC-74907 are all about the attack radius of mobs extending through blocks. (Some mobs are more bugged than others, but it’s the same basic problem).

There are also a few related issues:

  • MC-1297 is the same as the above, but for players.

  • MC-3059 is the same as the above, but for arrows.

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1

The problem seems to be the method net.minecraft.entity.ai.EntityAIAttackMelee.checkAndPerformAttack(EntityLivingBase, double) and methods overriding it. They all only test if the mob to attack is in a certain radius to the attacker without testing if blocks are between them.

Possible solutions

Bounding box check

The current behavior would be replaced by only allowing mobs to attack other mobs when their bounding boxes intersect.

Ray casting

The current behavior would be extended to require a ray cast from the attacker to the mob to attack (excluding liquids and blocks without collision box) to return no colliding blocks. Possible use y + height / 1.5 as attack height or have a method for mobs to define their attack height(s?). The height at which the mob to attack will be attacked could for example be y + height / 2 or with multiple tries depending on the height of the mob, for example

for (int attackFraction = 0; attackFraction < height / 2; attackFraction++) {
    double attackHeight = y + height * ((attackFraction + 1.0) / (height / 2.0 + 1.0))
}

Related issues

MC-15127 Zombies can Hit NPCs Through Doors. MC-18326 Hit by mob through solid wall MC-20142 Zombies hit me through doors MC-23919 Baby Zombies can attack through doors. MC-24069 zombie glitch MC-29270 Zombies can damage the player when breaking doors MC-29292 Zombies can damage villagers through doors. MC-40354 Door & Zombie bug MC-40987 Zombies attack through doors MC-50668 Mobs' Hitbox disregards Blocks MC-63435 Zombies can attack villagers trough doors MC-63965 Zombies can Attack Villagers through Fences MC-69551 Zombies turn/harm villagers through iron doors MC-70772 Zombies attack through doors MC-71235 Baby Zombie hit player through door. MC-71834 Video: Cave Spiders attack through solid floors when aggro on player MC-73341 In mine craft, if a zombie is behind a door, and if you attack another npc near the zombie behind the door, it will walk up to the door, and is able to attack you from behind the door. MC-74629 zombie through doors MC-74905 mobs can interact with each other through doors,fences, and glass panes MC-74907 Iron Golems can hurt players and mobs through walls MC-77499 Spiders can attack through blocks and at a high distance when crowded MC-79382 Zombies turning villagers through doors MC-88647 Glitchy spiders hitting through wall MC-92896 Mobs can STILL be hit through corners MC-96693 Unable to attack mobs through closed doors, though there are holes in them. MC-96860 Mobs continue to attack player when a villager closes door MC-99135 Villagers dying in blocked doors. MC-100083 Enemies with sword can attack through walls MC-100129 Zombies can attack through the corners of blocks MC-106854 zombies attacking through blocks MC-106966 Zombies can attack through corners MC-107078 Glitches MC-110408 Certain mobs can attack diagonally MC-116039 Cave spiders can hit the player through the floor. MC-125826 Zombies can attack through doors MC-126046 The spiders can attack you under a block that is below you MC-129797 dolphins can hit MC-131846 Phantoms can hit you through blocks. MC-136341 Zombies Attack/Turn Villagers through doors MC-137849 Illager Beast can attack through blocks MC-138903 Pillager Beast MC-139210 The "illager beast" can hit players through walls MC-140962 new village style lets mobs kill villagers! MC-143305 Zombies see and attack residents through the corner of the house. MC-146425 Iron golem and ravager can attack their targets through walls. MC-146545 a 1.14 Bug and it needs to be fixed fast MC-147211 Enderman can hit you through the slab in survival. MC-147928 Ravager can hit you through 1 block wall MC-148521 Mini Zombies can attack you through closed doors MC-151950 Ravagers are able to attack player through blocks from a distance of at least 3 blocks away MC-152319 Ravanger can hit players through blocks MC-152893 Spiders MC-154751 Cave Spiders can hit you from a block MC-154789 Pufferfish Deal damage through blocks MC-154877 Mobs hitting through corners of walls. MC-155446 Ravagers hit through blocks MC-156313 Spider deals damage through half slabs MC-158868 Ravager can hit and see through walls and hit box causes insane issue when trying to hit it. MC-159479 Bees sting through Glass Panes MC-161491 The Ravager is able to kill players thru buildings MC-162382 Bees sting through glass panes MC-162849 Iron golems can hurt players and mobs through walls MC-164394 Pandas can attack through a full solid block MC-167398 make the fence a complete block MC-167784 Bees can attack through slim blocks MC-168686 Died to Ravager in my home through wood blocks MC-169158 Bee stung through glass pane MC-169800 Iron Golem deals damage through the wall MC-171356 Zombies can hit through doors MC-172294 Bees sting through glass panes again (1.15.2) MC-172863 Enderman hitting though wall MC-172864 Enderman hitting though wall MC-172939 Iron Golem attack not just through door, but a good 2.5-3 blocks through MC-175374 Spider can hit up through blocks MC-177256 Spiders beat the player through half blocks MC-179312 Mobs hitting through walls MC-181047 Pufferfish attacks through wall MC-184710 Some mobs don't have appropriate "stopping ranges" when attempting to attack an enemy. MC-186969 AFK bug or Alt+tab glitch MC-188523 iron golem can hit the player from 1 block {if u in the house} MC-190029 zombie atack villager through block MC-192705 Bug where you can hit people with arrows through walls. MC-192895 Zombies can attack through player-built cobblestone MC-194971 Enemies can hit through blocks. MC-195335 Zombified Piglin can attack through block corner MC-196923 zombies can punch through fences MC-198114 spiders can attack players through blocks MC-198395 Bug in spiders MC-198476 The Sweeping Attack can hit through corners MC-199687 Spiders can hit through blocks MC-201532 Spiders can be shot if they are right up against glass panes MC-202151 so piglin brutes can hit through walls. MC-202426 Zombies can hit through blocks MC-207383 Damage Through Walls MC-209036 Mobs able to get you through corners MC-211507 Mobs are able to hit you through blocks MC-211695 Mobs can hit you through walls with no blocks as a corner MC-211873 mobs MC-215294 Magma Cubes are Deadly MC-217006 Iron Golems can hit you through blocks. MC-217360 Zombies are hitting me through blocks when I crawl. MC-218016 Mobs Hitting Players Through Walls MC-218423 Endermen are broken. Please fix MC-220315 zombie and the door bug MC-220665 Attacked by zombified piglin through a wall MC-224513 Endermen can attack diagonally through solid blocks MC-227326 Spiders can attack player through slabs MC-227631 Iron golems can hit you through wall MC-228635 zombies hits me right through block MC-229284 Spiders attacks through walls MC-230134 i was play the new 1.17 when i found that spiders can hit me through solid blocks MC-230627 Cave Spider Reach MC-231751 Spiders can hit me through doors MC-231753 Iron Golems can hit me Through walls MC-233245 Spiders can hit the player from beneath a block MC-241510 Spiders can go through walls MC-241648 dead MC-245806 Wither skeleton can hit the player through walls MC-250268 Bees can sting you through doors and slabs MC-253264 Ravagers can kill me through walls MC-253637 Spiders can hit trough slabs/ground. MC-258640 Ravagers hit through walls MC-261497 Spiders being able to attack through Stairs MC-261906 iron golems kill zombie villagers and zombies throught walls

Attachments

Comments

migrated
[media][media][media][media][media][media]
migrated

I know I'm not a mod but I think I know the problem. Zombies can't hit mobs but can break doors when they are closed. If the door is open, the zombie can hit mobs but can't break it down. If you place the door sideways, then put it in the open position, zombies can hit mobs (like the villager) through doors. Th other problem might be that Createshops filter was messing it up. If the zombie is making the banging noises than Createshops is the problem. If not it could be either one. I may also be completely wrong.

migrated

We're seeing this on naturally generated villages in our vanilla server.

migrated

This can sometimes happen to players (tested 1.6.2) and will always occur with baby zombies.

migrated

This is a really annoying problem which I hope is fixed soon. Confirmed to still be an issue on Mineraft 1.6.2 with Java 7 update 25 64-bit.

migrated

Maybe this issue should be re-opened. I ran some tests in a creative world and it appears that villagers seem to crowd,mostly around the door, in one or several houses at night.

Because the zombies group before the door and then start hitting the villagers through the door somehow, if one villager turns into a zombie, your whole villager population is killed in one sweep.

migrated

Reopened? It was never resolved in first place.

migrated

This is still an issue in all versions up to and including 14w04a.

migrated

Got attacked through an iron door by a Zombie Pigman earlier using snapshot version 14w07a.

migrated

This bug is observed in 14w11b.

migrated

is this problem being fixed? cause i"m now in snapshot 14w18b and zombies can hit me trough doors.
never had this problem before this snapshot though :S ...

oh and btw: zombies don't break down doors anymore, maybe its related.

migrated

This old a bug and none of you noted how it happens? This is old news. If a mob is standing in the block that the door is on ("in the alcove") they can hit through the door. This can be fixed by removing the door and replacing it so the alcove is on the inside of the house. I often go through newly found villages fixing the doors and changing the location of the doorway on the blacksmith (if you add a door in the old location it kills villagers, as they mistake the outside for the inside. The mods here have declared it "not a bug because Mojang doesn't intend players to fix up villages").

Also zombies break down doors on hard only. They half-break the doors on normal and easy (bang on the door causing it to crack but never get further than halfway broken).

Also related: Players can hit baby zombies through the door from the alcove. Only instance I know of where players get to hit through the door. Normally it's only monsters.

EDIT: if the alcove is on the inside and zombies are still getting kills through the door it's probably that other glitch. If multiple villagers are pushing each other and one is in the alcove they can be slightly pushed through the door. It corrects itself (like animals being pushed through fences usually corrects itself) but for a second the villager is vulnerable to hits from zombies outside. I think that's the same way wolves get kills on fenced in sheep.

migrated

Only some zombies spawn with the ability to break doors, most of them can't break them.

migrated

I can confirm this is still an issue on the 1.8-pre1 release. Zombies are able to kill villagers, as well as players, through any door when close enough to the closed door.

migrated

I created a new singe player game, in which a village was close by.
During the night, I heard the "oomph!" sound of a villager being damaged, so I went out of the building and saw a zombie on the outside and villager on the inside. I killed the zombie and went inside with the villager. Another zombie came and as the villager went by the door, it was hurt. I could hear other villagers hurt in another building. I protected my one villager until morning and I went to check on the other villagers.
There were no more villagers, but 6 new 'zombies' were let out of the building the villagers had been in and were promptly killed.
These were all spawned villages and it seems as though normal doors do not prevent villager/zombie damage. Im bummed because I only have 1 villager now.

migrated

Using a splash potion of weakness then a regular golden apple should turn a villager zombie back into a normal villager. So instead of killing the zombies, you could have left them for when you got the potions and golden apples and you would have 7 villagers left. This might end up costing far too much gold though.

migrated

There are quite a few problems with blocks that don't take up the whole 1m by 1m area. For doors, being attacked by mobs or being shot by an arrow through the door is probably possible because the player or entity's hitbox ends up outside of the door, allowing interaction with it. This has also occasionally happened with regular blocks in a corner where you can see the mob's arm, allowing you to kill a zombie through solid blocks.

PS Zombies will no longer break down doors on any gamemode or difficulty and it is intended to be that way.

Sonicwave

Confirmed for 1.8.1-pre1/pre2.

migrated

the problem is the hitbox of a zombie.
the hitbox of a zombie (which can be see by pressing F3 + B) can sometimes glitch in the hitbox of a door. however, i do believe this is just a directional glitch.
when the hitbox of a zombie and something it wants to hit collide, the zombie can actually hurt it.

migrated

I got killed by a baby zombie going through a IRON DOOR!!!!

migrated

Edit: baby zombie bypassing the iron door is for 1.8,1.8.1 now this bug has ben fixed for 1.8.2 and it started after upgradeing from 1.7.10

migrated

I also have this problem, my villagers keep dying and I have to block the house entrances with dirt until the morning (damn it...).

migrated

http://minecraft.gamepedia.com/Zombie

At "Behavoir" they say zombies are able to deal damage through a closed door.

migrated

The Minecraft Wiki isn't considered a reliable source for bug reports. It basically documents the current behavior of the game.

migrated

I think this relates to MC-3059 because what is probably happening in both is that the attack IN GENERAL is just going through the door.

Sonicwave

Confirmed for 15w33c. It doesn't help that the villagers often press themselves against the door, even if a zombie is trying to break it - _ -

migrated

Confirmed for 15w47c

migrated

Confirmed for 15w49a

migrated

Confirmed for 15w50a

migrated

confirmed 16w02a , through closed door and diagonally through corners of blocks and both at same time

migrated

This is confirmed for 16w05b, and it's also unfair how the Player is unable to attack through closed doors. My friend created an issue about the Player being unable to attack through closed doors. See MC-96993

migrated

Confirmed for 16w06a

SunCat

Confirmed for 1.9-pre2

SunCat

Still in 1.9-pre3

SunCat

Still in 1.9-pre4

migrated

Has anyone had the problem in 1.9 where you cover up the door with blocks and the villagers still die? It used to keep them safe, but I lost most of a village yesterday. I guess I'll have to build a whole little room in front of each door until I get the village walled and lit.

SunCat

Still in 1.9.1-pre1

SunCat

Still in 1.9.1-pre3

migrated

There are a number of bug reports about attack radius that are all very similar. MC-2310, MC-18326, MC-50668, MC-63965, MC-71834, and MC-74907 are all about the attack radius of mobs extending through blocks. (Some mobs are more bugged then others, but it’s the same basic problem). There are also a few related issues:

MC-1297 is the same as the above, but for players.
MC-3059 is the same as the above, but for arrows.

Most or all of these reports should be consolidated into one, as they are all caused by the same base issue.

migrated

Confirmed in 1.9.2.

I just died in a new hardcore world because a zombie was able to hit me through the corner of a wall.

SunCat

Still in 1.10

migrated

An arrow can also hit living entities through corners.

migrated

Confirmed for 1.10 and 1.10.2.

migrated

Confirmed for 1.11.2.

migrated

I myself tested and confirmed for 1.9.4, 1.10.2, 1.11.2 both:

  • adult zombies hit through corners of a (diagonal) wall (sometimes an arm can be seen) and

  • adult zombies hit through a closed door.

Maybe it's not attack radius but something like hitbox or gaps or solidity of the object(s) between attacker an mob/player. (Seed -5821562820736002727 on 1.11.2 generates a village near the spawn - all villagers die because in the houses they are not safe against zombies.)

For similar description see the duplicates (whose problems are not solved, but there status is "resolved" only because they are duplicates).

My details: I tested with zombies on one side and villagers and player on the other side of a wall. I tested some types of stone and wood - all the same result. Hitting through the door is not affected by the orientation (inside/outside) of the door.

X = block of the wall
D = door (tested in both directions)
Z = zombie
V = villager (same with player)
o = nothing special (monospace did not work here)

oZXZo
ZXVXZ
XVoVX zombies hit villagers
ZXVXZ
oZXZo

ZZZZZZ
ZXXXXZ
ZXVVXZ zombies do not hit villagers
ZXVVXZ
ZXXXXZ
ZZZZZZ

XXXX
XoVDZ zombie hits villager if both near the door
XXXX

(Many villagers were harmed during this test.)

marcono1234

Added a code analysis and possible solutions I could come up with. Feel free to add own solutions as well.

migrated

Confirmed for 1.12 Pre Release 2

migrated

this bug is apperntly also in mc10 C++/PE as well not sure if i should find a report already or what

FaRo1

MCBC and MCJava have two separate trackers. You can filter by using "project" in the search options. If you find a report there or, if there is none, make one, can you please comment here with the number of it so that it can be linked as related?

migrated

Confirmed for 1.12.1. Zombies killed me even though I was boxed into a 1x2x1 hole. Hit diagonally through corners.

migrated

Confirmed in 1.12.2

JochCool

Confirmed for 18w03b 😞

migrated

I like the ray cast solution, simple and elegant and the mechanisms are already in place

migrated

Confirmed for 1.13.

migrated

This potentially is caused by the same issue, as the Drowned attack radius while they are in the swimming animation extends to about 2 blocks away. Only occurs if they are 'horizontal', otherwise attack radius is normal. This becomes very bad if they get in a boat, as they are stuck in swim animation and have a large attack radius.

migrated

Can confirm for 18w43c - the zombie hurts the villager and does not attack the door between them.

migrated

Confirmed for 18w47b

migrated

The villagers can also be damaged through diagonal wall spaces of the new huts usually ther 5x5 ones. appears in 18w50a

migrated

Confirmed for 18w50a, the majority of the villages are almost empty because all the villagers are being killed by that.

migrated

Still happening in 19w05a

ZeNico13

Still in 19w12b

ZeNico13

Still in 19w13a

ZeNico13

Still in 19w14a

ZeNico13

Still in 19w14b and 1.14 Pre-Release 1

ZeNico13

Still in 1.14 Pre-Release 2

Anonymous_46YT

it still happens in 1.14 Pre-Release 3 and 4

ZeNico13

Still in 1.14 pre-5

ZeNico13

Still in 1.14 Release

ZeNico13

Still in 1.14.1 Release

ZeNico13

Still in 1.14.2 Pre-Release 1 and 1.14.2 Pre-Release 2

migrated

Still in 1.14.4

anthony cicinelli

Confirmed for 19w42a

TheBoy358

Confirmed in 19w45b.

AGriggs191

It's very disappointing that this is still a bug 7 YEARS after being reported. I was very hopeful that it would be fixed before 1.15 comes out, but it doesn't look like that's going to happen.

migrated

Still in 1.15.1

Got stung by bee through glass pane (bee died)

For details: MC-169158

migrated

I'm having the same problem in the Nintendo Switch version of this game. Clean through the f[redacted]ing walls, 40 f[redacted]ing levels are gone now. I'll be honest, I expect these types of malfunctions from Bethesda but Mojang really dropped the ball here.

marcono1234

@@unknown, this issue is only for the Java Edition. Please search if this issue has already been reported for Bedrock Edition (MCPE), which includes the Nintendo Switch version, and if not create a new report. Note that there is already MCPE-48401 which sounds similar, but not quite the same.

migrated

This bug is extremely conspicuous with ravagers. I'm getting killed (on hard difficulty if I don't have full health) standing 2+ blocks away from a ravager, with a door in between. Its range is bigger than the player's!

violine1101

Technical difficulties... this ticket will be reopened as soon as Arisa will let us ^^

Uriel Salischiker

Ticket has been reopeend

RedCMD

Golems can attack through over 1.5m solid thick walls

migrated

@unknown made a comment on MC-147516 that these issues relating to the attack ranges of mobs could be related to this issue.

https://streamable.com/hph3g1

https://streamable.com/omr8d9

https://streamable.com/fj1dqj

I attempted to make an individual issue to the bug shown in the video. MC-184710

If you think that this issue does not address the above, you should reopen my issue. Now that it seems this issue might be fixed in 1.16 (It was assigned to Searge 4 hours ago) you might as well get to fixing the issue in the videos as its very similar.

migrated

Ravegers are killing me 2 blocks away (me, block block, raveger) inside a building. I am playing on normal difficulty. Even with full iron armor and a shield I am dead in 2 hits and they instantly counter attack when hit. Finally, I can only escape them if I run straight, any deviation they will catch and kill me. This is too much for normal difficulty. I was also killed 23 time because the thing spawn camped me. I literally could not leave my hut. It doesn't help that I also had to deal with a mach 5 evoker spawning vexes like crazy, but that's a different ticket. I did not have this difficulty before 1.16. A raveger with a guy on top will stop to shoot giving me a chance to run at least. I had to use the other pillagers to kill this raveger.

migrated

I'm not sure if the villager problem relates to hitboxes but I think if the door was placed incorrectly (on the block next to the doorway) then the villager keeps walking to it (I had it too). I had zombies outside an iron door incorrectly placed and the villager kept running there and died.

migrated

Seriously how long does it take to implement three lines of code?

How about stop adding stuff and start fixing stuff?

This bug is game ending. Like quitting playing the game ending.

Look at that Ravenger gif above. How is that fair after all the grinding the player has done to get to that point?

We have to abide by the rules so why can't the rest of MC?

 

Honestly? Shame on you guys.

migrated

Can confirm in 1.17.1

migrated

Can confirm in 1.17.1
Ravagers can attack you through a completely sealed off wall if they are still targeting you behind it.
Steps to reproduce:

  1. Build a completely sealed off house with no windows or doors from opaque blocks like planks or cobblestone or the like, leave some blocks in the inventory for you to place in step 7.

  2. Make a two-block tall one-block wide empty doorway in the wall for you to go through and to seal off with blocks in step 7.

  3. Outside the house, spawn a Ravager.

  4. Switch to survival mode.

  5. The Ravager should start going for you.

  6. Run in the house, let it hit you once through the empty doorway.

  7. Seal off the doorway with two blocks.

Result: The Ravager is still able to hit the player, from about two blocks away, with a complete wall every possible place in between.

Expected: The Ravager can't attack the player any more.

ampolive

Can confirm in 21w39a.

migrated

Can confirm 22w17a, 22w16a, and 22w15a.

migrated

Can confirm in 1.19.1-pre1
Especially the Ravager can be very annoying due to this bug
I made 2 new small clips to show the issue (One is also with F3 if that helps the devs)

Edit: Apparently my videos don't work on this website (although they are normal mp4), so I uploaded them to Imgur...here is the link

NBG-bootmgr

test and confirm in 1.19.1-pre5

NBG-bootmgr

Can confirm in 1.19.2

migrated

Tested in 1.18 thru 1.19.2
I've noticed that this happens once a mob has already started attacking, not before that.  I have a villager zombification/curing station wherein a villager in a minecart is in the corner and a zombie is on the outside of the corner.  With the flick of a lever, the blocks on one side of the corner are pulled away, allowing the zombie to attack.  If I deactivate the lever and push the zombie back outside BEFORE he attacks the villager, he will go idle, but if I let him attack the villager even one time before pushing him outside, he continues to attack the villager through the corner until the villager is zombified.  See attached screenshots: when the wall is open, the villager is being attacked.  Even after I close the wall, the zombie continues attacking over and over.

[media][media]
Brain81505

Can confirm in 23w06a

Brevort

Affects 1.20.1.

migrated

OMG NO WAY THEY FINALLY FIXED IT
After almost 11 years, against all odds, someone at Mojang finally fixed one of the most annoying issues in the game.

Whoever is the dev that fixed it: https://imgur.com/a/xFoTlWQ
We need to get this guy a dev of the year award.

migrated

In 23w32a

windwend

Finally, zombies can't hit you through doors anymore. Good job Gnembon!

migrated

Woah, amazing to see this fixed.

FaRo1

Still happens sometimes in 23w33a with spiders.

migrated

That's tracked in MC-264915.

[Mod] markderickson

gnembon

Confirmed

Platform

Very Important

Entities, Hitboxes

attack, damage, kill

Minecraft 1.4.3, Snapshot 13w05b, Minecraft 1.5.1, Minecraft 1.5.2, Minecraft 1.6.1, ..., 1.19.3, 1.19.4, 23w13a, 1.20.1, 23w32a

23w33a

Retrieved