Hits Mobs through blocks and Ignores Hitboxes
jimurray opened this issue ยท 3 comments
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.
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.
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