Package org.spongepowered.api.world
Interface World<W extends World<W,L>,L extends Location<W,L>>
- All Superinterfaces:
ArchetypeVolumeCreator
,Audience
,BiomeVolume
,BiomeVolume.Modifiable<W>
,BiomeVolume.Streamable<W>
,BlockEntityVolume
,BlockEntityVolume.Modifiable<W>
,BlockEntityVolume.Streamable<W>
,BlockVolume
,BlockVolume.Modifiable<W>
,BlockVolume.Streamable<W>
,ChunkVolume
,ContextSource
,EntityVolume
,EntityVolume.Modifiable<W>
,EntityVolume.Streamable<W>
,EnvironmentalVolume
,ForwardingAudience
,GenerationVolume
,GenerationVolume.Mutable
,HeightAwareVolume
,LocationBaseDataHolder
,LocationBaseDataHolder.Mutable
,LocationCreator<W,
,L> MutableGameVolume
,MutableVolume
,PhysicsAwareMutableBlockVolume<W>
,Pointered
,PrimitiveGameVolume
,RandomProvider
,Region<W>
,RegistryHolder
,UpdatableVolume
,Viewer
,Volume
,WeatherUniverse
,WorldLike<W>
- All Known Subinterfaces:
ClientWorld
,ServerWorld
@DoNotStore
public interface World<W extends World<W,L>,L extends Location<W,L>>
extends ForwardingAudience, WorldLike<W>, LocationCreator<W,L>, PhysicsAwareMutableBlockVolume<W>, ContextSource, Viewer, ArchetypeVolumeCreator, WeatherUniverse, RegistryHolder
A loaded Minecraft world.
-
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.weather.WeatherUniverse
WeatherUniverse.Mutable
-
Method Summary
Modifier and TypeMethodDescriptionchunk
(int cx, int cy, int cz) Gets the loaded chunk at the given chunk coordinate position.default WorldChunk
Gets the loaded chunk at the given chunk coordinate position.chunkAtBlock
(int bx, int by, int bz) Gets the loaded chunk at the given chunk coordinate position.chunkAtBlock
(Vector3i blockPosition) Gets the loaded chunk at the given block coordinate position.closestPlayer
(int x, int y, int z, double distance) closestPlayer
(int x, int y, int z, double distance, Predicate<? super Player> predicate) closestPlayer
(Entity entity, double distance) closestPlayer
(Entity entity, double distance, Predicate<? super Player> predicate) closestPlayer
(Vector3i position, double distance) closestPlayer
(Vector3i position, double distance, Predicate<? super Player> predicate) boolean
isLoaded()
Gets if this world is currently loaded.loadChunk
(int cx, int cy, int cz, boolean shouldGenerate) Gets the chunk at the given chunk coordinate position if it exists or ifshouldGenerate
is true and the chunk is generated.default Optional<WorldChunk>
Gets the chunk at the given chunk coordinate position if it exists or ifshouldGenerate
is true and the chunk is generated.Returns a Collection of all actively loaded chunks in this world.Collection<? extends Player>
players()
Gets an unmodifiable collection ofplayers
currently in this world.Gets theproperties
.default W
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.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.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.WorldLike
difficulty, engine, removeBlock, removeBlock, seed, setBlock, setBlock
-
Method Details
-
properties
WorldProperties properties()Gets theproperties
.- Returns:
- The properties
-
world
-
isLoaded
boolean isLoaded()Gets if this world is currently loaded.An assumption can be made that if this returns false, this is considered a stale object.
- Returns:
- True if loaded, false if not
-
players
Collection<? extends Player> players()Gets an unmodifiable collection ofplayers
currently in this world.- Specified by:
players
in interfaceEntityVolume
- Returns:
- The players
-
audiences
- Specified by:
audiences
in interfaceForwardingAudience
-
closestPlayer
-
closestPlayer
-
closestPlayer
-
closestPlayer
-
closestPlayer
-
closestPlayer
-
chunkAtBlock
Gets the loaded chunk at the given block coordinate position. 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
chunk(Vector3i)
due to it being a relative block position which can vary depending on implementation and other mods installed.- Specified by:
chunkAtBlock
in interfaceChunkVolume
- Parameters:
blockPosition
- The block position to be transformed for relative chunk position- Returns:
- The available chunk at that position
-
chunkAtBlock
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
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
- Parameters:
bx
- The block x coordinateby
- The block y coordinatebz
- The block z coordinate- Returns:
- The available chunk at that position
-
chunk
Gets the loaded chunk at the given chunk coordinate position. The position is the same asChunk.chunkPosition()
. The difference between a block placed within aWorldLike
is different from aChunk
's position, and therefore care should be taken when requesting a chunk. It is not guaranteed that the returnedChunk
isempty
or not, nor thestate
of the chunk. This gets a guaranteedWorldChunk
at the desired chunk 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.- Specified by:
chunk
in interfaceChunkVolume
- Parameters:
chunkPos
- The chunk position relative to thechunk layout
- Returns:
- The available chunk at that position
-
chunk
Gets the loaded chunk at the given chunk coordinate position. The position is the same asChunk.chunkPosition()
. The difference between a block placed within aWorldLike
is different from aChunk
's position, and therefore care should be taken when requesting a chunk. It is not guaranteed that the returnedChunk
isempty
or not, nor thestate
of the chunk.In Vanilla, the y coordinate will always be 0.
This gets a guaranteedWorldChunk
at the desired chunk 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.- Specified by:
chunk
in interfaceChunkVolume
- Parameters:
cx
- The x chunk coordinatecy
- The y coordinatecz
- The z chunk coordinate- Returns:
- The available chunk at the chunk position
-
loadChunk
Gets the chunk at the given chunk coordinate position if it exists or ifshouldGenerate
is true and the chunk is generated.- Parameters:
chunkPosition
- The positionshouldGenerate
- True to generate a new chunk- Returns:
- The loaded or generated chunk, if already generated
-
loadChunk
Gets the chunk at the given chunk coordinate position if it exists or ifshouldGenerate
is true and the chunk is generated.In Vanilla, the y coordinate will always be 0.
- Parameters:
cx
- The x coordinatecy
- The y coordinatecz
- The z coordinateshouldGenerate
- True to generate a new chunk- Returns:
- The loaded or generated chunk, if already generated
-
loadedChunks
Iterable<WorldChunk> loadedChunks()Returns a Collection of all actively loaded chunks in this world.The ordering of the returned chunks is undefined.
- Returns:
- The loaded chunks
-