Class NullWorld
- All Implemented Interfaces:
Extent
,InputExtent
,OutputExtent
,Keyed
,World
World
that drops all changes and
returns dummy data.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapplySideEffects
(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) Applies a set of side effects on the given block.boolean
clearContainerBlockContents
(BlockVector3 position) Clear a chest's contents.createEntity
(Location location, BaseEntity entity) Create an entity at the given location.void
dropItem
(Vector3 position, BaseItemStack item) Drop one stack of the item at the given position.boolean
Check if this extent fully supports 3D biomes.boolean
generateTree
(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) Generate a tree at the given position.getBiome
(BlockVector3 position) Get the biome at the given location.getBlock
(BlockVector3 position) Get a snapshot of the block at the given location.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 a immutable snapshot of the block at the given location.getId()
The id of this object in the registry.static NullWorld
Return an instance of this null world.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.boolean
regenerate
(Region region, Extent extent, RegenOptions options) Regenerate an area.boolean
setBiome
(BlockVector3 position, BiomeType biome) Set the biome.<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.Methods inherited from class com.sk89q.worldedit.world.AbstractWorld
checkLoadedChunk, commit, createLiquidMask, dropItem, fixAfterFastMode, fixLighting, getMaximumPoint, getMaxY, getMinimumPoint, getMinY, getStoragePath, playEffect, queueBlockBreakEffect, setBlock, useItem
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.InputExtent
getBiome
Methods inherited from interface com.sk89q.worldedit.extent.OutputExtent
setBiome
Methods inherited from interface com.sk89q.worldedit.world.World
canPlaceAt, equals, hashCode, notifyAndLightBlock, regenerate, regenerate, setBlock
-
Constructor Details
-
NullWorld
protected NullWorld()
-
-
Method Details
-
getName
Description copied from interface:World
Get the name of the world.- Returns:
- a name for the world
-
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.- Returns:
- an id
-
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
-
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
-
fullySupports3DBiomes
public boolean fullySupports3DBiomes()Description copied from interface:OutputExtent
Check if this extent fully supports 3D biomes.If
false
, the extent only visually reads biomes fromy = 0
. The biomes will still be set in 3D, but the client will only see the one aty = 0
. It is up to the caller to determine if they want to set that biome instead, or simply warn the actor.- Returns:
- if the extent fully supports 3D biomes
-
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
-
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)
-
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:
position
- the position
-
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
-
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
-
getSpawnPosition
Description copied from interface:World
Gets the spawn position of this world.- Returns:
- The spawn position
-
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 a immutable snapshot of the block at the given location.- Parameters:
position
- position of the block- Returns:
- the block
-
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
-
getInstance
Return an instance of this null world.- Returns:
- a null world
-