Interface DynamicInstance

All Superinterfaces:
Instance
All Known Implementing Classes:
BellInstance, ChestInstance, MinecartInstance, ShulkerBoxInstance

public interface DynamicInstance extends Instance
An interface giving BlockEntityInstances a hook to have a function called at the start of a frame. By implementing DynamicInstance, a BlockEntityInstance can animate its models in ways that could not be easily achieved by shader attribute parameterization.

If your goal is offloading work to shaders, but you're unsure exactly how you need to parameterize the instances, you're encouraged to implement this for prototyping.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called every frame, and after initialization.
    default boolean
    As a further optimization, dynamic instances that are far away are ticked less often.

    Methods inherited from interface com.jozufozu.flywheel.api.instance.Instance

    getWorldPosition
  • Method Details

    • beginFrame

      void beginFrame()
      Called every frame, and after initialization.
      DISPATCHED IN PARALLEL, don't attempt to mutate anything outside this instance.
      Instancer/InstanceData creation/acquisition is safe here.
    • decreaseFramerateWithDistance

      default boolean decreaseFramerateWithDistance()
      As a further optimization, dynamic instances that are far away are ticked less often. This behavior can be disabled by returning false.
      You might want to opt out of this if you want your animations to remain smooth even when far away from the camera. It is recommended to keep this as is, however.
      Returns:
      true if your instance should be slow ticked.