Appearance
Cutscenes
FilmApi moves the camera through a list of shots, draws a title, and handles the shared skip key. It is client only.
Set up
Call this once from your client init. All mods share one key, which players can rebind.
java
FilmApi.enableKey();Play a film
A film has a subject, a title and a list of shots. Shot times are in ticks, so 20 is one second.
java
Subject subject = FilmApi.follow(player, target);
List<Shot> shots = List.of(
FilmApi.cut(0, 60, (s, partial, k) ->
FilmApi.pose(s.frame(s.feet(partial), 0, 3, -6), s.eye(partial), 60.0F)),
FilmApi.sweep(60, 120, 20, (s, partial, k) ->
FilmApi.pose(s.aroundTarget(partial, 8, 4, 12), s.target(), 50.0F))
);
FilmApi.play(FilmApi.film(subject, "Skill", "Meteor", 0xFF7FB0FF, shots));A shot's path gets the subject, the frame's partial tick, and k, which runs from 0 to 1 across the shot.
cutstarts its shot with no blend.sweepblends in from the shot before overblendInticks.
Subject helpers
| Method | Returns |
|---|---|
feet(partial), eye(partial) | The entity's live position |
target(), forward(), right() | The target and flat directions |
frame(anchor, right, up, forward) | A point offset in the entity's own frame |
aroundTarget(partial, side, up, back) | A point around the target |
Subject.orbit(point, pivot, degrees) | A point turned around a vertical axis |
For a custom subject, implement Subject yourself.
Control
| Method | What it does |
|---|---|
active() | Whether a film is playing |
time(subject, partial) | How far that subject's film has got |
weight(subject) | How much that film has the camera, from 0 to 1 |
automatic() | Whether the player lets films play on their own |
skip() | Skips the current film if it can be skipped |
stop(subject) | Stops that subject's film |
hintOnly(modId) | Shows only the skip hint, with no title card, for your mod's films |
holdInput(rule) | Holds player input while rule is true |
hideHand(rule) | Hides the held item while rule is true |
The Cutscene that film returns has more options, such as priority, speed, hardCut and fullFrame.
