Zombies can Attack Villagers through Fences
I was AFK for about an hour at my automatic villager breeder. The villagers are protected by fences. When I came back from AFK, There were no villagers except two zombie villagers holding carrots. When I had converted the zombie villagers to start the breeding from the beginning, I entered a r]test world. I spawned a lot of villagers in the fenced off pen and spawned zombies on the outside. They were able to attack the villagers. They can also attack the villagers through stacked up fences.
To reproduce, go into a creative world and spawn a lot of villagers in a pen of one high fences. Then spawn lots of zombies on the outside. The zombies will attack the villagers. After that follow those steps again except this time using two high fences.
Linked Issues
Created Issue:
Zombies can Attack /villagers through Fences
I was AFK for about an hour at my automatic villager breeder. The villagers are protected by fences. When I came back from AFK, There were no villagers except two zombie villagers holding carrots. When I had converted the zombie villagers to start the breeding from the beginning, I entered a r]test world. I spawned a lot of villagers in the fenced off pen and spawned zombies on the outside. They were able to attack the villagers. They can also attack the villagers through stacked up fences.
Zombies can Attack/villagers through FencesZombies can Attack Villagers through Fences
I was AFK for about an hour at my automatic villager breeder. The villagers are protected by fences. When I came back from AFK, There were no villagers except two zombie villagers holding carrots. When I had converted the zombie villagers to start the breeding from the beginning, I entered a r]test world. I spawned a lot of villagers in the fenced off pen and spawned zombies on the outside. They were able to attack the villagers. They can also attack the villagers through stacked up fences.
To reproduce, go into a creative world and spawn a lot of villagers in a pen of one high fences. Then spawn lots of zombies on the outside. The zombies will attack the villagers. After that follow those steps again except this time using two high fences.
duplicates
The bug
Mobs can attack you through blocks and corners due to miscalculation of attack radius.
How to reproduce
- 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.
- 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.
- Outside the house, spawn a Ravager.
- Switch to survival mode.
- The Ravager should start going for you.
- Run in the house, let it hit you once through the empty doorway.
- 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 KingSupernova:
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-1297is 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)) }
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.
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.
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.
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.
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.
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.
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.
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.



I can confirm this is still an issue on 1.8-pre1 release. I put villagers in a fenced off area, and spawned zombies outside of the fence, and the zombies were able to attack and kill my villagers through the fence. This even happens with a 2 high wall of fences.
I have a similar problem with zombies attacking villagers behind doors.
Version 1.8
To recreate: build a small house, and place a villager or two in it next to the door. spawn some zombies outside and watch.
I think a simple solution would be to make the villager AI stay as far from the zombie as possible even if the door is closed.
sounds logical because the zombie stand against the fence and standing ontop of the block where the fence is placed if a villager does the same on the other side it can be hit because the fence hitbox is 1.5 blocks heigh but smaller from the sides so the zombie can reach the villagers
Still present 16w02a. Zombies can attack through a 2 high fence.
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, andMC-74907are 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-1297is 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.