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 |
---|---|
java.util.Set<SideEffect> |
applySideEffects(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.
|
Entity |
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 |
fullySupports3DBiomes()
Check if this extent fully supports 3D biomes.
|
boolean |
generateTree(TreeGenerator.TreeType type,
EditSession editSession,
BlockVector3 position)
Generate a tree at the given position.
|
BiomeType |
getBiome(BlockVector3 position)
Get the biome at the given location.
|
BlockState |
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.
|
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(BlockVector3 position)
Get a immutable snapshot of the block at the given location.
|
java.lang.String |
getId()
The id of this object in the registry.
|
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.
|
BlockVector3 |
getSpawnPosition()
Gets the spawn position of this world.
|
WeatherType |
getWeather()
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>> |
setBlock(BlockVector3 position,
B block,
SideEffectSet sideEffects)
Similar to
OutputExtent.setBlock(BlockVector3, BlockStateHolder) but a
sideEffects 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.
|
checkLoadedChunk, commit, createLiquidMask, dropItem, fixAfterFastMode, fixLighting, getMaximumPoint, getMaxY, getMinimumPoint, getMinY, getStoragePath, playEffect, queueBlockBreakEffect, setBlock, useItem
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canPlaceAt, equals, hashCode, notifyAndLightBlock, regenerate, regenerate, setBlock
getBiome
setBiome
public java.lang.String getName()
World
public java.lang.String getId()
Keyed
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException
World
OutputExtent.setBlock(BlockVector3, BlockStateHolder)
but a
sideEffects
parameter indicates which side effects should be applied
to the block. This includes block updates, lighting, and others. See SideEffect
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.
position
- position of the blockblock
- block to setsideEffects
- which side effects to performWorldEditException
public java.util.Set<SideEffect> applySideEffects(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) throws WorldEditException
World
position
- position of the blockpreviousType
- the type of the previous block that was theresideEffectSet
- which side effects to performWorldEditException
public int getBlockLightLevel(BlockVector3 position)
World
position
- the positionpublic boolean clearContainerBlockContents(BlockVector3 position)
World
position
- the positionpublic boolean fullySupports3DBiomes()
OutputExtent
If false
, the extent only visually reads biomes from y = 0
.
The biomes will still be set in 3D, but the client will only see the one at
y = 0
. It is up to the caller to determine if they want to set that
biome instead, or simply warn the actor.
public BiomeType getBiome(BlockVector3 position)
InputExtent
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.
position
- the (x, y, z) location to check the biome atpublic boolean setBiome(BlockVector3 position, BiomeType biome)
OutputExtent
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.
position
- the (x, y, z) location to set the biome atbiome
- the biome to set topublic void dropItem(Vector3 position, BaseItemStack item)
World
position
- the positionitem
- the item to dropshortcut method to specify the number of stacks
public void simulateBlockMine(BlockVector3 position)
World
position
- the positionpublic boolean regenerate(Region region, Extent extent, RegenOptions options)
World
region
- the regionextent
- the Extent
options
- the regeneration optionspublic boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException
World
type
- the tree typeeditSession
- the EditSession
position
- the positionMaxChangedBlocksException
- thrown if too many blocks were changedpublic WeatherType getWeather()
World
getWeather
in interface World
getWeather
in class AbstractWorld
public long getRemainingWeatherDuration()
World
getRemainingWeatherDuration
in interface World
getRemainingWeatherDuration
in class AbstractWorld
public void setWeather(WeatherType weatherType)
World
setWeather
in interface World
setWeather
in class AbstractWorld
weatherType
- The weather typepublic void setWeather(WeatherType weatherType, long duration)
World
setWeather
in interface World
setWeather
in class AbstractWorld
weatherType
- The weather typeduration
- The duration of the weatherpublic BlockVector3 getSpawnPosition()
World
public BlockState getBlock(BlockVector3 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(BlockVector3 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()