Class LightVolume

java.lang.Object
com.jozufozu.flywheel.light.LightVolume
All Implemented Interfaces:
LightListener, ImmutableBox
Direct Known Subclasses:
GPULightVolume

public class LightVolume extends Object implements ImmutableBox, LightListener
  • Field Details

    • level

      protected final net.minecraft.world.level.BlockAndTintGetter level
    • box

      protected final GridAlignedBB box
    • lightData

      protected ByteBuffer lightData
  • Constructor Details

    • LightVolume

      public LightVolume(net.minecraft.world.level.BlockAndTintGetter level, ImmutableBox sampleVolume)
  • Method Details

    • setBox

      protected void setBox(ImmutableBox box)
    • getPackedLight

      public short getPackedLight(int x, int y, int z)
    • getMinX

      public int getMinX()
      Specified by:
      getMinX in interface ImmutableBox
    • getMinY

      public int getMinY()
      Specified by:
      getMinY in interface ImmutableBox
    • getMinZ

      public int getMinZ()
      Specified by:
      getMinZ in interface ImmutableBox
    • getMaxX

      public int getMaxX()
      Specified by:
      getMaxX in interface ImmutableBox
    • getMaxY

      public int getMaxY()
      Specified by:
      getMaxY in interface ImmutableBox
    • getMaxZ

      public int getMaxZ()
      Specified by:
      getMaxZ in interface ImmutableBox
    • move

      public void move(ImmutableBox newSampleVolume)
    • onLightUpdate

      public void onLightUpdate(net.minecraft.world.level.LightLayer type, ImmutableBox changedVolume)
      Description copied from interface: LightListener
      Called when a light updates in a chunk the implementor cares about.
      Specified by:
      onLightUpdate in interface LightListener
    • onLightPacket

      public void onLightPacket(int chunkX, int chunkZ)
      Description copied from interface: LightListener
      Called when the server sends light data to the client.
      Specified by:
      onLightPacket in interface LightListener
    • initialize

      public void initialize()
      Completely (re)populate this volume with block and sky lighting data. This is expensive and should be avoided.
    • copyBlock

      public void copyBlock(ImmutableBox worldVolume)
      Copy block light from the world into this volume.
      Parameters:
      worldVolume - the region in the world to copy data from.
    • copySky

      public void copySky(ImmutableBox worldVolume)
      Copy sky light from the world into this volume.
      Parameters:
      worldVolume - the region in the world to copy data from.
    • copyLight

      public void copyLight(ImmutableBox worldVolume)
      Copy all light from the world into this volume.
      Parameters:
      worldVolume - the region in the world to copy data from.
    • delete

      public void delete()
    • markDirty

      protected void markDirty()
    • writeLight

      protected void writeLight(int x, int y, int z, int block, int sky)
    • writeBlock

      protected void writeBlock(int x, int y, int z, int block)
    • writeSky

      protected void writeSky(int x, int y, int z, int sky)
    • worldPosToBufferIndex

      protected int worldPosToBufferIndex(int x, int y, int z)
    • boxPosToBufferIndex

      protected int boxPosToBufferIndex(int x, int y, int z)
    • getVolume

      public ImmutableBox getVolume()
      Specified by:
      getVolume in interface LightListener
    • isListenerInvalid

      public boolean isListenerInvalid()
      Description copied from interface: LightListener
      Check the status of the light listener.
      Specified by:
      isListenerInvalid in interface LightListener
      Returns:
      true if the listener is invalid/removed/deleted, and should no longer receive updates.