public class NullWorld extends AbstractWorld
World
that drops all changes and
returns dummy data.Modifier | Constructor and Description |
---|---|
protected |
NullWorld() |
Modifier and Type | Method and Description |
---|---|
boolean |
clearContainerBlockContents(Vector position)
Clear a chest's contents.
|
Entity |
createEntity(Location location,
BaseEntity entity)
Create an entity at the given location.
|
void |
dropItem(Vector position,
BaseItemStack item)
Drop one stack of the item at the given position.
|
boolean |
generateTree(TreeGenerator.TreeType type,
EditSession editSession,
Vector position)
Generate a tree at the given position.
|
BaseBiome |
getBiome(Vector2D position)
Get the biome at the given location.
|
BlockState |
getBlock(Vector position)
Get a snapshot of the block at the given location.
|
int |
getBlockLightLevel(Vector position)
Get the light level at the given block.
|
java.util.List<Entity> |
getEntities()
Get a list of all entities.
|
java.util.List<Entity> |
getEntities(Region region)
Get a list of all entities within the given region.
|
BaseBlock |
getFullBlock(Vector position)
Get a immutable snapshot of the block at the given location.
|
static NullWorld |
getInstance()
Return an instance of this null world.
|
java.lang.String |
getName()
Get the name of the world.
|
long |
getRemainingWeatherDuration()
Gets the remaining weather duration.
|
WeatherType |
getWeather()
Gets the weather type of the world.
|
boolean |
regenerate(Region region,
EditSession editSession)
Regenerate an area.
|
boolean |
setBiome(Vector2D position,
BaseBiome biome)
Set the biome.
|
boolean |
setBlock(Vector position,
BlockStateHolder block,
boolean notifyAndLight)
Similar to
OutputExtent.setBlock(Vector, BlockStateHolder) but a
notifyAndLight parameter indicates whether adjacent blocks
should be notified that changes have been made and lighting operations
should be executed. |
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(Vector position)
Simulate a block being mined at the given position.
|
checkLoadedChunk, commit, createLiquidMask, dropItem, fixAfterFastMode, fixLighting, getMaximumPoint, getMaxY, getMinimumPoint, playEffect, queueBlockBreakEffect, setBlock, useItem
public java.lang.String getName()
World
public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException
World
OutputExtent.setBlock(Vector, BlockStateHolder)
but a
notifyAndLight
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.
position
- position of the blockblock
- block to setnotifyAndLight
- true to to notify and lightWorldEditException
public int getBlockLightLevel(Vector position)
World
position
- the positionpublic boolean clearContainerBlockContents(Vector position)
World
position
- the positionpublic BaseBiome getBiome(Vector2D position)
InputExtent
If there is no biome available, then the ocean biome should be returned.
position
- the (x, z) location to check the biome atpublic boolean setBiome(Vector2D position, BaseBiome biome)
OutputExtent
position
- the (x, z) location to set the biome atbiome
- the biome to set topublic void dropItem(Vector position, BaseItemStack item)
World
position
- the positionitem
- the item to dropshortcut method to specify the number of stacks
public void simulateBlockMine(Vector position)
World
position
- the positionpublic boolean regenerate(Region region, EditSession editSession)
World
region
- the regioneditSession
- the EditSession
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException
World
type
- the tree typeeditSession
- the EditSession
position
- the positionMaxChangedBlocksException
- thrown if too many blocks were changedpublic WeatherType getWeather()
World
public long getRemainingWeatherDuration()
World
public void setWeather(WeatherType weatherType)
World
weatherType
- The weather typepublic void setWeather(WeatherType weatherType, long duration)
World
weatherType
- The weather typeduration
- The duration of the weatherpublic BlockState getBlock(Vector position)
InputExtent
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.
position
- position of the blockpublic BaseBlock getFullBlock(Vector position)
InputExtent
position
- position of the blockpublic java.util.List<Entity> getEntities(Region region)
Extent
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.
region
- the region in which entities must be containedpublic java.util.List<Entity> getEntities()
Extent
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.
@Nullable public Entity createEntity(Location location, BaseEntity entity)
Extent
location
- the locationentity
- the entitypublic static NullWorld getInstance()