SwingThroughGrass

SwingThroughGrass

54M Downloads

Hits Mobs through blocks and Ignores Hitboxes

jimurray opened this issue ยท 3 comments

commented

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

commented

Fixed for 1.19 and 1.18

commented

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.

commented

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