Class DynamicChunk
java.lang.Object
net.minestom.server.instance.Chunk
net.minestom.server.instance.DynamicChunk
- All Implemented Interfaces:
Block.Getter, Block.Setter, Snapshotable, Taggable, TagReadable, TagWritable, Tickable, Viewable, Biome.Getter, Biome.Setter
- Direct Known Subclasses:
LightingChunk
-
Nested Class Summary
Nested classes/interfaces inherited from interface Block.Getter
Block.Getter.Condition -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<Block> protected Heightmapprotected final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<Block> protected HeightmapFields inherited from class Chunk
CHUNK_SECTION_SIZE, CHUNK_SIZE_X, CHUNK_SIZE_Z, chunkX, chunkZ, instance, loaded, maxSection, minSection -
Constructor Summary
ConstructorsModifierConstructorDescriptionDynamicChunk(Instance instance, int chunkX, int chunkZ) protectedDynamicChunk(Instance instance, int chunkX, int chunkZ, List<Section> sections) -
Method Summary
Modifier and TypeMethodDescriptionCreates a copy of this chunk, including blocks state id, custom block id, biomes, update data.protected LightDatacreateLightData(boolean requiredFullChunk) getBiome(int x, int y, int z) getBlock(int x, int y, int z, Block.Getter.Condition condition) protected Map<Heightmap.Type, long[]> getSection(int section) voidInvalidate the chunk cachesvoidloadHeightmapsFromNBT(CompoundBinaryTag heightmapsNBT) voidreset()Resets the chunk, this means clearing all the data making it empty.voidsetBiome(int x, int y, int z, RegistryKey<Biome> biome) voidsetBlock(int x, int y, int z, Block block, BlockHandler.Placement placement, BlockHandler.Destroy destroy) voidtick(long time) Executes a chunk tick.updateSnapshot(SnapshotUpdater updater) Updates the currently cached snapshot if required.Methods inherited from class Chunk
addViewer, getChunkX, getChunkZ, getIdentifier, getInstance, getMaxSection, getMinSection, getSectionAt, getViewers, isLoaded, isReadOnly, onGenerate, onLoad, removeViewer, sendChunk, sendChunk, setBlock, setReadOnly, shouldGenerate, tagHandler, toPosition, toString, unloadMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Biome.Getter
getBiomeMethods inherited from interface Biome.Setter
setBiomeMethods inherited from interface Block.Getter
getBlock, getBlock, getBlockMethods inherited from interface Block.Setter
setBlock, setBlockAreaMethods inherited from interface Taggable
getAndSetTag, getAndUpdateTag, getTag, hasTag, removeTag, setTag, updateAndGetTag, updateTagMethods inherited from interface Viewable
getViewersAsAudience, getViewersAsAudiences, isViewer, sendPacketsToViewers, sendPacketsToViewers, sendPacketToViewers, sendPacketToViewersAndSelf
-
Field Details
-
sections
-
motionBlocking
-
worldSurface
-
entries
-
tickableMap
-
-
Constructor Details
-
DynamicChunk
-
DynamicChunk
-
-
Method Details
-
setBlock
public void setBlock(int x, int y, int z, Block block, @Nullable BlockHandler.Placement placement, @Nullable BlockHandler.Destroy destroy) -
setBiome
-
getSections
- Specified by:
getSectionsin classChunk
-
getSection
- Specified by:
getSectionin classChunk
-
motionBlockingHeightmap
- Specified by:
motionBlockingHeightmapin classChunk
-
worldSurfaceHeightmap
- Specified by:
worldSurfaceHeightmapin classChunk
-
loadHeightmapsFromNBT
- Specified by:
loadHeightmapsFromNBTin classChunk
-
tick
public void tick(long time) Description copied from class:ChunkExecutes 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.
-
getBlock
-
getBiome
-
getFullDataPacket
- Specified by:
getFullDataPacketin classChunk
-
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.
-
reset
-
invalidate
public void invalidate()Description copied from class:ChunkInvalidate the chunk caches- Specified by:
invalidatein classChunk
-
createLightData
-
getHeightmaps
-
updateSnapshot
Description copied from interface:SnapshotableUpdates the currently cached snapshot if required. The updater can be used to retrieve references to other snapshots while avoiding circular dependency. Be careful to do not storeupdateranywhere as its data will change when building requested references.This method is not thread-safe, and targeted at internal use since its execution rely on safe-points (e.g. end of ticks)
- Parameters:
updater- the snapshot updater/context- Returns:
- the updated snapshot
-