-
-
Notifications
You must be signed in to change notification settings - Fork 131
Keyframe Triggers (Geckolib4)
GeckoLib supports custom callbacks from animations via keyframe handlers. This allows for your animation to define certain additional effects such as particles, sounds, or just about anything else.
To use this feature in BlockBench, click Animation
-> Animate Effects
. You'll see a new animation panel pop up in the animator. From here, you can add global keyframes to your model.
This is split into three types in GeckoLib:
- Sounds
- Particles
- Custom Instructions
To handle sound keyframe callbacks, you add an instance of SoundKeyframeHandler to your AnimationController
via setSoundKeyframeHandler
.
This listener will then be called at the appropriate time as marked by the keyframe in the animation json.
For an example of this, see the Jack in the Box example item
GeckoLib has a builtin SoundKeyframeHandler
that allows you to skip the boilerplate of handling basic sound playing yourself.
To use this, add a SoundKeyframeHandler like normal, but instead of your own, just pass a new instance of AutoPlayingSoundKeyframeHandler
Then, in your animation json, you can use either of the two below formats for your keyframe instructions to have the handler auto-handle the sound for you:
namespace:soundid
namespace:soundid|volume|pitch
To handle particle keyframe callbacks, you add an instance of ParticleKeyframeHandler to your AnimationController
via setParticleKeyframeHandler
.
This listener will then be called at the appropriate time as marked by the keyframe in the animation json.
Custom instructions are helpful for non-sound and non-particle things you want to do to your entity at a specific time in your keyframe.
To handle custom keyframe callbacks, you add an instance of ICustomInstructionListener to your AnimationController
via setCustomInstructionKeyframeHandler
.
This listener will then be called at the appropriate time as marked by the keyframe in the animation json.
Geckolib 3
Geckolib 4
- Installation
- Getting Started
- Upgrading from GeckoLib 3.1.x to 4.0
- Updating to GeckoLib 4.5
- Basic
- Advanced
- Miscellaneous
Package repository hosting is graciously provided by Cloudsmith.
Cloudsmith is the only fully hosted, cloud-native, universal package management solution that enables your organization to create, store and share packages in any format, to any place, with total confidence.