Class WorldWrapper
- All Implemented Interfaces:
IChunkCache<IChunkGet>
,Trimable
,Extent
,InputExtent
,OutputExtent
,Keyed
,World
-
Method Summary
Modifier and TypeMethodDescriptionapplySideEffects
(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) Applies a set of side effects on the given block.void
Load the chunk at the given position if it isn't loaded.boolean
clearContainerBlockContents
(BlockVector3 position) Clear a chest's contents.commit()
Return anOperation
that should be called to tie up loose ends (such as to commit changes in a buffer).createEntity
(Location location, BaseEntity entity) Create an entity at the given location.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 pt, BaseItemStack item, int times) 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) getBiome
(BlockVector3 position) Get the biome at the given location.getBlock
(BlockVector3 position) Get a snapshot of the block at the given location.getBlockDrops
(BlockVector3 position) Return items that may drop by destroying this block.int
getBlockLightLevel
(BlockVector3 position) Get the light level at the given block.Get a list of all entities.getEntities
(Region region) Get a list of all entities within the given region.getFullBlock
(BlockVector3 position) Get an immutable snapshot of the block at the given location.Get the maximum point in the extent.int
getMaxY()
Get the maximum Y.Get the minimum point in the extent.int
getMinY()
Get the minimum Y.getName()
Get the name of the world.long
Gets the remaining weather duration.Gets the spawn position of this world.Gets the weather type of the world.int
hashCode()
boolean
notifyAndLightBlock
(BlockVector3 position, BlockState previousType) Notifies the simulation that the block at the given location has been changed and it must be re-lighted (and issue other events).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.boolean
regenerate
(Region region, EditSession session) Regenerate an area.boolean
regenerate
(Region region, Extent extent, RegenOptions options) Regenerate an area.void
sendFakeChunk
(Player player, ChunkPacket packet) Send a fake chunk to a player.boolean
boolean
setBiome
(BlockVector3 position, BiomeType biome) Set the biome.<T extends BlockStateHolder<T>>
booleansetBlock
(int x, int y, int z, T block) <B extends BlockStateHolder<B>>
booleansetBlock
(BlockVector3 position, B block, boolean notifyAndLight) 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.<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.boolean
setTile
(int x, int y, int z, CompoundTag tile) 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
Simulate a block being mined at the given position.static World
static World
boolean
useItem
(BlockVector3 position, BaseItem item, Direction face) Use the given item on the block at the given location on the given side.static WorldWrapper
Methods inherited from class com.sk89q.worldedit.world.AbstractWorld
getStoragePath, setBlock
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sk89q.worldedit.extent.Extent
addCaves, addOre, addOres, addPostProcessor, addProcessor, addSchems, apply, apply, cancel, center, contains, contains, countBlocks, countBlocks, disableHistory, disableQueue, enableHistory, enableQueue, generate, getBlockDistribution, getBlockDistributionWithData, getHighestTerrainBlock, getHighestTerrainBlock, 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, getBrightness, getBrightness, getEmittedLight, getEmittedLight, getFullBlock, getHeightMap, getOpacity, getOpacity, getSkyLight, getSkyLight
Methods inherited from interface com.sk89q.worldedit.extent.OutputExtent
fullySupports3DBiomes, setBiome, setBlockLight, setBlockLight, setHeightMap, setSkyLight, setSkyLight
Methods inherited from interface com.sk89q.worldedit.world.World
canPlaceAt, getId, isWorld, regenerate
-
Method Details
-
wrap
-
unwrap
-
unwrap
-
getParent
-
useItem
Description copied from interface:World
Use the given item on the block at the given location on the given side.- Specified by:
useItem
in interfaceWorld
- Overrides:
useItem
in classAbstractWorld
item
- The itemface
- The face- Returns:
- Whether it succeeded
-
getMaxY
public int getMaxY()Description copied from interface:World
Get the maximum Y. -
getMinY
public int getMinY()Description copied from interface:World
Get the minimum Y. -
createLiquidMask
Description copied from interface:World
Create a mask that matches all liquids.Implementations should override this so that custom liquids are supported.
- Specified by:
createLiquidMask
in interfaceWorld
- Overrides:
createLiquidMask
in classAbstractWorld
- Returns:
- a mask
-
dropItem
Description copied from interface:World
Drop an item at the given position.- Specified by:
dropItem
in interfaceWorld
- Overrides:
dropItem
in classAbstractWorld
- Parameters:
pt
- the positionitem
- the item to droptimes
- the number of individual stacks to drop (number of item entities)
-
checkLoadedChunk
Description copied from interface:World
Load the chunk at the given position if it isn't loaded.- Specified by:
checkLoadedChunk
in interfaceWorld
- Overrides:
checkLoadedChunk
in classAbstractWorld
- Parameters:
pt
- the position
-
fixAfterFastMode
Description copied from interface:World
Fix the given chunks after fast mode was used.Fast mode makes calls to
World.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.- Specified by:
fixAfterFastMode
in interfaceWorld
- Overrides:
fixAfterFastMode
in classAbstractWorld
- Parameters:
chunks
- a list of chunk coordinates to fix
-
fixLighting
Description copied from interface:World
Relight the given chunks if possible.- Specified by:
fixLighting
in interfaceWorld
- Overrides:
fixLighting
in classAbstractWorld
- Parameters:
chunks
- a list of chunk coordinates to fix
-
playEffect
Description copied from interface:World
Play the given effect.- Specified by:
playEffect
in interfaceWorld
- Overrides:
playEffect
in classAbstractWorld
- Parameters:
position
- the positiontype
- the effect typedata
- the effect data- Returns:
- true if the effect was played
-
queueBlockBreakEffect
public boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority) Description copied from interface:World
Queue a block break effect.- Specified by:
queueBlockBreakEffect
in interfaceWorld
- Overrides:
queueBlockBreakEffect
in classAbstractWorld
- Parameters:
server
- the serverposition
- the positionblockType
- the block typepriority
- the priority- Returns:
- true if the effect was played
-
getMinimumPoint
Description copied from interface:Extent
Get the minimum point in the extent.If the extent is unbounded, then a large (negative) value may be returned.
- Specified by:
getMinimumPoint
in interfaceExtent
- Overrides:
getMinimumPoint
in classAbstractWorld
- Returns:
- the minimum point
-
getMaximumPoint
Description copied from interface:Extent
Get the maximum point in the extent.If the extent is unbounded, then a large (positive) value may be returned.
- Specified by:
getMaximumPoint
in interfaceExtent
- Overrides:
getMaximumPoint
in classAbstractWorld
- Returns:
- the maximum point
-
commit
Description copied from interface:OutputExtent
Return anOperation
that should be called to tie up loose ends (such as to commit changes in a buffer).- Specified by:
commit
in interfaceExtent
- Specified by:
commit
in interfaceOutputExtent
- Overrides:
commit
in classAbstractWorld
- Returns:
- an operation or null if there is none to execute
-
getWeather
Description copied from interface:World
Gets the weather type of the world.- Specified by:
getWeather
in interfaceWorld
- Overrides:
getWeather
in classAbstractWorld
- Returns:
- The weather
-
getRemainingWeatherDuration
public long getRemainingWeatherDuration()Description copied from interface:World
Gets the remaining weather duration.- Specified by:
getRemainingWeatherDuration
in interfaceWorld
- Overrides:
getRemainingWeatherDuration
in classAbstractWorld
- Returns:
- The weather duration
-
setWeather
Description copied from interface:World
Sets the weather type of the world.- Specified by:
setWeather
in interfaceWorld
- Overrides:
setWeather
in classAbstractWorld
- Parameters:
weatherType
- The weather type
-
setWeather
Description copied from interface:World
Sets the weather type of the world.- Specified by:
setWeather
in interfaceWorld
- Overrides:
setWeather
in classAbstractWorld
- Parameters:
weatherType
- The weather typeduration
- The duration of the weather
-
setBlock
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException - Throws:
WorldEditException
-
setTile
- Throws:
WorldEditException
-
setBiome
-
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.
- 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)
-
getName
Description copied from interface:World
Get the name of the world.- Returns:
- a name for the world
-
setBlock
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException Description copied from interface:World
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
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException Description copied from interface:World
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
public boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException Description copied from interface:World
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
public Set<SideEffect> applySideEffects(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) throws WorldEditException Description copied from interface:World
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
Description copied from interface:World
Get the light level at the given block.- Parameters:
position
- the position- Returns:
- the light level (0-15)
-
clearContainerBlockContents
Description copied from interface:World
Clear a chest's contents.- Parameters:
position
- the position- Returns:
- true if the container was cleared
-
dropItem
Description copied from interface:World
Drop one stack of the item at the given position.- Parameters:
position
- the positionitem
- the item to drop- See Also:
-
simulateBlockMine
Description copied from interface:World
Simulate a block being mined at the given position.- Parameters:
pt
- the position
-
getBlockDrops
Description copied from interface:World
Return items that may drop by destroying this block.- Parameters:
position
- the position- Returns:
- Block drops
-
regenerate
Description copied from interface:World
Regenerate an area.- Parameters:
region
- the regionsession
- theEditSession
- Returns:
- true if re-generation was successful
-
regenerate
Description copied from interface:World
Regenerate an area.- Parameters:
region
- the regionextent
- theExtent
options
- the regeneration options- Returns:
- true if regeneration was successful
-
generateTree
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException Description copied from interface:World
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
-
getSpawnPosition
Description copied from interface:World
Gets the spawn position of this world.- Returns:
- The spawn position
-
refreshChunk
public void refreshChunk(int chunkX, int chunkZ) Description copied from interface:World
Refresh a specific chunk. Note: only 0 is guaranteed to send all tiles / entities Note: Only 65535 is guaranteed to send all blocks -
get
-
sendFakeChunk
Description copied from interface:World
Send a fake chunk to a player.- Parameters:
player
- may be null to send to everyonepacket
- the chunk packet
-
hashCode
public int hashCode() -
equals
-
getEntities
Description copied from interface:Extent
Get a list of all entities within the given region.If the extent is not wholly loaded (i.e. a world being simulated in the game will not have every chunk loaded), then this list may not be incomplete.
- Parameters:
region
- the region in which entities must be contained- Returns:
- a list of entities
-
getEntities
Description copied from interface:Extent
Get a list of all entities.If the extent is not wholly loaded (i.e. a world being simulated in the game will not have every chunk loaded), then this list may not be incomplete.
- Returns:
- a list of entities
-
createEntity
Description copied from interface:Extent
Create an entity at the given location.- Parameters:
location
- the locationentity
- the entity- Returns:
- a reference to the created entity, or null if the entity could not be created
-
getBlock
Description copied from interface:InputExtent
Get a snapshot of the block at the given location.If the given position is out of the bounds of the extent, then the behavior is undefined (an air block could be returned). However,
null
should not be returned.The returned block is immutable and is a snapshot of the block at the time of call. It has no position attached to it, so it could be reused in
Pattern
s and so on.- Parameters:
position
- position of the block- Returns:
- the block
-
getFullBlock
Description copied from interface:InputExtent
Get an immutable snapshot of the block at the given location.- Parameters:
position
- position of the block- Returns:
- the block
-
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.
- Parameters:
position
- the (x, y, z) location to check the biome at- Returns:
- the biome at the location
- See Also:
-
flush
public void flush()
-