Interface LitVisual

All Superinterfaces:
Visual
All Known Implementing Classes:
AbstractBlockEntityVisual, BellVisual, ChestVisual, ShulkerBoxVisual

public interface LitVisual extends Visual
A visual that listens to light updates.

If your visual moves around in the level at all, you should use TickableVisual or DynamicVisual, and poll for light yourself along with listening for updates. When your visual moves to a different section, call LitVisual.Notifier.notifySectionsChanged().

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A notifier object that can be used to indicate to the impl that the sections a visual is contained in have changed.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Collect the sections that this visual is contained in.
    void
    Set the notifier object.
    void
    Called when a section this visual is contained in receives a light update.

    Methods inherited from interface com.jozufozu.flywheel.api.visual.Visual

    delete, init, update
  • Method Details

    • updateLight

      void updateLight()
      Called when a section this visual is contained in receives a light update.

      Even if multiple sections are updated at the same time, this method will only be called once.

      The implementation is free to parallelize calls to this method, as well as execute the plan returned by DynamicVisual.planFrame() simultaneously. It is safe to query/update light here, but you must ensure proper synchronization if you want to mutate anything outside this visual or anything that is also mutated within DynamicVisual.planFrame().

    • collectLightSections

      void collectLightSections(LongConsumer consumer)
      Collect the sections that this visual is contained in.

      This method is called upon visual creation, and the frame after LitVisual.Notifier.notifySectionsChanged() is called.

      Parameters:
      consumer - The consumer to provide the sections to.
      See Also:
      • SectionPos.asLong(net.minecraft.core.BlockPos)
    • initLightSectionNotifier

      void initLightSectionNotifier(LitVisual.Notifier notifier)
      Set the notifier object.

      This method is only called once, upon visual creation, after Visual.init(float) and before collectLightSections(java.util.function.LongConsumer).

      Parameters:
      notifier - The notifier.