Interface TickableInstance

All Superinterfaces:
Instance
All Known Implementing Classes:
MinecartInstance

public interface TickableInstance extends Instance
An interface giving BlockEntityInstances a hook to have a function called at the end of every tick. By implementing TickableInstance, a BlockEntityInstance can update frequently, but not every frame.
There are a few cases in which this should be considered over DynamicInstance:
  • You'd like to change something about the instance every now and then. eg. adding or removing parts, snapping to a different rotation, etc.
  • Your BlockEntity does animate, but the animation doesn't have to be smooth, in which case this could be an optimization.
  • Method Summary

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

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

    getWorldPosition
  • Method Details

    • tick

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

      default boolean decreaseTickRateWithDistance()
      As a further optimization, tickable 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.