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

Reset max health attribute on server switch #515

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

Conversation

kennytv
Copy link
Member

@kennytv kennytv commented Jun 6, 2020

Attributes aren't reset, so the player sees the wrong amount of hearts when switching away from a server that changed the default value to a server without the change (since default attributes are not sent to the client). All of the other attributes either don't affect the client itself or are reset due to non-default values for players, so only the max health attribute is important.

@Xernium
Copy link
Contributor

Xernium commented Jun 28, 2020

While we are on this subject, shouldn't JoinGame be resent if the next server is != the same mode (hardcore or not hardcore) ?

+ public static EntityAttributes createDefaultHealth(int entityId, int protocolVersion)
+ {
+ EntityAttributes packet = new EntityAttributes( entityId );
+ String key = "generic.maxHealth"; //TODO Differentiate for 1.16: minecraft:generic.max_health
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that todo should be solved before merge. shouldn't be hard as the method already gets the protocolVersion.

@Janmm14
Copy link
Contributor

Janmm14 commented Nov 3, 2020

While we are on this subject, shouldn't JoinGame be resent if the next server is != the same mode (hardcore or not hardcore) ?
@Xernium

This is already done if you enable the option "disableEntityMetadataRewrite" in Waterfall.

It should also be checked if that does reset the client's max health, in that caser this patch would need additional ifs so we don't send it if its not actually needed.

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.

3 participants