Interface ServerWorld
- All Superinterfaces:
ArchetypeVolumeCreator,Audience,BiomeVolume,BiomeVolume.Modifiable<ServerWorld>,BiomeVolume.Streamable<ServerWorld>,BlockEntityVolume,BlockEntityVolume.Modifiable<ServerWorld>,BlockEntityVolume.Streamable<ServerWorld>,BlockVolume,BlockVolume.Modifiable<ServerWorld>,BlockVolume.Streamable<ServerWorld>,ChunkVolume,ContextSource,EntityVolume,EntityVolume.Modifiable<ServerWorld>,EntityVolume.Streamable<ServerWorld>,EnvironmentalVolume,ForwardingAudience,ForwardingViewer,GenerationVolume,GenerationVolume.Mutable,HeightAwareVolume,Identifiable,InteractableVolume,LocationBaseDataHolder,LocationBaseDataHolder.Mutable,LocationCreator<ServerWorld,,ServerLocation> MutableGameVolume,MutableVolume,PhysicsAwareMutableBlockVolume<ServerWorld>,Pointered,PrimitiveGameVolume,RandomProvider,Region<ServerWorld>,RegistryHolder,ServerLocationCreator,UpdatableVolume,Viewer,Volume,WeatherUniverse,WeatherUniverse.Mutable,World<ServerWorld,,ServerLocation> WorldLike<ServerWorld>
-
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.entity.EntityVolume
EntityVolume.EntityVolumeFactory, EntityVolume.Immutable, EntityVolume.Modifiable<M extends EntityVolume.Modifiable<M>>, EntityVolume.Mutable, EntityVolume.Streamable<E extends EntityVolume.Streamable<E>>, EntityVolume.Unmodifiable<U extends EntityVolume.Unmodifiable<U>>Nested classes/interfaces inherited from interface net.kyori.adventure.audience.ForwardingAudience
ForwardingAudience.SingleNested classes/interfaces inherited from interface org.spongepowered.api.effect.ForwardingViewer
ForwardingViewer.FactoryNested classes/interfaces inherited from interface org.spongepowered.api.world.volume.game.GenerationVolume
GenerationVolume.MutableNested classes/interfaces inherited from interface org.spongepowered.api.world.volume.game.LocationBaseDataHolder
LocationBaseDataHolder.MutableNested classes/interfaces inherited from interface org.spongepowered.api.util.RandomProvider
RandomProvider.SourceNested classes/interfaces inherited from interface org.spongepowered.api.world.server.ServerLocationCreator
ServerLocationCreator.FactoryNested classes/interfaces inherited from interface org.spongepowered.api.world.weather.WeatherUniverse
WeatherUniverse.Mutable -
Method Summary
Modifier and TypeMethodDescriptiondefault WorldChunkchunkAtBlock(int bx, int by, int bz) Gets the loaded chunk at the given chunk coordinate position.default WorldChunkchunkAtBlock(Vector3i blockPosition) Gets the loaded chunk at the given block coordinate position.Gets theChunkManagerfor this world.Returns a stream of existing chunk positions for this world.createSnapshot(int x, int y, int z) Gets a snapshot of this block at the current point in time.default BlockSnapshotcreateSnapshot(Vector3i position) Gets a snapshot of this block at the current point in time.Gets thePathpointing to the root of where the world's data is being stored.Gets theBossBarof the ender dragon fight occurring in thisServerWorld.engine()Gets theEnginethat simulates this world.key()Returns a stream of existing chunks for this world.players()Gets an unmodifiable collection ofplayerscurrently in this world.Gets theproperties.Gets theRaidoccurring at a position in the world.raids()Gets allRaids occuring in thisServerWorld.booleanrestoreSnapshot(int x, int y, int z, BlockSnapshot snapshot, boolean force, BlockChangeFlag flag) Restores theBlockSnapshotat the given position.booleanrestoreSnapshot(BlockSnapshot snapshot, boolean force, BlockChangeFlag flag) Restores the givenBlockSnapshotusing the saved block position stored within the snapshot.default booleanrestoreSnapshot(Vector3i position, BlockSnapshot snapshot, boolean force, BlockChangeFlag flag) Restores theBlockSnapshotat the given position.booleansave()Instructs the world to save all data.booleanInstructs the world to save and flush all data immediately.voidtriggerExplosion(Explosion explosion) Causes anExplosionin a world.default UUIDuniqueId()Gets the unique ID for this object.booleanunloadChunk(WorldChunk chunk) Unloads the given chunk from the world.Methods inherited from interface org.spongepowered.api.world.volume.archetype.ArchetypeVolumeCreator
createArchetypeVolumeMethods inherited from interface net.kyori.adventure.audience.Audience
deleteMessage, openBook, removeResourcePacks, removeResourcePacks, removeResourcePacks, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, showTitle, stopSoundMethods inherited from interface org.spongepowered.api.world.volume.biome.BiomeVolume
biome, biomeMethods inherited from interface org.spongepowered.api.world.volume.biome.BiomeVolume.Modifiable
setBiome, setBiomeMethods inherited from interface org.spongepowered.api.world.volume.biome.BiomeVolume.Streamable
biomeStreamMethods inherited from interface org.spongepowered.api.world.volume.block.entity.BlockEntityVolume
blockEntities, blockEntities, blockEntity, blockEntityMethods inherited from interface org.spongepowered.api.world.volume.block.entity.BlockEntityVolume.Modifiable
addBlockEntity, addBlockEntity, removeBlockEntity, removeBlockEntityMethods inherited from interface org.spongepowered.api.world.volume.block.entity.BlockEntityVolume.Streamable
blockEntityStreamMethods inherited from interface org.spongepowered.api.world.volume.block.BlockVolume
block, block, blockPalette, fluid, fluid, highestPositionAt, highestYAt, highestYAtMethods inherited from interface org.spongepowered.api.world.volume.block.BlockVolume.Streamable
blockStateStreamMethods inherited from interface org.spongepowered.api.world.volume.game.ChunkVolume
chunkLayout, hasChunk, hasChunk, hasChunkAtBlock, hasChunkAtBlock, isChunkLoaded, isChunkLoaded, isChunkLoadedAtBlock, isChunkLoadedAtBlockMethods inherited from interface org.spongepowered.api.service.context.ContextSource
contextMethods inherited from interface org.spongepowered.api.world.volume.entity.EntityVolume
entities, entities, entities, entities, entities, entity, nearbyEntities, nearestPlayerMethods inherited from interface org.spongepowered.api.world.volume.entity.EntityVolume.Modifiable
createEntity, createEntity, createEntity, createEntity, createEntity, createEntity, createEntityNaturally, createEntityNaturally, createEntityNaturally, createEntityNaturally, spawnEntities, spawnEntityMethods inherited from interface org.spongepowered.api.world.volume.entity.EntityVolume.Streamable
entityStreamMethods inherited from interface org.spongepowered.api.world.volume.game.EnvironmentalVolume
isSkylightMax, light, light, light, light, light, lightMethods inherited from interface net.kyori.adventure.audience.ForwardingAudience
clearResourcePacks, clearTitle, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, playSound, playSound, playSound, pointers, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendTitlePart, showBossBar, stopSoundMethods inherited from interface org.spongepowered.api.world.volume.game.GenerationVolume
hasBlockState, hasBlockState, hasBlockState, maximumHeightMethods inherited from interface org.spongepowered.api.world.volume.game.HeightAwareVolume
height, heightMethods inherited from interface org.spongepowered.api.world.volume.game.InteractableVolume
blockDigTimeWith, blockDigTimeWith, digBlock, digBlock, digBlockWith, digBlockWith, hitBlock, hitBlock, interactBlock, interactBlock, interactBlockWith, interactBlockWith, placeBlock, placeBlockMethods 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, supportsMethods 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, validateRawDataMethods inherited from interface org.spongepowered.api.world.LocationCreator
location, location, location, locationMethods inherited from interface org.spongepowered.api.world.volume.game.MutableGameVolume
destroyBlock, spawnEntityMethods inherited from interface org.spongepowered.api.world.volume.block.PhysicsAwareMutableBlockVolume
setBlock, setBlock, setBlock, setBlockMethods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFromMethods inherited from interface org.spongepowered.api.world.volume.game.PrimitiveGameVolume
emittedLight, emittedLight, height, maximumLightMethods inherited from interface org.spongepowered.api.util.RandomProvider
randomMethods inherited from interface org.spongepowered.api.world.volume.game.Region
border, canSeeSky, canSeeSky, containsAnyLiquids, hasLiquid, hasLiquid, isAreaLoaded, isAreaLoaded, isAreaLoaded, isAreaLoaded, isAreaLoaded, isBlockLoaded, isBlockLoaded, isBlockLoaded, isBlockLoaded, isCollisionBoxesEmpty, isInBorder, seaLevel, setBorder, skylightSubtracted, worldTypeMethods inherited from interface org.spongepowered.api.registry.RegistryHolder
findRegistry, registry, streamRegistriesMethods inherited from interface org.spongepowered.api.world.server.ServerLocationCreator
locatableBlock, locatableBlockMethods inherited from interface org.spongepowered.api.world.volume.game.UpdatableVolume
scheduledBlockUpdates, scheduledFluidUpdatesMethods inherited from interface org.spongepowered.api.effect.Viewer
playMusicDisc, playMusicDisc, playSound, resetBlockChange, resetBlockChange, resetBlockProgress, resetBlockProgress, sendBlockChange, sendBlockChange, sendBlockProgress, sendBlockProgress, sendWorldType, spawnParticles, spawnParticles, stopMusicDisc, stopMusicDiscMethods inherited from interface org.spongepowered.api.world.volume.Volume
available, contains, contains, isAreaAvailable, max, min, sizeMethods inherited from interface org.spongepowered.api.world.weather.WeatherUniverse
weatherMethods inherited from interface org.spongepowered.api.world.weather.WeatherUniverse.Mutable
setWeather, setWeatherMethods inherited from interface org.spongepowered.api.world.World
audiences, chunk, chunk, closestPlayer, closestPlayer, closestPlayer, closestPlayer, closestPlayer, closestPlayer, isLoaded, loadChunk, loadChunk, loadedChunks, worldMethods inherited from interface org.spongepowered.api.world.WorldLike
difficulty, removeBlock, removeBlock, seed, setBlock, setBlock
-
Method Details
-
engine
Server engine()Description copied from interface:WorldLikeGets theEnginethat simulates this world.- Specified by:
enginein interfaceWorldLike<ServerWorld>- Returns:
- The engine
-
properties
ServerWorldProperties properties()Description copied from interface:WorldGets theproperties.- Specified by:
propertiesin interfaceWorld<ServerWorld,ServerLocation> - Returns:
- The properties
-
generator
ChunkGenerator generator() -
key
ResourceKey key()- Returns:
- The key
- See Also:
-
uniqueId
Description copied from interface:IdentifiableGets the unique ID for this object.- Specified by:
uniqueIdin interfaceIdentifiable- Returns:
- The unique id
- See Also:
-
chunkAtBlock
Description copied from interface:WorldGets the loaded chunk at the given block coordinate position. This gets a guaranteedWorldChunkat the desired block position; however, theWorldChunkinstance may beempty, and likewise, may not be generated, valid, pre-existing. It is important to check for these cases prior to attempting to modify the chunk.Note that this is still different from
World.chunk(Vector3i)due to it being a relative block position which can vary depending on implementation and other mods installed.- Specified by:
chunkAtBlockin interfaceChunkVolume- Specified by:
chunkAtBlockin interfaceWorld<ServerWorld,ServerLocation> - Parameters:
blockPosition- The block position to be transformed for relative chunk position- Returns:
- The available chunk at that position
-
chunkAtBlock
Description copied from interface:WorldGets the loaded chunk at the given chunk coordinate position. The position is the block position relative to theChunk.chunkPosition(), and therefor is going to return a different chunk fromChunkVolume.chunk(Vector3i). This is more usable fromServerLocations or aLocatablethat returns apositionin relation to aWorldLike. This gets a guaranteedWorldChunkat the desired block position; however, theWorldChunkinstance may beempty, and likewise, may not be generated, valid, pre-existing. It is important to check for these cases prior to attempting to modify the chunk.Note that this is still different from
World.chunk(Vector3i)due to the relative block position dictated byServer.chunkLayout(), which can vary depending on implementation and other mods installed.- Specified by:
chunkAtBlockin interfaceChunkVolume- Specified by:
chunkAtBlockin interfaceWorld<ServerWorld,ServerLocation> - Parameters:
bx- The block x coordinateby- The block y coordinatebz- The block z coordinate- Returns:
- The available chunk at that position
-
createSnapshot
Gets a snapshot of this block at the current point in time.A snapshot is disconnected from the
Worldthat it was taken from so changes to the original block do not affect the snapshot.- Parameters:
position- The position of the block- Returns:
- A snapshot
-
createSnapshot
Gets a snapshot of this block at the current point in time.A snapshot is disconnected from the
Worldthat it was taken from so changes to the original block do not affect the snapshot.- Parameters:
x- The x positiony- The y positionz- The z position- Returns:
- A snapshot
-
restoreSnapshot
Restores the givenBlockSnapshotusing the saved block position stored within the snapshot.If forced, the state of the block will change its
BlockTypeto match that of the snapshot then set the state. However, if force is set to false and theBlockTypes does not match, false will be returned. If notifyNeighbors is true, neighboring blocks will be notified of changes at the restored block location triggering physic updates.- Parameters:
snapshot- The snapshotforce- If true, forces block state to be set even if theBlockTypedoes not match the snapshot one.flag- The various change flags controlling some interactions- Returns:
- True if the restore was successful, false otherwise
-
restoreSnapshot
default boolean restoreSnapshot(Vector3i position, BlockSnapshot snapshot, boolean force, BlockChangeFlag flag) Restores theBlockSnapshotat the given position.If forced, the state of the block will change its
BlockTypeto match that of the snapshot then set the state. However, if force is set to false and theblock typesdo not match, false will be returned. If notifyNeighbors istrue, neighboring blocks will be notified of changes at the restored block location triggering physics updates.- Parameters:
position- The position of the blocksnapshot- The snapshotforce- If true, forces block state to be set even if the the block type does not match the snapshot one.flag- The various change flags controlling some interactions- Returns:
- True if the restore was successful, false otherwise
-
restoreSnapshot
boolean restoreSnapshot(int x, int y, int z, BlockSnapshot snapshot, boolean force, BlockChangeFlag flag) Restores theBlockSnapshotat the given position.If forced, the state of the block will change its
BlockTypeto match that of the snapshot then set the state. However, if force is set to false and theBlockTypes does not match, false will be returned. If notifyNeighbors is true, neighboring blocks will be notified of changes at the restored block location triggering physic updates.- Parameters:
x- The X positiony- The Y positionz- The Z positionsnapshot- The snapshotforce- If true, forces block state to be set even if theBlockTypedoes not match the snapshot one.flag- The various change flags controlling some interactions- Returns:
- true if the restore was successful, false otherwise
-
directory
Path directory()Gets thePathpointing to the root of where the world's data is being stored.- Returns:
- The path
-
save
Instructs the world to save all data.- Returns:
- True if save was successful, or false if
SerializationBehaviorisSerializationBehavior.NONE - Throws:
IOException- If the save failed- See Also:
-
saveAndFlush
Instructs the world to save and flush all data immediately.Note: May cause a short-term drop in server performance
- Returns:
- True if save was successful, or false if
SerializationBehaviorisSerializationBehavior.NONE - Throws:
IOException- If the save failed- See Also:
-
unloadChunk
Unloads the given chunk from the world. Returns abooleanflag for whether the operation was successful.- Parameters:
chunk- The chunk to unload- Returns:
- Whether the operation was successful
-
triggerExplosion
Causes anExplosionin a world.- Parameters:
explosion- The explosion to cause
-
players
Collection<ServerPlayer> players()Description copied from interface:WorldGets an unmodifiable collection ofplayerscurrently in this world.- Specified by:
playersin interfaceEntityVolume- Specified by:
playersin interfaceWorld<ServerWorld,ServerLocation> - Returns:
- The players
-
raids
Collection<Raid> raids()Gets allRaids occuring in thisServerWorld.Please note by default, some
WorldTypes such asWorldTypes.THE_NETHERwill not contain any Raids because the game prevents Raids from starting in the nether.- Returns:
- All the raids in this world.
-
raidAt
Gets theRaidoccurring at a position in the world.- Parameters:
blockPosition- The location of the Raid.- Returns:
- The raid at that location, if present
-
dragonFightBossBar
Gets theBossBarof the ender dragon fight occurring in thisServerWorld.- Returns:
- The dragon fight boss bar, if present
-
chunkManager
ChunkManager chunkManager()Gets theChunkManagerfor this world.- Returns:
- The chunk manager.
-
chunkPositions
Returns a stream of existing chunk positions for this world.Note that consuming the stream is slow, consider consuming it asynchronously.
The stream must be closed or fully consumed otherwise file handles may stay open.
- Returns:
- The stream of existing chunk positions.
-
offlineChunks
Stream<OfflineChunk> offlineChunks()Returns a stream of existing chunks for this world.Note that consuming the stream is very slow, consider consuming it asynchronously.
The stream must be closed or fully consumed otherwise file handles may stay open.
You should not modify data of currently loaded chunks.
- Returns:
- The stream of existing chunks.
-