Class AbstractWorld
- All Implemented Interfaces:
Extent
,InputExtent
,OutputExtent
,Keyed
,World
- Direct Known Subclasses:
NullWorld
World
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Load the chunk at the given position if it isn't loaded.commit()
Return anOperation
that should be called to tie up loose ends (such as to commit changes in a buffer).Create a mask that matches all liquids.void
dropItem
(Vector3 pt, BaseItemStack item, int times) Drop an item at the given position.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.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.long
Gets the remaining weather duration.Get the folder in which this world is stored.Gets the weather type of the world.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.final <B extends BlockStateHolder<B>>
booleansetBlock
(BlockVector3 pt, B block) Change the block at the given location to the given 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.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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sk89q.worldedit.extent.Extent
createEntity, getEntities, getEntities
Methods inherited from interface com.sk89q.worldedit.extent.InputExtent
getBiome, getBiome, getBlock, getFullBlock
Methods inherited from interface com.sk89q.worldedit.extent.OutputExtent
fullySupports3DBiomes, setBiome, setBiome
Methods inherited from interface com.sk89q.worldedit.world.World
applySideEffects, canPlaceAt, clearContainerBlockContents, dropItem, equals, generateTree, getBlockLightLevel, getName, getSpawnPosition, hashCode, notifyAndLightBlock, regenerate, regenerate, regenerate, setBlock, setBlock, simulateBlockMine
-
Constructor Details
-
AbstractWorld
public AbstractWorld()
-
-
Method Details
-
useItem
Description copied from interface:World
Use the given item on the block at the given location on the given side. -
setBlock
public final <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 pt, B block) throws WorldEditException Description copied from interface:OutputExtent
Change the block at the given location to the given block. The operation may not tie the givenBlockStateHolder
to the world, so future changes to theBlockStateHolder
do not affect the world until this method is called again.The return value of this method indicates whether the change was probably successful. It may not be successful if, for example, the location is out of the bounds of the extent. It may be unsuccessful if the block passed is the same as the one in the world. However, the return value is only an estimation and it may be incorrect, but it could be used to count, for example, the approximate number of changes.
- Specified by:
setBlock
in interfaceOutputExtent
- Parameters:
pt
- position of the blockblock
- block to set- Returns:
- true if the block was successfully set (return value may not be accurate)
- Throws:
WorldEditException
- thrown on an error
-
getStoragePath
Description copied from interface:World
Get the folder in which this world is stored. May return null if unknown or if this world is not serialized to disk.- Specified by:
getStoragePath
in interfaceWorld
- Returns:
- world storage path
-
getMinY
public int getMinY()Description copied from interface:World
Get the minimum Y. -
getMaxY
public int getMaxY()Description copied from interface:World
Get the maximum 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
- Returns:
- a mask
-
dropItem
Description copied from interface:World
Drop an item at the given position. -
checkLoadedChunk
Description copied from interface:World
Load the chunk at the given position if it isn't loaded.- Specified by:
checkLoadedChunk
in interfaceWorld
- 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
- 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
- Parameters:
chunks
- a list of chunk coordinates to fix
-
playEffect
Description copied from interface:World
Play the given effect.- Specified by:
playEffect
in interfaceWorld
- 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
- 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
- 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
- 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 interfaceOutputExtent
- 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
- Returns:
- The weather
-
getRemainingWeatherDuration
public long getRemainingWeatherDuration()Description copied from interface:World
Gets the remaining weather duration.- Specified by:
getRemainingWeatherDuration
in interfaceWorld
- Returns:
- The weather duration
-
setWeather
Description copied from interface:World
Sets the weather type of the world.- Specified by:
setWeather
in interfaceWorld
- Parameters:
weatherType
- The weather type
-
setWeather
Description copied from interface:World
Sets the weather type of the world.- Specified by:
setWeather
in interfaceWorld
- Parameters:
weatherType
- The weather typeduration
- The duration of the weather
-