mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Reset attributes in JavaLoginTranslator
This commit is contained in:
parent
1bd595826b
commit
14e7145503
3 changed files with 9 additions and 4 deletions
|
@ -281,6 +281,13 @@ public class SessionPlayerEntity extends PlayerEntity {
|
|||
silent = false;
|
||||
}
|
||||
|
||||
public void resetAttributes() {
|
||||
attributes.clear();
|
||||
maxHealth = GeyserAttributeType.MAX_HEALTH.getDefaultValue();
|
||||
// Relying on the server to resend speed attribute
|
||||
// Armor attribute reset would go here
|
||||
}
|
||||
|
||||
public void resetAir() {
|
||||
this.setAirSupply(getMaxAir());
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class JavaLoginTranslator extends PacketTranslator<ClientboundLoginPacket
|
|||
// Remove all bossbars
|
||||
session.getEntityCache().removeAllBossBars();
|
||||
// Remove extra hearts, hunger, etc.
|
||||
entity.getAttributes().clear();
|
||||
entity.resetAttributes();
|
||||
entity.resetMetadata();
|
||||
|
||||
// Reset weather
|
||||
|
|
|
@ -54,9 +54,7 @@ public class JavaRespawnTranslator extends PacketTranslator<ClientboundRespawnPa
|
|||
}
|
||||
|
||||
if (!packet.isKeepAttributes()) {
|
||||
entity.getAttributes().clear();
|
||||
entity.setMaxHealth(GeyserAttributeType.MAX_HEALTH.getDefaultValue());
|
||||
// Relying on the server to resend speed attribute
|
||||
entity.resetAttributes();
|
||||
}
|
||||
|
||||
session.setSpawned(false);
|
||||
|
|
Loading…
Reference in a new issue