fix fallback entity name

This commit is contained in:
Moritz Zwerger 2023-11-07 21:56:58 +01:00
parent fddea73f3a
commit c809357f16
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 6 additions and 2 deletions

View File

@ -47,7 +47,7 @@ abstract class LivingEntity(connection: PlayConnection, entityType: EntityType,
override val canRaycast: Boolean get() = super.canRaycast && health > 0.0
override val name: ChatComponent? get() = super.name ?: connection.language.translate(type.translationKey)
override val name: ChatComponent? get() = super.name
private fun getLivingEntityFlag(bitMask: Int): Boolean {
return data.getBitMask(FLAGS_DATA, bitMask, 0x00)

View File

@ -52,7 +52,11 @@ class EntityNameFeature(renderer: EntityRenderer<*>) : BillboardTextFeature(rend
private fun Entity.getName(invisible: Boolean): ChatComponent? {
if (invisible) return null
if (this.isNameVisible) return name
if (this.isNameVisible) {
var name = this.name
if (name == null && this is LivingEntity) name = connection.language.translate(type.translationKey) // TODO: Is that correct?
return name
}
if (!isTargeted()) return null
return name
}