Home - fadookie/geckolib-plugin GitHub Wiki
GeckoLib Animation Utils Developer Docs
Overview
The plugin is built from src/animation_utils folder by webpack. Blockbench loads it from the plugins
folder like other plugins.
Installing
Pre-requisites: node.js
cd src/animation_utils
npm install
Running in development
npm start
Webpack will watch filesystem for changes. Use Blockbench Filter > Plugins > Load Plugin From File to load plugin from plugins/animation_utils.js
. Use Help > Developer > Reload Plugins after making changes.
Publishing
npm run build
Builds plugin in production mode.
For plugins to go live they must be merged to JannisX11/blockbench-plugins (please check in with me first before sending any PRs there, but feel free to PR to this repo first.)
Debugging
Blockbench offers the Chrome devloper tools under Help > Developer > Open Dev Tools.
Print debugging via console.log
is one of the easiest ways to figure out what's going on.
It is possible to use the debugger, although this is more difficult that it usually is for JS apps because breakpoints get reset every time the plugin is re-loaded. I've found it's best to add a log statement, then click on the source code line reference in the console next to the log statement to jump to the source code, then you can set a breakpoint there.
I also recommend using the console as a way to explore the Blockbench API, especially for inspecting globals.
Architecture
See the Official Blockbench Plugins Documentation for an intro.
I've found reading the Blockbench source code to also be one of the most important ways to learn how Blockbench works.
The GeckoLib plugin is layed out as follows:
- index.js - Main entrypoint for plugin. Contains our call to
Plugin.register
and responsible for loading/unloading all other modules. Also contains misc bits of UI for GeckoLib Model Settings menu and export option. - Easing.js - Easing function implementations and related metadata.
- animationUi.js - Monkeypatches for Blockbench animations.js to implement easing curve keyframe editor UI and various menu tweaks.
- armorTemplate.json - bbmodel for JTK222's armor template, used for new Armor project types.
- codec.js - Implementation of
animated_entity_model
ModelFormat/Codec for import/export. - keyframe.js - Monkeypatches for Keyframe class to support easing curve storage and interpolation.
- settings.js - Settings model, used for GeckoLib Model Settings menu.
- utils.js - Misc utilities. Monkeypatching system.