-
Notifications
You must be signed in to change notification settings - Fork 0
Follow
wjddusrb03 edited this page Mar 29, 2026
·
1 revision
Makes a display entity follow a target entity (player, mob, etc.) with smooth movement.
SpawnedDisplay display = DisplayAPI.text(location)
.text(Component.text("Name Tag"))
.noBackground()
.spawn();
FollowDisplay follow = DisplayAPI.follow(display, player)
.offset(0, 2.5, 0)
.smoothTeleport(3)
.start();| Method | Description | Default |
|---|---|---|
.offset(x, y, z) |
Position offset from target | 0, 2.5, 0 |
.smoothTeleport(int ticks) |
Interpolation duration for smooth movement | 3 |
.updateInterval(int ticks) |
How often to update position | 1 |
.start() |
Begin following | - |
.stop() |
Stop following | - |
.remove() |
Stop and remove display | - |
FollowDisplay automatically stops when:
- The display entity dies or is removed
- The target entity dies or is invalid
- The target player goes offline
SpawnedDisplay tag = DisplayAPI.text(player.getLocation())
.text(Component.text(player.getName()).color(NamedTextColor.AQUA))
.noBackground()
.billboard(Billboard.CENTER)
.spawn();
DisplayAPI.follow(tag, player)
.offset(0, 2.3, 0)
.start();SpawnedDisplay hp = DisplayAPI.text(pet.getLocation())
.text(Component.text("HP: " + pet.getHealth()))
.noBackground()
.spawn();
DisplayAPI.follow(hp, pet)
.offset(0, 1.5, 0)
.smoothTeleport(2)
.start();SpawnedDisplay arrow = DisplayAPI.text(target.getLocation())
.text(Component.text("V").color(NamedTextColor.RED))
.noBackground()
.spawn();
FollowDisplay f = DisplayAPI.follow(arrow, target)
.offset(0, 3.0, 0)
.start();
// Stop after 10 seconds
new BukkitRunnable() {
public void run() { f.remove(); }
}.runTaskLater(plugin, 200L);