public abstract class AbstractWorld extends java.lang.Object implements World
World
.Constructor and Description |
---|
AbstractWorld() |
Modifier and Type | Method and Description |
---|---|
void |
checkLoadedChunk(BlockVector3 pt)
Load the chunk at the given position if it isn't loaded.
|
Operation |
commit()
Return an
Operation that should be called to tie up loose ends
(such as to commit changes in a buffer). |
Mask |
createLiquidMask()
Create a mask that matches all liquids.
|
void |
dropItem(Vector3 pt,
BaseItemStack item,
int times)
Drop an item at the given position.
|
void |
fixAfterFastMode(java.lang.Iterable<BlockVector2> chunks)
Fix the given chunks after fast mode was used.
|
void |
fixLighting(java.lang.Iterable<BlockVector2> chunks)
Relight the given chunks if possible.
|
BlockVector3 |
getMaximumPoint()
Get the maximum point in the extent.
|
int |
getMaxY()
Get the maximum Y.
|
BlockVector3 |
getMinimumPoint()
Get the minimum point in the extent.
|
int |
getMinY()
Get the minimum Y.
|
long |
getRemainingWeatherDuration()
Gets the remaining weather duration.
|
java.nio.file.Path |
getStoragePath()
Get the folder in which this world is stored.
|
WeatherType |
getWeather()
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.
|
<B extends BlockStateHolder<B>> |
setBlock(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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applySideEffects, canPlaceAt, clearContainerBlockContents, dropItem, equals, generateTree, getBlockLightLevel, getName, getSpawnPosition, hashCode, notifyAndLightBlock, regenerate, regenerate, regenerate, setBlock, setBlock, simulateBlockMine
createEntity, getEntities, getEntities
getBiome, getBiome, getBlock, getFullBlock
fullySupports3DBiomes, setBiome, setBiome
public boolean useItem(BlockVector3 position, BaseItem item, Direction face)
World
public final <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 pt, B block) throws WorldEditException
OutputExtent
BlockStateHolder
to the world, so future changes to the
BlockStateHolder
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.
setBlock
in interface OutputExtent
pt
- position of the blockblock
- block to setWorldEditException
- thrown on an errorpublic java.nio.file.Path getStoragePath()
World
getStoragePath
in interface World
public int getMinY()
World
public int getMaxY()
World
public Mask createLiquidMask()
World
Implementations should override this so that custom liquids are supported.
createLiquidMask
in interface World
public void dropItem(Vector3 pt, BaseItemStack item, int times)
World
public void checkLoadedChunk(BlockVector3 pt)
World
checkLoadedChunk
in interface World
pt
- the positionpublic void fixAfterFastMode(java.lang.Iterable<BlockVector2> chunks)
World
Fast mode makes calls to World.setBlock(BlockVector3, BlockStateHolder, boolean)
with false
for the notifyAndLight
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.
fixAfterFastMode
in interface World
chunks
- a list of chunk coordinates to fixpublic void fixLighting(java.lang.Iterable<BlockVector2> chunks)
World
fixLighting
in interface World
chunks
- a list of chunk coordinates to fixpublic boolean playEffect(Vector3 position, int type, int data)
World
playEffect
in interface World
position
- the positiontype
- the effect typedata
- the effect datapublic boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority)
World
queueBlockBreakEffect
in interface World
server
- the serverposition
- the positionblockType
- the block typepriority
- the prioritypublic BlockVector3 getMinimumPoint()
Extent
If the extent is unbounded, then a large (negative) value may be returned.
getMinimumPoint
in interface Extent
public BlockVector3 getMaximumPoint()
Extent
If the extent is unbounded, then a large (positive) value may be returned.
getMaximumPoint
in interface Extent
@Nullable public Operation commit()
OutputExtent
Operation
that should be called to tie up loose ends
(such as to commit changes in a buffer).commit
in interface OutputExtent
public WeatherType getWeather()
World
getWeather
in interface World
public long getRemainingWeatherDuration()
World
getRemainingWeatherDuration
in interface World
public void setWeather(WeatherType weatherType)
World
setWeather
in interface World
weatherType
- The weather typepublic void setWeather(WeatherType weatherType, long duration)
World
setWeather
in interface World
weatherType
- The weather typeduration
- The duration of the weather