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 BiomeVolume
BiomeVolume.Immutable, BiomeVolume.Modifiable<M>, BiomeVolume.Mutable, BiomeVolume.Streamable<B>, BiomeVolume.Unmodifiable<U>Nested classes/interfaces inherited from interface BlockEntityVolume
BlockEntityVolume.Modifiable<M>, BlockEntityVolume.Mutable, BlockEntityVolume.Streamable<T>, BlockEntityVolume.Unmodifiable<U>Nested classes/interfaces inherited from interface BlockVolume
BlockVolume.Immutable, BlockVolume.Modifiable<M>, BlockVolume.Mutable, BlockVolume.Streamable<B>, BlockVolume.Unmodifiable<U>Nested classes/interfaces inherited from interface EntityVolume
EntityVolume.EntityVolumeFactory, EntityVolume.Immutable, EntityVolume.Modifiable<M>, EntityVolume.Mutable, EntityVolume.Streamable<E>, EntityVolume.Unmodifiable<U>Nested classes/interfaces inherited from interface ForwardingAudience
ForwardingAudience.SingleNested classes/interfaces inherited from interface ForwardingViewer
ForwardingViewer.FactoryNested classes/interfaces inherited from interface GenerationVolume
GenerationVolume.MutableNested classes/interfaces inherited from interface LocationBaseDataHolder
LocationBaseDataHolder.MutableNested classes/interfaces inherited from interface RandomProvider
RandomProvider.SourceNested classes/interfaces inherited from interface WeatherUniverse
WeatherUniverse.Mutable -
Method Summary
Modifier and TypeMethodDescriptiondefault CauseStackManagerGets theCauseStackManagerfor handling the current event cause stack and context information.chunk(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.default booleanChecks if thecurrent threadis the main thread of the world.Collection<? extends Player> players()Gets an unmodifiable collection ofplayerscurrently in this world.Gets theproperties.default Schedulerdefault Wworld()Methods inherited from interface ArchetypeVolumeCreator
createArchetypeVolumeMethods inherited from interface 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 BiomeVolume
biome, biomeMethods inherited from interface BiomeVolume.Modifiable
setBiome, setBiomeMethods inherited from interface BiomeVolume.Streamable
biomeStreamMethods inherited from interface BlockEntityVolume
blockEntities, blockEntities, blockEntity, blockEntityMethods inherited from interface BlockEntityVolume.Modifiable
addBlockEntity, addBlockEntity, removeBlockEntity, removeBlockEntityMethods inherited from interface BlockEntityVolume.Streamable
blockEntityStreamMethods inherited from interface BlockVolume
block, block, blockPalette, fluid, fluid, highestPositionAt, highestYAt, highestYAtMethods inherited from interface BlockVolume.Streamable
blockStateStreamMethods inherited from interface ChunkVolume
chunkLayout, hasChunk, hasChunk, hasChunkAtBlock, hasChunkAtBlock, isChunkLoaded, isChunkLoaded, isChunkLoadedAtBlock, isChunkLoadedAtBlockMethods inherited from interface ContextSource
contextMethods inherited from interface EntityVolume
entities, entities, entities, entities, entities, entity, nearbyEntities, nearestPlayerMethods inherited from interface EntityVolume.Modifiable
createEntity, createEntity, createEntity, createEntity, createEntity, createEntity, createEntityNaturally, createEntityNaturally, createEntityNaturally, createEntityNaturally, filterEntities, filterEntities, filterEntities, filterEntities, filterEntities, spawnEntities, spawnEntityMethods inherited from interface EntityVolume.Streamable
entityStreamMethods inherited from interface EnvironmentalVolume
isSkylightMax, light, light, light, light, light, lightMethods inherited from interface ForwardingAudience
clearResourcePacks, clearTitle, closeDialog, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, playSound, playSound, playSound, pointers, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendTitlePart, showBossBar, showDialog, stopSoundMethods inherited from interface GenerationVolume
hasBlockState, hasBlockState, hasBlockState, maximumHeightMethods inherited from interface HeightAwareVolume
height, heightMethods inherited from interface 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 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 LocationCreator
location, location, location, locationMethods inherited from interface MutableGameVolume
destroyBlock, spawnEntityMethods inherited from interface PhysicsAwareMutableBlockVolume
setBlock, setBlock, setBlock, setBlockMethods inherited from interface Pointered
get, getOrDefault, getOrDefaultFromMethods inherited from interface PrimitiveGameVolume
emittedLight, emittedLight, height, maximumLightMethods inherited from interface RandomProvider
randomMethods inherited from interface 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 RegistryHolder
findRegistry, registry, streamRegistries, streamRegistriesMethods inherited from interface UpdatableVolume
scheduledBlockUpdates, scheduledFluidUpdatesMethods inherited from interface Viewer
playMusicDisc, playMusicDisc, playSound, playTotemOfUndyingEffect, resetBlockChange, resetBlockChange, resetBlockProgress, resetBlockProgress, sendBlockChange, sendBlockChange, sendBlockProgress, sendBlockProgress, sendWorldType, spawnParticles, spawnParticles, stopMusicDisc, stopMusicDiscMethods inherited from interface Volume
available, contains, contains, isAreaAvailable, max, min, sizeMethods inherited from interface WeatherUniverse
weatherMethods inherited from interface WorldLike
difficulty, engine, removeBlock, removeBlock, seed, setBlock, setBlock
-
Method Details
-
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
-
scheduler
-
causeStackManager
Gets theCauseStackManagerfor handling the current event cause stack and context information.Note: Accessing this outside of
onWorldThread()can lead to hard to diagnose problems or unrecoverable crashes.- Returns:
- The cause stack manager
-
onWorldThread
default boolean onWorldThread()Checks if thecurrent threadis the main thread of the world.- Returns:
trueif main thread,falseif not
-