Skip to content

Commit

Permalink
Fixed display name
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jul 14, 2024
1 parent 52c1b52 commit eecd80b
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@ class DisplayName : DisplayNameProxy {
val nmsComponent = displayName.toNMS()

val nmsEntity = entity.handle
nmsEntity.isCustomNameVisible
val entityData = SynchedEntityData.Builder(nmsEntity).build()

entityData.set(displayNameAccessor, Optional.of(nmsComponent), true)
entityData.set(customNameVisibleAccessor, visible, true)

val packet = ClientboundSetEntityDataPacket(
nmsEntity.id,
entityData.packDirty() ?: throw IllegalStateException("No packed entity data")
listOf(
SynchedEntityData.DataValue.create(displayNameAccessor, Optional.of(nmsComponent)),
SynchedEntityData.DataValue.create(customNameVisibleAccessor, visible)
)
)

player.sendPacket(Packet(packet))
Expand Down

0 comments on commit eecd80b

Please sign in to comment.