Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-25 15:50:14 +01:00
Round up health attribute for all living entities (fixes #2362)
Dieser Commit ist enthalten in:
Ursprung
334e4fb059
Commit
887296ef78
@ -160,7 +160,8 @@ public class LivingEntity extends Entity {
|
|||||||
*/
|
*/
|
||||||
protected AttributeData createHealthAttribute() {
|
protected AttributeData createHealthAttribute() {
|
||||||
// Default health needs to be specified as the max health in order for maximum hearts to show correctly on mounted entities
|
// Default health needs to be specified as the max health in order for maximum hearts to show correctly on mounted entities
|
||||||
return new AttributeData(GeyserAttributeType.HEALTH.getBedrockIdentifier(), 0f, this.maxHealth, this.health, this.maxHealth);
|
// Round health value up, so that Bedrock doesn't consider the entity to be dead when health is between 0 and 1
|
||||||
|
return new AttributeData(GeyserAttributeType.HEALTH.getBedrockIdentifier(), 0f, this.maxHealth, (float) Math.ceil(this.health), this.maxHealth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateArmor(GeyserSession session) {
|
public void updateArmor(GeyserSession session) {
|
||||||
|
@ -107,12 +107,6 @@ public class EnderDragonEntity extends InsentientEntity implements Tickable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected AttributeData createHealthAttribute() {
|
|
||||||
// Round health up, so that Bedrock doesn't consider the dragon to be dead when health is between 0 and 1
|
|
||||||
return new AttributeData(GeyserAttributeType.HEALTH.getBedrockIdentifier(), 0f, this.maxHealth, (float) Math.ceil(this.health), this.maxHealth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void spawnEntity(GeyserSession session) {
|
public void spawnEntity(GeyserSession session) {
|
||||||
super.spawnEntity(session);
|
super.spawnEntity(session);
|
||||||
|
@ -46,7 +46,6 @@ import lombok.Setter;
|
|||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.geysermc.connector.entity.Entity;
|
import org.geysermc.connector.entity.Entity;
|
||||||
import org.geysermc.connector.entity.LivingEntity;
|
import org.geysermc.connector.entity.LivingEntity;
|
||||||
import org.geysermc.connector.entity.attribute.GeyserAttributeType;
|
|
||||||
import org.geysermc.connector.entity.living.animal.tameable.ParrotEntity;
|
import org.geysermc.connector.entity.living.animal.tameable.ParrotEntity;
|
||||||
import org.geysermc.connector.entity.type.EntityType;
|
import org.geysermc.connector.entity.type.EntityType;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
@ -245,13 +244,6 @@ public class PlayerEntity extends LivingEntity {
|
|||||||
this.position = includeOffset ? position.add(0, entityType.getOffset(), 0) : position;
|
this.position = includeOffset ? position.add(0, entityType.getOffset(), 0) : position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected AttributeData createHealthAttribute() {
|
|
||||||
// Round health up, so that Bedrock doesn't consider the player to be dead when health is between 0 and 1 (half a heart)
|
|
||||||
// This issue, as of Bedrock 1.17.0, does not appear to persist with any other entity except the ender dragon
|
|
||||||
return new AttributeData(GeyserAttributeType.HEALTH.getBedrockIdentifier(), 0f, this.maxHealth, (float) Math.ceil(this.health), this.maxHealth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
|
||||||
super.updateBedrockMetadata(entityMetadata, session);
|
super.updateBedrockMetadata(entityMetadata, session);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren