Exidex / SwingThroughGrass

Quality of life mod for Minecraft
MIT License
12 stars 7 forks source link

Hits Mobs through blocks and Ignores Hitboxes #14

Closed jimurray closed 2 years ago

jimurray commented 4 years ago

I'm playing Craft To Exile Dissonance (MC version 1.15.2) release 2.5.6. I ran into an issue where I was building a villager trading hall, broke a torch, and killed a villager (since the mod pack gives you loads of base damage with all hits). So there are 2 big issues. First, when I break the torch, it will damage the villager despite them being on the other side of the glass block. Second, when I break the torch, it will damage the villager even if the crosshair is outside of their cursor.

So in the screenshot, clicking will damage the villager. 2020-10-31_22 15 28

Exidex commented 4 years ago

I knew about existence of this bug when I was initially writing the mod. This is a side effect of primary function of mod, to hit the mobs behind block that has no collision box. There is no way I could find to fix it.

jimurray commented 3 years ago

Can you use something like world.rayTraceBlocks with blockmode of collider to check if there's a block between the player and the entity that the entity raytrace returns? Or will that return blocks with no collision box? https://forge.yue.moe/javadoc/1.15.2/net/minecraft/util/math/RayTraceContext.BlockMode.html#enum.constant.detail

If that won't work, then perhaps something like this to check each block in front of the player could help. The for loop in the RayTraceResult function is the part I'm referring to: https://github.com/tp3rson/PUBGMC/blob/23b8d621848547fafee5a562009da7fedd6a8c9a/src/main/java/com/toma/pubgmc/common/entity/throwables/EntityFlashBang.java

Exidex commented 2 years ago

Fixed for 1.19 and 1.18