Skip to content

Commit 08ca369

Browse files
authored
chore: mention display teleport interpolation (#617)
1 parent 0921c55 commit 08ca369

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/content/docs/paper/dev/api/entity-api/display-entities.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,10 @@ world.spawn(location, BlockDisplay.class, entity -> {
168168

169169
## Interpolation
170170

171-
A transformation can be linearly interpolated by the client to create a smooth animation,
172-
switching from one transformation to the next.
171+
Transformations and teleports can be linearly interpolated by the client to create a smooth animation,
172+
switching from one transformation/location to the next.
173+
174+
### Transformation
173175

174176
An example of this would be smoothly rotating a block/item/text in-place. In conjunction with the
175177
[Scheduler API](/paper/dev/scheduler), the animation can be restarted after it's done,
@@ -197,6 +199,22 @@ Bukkit.getScheduler().runTaskTimer(plugin, task -> {
197199

198200
<span class="img-inline-center">![Interpolation example](./assets/display-interp.gif)</span>
199201

202+
### Teleportation
203+
204+
Similarly to the transformation interpolation, you may also want to interpolate the movement
205+
of the entire display entity between two points.
206+
207+
A similar effect may be achieved using an interpolated translation, however if you change
208+
other properties of the transformation, those too will be interpolated, which may or may not be what you want.
209+
210+
```java
211+
// new position will be 10 blocks higher
212+
Location newLocation = display.getLocation().add(0, 10, 0);
213+
214+
display.setTeleportDuration(20 * 10); // the movement will take 10 seconds (1 second = 20 ticks)
215+
display.teleport(newLocation); // perform the movement
216+
```
217+
200218
## Use cases
201219

202220
Displays have many different use cases, ranging from stationary decoration to complex animation.

0 commit comments

Comments
 (0)