š„ A Minecraft datapack library for flying players through cinematic camera moves.
~ and ^ coordinates throughout.š¦ Embedded library: package it inside your datapack rather than shipping it separately. Requires LanternLoad and Bookshelf Spline.
https://github.com/user-attachments/assets/41fed243-05f5-457f-afa7-ba6c6ea59dee
execute as @p run function #cinemalya:v1/launch {with:{x:19.5,y:82.5,z:23.5,duration:60,arc_side:1,particle:"minecraft:glow"}}
Every entry point takes one with compound, so each field inside stays optional.
| I want to | Call |
|---|---|
| Fly a player to some coordinates | launch |
Aim from a command block with ~ / ^ | launch_here |
| Fly to where an entity stands | launch_at_entity |
| Fly through several waypoints | launch_path |
| Open a scene with a title card | intro |
| Cut a cinematic short | stop |
| Record a path in game | editor/start |
| React when one starts or ends | signals |
| Tune anything | options |
#cinemalya:v1/launchexecute as <player> run function #cinemalya:v1/launch {with:{x:19.5,y:82.5,z:23.5,duration:60,arc_side:1}}
x / y / z are where the player ends up standing, not where the camera stops.
#cinemalya:v1/launch_hereDestination comes from the execution position and rotation, so relative coordinates work. NBT cannot hold a ~, which is why launch needs absolute numbers and this one exists.
execute positioned ~12 ~8 ~-4 rotated 90 20 as @a[distance=..30] run function #cinemalya:v1/launch_here {with:{duration:60,arc_side:1}}
Mind the order: positioned resolves against the command block before as swaps the executor, so the destination is fixed while each player still starts from their own feet. facing and ^ work too.
#cinemalya:v1/launch_at_entityexecute as <player> run function #cinemalya:v1/launch_at_entity {with:{target:"@e[tag=camera_anchor,limit=1]",duration:60,ease:"ease_in_out"}}
#cinemalya:v1/launch_pathFly through explicit waypoints. Here the positions are camera positions, used literally.
execute as <player> run function #cinemalya:v1/launch_path {with:{duration:90,ease:"ease_in_out",waypoints:[{args:[-112,75,-21,-30,4]},{args:[-116,77,28,-121,16]},{args:[-72,68,20,92,-11.7]}]}}
waypoints[0] is the starting point, so three waypoints mean two segments. Give just one and the player's own position starts the path. A waypoint may be written three ways:
| Key | Example | |
|---|---|---|
args | {args:[x,y,z,yaw,pitch,duration]} | Flat, stop early at 3 or 5. Integers are fine |
pos / rot | {pos:[0.5,90.0,0.5],rot:[0.0,20.0]} | Explicit |
at | {at:"~30 ~12 ~-30",rot:[135,20]} | Relative to where the command ran, ~ or ^ |
Missing rot keeps the previous heading. The waypoints with no duration share theirs in proportion to the length of the segment arriving at them, so the camera flies at one steady speed through them; together they get the part of the total they would get as equal shares. at overrides pos. Local ^ needs an execution rotation, so add rotated when using it from a command block.
Easing. A path-level ease shapes the whole travel: it accelerates off the first waypoint, cruises through the middle ones at a steady pace, and settles onto the last. Put ease on a waypoint instead to shape only the hop arriving there:
execute as <player> run function #cinemalya:v1/launch_path {with:{waypoints:[{args:[-112,75,-21,-30,4]},{args:[-116,77,28,-121,16,55],ease:"ease_out"},{args:[-72,68,20,92,-11.7,25],ease:"ease_in"}]}}
That drifts to a near stop on the middle waypoint, holds the beat, then accelerates away.
Teleports. A waypoint with tp:true is reached by teleport: nothing is flown from the one before it. Circle a building, then cut to the inside and carry on:
execute as <player> run function #cinemalya:v1/launch_path {with:{duration:120,waypoints:[{args:[0,70,0]},{args:[10,70,10]},{args:[20,70,0]},{args:[200,64,0,90,0],tp:true,delay:20},{args:[210,64,0]}]}}
The path is cut at every teleport and each piece is sampled on its own, so no curve bends across a cut. They share duration in proportion to the segments each one flies, and an ease applies to each piece. The camera lands exactly on the tp waypoint, then holds there for its delay ticks (0 by default), time for the chunks around it to load. A path takes up to 8 pieces. The key is read by presence, so tp:false still counts as a teleport: leave it out instead. A teleport under 64 blocks would normally glide across the map on the client, so the camera's teleport_duration is cut to 0 the tick before.
Waypoint events. A waypoint with function:"<namespace>:<path>" runs it when the camera reaches the waypoint, as the player (or as the camera for gamemode:"none"), at the camera. Every waypoint also fires on_waypoint. The first waypoint fires on the first step, about one block after the starting point.
#cinemalya:v1/introHold on an establishing shot, name the scene, place every player, fly them all in. Run it positioned and rotated at the shot.
execute positioned 36.29 102.97 81.36 rotated 145.55 21.76 run function #cinemalya:v1/intro {with:{title:"Warden Forest",subtitle:"by Stoupy",display_time:130,duration:50}}
target_function runs as each player and is where you teleport them to their spot; omit it and they stay put. Also takes selector, sound, title_color, subtitle_color, and every launch field.
#cinemalya:v1/stopexecute as <player> run function #cinemalya:v1/stop {with:{}}
The player is left exactly where the camera was, so you decide where they belong. restore:false leaves them in spectator too.
#cinemalya:v1/editor/startRecord a path in game instead of typing coordinates. start gives you the editor item, editor/stop takes it back.
function #cinemalya:v1/editor/start
https://github.com/user-attachments/assets/0180165c-f481-47a7-9d31-23b4a836decd
| With the item in hand | Does |
|---|---|
| Right click | Place a keyframe at your eyes, with your rotation |
| Left click | Remove the last keyframe |
| Sneak + right click | Preview the path |
| Swap hands (default F) | Make the last keyframe a teleport, or fly to it again |
| Drop it | Open the export, with the item handed back to you |
The export shows two launch_path commands to copy into a command block: one with absolute positions, one with positions relative to its execute positioned coordinates, which start on the first keyframe, so editing them moves the whole path. Both last duration:200 ticks and move between keyframes with ease:"linear", written in the command so you edit them there (ease_in, ease_out and ease_in_out are the other choices). Every other option is written with its default value too, except particle and spline. Every editor shares the same path, up to 128 keyframes, and it is cleared when the last of them stops.
| Field | Type | Default | Meaning |
|---|---|---|---|
duration | int | 60 | Length of the travel, in ticks |
smoothing | int | 1 | Ticks between frames. Higher is cheaper and softer |
delay | int | 0 | Ticks to hold still before moving |
ease | string | "linear" | linear, ease_in, ease_out, ease_in_out |
spline | string | auto | bezier (2 waypoints) or catmull_rom (more) |
arc_side | float | 0.0 | Sideways swing, as a fraction of half the distance |
arc_height | float | 0.0 | How far above the higher end the arc peaks, see below |
particle | string | none | Particle trailed behind the camera |
gamemode | string | "restore" | restore, keep (already spectator), none (no player) |
mode | string | "spectator" | spectator, or ride to sit on the camera in your own gamemode, see ride |
body | string | none | mannequin: a mannequin with your skin, armor and hands stands one block behind the camera, for everyone else to see. Looking straight down still shows its helmet and hands |
pose | string | "standing" | With body: standing, crouching, swimming or fall_flying |
protect | bool | false | Resistance for the whole travel, cleared at the end, so a rider takes no damage |
tags | list | [] | Extra tags on the cinematic entity |
precise_rotation | bool | true | See rotation precision |
yaw / pitch | float | target's | Override the ending rotation |
Per entry point: launch takes x/y/z, launch_at_entity takes target, launch_path takes waypoints, launch_here takes neither. yaw/pitch do not apply to launch_path, where each waypoint carries its own rot.
Arc. arc_height:0.0 flies two-waypoint travels (launch, launch_here, launch_at_entity, or a launch_path of two waypoints) in a straight line. A value like 10 to 20 lifts the camera over the middle of a long travel, which usually looks better when the ends are far apart or at different heights. A path through three or more waypoints follows its own curve and ignores it.
Every argument that ends up bounding a loop is clamped at launch, so a typo costs you a wrong looking cinematic rather than a frozen server.
| Argument | Bound | What happens past it |
|---|---|---|
duration, .duration | 36000 (30 min) | Clamped, per travel and per waypoint |
smoothing | 1 to 100 | Clamped |
waypoints | 128 | Refused, with a red message to the player and fail |
| Pieces (teleports + 1) | 8 | Refused, with a red message to the player and fail |
tags | 32 | The extras are dropped |
| Frames emitted | 600 | The smoothing rises so the path keeps its full length |
A travel asking for more frames than the budget gets a softer smoothing instead of a shortened path, so duration:36000 still lands where you told it to. The cap keeps a launch under the max_command_sequence_length default of 65536 commands, past which Minecraft drops the rest of it and no camera appears.
Add your own function to these tags. They run as and at the player, or as the camera when the path has no player.
| Tag | When |
|---|---|
#cinemalya:v1/signals/on_launch | Just before the camera takes them. Cancel parkour timers, combat tags, anything a teleport should interrupt |
#cinemalya:v1/signals/on_finish | Once they are set down and their gamemode is back |
#cinemalya:v1/signals/on_waypoint | Each time the camera reaches a waypoint, at the camera. #waypoint cinemalya.data is its index from 0 |
Reading the state. #entities cinemalya.data counts the cinematics playing right now, so you can gate on it (execute if score #entities cinemalya.data matches 1.. run return 1). Camera entities carry the cinemalya.cinematic tag plus whatever you passed in tags.
Riding. mode:"ride" keeps the player in their own gamemode and sits them on the camera, so they keep their hands, HUD and body, and the camera is where their eyes are. Their head stays free: nothing can turn it for them smoothly, since a forced rotation only moves in steps of one tick. Use the default spectator mode for a sweeping pan. Sneaking cannot get a rider off, the camera puts them back, but the game still prints its dismount hint. Pair it with protect:true so nothing hurts them on the way. That clears the player's own resistance effect when the travel ends.
Rotation precision. Minecraft quantises rotations to steps of 360/256 = 1.40625°, which makes a /spectate camera turn in visible notches (MC-184359). Flipping the camera's OnGround flag each tick makes the server send full precision instead. On by default, one command per cinematic per tick, no side effect since display entities are not living entities. It relies on MC-278440, a community find, so a future version could close it: pass precise_rotation:false to opt out.
How it works. A cinematic is an invisible item_display the player spectates. Your waypoints become spline control points, Bookshelf samples them into a dense polyline, and each segment picks exactly as many frames as its duration buys. All of that happens once at launch, so playback costs one macro and two NBT reads per step whether the path is 10 frames or 500.