Cinematic
Warning
Not available in LabyMod 4! Only available for LabyMod 3 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
- LabyMod API (or use the Protocol without the API)
Example code
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:
Warning
Make sure that the player can fly (Creative mode or Spectator mode)