Skip to content

Cinematic

Info

Available for LabyMod users with version greater than 3.7.7

Overview

It is possible to create an animated camera movement with LabyMod. It is possible to combine this feature with the cinescopes

Requirements

Example code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
public void playCinematic( Player player, List<Location> points, long duration ) {
    JsonObject cinematic = new JsonObject();

    // Add points
    JsonArray points = new JsonArray();
    for ( Location location : points ) {
        // Add points
        JsonObject point = new JsonObject();
        point.addProperty( "x", location.getX() );
        point.addProperty( "y", location.getY() );
        point.addProperty( "z", location.getZ() );
        point.addProperty( "yaw", location.getYaw() );
        point.addProperty( "pitch", location.getPitch() );
        point.addProperty( "tilt", 0 ); 
        points.add( point );
    }
    cinematic.add( "points", points );

    // Clear the Minecraft Chat
    cinematic.add("clear_chat", true );

    // Cinematic duration in ms
    cinematic.addProperty( "duration", duration );

    // Always teleport the player to the start point
    player.teleport( points.get(0) );

    // The player needs to fly for the cinematic
    player.setAllowFlight( true );

    // Play cinematic
    LabyModProtocol.sendLabyModMessage( player, "cinematic", cinematic );
}

public void cancelCinematic( Player player ) {
    // Cancel currently playing cinematic
    LabyModProtocol.sendLabyModMessage( player, "cinematic", new JsonObject() ); // Empty object
}

You will get the following response message with the cinematic key when the player finished the cinematic successfully:

1
2
3
{
    "completed": true
}

Warning

Make sure that the player can fly (Creative mode or Spectator mode)