Interface LightCalculation

All Known Implementing Classes:
FloodLightCalculation, FullBrightLightCalculation

public interface LightCalculation
An interface that represents an approach to calculating lighting in chunks.
  • Method Summary

    Modifier and Type
    Method
    Description
    calculateLight(org.joml.Vector3i chunkPosition)
    Calculates the lighting for a chunk section.
    void
    init(ChunkGrid chunkGrid, Ref<ChunkStore> sectionRef)
     
    boolean
    invalidateLightAtBlock(ChunkGrid chunkGrid, int blockX, int blockY, int blockZ, BlockType blockType, int oldHeight, int newHeight)
    Updates or queues an update for lighting at a block position.
    boolean
    invalidateLightInChunkSections(ChunkGrid chunkGrid, int chunkX, int chunkZ, int sectionIndexFrom, int sectionIndexTo)
    Updates or queues an update for lighting in chunk for sections in range sectionIndexFrom (inclusive) to sectionIndexTo (exclusive)
  • Method Details

    • init

      void init(ChunkGrid chunkGrid, Ref<ChunkStore> sectionRef)
    • calculateLight

      @Nonnull CalculationResult calculateLight(@Nonnull org.joml.Vector3i chunkPosition)
      Calculates the lighting for a chunk section.
      Parameters:
      chunkPosition - The position of the chunk to calculate lighting for.
      Returns:
      true if the chunk was processed and false if the chunk is waiting for something
    • invalidateLightAtBlock

      boolean invalidateLightAtBlock(@Nonnull ChunkGrid chunkGrid, int blockX, int blockY, int blockZ, @Nonnull BlockType blockType, int oldHeight, int newHeight)
      Updates or queues an update for lighting at a block position.
      Parameters:
      chunkGrid - The chunk store containing the block.
      blockX - The x coordinate of the block.
      blockY - The y coordinate of the block.
      blockZ - The z coordinate of the block.
      blockType - The type of the block.
      oldHeight - The old height of the block.
      newHeight - The new height of the block.
      Returns:
      true if the update has been handled or false if the update is deferred.
    • invalidateLightInChunkSections

      boolean invalidateLightInChunkSections(@Nonnull ChunkGrid chunkGrid, int chunkX, int chunkZ, int sectionIndexFrom, int sectionIndexTo)
      Updates or queues an update for lighting in chunk for sections in range sectionIndexFrom (inclusive) to sectionIndexTo (exclusive)
      Parameters:
      chunkGrid - The chunk to update lighting for.
      chunkX - The chunk x coordinate.
      chunkZ - The chunk z coordinate.
      sectionIndexFrom - The section index to start from (inclusive).
      sectionIndexTo - The section index to end at (exclusive).
      Returns:
      true if the update has been handled now