A small flexible library for showing animated screen overlays to the user.
[!NOTE] Using this method requires the following to be installed in your system: Deno, ffmpeg. After getting those, restart your computer.
screen_effects
folder to make this process easier.[!NOTE]
- You can use any image editing software you like as long as it can export your animation into a spritesheet. Aseprite has this functionality.
- It is recommended to make a 256x256 .png file for the best results.
screen_effects
folder.screen_effects
folder if you want more screen effects.buildScreenEffects.js
folder and adjust these configs.// -------------CONFIGS---------------
// Replace with the namespace you use!
const NAMESPACE = "example";
// This logs what the builder is currently doing.
// If compiling is taking a while, disabling this will improve compilation time.
const debugMode = false;
// If you want the font JSON files to be formatted, make this boolean true.
const prettyPrintFontFiles = false;
// If you want to see the ffmpeg logs, make this boolean true.
// If compiling is taking a while, disabling this will improve compilation time.
const showFFMPEGLogs = false;
// -----------------------------------
screen_effects
folder.deno run --allow-all .\buildScreenEffects.js
Congrats! You've successfully turned your wonderful animations into frames! :tada:
If you only want to to compile 1 spritesheet, simply run deno run --allow-all .\buildScreenEffects.js <REPLACE WITH FILENAME including .png>
scrfx:registry
.mcfunction file."ns:identifier": {
tps: positive integer,
frame_count: positive integer,
middle: {
frame: positive_integer below or equal to frame_count,
callback: command
},
end: { callback: command },
path: resource path.
}
"ns:identifier"
- The identifier of the screen effect, the namespace is optional but recommended to be compatible with other packs.tps
- The frametime / fps of the screen effect, but in ticks. (1 second = 20 ticks)frame_count
- How much frames the screen effect has.middle.frame (optional)
- Points to what frame the declared 'middle' is. This is useful for transition animations like tping the player when the screen is fully covered.middle.callback (optional)
- The command to run when the 'middle' frame is ran.end.callback (optional)
- The command to run when the 'end' frame is ran. This does not have a 'frame' property, this already runs once the animation ends.path
- The resource path of the font file with the number at the end omitted.[!TIP] When in development, you can turn on development mode using a scoreboard value so the registry always gets reloaded when doing
/reload
. Simply runscoreboard players set .dev_mode scrfx.zinternals.globals 1
to turn this on.
scrfx:in id
storage.scrfx:play
!data modify storage scrfx:in id set value "ns:identifier"
execute as Trplnr run function scrfx:play