feat: display entity name
This commit is contained in:
parent
5dc07382d7
commit
351ec0f9bf
@ -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
|
||||
@ -42,7 +43,7 @@ class ProjectedPersonEntity(entityType: EntityType<out PathfinderMob>, level: Le
|
||||
|
||||
init {
|
||||
EntityAttributeRegistry.register(entity, ::createAttributes)
|
||||
if(Platform.getEnv() == EnvType.CLIENT) {
|
||||
if (Platform.getEnv() == EnvType.CLIENT) {
|
||||
EntityRendererRegistry.register(entity, ::ProjectedPersonRenderer)
|
||||
}
|
||||
ProjectedPersonShape
|
||||
@ -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()
|
||||
|
||||
}
|
@ -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,
|
||||
) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user