Interface World
- All Superinterfaces:
Extent
,IChunkCache<IChunkGet>
,InputExtent
,Keyed
,OutputExtent
,Trimable
- All Known Subinterfaces:
SimpleWorld
- All Known Implementing Classes:
AbstractWorld
,NullWorld
,WorldWrapper
-
Method Summary
Modifier and TypeMethodDescriptionapplySideEffects
(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) Applies a set of side effects on the given block.default boolean
canPlaceAt
(BlockVector3 position, BlockState blockState) Gets whether the givenBlockState
can be placed here.void
checkLoadedChunk
(BlockVector3 position) Load the chunk at the given position if it isn't loaded.boolean
clearContainerBlockContents
(BlockVector3 position) Clear a chest's contents.Create a mask that matches all liquids.void
dropItem
(Vector3 position, BaseItemStack item) Drop one stack of the item at the given position.void
dropItem
(Vector3 position, BaseItemStack item, int count) Drop an item at the given position.boolean
void
fixAfterFastMode
(Iterable<BlockVector2> chunks) Fix the given chunks after fast mode was used.void
fixLighting
(Iterable<BlockVector2> chunks) Relight the given chunks if possible.void
flush()
boolean
generateTree
(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) Generate a tree at the given position.get
(int x, int z) default BiomeType
getBiome
(BlockVector3 position) Get the biome at the given location.default Collection<BaseItemStack>
getBlockDrops
(BlockVector3 position) Return items that may drop by destroying this block.default int
getBlockLightLevel
(BlockVector3 position) Get the light level at the given block.default String
getId()
The id of this object in the registry.int
getMaxY()
Get the maximum Y.int
getMinY()
Get the minimum Y.getName()
Get the name of the world.Get the name of the world.long
Gets the remaining weather duration.Gets the spawn position of this world.Get the folder in which this world is stored.Gets the weather type of the world.int
hashCode()
default boolean
isWorld()
default boolean
notifyAndLightBlock
(BlockVector3 position, BlockState previousType) Deprecated.boolean
playEffect
(Vector3 position, int type, int data) Play the given effect.boolean
queueBlockBreakEffect
(Platform server, BlockVector3 position, BlockType blockType, double priority) Queue a block break effect.void
refreshChunk
(int chunkX, int chunkZ) Refresh a specific chunk.default boolean
regenerate
(Region region, EditSession editSession) Regenerate an area.default boolean
regenerate
(Region region, Extent extent) Regenerate an area.default boolean
regenerate
(Region region, Extent extent, RegenOptions options) Regenerate an area.void
sendFakeChunk
(Player player, ChunkPacket packet) Send a fake chunk to a player.default boolean
default boolean
setBiome
(BlockVector3 position, BiomeType biome) Set the biome.default <B extends BlockStateHolder<B>>
booleansetBlock
(BlockVector3 position, B block, boolean notifyAndLight) Deprecated.<B extends BlockStateHolder<B>>
booleansetBlock
(BlockVector3 position, B block, SideEffectSet sideEffects) Similar toOutputExtent.setBlock(BlockVector3, BlockStateHolder)
but asideEffects
parameter indicates which side effects should be applied to the block.void
setWeather
(WeatherType weatherType) Sets the weather type of the world.void
setWeather
(WeatherType weatherType, long duration) Sets the weather type of the world.void
simulateBlockMine
(BlockVector3 position) Simulate a block being mined at the given position.boolean
useItem
(BlockVector3 position, BaseItem item, Direction face) Use the given item on the block at the given location on the given side.Methods inherited from interface com.sk89q.worldedit.extent.Extent
addCaves, addOre, addOres, addPostProcessor, addProcessor, addSchems, apply, apply, cancel, center, commit, contains, contains, countBlocks, countBlocks, createEntity, disableHistory, disableQueue, enableHistory, enableQueue, generate, getBlockDistribution, getBlockDistributionWithData, getEntities, getEntities, getHighestTerrainBlock, getHighestTerrainBlock, getMaximumPoint, getMinimumPoint, getNearestSurfaceLayer, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, getNearestSurfaceTerrainBlock, isQueueEnabled, lazyCopy, regenerateChunk, relight, relightBlock, relightSky, removeEntity, replaceBlocks, replaceBlocks, replaceBlocks, setBlocks, setBlocks, setBlocks, spawnResource
Methods inherited from interface com.fastasyncworldedit.core.queue.IChunkCache
trim
Methods inherited from interface com.sk89q.worldedit.extent.InputExtent
getBiome, getBiomeType, getBlock, getBlock, getBrightness, getBrightness, getEmittedLight, getEmittedLight, getFullBlock, getFullBlock, getHeightMap, getOpacity, getOpacity, getSkyLight, getSkyLight
Methods inherited from interface com.sk89q.worldedit.extent.OutputExtent
fullySupports3DBiomes, setBiome, setBlock, setBlock, setBlockLight, setBlockLight, setHeightMap, setSkyLight, setSkyLight, setTile
-
Method Details
-
getName
String getName()Get the name of the world. This will error if world has been unloaded by the server.- Returns:
- a name for the world
-
getNameUnsafe
String getNameUnsafe()Get the name of the world. If the world referenced has been unloaded, this will still return the name.- Returns:
- a name for the world
- Since:
- 2.2.0
-
getStoragePath
Get the folder in which this world is stored. May return null if unknown or if this world is not serialized to disk.- Returns:
- world storage path
-
getMinY
int getMinY()Get the minimum Y. -
getMaxY
int getMaxY()Get the maximum Y. -
createLiquidMask
Mask createLiquidMask()Create a mask that matches all liquids.Implementations should override this so that custom liquids are supported.
- Returns:
- a mask
-
useItem
Use the given item on the block at the given location on the given side.- Parameters:
item
- The itemface
- The face- Returns:
- Whether it succeeded
-
setBlock
@Deprecated default <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException Deprecated.Similar toOutputExtent.setBlock(BlockVector3, BlockStateHolder)
but anotifyAndLight
parameter indicates whether adjacent blocks should be notified that changes have been made and lighting operations should be executed.If it's not possible to skip lighting, or if it's not possible to avoid notifying adjacent blocks, then attempt to meet the specification as best as possible.
On implementations where the world is not simulated, the
notifyAndLight
parameter has no effect either way.- Parameters:
position
- position of the blockblock
- block to setnotifyAndLight
- true to to notify and light- Returns:
- true if the block was successfully set (return value may not be accurate)
- Throws:
WorldEditException
-
setBlock
<B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException Similar toOutputExtent.setBlock(BlockVector3, BlockStateHolder)
but asideEffects
parameter indicates which side effects should be applied to the block. This includes block updates, lighting, and others. SeeSideEffect
for a full list.Not all implementations support all side effects. Use
Platform.getSupportedSideEffects()
for a list of supported side effects. Non-supported side effects will be ignored.- Parameters:
position
- position of the blockblock
- block to setsideEffects
- which side effects to perform- Returns:
- true if the block was successfully set (return value may not be accurate)
- Throws:
WorldEditException
-
notifyAndLightBlock
@Deprecated default boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException Deprecated.Notifies the simulation that the block at the given location has been changed and it must be re-lighted (and issue other events).- Parameters:
position
- position of the blockpreviousType
- the type of the previous block that was there- Returns:
- true if the block was successfully notified
- Throws:
WorldEditException
-
applySideEffects
Set<SideEffect> applySideEffects(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) throws WorldEditException Applies a set of side effects on the given block.- Parameters:
position
- position of the blockpreviousType
- the type of the previous block that was theresideEffectSet
- which side effects to perform- Returns:
- a set of side effects that were applied
- Throws:
WorldEditException
-
getBlockLightLevel
Get the light level at the given block.- Parameters:
position
- the position- Returns:
- the light level (0-15)
-
clearContainerBlockContents
Clear a chest's contents.- Parameters:
position
- the position- Returns:
- true if the container was cleared
-
dropItem
Drop an item at the given position.- Parameters:
position
- the positionitem
- the item to dropcount
- the number of individual stacks to drop (number of item entities)
-
dropItem
Drop one stack of the item at the given position.- Parameters:
position
- the positionitem
- the item to drop- See Also:
-
simulateBlockMine
Simulate a block being mined at the given position.- Parameters:
position
- the position
-
getBlockDrops
Return items that may drop by destroying this block.- Parameters:
position
- the position- Returns:
- Block drops
-
canPlaceAt
Gets whether the givenBlockState
can be placed here.- Parameters:
position
- The positionblockState
- The blockstate- Returns:
- If it can be placed
-
regenerate
Regenerate an area.- Parameters:
region
- the regioneditSession
- theEditSession
- Returns:
- true if re-generation was successful
-
regenerate
Regenerate an area.- Parameters:
region
- the regionextent
- theExtent
- Returns:
- true if re-generation was successful
-
regenerate
@NonAbstractForCompatibility(delegateName="regenerate", delegateParams={Region.class,EditSession.class}) default boolean regenerate(Region region, Extent extent, RegenOptions options) Regenerate an area.- Parameters:
region
- the regionextent
- theExtent
options
- the regeneration options- Returns:
- true if regeneration was successful
-
generateTree
boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException Generate a tree at the given position.- Parameters:
type
- the tree typeeditSession
- theEditSession
position
- the position- Returns:
- true if generation was successful
- Throws:
MaxChangedBlocksException
- thrown if too many blocks were changed
-
checkLoadedChunk
Load the chunk at the given position if it isn't loaded.- Parameters:
position
- the position
-
fixAfterFastMode
Fix the given chunks after fast mode was used.Fast mode makes calls to
setBlock(BlockVector3, BlockStateHolder, boolean)
withfalse
for thenotifyAndLight
parameter, which may causes lighting errors to accumulate. Use of this method, if it is implemented by the underlying world, corrects those lighting errors and may trigger block change notifications.- Parameters:
chunks
- a list of chunk coordinates to fix
-
fixLighting
Relight the given chunks if possible.- Parameters:
chunks
- a list of chunk coordinates to fix
-
playEffect
Play the given effect.- Parameters:
position
- the positiontype
- the effect typedata
- the effect data- Returns:
- true if the effect was played
-
queueBlockBreakEffect
boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority) Queue a block break effect.- Parameters:
server
- the serverposition
- the positionblockType
- the block typepriority
- the priority- Returns:
- true if the effect was played
-
getWeather
WeatherType getWeather()Gets the weather type of the world.- Returns:
- The weather
-
getRemainingWeatherDuration
long getRemainingWeatherDuration()Gets the remaining weather duration.- Returns:
- The weather duration
-
setWeather
Sets the weather type of the world.- Parameters:
weatherType
- The weather type
-
setWeather
Sets the weather type of the world.- Parameters:
weatherType
- The weather typeduration
- The duration of the weather
-
getSpawnPosition
BlockVector3 getSpawnPosition()Gets the spawn position of this world.- Returns:
- The spawn position
-
equals
-
hashCode
int hashCode() -
isWorld
default boolean isWorld() -
getId
Description copied from interface:Keyed
The id of this object in the registry. Must be unique, and lowercase. Certain registries (e.g Namespaced ones) may have additional restrictions. -
refreshChunk
void refreshChunk(int chunkX, int chunkZ) Refresh a specific chunk. Note: only 0 is guaranteed to send all tiles / entities Note: Only 65535 is guaranteed to send all blocks -
get
- Specified by:
get
in interfaceIChunkCache<IChunkGet>
-
sendFakeChunk
Send a fake chunk to a player.- Parameters:
player
- may be null to send to everyonepacket
- the chunk packet
-
getBiome
Description copied from interface:InputExtent
Get the biome at the given location.If there is no biome available, then the ocean biome should be returned.
As implementation varies per Minecraft version, this may not exactly get this positions biome. On versions prior to 1.15, this will get the entire column. On later versions it will get the 4x4x4 cube's biome.
- Specified by:
getBiome
in interfaceInputExtent
- Parameters:
position
- the (x, y, z) location to check the biome at- Returns:
- the biome at the location
- See Also:
-
setBiome
- Specified by:
setBiome
in interfaceOutputExtent
-
setBiome
Description copied from interface:OutputExtent
Set the biome.As implementation varies per Minecraft version, this may set more than this position's biome. On versions prior to 1.15, this will set the entire column. On later versions it will set the 4x4x4 cube.
- Specified by:
setBiome
in interfaceOutputExtent
- Parameters:
position
- the (x, y, z) location to set the biome atbiome
- the biome to set to- Returns:
- true if the biome was successfully set (return value may not be accurate)
-
flush
void flush()
-