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,ForwardingViewer,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 ForwardingViewer, WorldLike<W>, LocationCreator<W,L>, PhysicsAwareMutableBlockVolume<W>, ContextSource, 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.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.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 WorldChunkGets 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) booleanisLoaded()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 ifshouldGenerateis true and the chunk is generated.default Optional<WorldChunk> Gets the chunk at the given chunk coordinate position if it exists or ifshouldGenerateis 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 ofplayerscurrently in this world.Gets theproperties.default Wworld()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.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.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.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 ofplayerscurrently in this world.- Specified by:
playersin interfaceEntityVolume- Returns:
- The players
-
audiences
- Specified by:
audiencesin interfaceForwardingAudience- Specified by:
audiencesin interfaceForwardingViewer
-
closestPlayer
-
closestPlayer
-
closestPlayer
-
closestPlayer
-
closestPlayer
-
closestPlayer
-
chunkAtBlock
Gets 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
chunk(Vector3i)due to it being a relative block position which can vary depending on implementation and other mods installed.- Specified by:
chunkAtBlockin 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 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
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- 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 aWorldLikeis different from aChunk's position, and therefore care should be taken when requesting a chunk. It is not guaranteed that the returnedChunkisemptyor not, nor thestateof the chunk. This gets a guaranteedWorldChunkat the desired chunk 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.- Specified by:
chunkin 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 aWorldLikeis different from aChunk's position, and therefore care should be taken when requesting a chunk. It is not guaranteed that the returnedChunkisemptyor not, nor thestateof the chunk.In Vanilla, the y coordinate will always be 0.
This gets a guaranteedWorldChunkat the desired chunk 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.- Specified by:
chunkin 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 ifshouldGenerateis 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 ifshouldGenerateis 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
-