Package net.minestom.server.instance
Class LightingChunk
java.lang.Object
net.minestom.server.instance.Chunk
net.minestom.server.instance.DynamicChunk
net.minestom.server.instance.LightingChunk
- All Implemented Interfaces:
Block.Getter
,Block.Setter
,Snapshotable
,Taggable
,TagReadable
,TagWritable
,Tickable
,Viewable
,Biome.Getter
,Biome.Setter
A chunk which supports lighting computation.
This chunk is used to compute the light data for each block.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minestom.server.instance.block.Block.Getter
Block.Getter.Condition
-
Field Summary
Fields inherited from class net.minestom.server.instance.DynamicChunk
entries, motionBlocking, sections, tickableMap, worldSurface
Fields inherited from class net.minestom.server.instance.Chunk
CHUNK_SECTION_SIZE, CHUNK_SIZE_X, CHUNK_SIZE_Z, chunkX, chunkZ, instance, loaded, maxSection, minSection
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull Chunk
Creates a copy of this chunk, including blocks state id, custom block id, biomes, update data.protected LightData
createLightData
(boolean requiredFullChunk) int[]
void
Invalidate the chunk cachesvoid
invalidateNeighborsSection
(int coordinate) void
boolean
isLoaded()
Used to verify if the chunk should still be kept in memory.void
Called when the chunk generator has finished generating the chunk.protected void
onLoad()
Called when the chunk has been successfully loaded.relight
(Instance instance, Collection<Chunk> chunks) Forces a relight of the specified chunks.void
void
setBlock
(int x, int y, int z, @NotNull Block block, BlockHandler.Placement placement, BlockHandler.Destroy destroy) void
setFreezeInvalidation
(boolean freezeInvalidation) void
tick
(long time) Executes a chunk tick.Methods inherited from class net.minestom.server.instance.DynamicChunk
getBiome, getBlock, getFullDataPacket, getHeightmapNBT, getLastChangeTime, getSection, getSections, loadHeightmapsFromNBT, motionBlockingHeightmap, reset, setBiome, updateSnapshot, worldSurfaceHeightmap
Methods inherited from class net.minestom.server.instance.Chunk
addViewer, getChunkX, getChunkZ, getIdentifier, getInstance, getMaxSection, getMinSection, getSectionAt, getViewers, isReadOnly, removeViewer, sendChunk, sendChunk, setBlock, setReadOnly, shouldGenerate, tagHandler, toPosition, toString, unload
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minestom.server.world.biome.Biome.Getter
getBiome
Methods inherited from interface net.minestom.server.world.biome.Biome.Setter
setBiome
Methods inherited from interface net.minestom.server.instance.block.Block.Getter
getBlock, getBlock, getBlock
Methods inherited from interface net.minestom.server.instance.block.Block.Setter
setBlock
Methods inherited from interface net.minestom.server.tag.Taggable
getAndSetTag, getAndUpdateTag, getTag, hasTag, removeTag, setTag, updateAndGetTag, updateTag
Methods inherited from interface net.minestom.server.Viewable
getViewersAsAudience, getViewersAsAudiences, isViewer, sendPacketsToViewers, sendPacketsToViewers, sendPacketToViewers, sendPacketToViewersAndSelf
-
Constructor Details
-
LightingChunk
-
-
Method Details
-
invalidate
public void invalidate()Description copied from class:Chunk
Invalidate the chunk caches- Overrides:
invalidate
in classDynamicChunk
-
setFreezeInvalidation
public void setFreezeInvalidation(boolean freezeInvalidation) -
invalidateNeighborsSection
public void invalidateNeighborsSection(int coordinate) -
invalidateResendDelay
public void invalidateResendDelay() -
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 classDynamicChunk
-
sendLighting
public void sendLighting() -
onLoad
protected void onLoad()Description copied from class:Chunk
Called when the chunk has been successfully loaded. -
onGenerate
public void onGenerate()Description copied from class:Chunk
Called when the chunk generator has finished generating the chunk.- Overrides:
onGenerate
in classChunk
-
getOcclusionMap
public int[] getOcclusionMap() -
createLightData
- Overrides:
createLightData
in classDynamicChunk
-
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 interfaceTickable
- Overrides:
tick
in classDynamicChunk
- Parameters:
time
- the time of the update in milliseconds
-
relight
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 instancechunks
- the chunks to relight- Returns:
- the chunks which have been relighted
-
copy
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 classDynamicChunk
- Parameters:
instance
- the chunk ownerchunkX
- the chunk X of the copychunkZ
- the chunk Z of the copy- Returns:
- a copy of this chunk with a potentially new instance and position
-
isLoaded
public boolean isLoaded()Description copied from class:Chunk
Used to verify if the chunk should still be kept in memory.
-