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.
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>).
-
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, sections, tickableMapFields inherited from class net.minestom.server.instance.Chunk
CHUNK_SECTION_SIZE, CHUNK_SIZE_X, CHUNK_SIZE_Z, chunkX, chunkZ, columnarSpace, instance, loaded, maxSection, minSection -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.jglrxavpok.hephaistos.nbt.NBTCompound@NotNull ChunkCreates a copy of this chunk, including blocks state id, custom block id, biomes, update data.protected LightDataint[]booleanprotected voidonLoad()Called when the chunk has been successfully loaded.static voidrelight(Instance instance, Collection<Chunk> chunks) Forces a relight of the specified chunks.voidvoidsetBlock(int x, int y, int z, @NotNull Block block, BlockHandler.Placement placement, BlockHandler.Destroy destroy) Methods inherited from class net.minestom.server.instance.DynamicChunk
getBiome, getBlock, getFullDataPacket, getLastChangeTime, getSection, getSections, reset, setBiome, tick, updateSnapshotMethods inherited from class net.minestom.server.instance.Chunk
addViewer, getChunkX, getChunkZ, getIdentifier, getInstance, getMaxSection, getMinSection, getSectionAt, getViewers, isLoaded, isReadOnly, removeViewer, sendChunk, sendChunk, setBlock, setColumnarSpace, setReadOnly, shouldGenerate, tagHandler, toPosition, toString, unloadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minestom.server.world.biomes.Biome.Getter
getBiomeMethods inherited from interface net.minestom.server.world.biomes.Biome.Setter
setBiomeMethods inherited from interface net.minestom.server.instance.block.Block.Getter
getBlock, getBlock, getBlockMethods inherited from interface net.minestom.server.instance.block.Block.Setter
setBlockMethods inherited from interface net.minestom.server.Viewable
getViewersAsAudience, getViewersAsAudiences, isViewer, sendPacketsToViewers, sendPacketsToViewers, sendPacketToViewers, sendPacketToViewersAndSelf
-
Constructor Details
-
LightingChunk
-
-
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:
setBlockin classDynamicChunk
-
sendLighting
public void sendLighting() -
onLoad
protected void onLoad()Description copied from class:ChunkCalled when the chunk has been successfully loaded. -
isLightingCalculated
public boolean isLightingCalculated() -
computeHeightmap
protected org.jglrxavpok.hephaistos.nbt.NBTCompound computeHeightmap()- Overrides:
computeHeightmapin classDynamicChunk
-
getHeightmap
public int[] getHeightmap() -
createLightData
- Overrides:
createLightDatain classDynamicChunk
-
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
-
copy
Description copied from class:ChunkCreates 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:
copyin 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
-