Skip to content

Commit

Permalink
Attached entity fixes
Browse files Browse the repository at this point in the history
- Return on world teleport
- Return on removal
- Do not display to attached player
  • Loading branch information
andantet committed Jul 19, 2024
1 parent 22001b2 commit 715433b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ kotlin_version=1.9.24
fabric_kotlin_version=1.10.20

# Mod Properties
mod_version=1.1.1
mod_version=1.1.2

maven_group=net.mcbrawls
mod_id=brawls-entities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,18 @@ open class PlayerAttachedTextDisplayEntity(
override fun tick() {
super.tick()

if (isRemoved) {
return
}

val player = serverPlayer
if (player == null) {
discard()
} else {
// verify same world
if (player.world != world) {
teleport(player.serverWorld, player.x, player.y, player.z, emptySet(), 0.0f, 0.0f)
return
}

// verify riding
Expand All @@ -75,8 +80,8 @@ open class PlayerAttachedTextDisplayEntity(
}
}

override fun getPolymerEntityType(player: ServerPlayerEntity): EntityType<*> {
return EntityType.TEXT_DISPLAY
override fun getPolymerEntityType(viewer: ServerPlayerEntity): EntityType<*> {
return if (viewer.hardReference == player) EntityType.MARKER else EntityType.TEXT_DISPLAY
}

fun interface TextSupplier {
Expand Down

0 comments on commit 715433b

Please sign in to comment.