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. Lighting is only updated when a chunk is sent to the client. Updates can be forced using relight(net.minestom.server.instance.Instance, java.util.Collection<net.minestom.server.instance.Chunk>).

  • Constructor Details

    • LightingChunk

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

    • 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
    • isLightingCalculated

      public boolean isLightingCalculated()
    • 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
    • relight

      public static void 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
    • 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