Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix saving negative last damage to the entity #765

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

XDMAN500
Copy link

@XDMAN500 XDMAN500 commented Oct 26, 2024

Description

Minecraft uses the last damage stored on an entity to modify incoming damage that happens during the immunity tick with the formula real-damage=input-damage - last damage. When the last damage is negative the amount adds to the real damage taken and bypasses all damage reduction items like armor and effects like resistance.

Steps to Reproduce

Attack a player in full diamond armor with a sharpness 5 diamond sword while using a weakness 2 potion effect. Continue to attack the player until the potion effect expires. The player may suddenly die instead of taking normal diamond sword damage.

config.yml.txt

Minecraft uses the last damage stored on an entity to modify incoming damage that happens
during the immunity tick with the formual `real-damage=input-damage - last damage`. When the last damage is
negative the amount adds to the real damage taken and bypasses all damage reduction items
like armor and effects like resistance.

Steps to Reproduce

Attack a player in full diamond armor with a sharpness 5 diamond sword while using a weakness 2 potion effect.
Continue to attack the player until the potion effect expires.
The player may suddenly die instead of taking normal diamond sword damage.
@kernitus
Copy link
Owner

Under what circumstances would the newDamage passed into the function be negative?

@XDMAN500
Copy link
Author

Under what circumstances would the newDamage passed into the function be negative?

I added steps to reproduce the bug.

Attack a player in full diamond armor with a sharpness 5 diamond sword while using a weakness 2 potion effect. Continue to attack the player until the potion effect expires. The player may suddenly die instead of taking normal diamond sword damage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants