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,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>
public interface ServerWorld extends World<ServerWorld,ServerLocation>, Identifiable, InteractableVolume, ServerLocationCreator, WeatherUniverse.Mutable
-
-
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.Single
-
Nested classes/interfaces inherited from interface org.spongepowered.api.world.volume.game.GenerationVolume
GenerationVolume.Mutable
-
Nested classes/interfaces inherited from interface org.spongepowered.api.world.volume.game.LocationBaseDataHolder
LocationBaseDataHolder.Mutable
-
Nested classes/interfaces inherited from interface org.spongepowered.api.world.server.ServerLocationCreator
ServerLocationCreator.Factory
-
Nested classes/interfaces inherited from interface org.spongepowered.api.world.weather.WeatherUniverse
WeatherUniverse.Mutable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description WorldTemplateasTemplate()default 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.ChunkManagerchunkManager()Gets theChunkManagerfor this world.BlockSnapshotcreateSnapshot(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.Pathdirectory()Gets thePathpointing to the root of where the world's data is being stored.Serverengine()Gets theEnginethat simulates this world.ChunkGeneratorgenerator()ResourceKeykey()Collection<ServerPlayer>players()Gets an unmodifiable collection ofplayerscurrently in this world.ServerWorldPropertiesproperties()Gets theproperties.Optional<Raid>raidAt(Vector3i blockPosition)Gets theRaidoccurring at a position in the world.Collection<Raid>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.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
createArchetypeVolume
-
Methods inherited from interface net.kyori.adventure.audience.Audience
openBook, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, showTitle, stopSound
-
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.Streamable
blockStateStream
-
Methods inherited from interface org.spongepowered.api.world.volume.game.ChunkVolume
chunkLayout, hasChunk, hasChunk, hasChunkAtBlock, hasChunkAtBlock, isChunkLoaded, isChunkLoaded, isChunkLoadedAtBlock, isChunkLoadedAtBlock
-
Methods inherited from interface org.spongepowered.api.service.context.ContextSource
context
-
Methods inherited from interface org.spongepowered.api.world.volume.entity.EntityVolume
entities, entities, entities, entities, entities, entity, nearbyEntities, nearestPlayer
-
Methods inherited from interface org.spongepowered.api.world.volume.entity.EntityVolume.Modifiable
createEntity, createEntity, createEntity, createEntity, createEntity, createEntity, createEntityNaturally, createEntityNaturally, createEntityNaturally, createEntityNaturally, spawnEntities, spawnEntity
-
Methods inherited from interface org.spongepowered.api.world.volume.entity.EntityVolume.Streamable
entityStream
-
Methods inherited from interface org.spongepowered.api.world.volume.game.EnvironmentalVolume
isSkylightMax, light, light, light, light, light, light
-
Methods inherited from interface net.kyori.adventure.audience.ForwardingAudience
clearTitle, filterAudience, forEachAudience, hideBossBar, openBook, playSound, playSound, playSound, pointers, resetTitle, sendActionBar, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendTitlePart, showBossBar, stopSound
-
Methods inherited from interface org.spongepowered.api.world.volume.game.GenerationVolume
hasBlockState, hasBlockState, hasBlockState, maximumHeight
-
Methods inherited from interface org.spongepowered.api.world.volume.game.HeightAwareVolume
height, height
-
Methods inherited from interface org.spongepowered.api.world.volume.game.InteractableVolume
blockDigTimeWith, blockDigTimeWith, digBlock, digBlock, digBlockWith, digBlockWith, hitBlock, hitBlock, interactBlock, interactBlock, interactBlockWith, interactBlockWith, placeBlock, placeBlock
-
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.LocationCreator
location, location, location, location
-
Methods inherited from interface org.spongepowered.api.world.volume.game.MutableGameVolume
destroyBlock, spawnEntity
-
Methods inherited from interface org.spongepowered.api.world.volume.block.PhysicsAwareMutableBlockVolume
setBlock, setBlock, setBlock, setBlock
-
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom
-
Methods inherited from interface org.spongepowered.api.world.volume.game.PrimitiveGameVolume
emittedLight, emittedLight, height, maximumLight
-
Methods inherited from interface org.spongepowered.api.util.RandomProvider
random
-
Methods 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, worldType
-
Methods inherited from interface org.spongepowered.api.registry.RegistryHolder
findRegistry, registry, streamRegistries
-
Methods inherited from interface org.spongepowered.api.world.server.ServerLocationCreator
locatableBlock, locatableBlock
-
Methods inherited from interface org.spongepowered.api.world.volume.game.UpdatableVolume
scheduledBlockUpdates, scheduledFluidUpdates
-
Methods inherited from interface org.spongepowered.api.effect.Viewer
playMusicDisc, playSound, resetBlockChange, resetBlockChange, sendBlockChange, sendBlockChange, sendWorldType, spawnParticles, spawnParticles, stopMusicDisc
-
Methods inherited from interface org.spongepowered.api.world.volume.Volume
available, contains, contains, isAreaAvailable, max, min, size
-
Methods inherited from interface org.spongepowered.api.world.weather.WeatherUniverse
weather
-
Methods inherited from interface org.spongepowered.api.world.weather.WeatherUniverse.Mutable
setWeather, setWeather
-
Methods inherited from interface org.spongepowered.api.world.World
audiences, chunk, chunk, closestPlayer, closestPlayer, closestPlayer, closestPlayer, closestPlayer, closestPlayer, isLoaded, loadChunk, loadChunk, loadedChunks, world
-
Methods inherited from interface org.spongepowered.api.world.WorldLike
difficulty, removeBlock, removeBlock, seed, setBlock, setBlock
-
-
-
-
Method Detail
-
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()
-
asTemplate
WorldTemplate asTemplate()
-
key
ResourceKey key()
- Returns:
- The key
- See Also:
ResourceKeyed.key()
-
uniqueId
default UUID uniqueId()
Description copied from interface:IdentifiableGets the unique ID for this object.- Specified by:
uniqueIdin interfaceIdentifiable- Returns:
- The unique id
- See Also:
Identifiable.uniqueId()
-
chunkAtBlock
default WorldChunk chunkAtBlock(Vector3i blockPosition)
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
default WorldChunk chunkAtBlock(int bx, int by, int bz)
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
default BlockSnapshot createSnapshot(Vector3i position)
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
BlockSnapshot createSnapshot(int x, int y, int z)
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
boolean restoreSnapshot(BlockSnapshot snapshot, boolean force, BlockChangeFlag flag)
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
boolean save() throws IOExceptionInstructs the world to save all data.- Returns:
- True if save was successful, or false if
SerializationBehaviorisSerializationBehavior.NONE - Throws:
IOException- If the save failed
-
unloadChunk
boolean unloadChunk(WorldChunk chunk)
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
void triggerExplosion(Explosion explosion)
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
Optional<Raid> raidAt(Vector3i blockPosition)
Gets theRaidoccurring at a position in the world.- Parameters:
blockPosition- The location of the Raid.- Returns:
- The raid at that location, if present
-
chunkManager
ChunkManager chunkManager()
Gets theChunkManagerfor this world.- Returns:
- The chunk manager.
-
-