Entity damage from explosions is ray-casted from incorrect position #48
Labels
No Label
blocker
bug
code quality
confirmed
critical
discussion
high priority
incompatibility
incomplete feature
invalid
low priority
missing feauture
needs testing
packet spam
performance
project
regression
translations
unconfirmed
in review
ready for review
No Milestone
No project
No Assignees
2 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Mineclonia/Mineclonia#48
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Entity damage from explosions is calculated by casting rays from random points in the entities bounding box to the explosion. This is working correctly. The bounding box the rays originate from is however twice as large as it should be in all directions which makes the entity damage slightly incorrect. This bug has existed for as long as the mcl_explosions mod.
I have a solution for this and will make a PR shortly.
How to reproduce
An easy way to illustrate how this becomes a problem is the attached picture. Put a player (or any other entity of the same height) into the spot where the armor stand is and pull the lever.
The expected behavior is that the player/entity should take 1/2 heart damage (1 damage point) because there is a wall between the entity and the explosion. Because this bug exists the entity/player will take considerably more damage than that.
I think I was wrong assuming this is a bug. What made me think of this was when I read my own code:
But then I looked at the Minecraft Wiki which I used as a reference when implementing the mcl_explosions mod. It says:
So this is probably what happens in Minecraft too. I will leave this issue open for a few days in case someone have access to Minecraft and can confirm that it behaves the same. Otherwise I will close this issue as it is probably the expected behaviour.
Either way. I think something is slightly incorrect with the current code.
The fact that the size of the bounding box is multiplied by two means that part of it will clip into a roof. This results in you taking less damage if you have a roof over your head when there is direct exposure from you and the explosion.
@n_to you have the original minecraft as far as I know – could you test this scenario?
I am confident this is a bug because a player will take less damage from TNT if a player is surrounded by blocks. Like in the following picture. If a player stands were the armor stand is they will take more damage if the obsidian roof is removed.
I am quite sure I misinterpreted how the explosion entity damage algorithm works. I will make a PR adjusting it so it will only calculate the exposure from the entity collisionbox.
@ryvnf thank you for your efforts.
Closing after merging #62.