Skip to content

Instantly share code, notes, and snippets.

@jwulf
Created December 10, 2017 15:06
Show Gist options
  • Select an option

  • Save jwulf/9e30140bcdf26d2da50ebad1e7e161ff to your computer and use it in GitHub Desktop.

Select an option

Save jwulf/9e30140bcdf26d2da50ebad1e7e161ff to your computer and use it in GitHub Desktop.
Record your movement in Minecraft using Magikcraft
/**
* Capture a video of your movement in Minecraft.
*/
const magik = magikcraft.io;
function cam_capture(seconds = "--help", fps = 20) {
if (seconds === "--help") {
magik.dixit("Usage: /cast cam_capture [secs]");
magik.dixit("Usage: /cast cam_capture [secs] [fps]");
return;
}
global.film = {};
film.frames = [];
film.metadata = {
fps,
seconds
};
const interval = 1000 / fps;
const totalFrames = fps * seconds;
magik.dixit(`Recording ${seconds}s at ${fps} fps`);
let count = 0;
const camera = magik.setInterval(()=>{
const location = magik.getSender().getLocation();
film.frames.push(location);
count ++;
if (count > totalFrames) {
magik.clearInterval(camera);
magik.dixit('Finished recording!');
}
}, interval);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment