The Bug:
You can attack and be attacked through glass panes.
Steps to Reproduce:
Summon a box with a glass pane wall by using the commands provided below.
/fill ~1 ~-1 ~1 ~11 ~3 ~5 minecraft:tinted_glass hollow
/fill ~2 ~ ~1 ~10 ~2 ~1 minecraft:glass_pane
Summon a zombie inside of the box and break any block of glass pane that's at eye height, so that the zombie can be able to notice you.
Switch into survival mode and get the zombie to notice you.
When it does, move away from the hole in the glass pane, but remain standing as close as you can to adjacent glass pane blocks.
Wait for the zombie to approach you.
Take note as to whether or not you can attack and be attacked through glass panes.
Observed Behavior:
You can attack and be attacked through glass panes.
Expected Behavior:
You would not be able to attack or be attacked through glass panes.
Linked issues
is duplicated by 19
relates to 4
Attachments
Comments 57
It's safe to assume this has been fixed in 23w35a due to the fixes for MC-2310 & MC-264915, at least for mobs. There's still the other minor issue that is already stated in the title, which is players being able to attack through panes/blocks, but that one could be considered a completely different issue.
In certain protected areas, such as the spawn protection in servers, the player can attack other entities through blocks, because when the player breaks a block client-side, the gap remains for a few milliseconds until it regenerates, giving the player the opportunity to strike the entity behind, as can be seen in these screenshots:
[media][media]
However, i haven't tested this so i don't know if it's still the case in 1.20.1. If it is, the report should probably be centered around that, or either be covered in a new report.
It is almost never "safe to assume", but...
It seems that the attack and pathing behaviors of zombies (and maybe spiders, too) have changed since I last tested this (i.e. very long time ago), too.. I could not reproduce with the old test method, not even to the point of zombies getting as close to glass panes as before (they don't "hug the pane" now, but stay about at the center of the full free block outside). And could not get them to even to try to attack as soon as there was glass in between. So whatever has changed (in addition to those other two issues), a proper fix or not, has apparently made them unable/unwilling to attack through at least glass panes (in normal situations).
Spiders could get closer the glass pane (as they climb it), but no attacks through the pane.
I tried with only 3 zombies simultaneously, so they didn't push each other much towards the pane, as they all tried to get to the center of the same block, not straight towards the player 😛  Perhaps with a bigger horde, some could get pushed against the pane, close enough, but that would then probably be more about the problem of containing too many mobs in too little space.
... Or need new/better reproduction steps to catch the remaining situations, if any left.
Yeah, what I meant by my comment was that i tested most of the mobs trying to attack through panes, even trapdoors and I wasn't able to reproduce this issue anymore.
This happens to me too