Skip to content

Keyframe Triggers (Geckolib3)

Tslat edited this page Jul 3, 2023 · 3 revisions

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

Sound Keyframes

To handle sound keyframe callbacks, you add an instance of ISoundListener to your AnimationController via registerSoundListener. 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

Particle Keyframes

To handle particle keyframe callbacks, you add an instance of IParticleListener to your AnimationController via registerParticleListener. This listener will then be called at the appropriate time as marked by the keyframe in the animation json.

Custom Instruction Keyframes

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 registerCustomInstructionListener. This listener will then be called at the appropriate time as marked by the keyframe in the animation json.

Table of Contents

Geckolib 3
Geckolib 4

Hosted By: Cloudsmith

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.

Clone this wiki locally