Interface Chunk<P extends Chunk<P>>
-
- All Superinterfaces:
BiomeVolume,BiomeVolume.Modifiable<P>,BiomeVolume.Streamable<P>,BlockEntityVolume,BlockEntityVolume.Modifiable<P>,BlockEntityVolume.Streamable<P>,BlockVolume,BlockVolume.Modifiable<P>,BlockVolume.Streamable<P>,HeightAwareVolume,LocationBaseDataHolder,LocationBaseDataHolder.Mutable,MutableVolume,UpdatableVolume,Volume
- All Known Subinterfaces:
GenerationChunk,WorldChunk
@DoNotStore public interface Chunk<P extends Chunk<P>> extends BlockVolume.Modifiable<P>, BlockEntityVolume.Modifiable<P>, BiomeVolume.Modifiable<P>, UpdatableVolume, LocationBaseDataHolder.Mutable, HeightAwareVolume
A chunk is a specific grid-aligned partition of aWorldLike.Chunk is exposed as a superinterface due to the nature of needing chunk like structures for various purposes, whether it's for world generation, chunk loading from storage, or empty chunks on clients. Traditionally, a usable "live" proto chunk instance will be a
WorldChunkwith a validWorldinstance.A chunk may not be attached to a
WorldorGenerationRegionif it is in the process of being generated.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.world.volume.biome.BiomeVolume
BiomeVolume.Immutable, BiomeVolume.Modifiable<M extends BiomeVolume.Modifiable<M>>, BiomeVolume.Mutable, BiomeVolume.Streamable<B extends BiomeVolume.Streamable<B>>, BiomeVolume.Unmodifiable<U extends BiomeVolume.Unmodifiable<U>>
-
Nested classes/interfaces inherited from interface org.spongepowered.api.world.volume.block.entity.BlockEntityVolume
BlockEntityVolume.Modifiable<M extends BlockEntityVolume.Modifiable<M>>, BlockEntityVolume.Mutable, BlockEntityVolume.Streamable<T extends BlockEntityVolume.Streamable<T>>, BlockEntityVolume.Unmodifiable<U extends BlockEntityVolume.Unmodifiable<U>>
-
Nested classes/interfaces inherited from interface org.spongepowered.api.world.volume.block.BlockVolume
BlockVolume.Immutable, BlockVolume.Modifiable<M extends BlockVolume.Modifiable<M>>, BlockVolume.Mutable, BlockVolume.Streamable<B extends BlockVolume.Streamable<B>>, BlockVolume.Unmodifiable<U extends BlockVolume.Unmodifiable<U>>
-
Nested classes/interfaces inherited from interface org.spongepowered.api.world.volume.game.LocationBaseDataHolder
LocationBaseDataHolder.Mutable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddEntity(Entity entity)Vector3ichunkPosition()Gets the position of the chunk.TicksinhabitedTime()Gets thenumber of ticksplayers have been present in this chunk, used for calculation of the regional difficulty factor.booleanisEmpty()Gets whether this chunk is empty.voidsetInhabitedTime(Ticks newInhabitedTime)Sets thenumber of ticksplayers have been present in this chunk.ChunkStatestate()Gets thisChunk's currentChunkState.-
Methods inherited from interface org.spongepowered.api.world.volume.biome.BiomeVolume
biome, biome
-
Methods inherited from interface org.spongepowered.api.world.volume.biome.BiomeVolume.Modifiable
setBiome, setBiome
-
Methods inherited from interface org.spongepowered.api.world.volume.biome.BiomeVolume.Streamable
biomeStream
-
Methods inherited from interface org.spongepowered.api.world.volume.block.entity.BlockEntityVolume
blockEntities, blockEntities, blockEntity, blockEntity
-
Methods inherited from interface org.spongepowered.api.world.volume.block.entity.BlockEntityVolume.Modifiable
addBlockEntity, addBlockEntity, removeBlockEntity, removeBlockEntity
-
Methods inherited from interface org.spongepowered.api.world.volume.block.entity.BlockEntityVolume.Streamable
blockEntityStream
-
Methods inherited from interface org.spongepowered.api.world.volume.block.BlockVolume
block, block, fluid, fluid, highestPositionAt, highestYAt, highestYAt
-
Methods inherited from interface org.spongepowered.api.world.volume.block.BlockVolume.Modifiable
removeBlock, removeBlock, setBlock, setBlock
-
Methods inherited from interface org.spongepowered.api.world.volume.block.BlockVolume.Streamable
blockStateStream
-
Methods inherited from interface org.spongepowered.api.world.volume.game.HeightAwareVolume
height, height
-
Methods inherited from interface org.spongepowered.api.world.volume.game.LocationBaseDataHolder
get, get, get, get, getDouble, getDouble, getDouble, getDouble, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getValue, getValue, getValue, getValue, getValues, getValues, keys, keys, orElse, orElse, orElse, orElse, orElse, orElse, orElse, orElse, orNull, orNull, orNull, orNull, require, require, require, require, supports, supports, supports, supports, supports, supports
-
Methods inherited from interface org.spongepowered.api.world.volume.game.LocationBaseDataHolder.Mutable
copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, offer, offer, offer, offer, offer, offer, remove, remove, remove, remove, setRawData, setRawData, transform, transform, transform, transform, undo, undo, validateRawData, validateRawData
-
Methods inherited from interface org.spongepowered.api.world.volume.game.UpdatableVolume
scheduledBlockUpdates, scheduledFluidUpdates
-
-
-
-
Method Detail
-
addEntity
void addEntity(Entity entity)
Adds theEntityto thischunk. It is not guaranteed this will succeed in all cases, asstate()does play a role in whether an entity can be directly added or not.This method should realistically be used only during world generation, and therefore will likely emit warnings if attempting to add entities to live
WorldChunkinstances.- Parameters:
entity- The entity to add
-
state
ChunkState state()
Gets thisChunk's currentChunkState. TheChunkStatestipulates the potential validity of various operations that can be performed.A fully generated chunk will return
ChunkStates.FULL- though care should be taken as the chunk may be anemptyone.- Returns:
- This chunk's state
-
isEmpty
boolean isEmpty()
Gets whether this chunk is empty.- Returns:
- Whether this chunk is empty
-
chunkPosition
Vector3i chunkPosition()
Gets the position of the chunk.The returned position is 3-dimensional with the Y-coordinate set to be the base (lowest) Y-position of the chunk. As 3-dimensional chunks do not yet exist in Minecraft, the returned position will always have a
yset to 0.- Returns:
- The position
-
inhabitedTime
Ticks inhabitedTime()
Gets thenumber of ticksplayers have been present in this chunk, used for calculation of the regional difficulty factor. In vanilla, it is increased by the number of players in the chunk every tick, and is capped at 3,600,000 ticks (50 hours).- Returns:
- The number of ticks
-
setInhabitedTime
void setInhabitedTime(Ticks newInhabitedTime)
Sets thenumber of ticksplayers have been present in this chunk.- Parameters:
newInhabitedTime- TheTicksto set this value to- See Also:
inhabitedTime()
-
-