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 WorldTemplate
asTemplate()
default WorldChunk
chunkAtBlock(int bx, int by, int bz)
Gets the loaded chunk at the given chunk coordinate position.ChunkManager
chunkManager()
Gets theChunkManager
for this world.BlockSnapshot
createSnapshot(int x, int y, int z)
Gets a snapshot of this block at the current point in time.default BlockSnapshot
createSnapshot(Vector3i position)
Gets a snapshot of this block at the current point in time.Path
directory()
Gets thePath
pointing to the root of where the world's data is being stored.Server
engine()
Gets theEngine
that simulates this world.ChunkGenerator
generator()
ResourceKey
key()
Collection<ServerPlayer>
players()
Gets an unmodifiable collection ofplayers
currently in this world.ServerWorldProperties
properties()
Gets theproperties
.Optional<Raid>
raidAt(Vector3i blockPosition)
Gets theRaid
occurring at a position in the world.Collection<Raid>
raids()
Gets allRaid
s occuring in thisServerWorld
.boolean
restoreSnapshot(int x, int y, int z, BlockSnapshot snapshot, boolean force, BlockChangeFlag flag)
Restores theBlockSnapshot
at the given position.boolean
restoreSnapshot(BlockSnapshot snapshot, boolean force, BlockChangeFlag flag)
Restores the givenBlockSnapshot
using the saved block position stored within the snapshot.default boolean
restoreSnapshot(Vector3i position, BlockSnapshot snapshot, boolean force, BlockChangeFlag flag)
Restores theBlockSnapshot
at the given position.boolean
save()
Instructs the world to save all data.void
triggerExplosion(Explosion explosion)
Causes anExplosion
in a world.default UUID
uniqueId()
Gets the unique ID for this object.boolean
unloadChunk(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, chunkAtBlock, 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:WorldLike
Gets theEngine
that simulates this world.- Specified by:
engine
in interfaceWorldLike<ServerWorld>
- Returns:
- The engine
-
properties
ServerWorldProperties properties()
Description copied from interface:World
Gets theproperties
.- Specified by:
properties
in 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:Identifiable
Gets the unique ID for this object.- Specified by:
uniqueId
in interfaceIdentifiable
- Returns:
- The unique id
- See Also:
Identifiable.uniqueId()
-
chunkAtBlock
default WorldChunk chunkAtBlock(int bx, int by, int bz)
Description copied from interface:World
Gets 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 fromServerLocation
s or aLocatable
that returns aposition
in relation to aWorldLike
. This gets a guaranteedWorldChunk
at the desired block position; however, theWorldChunk
instance 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:
chunkAtBlock
in interfaceChunkVolume
- Specified by:
chunkAtBlock
in 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
World
that 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
World
that 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 givenBlockSnapshot
using the saved block position stored within the snapshot.If forced, the state of the block will change its
BlockType
to match that of the snapshot then set the state. However, if force is set to false and theBlockType
s 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 theBlockType
does 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 theBlockSnapshot
at the given position.If forced, the state of the block will change its
BlockType
to match that of the snapshot then set the state. However, if force is set to false and theblock types
do 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 theBlockSnapshot
at the given position.If forced, the state of the block will change its
BlockType
to match that of the snapshot then set the state. However, if force is set to false and theBlockType
s 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 theBlockType
does 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 thePath
pointing to the root of where the world's data is being stored.- Returns:
- The path
-
save
boolean save() throws IOException
Instructs the world to save all data.- Returns:
- True if save was successful, or false if
SerializationBehavior
isSerializationBehavior.NONE
- Throws:
IOException
- If the save failed
-
unloadChunk
boolean unloadChunk(WorldChunk chunk)
Unloads the given chunk from the world. Returns aboolean
flag for whether the operation was successful.- Parameters:
chunk
- The chunk to unload- Returns:
- Whether the operation was successful
-
triggerExplosion
void triggerExplosion(Explosion explosion)
Causes anExplosion
in a world.- Parameters:
explosion
- The explosion to cause
-
players
Collection<ServerPlayer> players()
Description copied from interface:World
Gets an unmodifiable collection ofplayers
currently in this world.- Specified by:
players
in interfaceEntityVolume
- Specified by:
players
in interfaceWorld<ServerWorld,ServerLocation>
- Returns:
- The players
-
raids
Collection<Raid> raids()
Gets allRaid
s occuring in thisServerWorld
.Please note by default, some
WorldType
s such asWorldTypes.THE_NETHER
will 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 theRaid
occurring 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 theChunkManager
for this world.- Returns:
- The chunk manager.
-
-