Class LightUpdater

java.lang.Object
com.jozufozu.flywheel.light.LightUpdater
Direct Known Subclasses:
DummyLightUpdater

public class LightUpdater extends Object
Keeps track of what chunks/sections each listener is in, so we can update exactly what needs to be updated.
  • Constructor Details

    • LightUpdater

      public LightUpdater(net.minecraft.world.level.LevelAccessor level)
  • Method Details

    • get

      public static LightUpdater get(net.minecraft.world.level.LevelAccessor level)
    • tick

      public void tick()
    • addListener

      public void addListener(LightListener listener)
      Add a listener.
      Parameters:
      listener - The object that wants to receive light update notifications.
    • removeListener

      public void removeListener(LightListener listener)
    • onLightUpdate

      public void onLightUpdate(net.minecraft.world.level.LightLayer type, long sectionPos)
      Dispatch light updates to all registered LightListeners.
      Parameters:
      type - The type of light that changed.
      sectionPos - A long representing the section position where light changed.
    • onLightPacket

      public void onLightPacket(int chunkX, int chunkZ)
      Dispatch light updates to all registered LightListeners when the server sends lighting data for an entire chunk.
    • blockToSection

      public static long blockToSection(net.minecraft.core.BlockPos pos)
    • sectionToChunk

      public static long sectionToChunk(long sectionPos)
    • getAllBoxes

      public Stream<ImmutableBox> getAllBoxes()
    • isEmpty

      public boolean isEmpty()