Class LightingChunk

All Implemented Interfaces:
Block.Getter, Block.Setter, Snapshotable, Taggable, TagReadable, TagWritable, Tickable, Viewable, Biome.Getter, Biome.Setter

public class LightingChunk extends DynamicChunk
A chunk which supports lighting computation.

This chunk is used to compute the light data for each block.

  • Constructor Details

    • LightingChunk

      public LightingChunk(@NotNull @NotNull Instance instance, int chunkX, int chunkZ)
  • Method Details

    • invalidate

      public void invalidate()
      Description copied from class: Chunk
      Invalidate the chunk caches
      Overrides:
      invalidate in class DynamicChunk
    • setBlock

      public void setBlock(int x, int y, int z, @NotNull @NotNull Block block, @Nullable BlockHandler.Placement placement, @Nullable BlockHandler.Destroy destroy)
      Overrides:
      setBlock in class DynamicChunk
    • sendLighting

      public void sendLighting()
    • onLoad

      protected void onLoad()
      Description copied from class: Chunk
      Called when the chunk has been successfully loaded.
      Overrides:
      onLoad in class Chunk
    • onGenerate

      public void onGenerate()
      Description copied from class: Chunk
      Called when the chunk generator has finished generating the chunk.
      Overrides:
      onGenerate in class Chunk
    • computeHeightmap

      protected org.jglrxavpok.hephaistos.nbt.NBTCompound computeHeightmap()
      Overrides:
      computeHeightmap in class DynamicChunk
    • getHeightmap

      public int[] getHeightmap()
    • createLightData

      protected LightData createLightData()
      Overrides:
      createLightData in class DynamicChunk
    • tick

      public void tick(long time)
      Description copied from class: Chunk
      Executes a chunk tick.

      Should be used to update all the blocks in the chunk.

      WARNING: this method doesn't necessary have to be thread-safe, proceed with caution.

      Specified by:
      tick in interface Tickable
      Overrides:
      tick in class DynamicChunk
      Parameters:
      time - the time of the update in milliseconds
    • relight

      public static List<Chunk> relight(Instance instance, Collection<Chunk> chunks)
      Forces a relight of the specified chunks.

      This method is used to force a relight of the specified chunks.

      This method is thread-safe and can be called from any thread.

      Parameters:
      instance - the instance
      chunks - the chunks to relight
      Returns:
      the chunks which have been relighted
    • copy

      @NotNull public @NotNull Chunk copy(@NotNull @NotNull Instance instance, int chunkX, int chunkZ)
      Description copied from class: Chunk
      Creates a copy of this chunk, including blocks state id, custom block id, biomes, update data.

      The chunk position (X/Z) can be modified using the given arguments.

      Overrides:
      copy in class DynamicChunk
      Parameters:
      instance - the chunk owner
      chunkX - the chunk X of the copy
      chunkZ - the chunk Z of the copy
      Returns:
      a copy of this chunk with a potentially new instance and position