feat: display entity name

This commit is contained in:
xtex 2023-07-02 11:17:37 +08:00
parent 5dc07382d7
commit 351ec0f9bf
Signed by: xtex
GPG Key ID: B918086ED8045B91
2 changed files with 6 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import dev.architectury.registry.client.level.entity.EntityRendererRegistry
import dev.architectury.registry.level.entity.EntityAttributeRegistry
import net.fabricmc.api.EnvType
import net.minecraft.nbt.CompoundTag
import net.minecraft.network.chat.Component
import net.minecraft.network.syncher.EntityDataAccessor
import net.minecraft.network.syncher.EntityDataSerializers
import net.minecraft.network.syncher.SynchedEntityData
@ -95,4 +96,7 @@ class ProjectedPersonEntity(entityType: EntityType<out PathfinderMob>, level: Le
override fun shouldShowName() = true
override fun getTypeName(): Component = shape.name.takeIf { it.isNotEmpty() }?.let { Component.literal(it) }
?: super.getTypeName()
}

View File

@ -23,7 +23,7 @@ data class ProjectedPersonShape(
val scaleX: Float = 1.0f,
val scaleY: Float = 1.0f,
val scaleZ: Float = 1.0f,
val name: String = "[DESYNC]",
val name: String = "",
val skin: Int = 0,
) {