public interface World extends Extent, Keyed
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.
|
default boolean |
canPlaceAt(BlockVector3 position,
BlockState blockState)
Gets whether the given
BlockState can be placed here. |
void |
checkLoadedChunk(BlockVector3 position)
Load the chunk at the given position if it isn't loaded.
|
boolean |
clearContainerBlockContents(BlockVector3 position)
Clear a chest's contents.
|
Mask |
createLiquidMask()
Create a mask that matches all liquids.
|
void |
dropItem(Vector3 position,
BaseItemStack item)
Drop one stack of the item at the given position.
|
void |
dropItem(Vector3 position,
BaseItemStack item,
int count)
Drop an item at the given position.
|
boolean |
equals(java.lang.Object other) |
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.
|
boolean |
generateTree(TreeGenerator.TreeType type,
EditSession editSession,
BlockVector3 position)
Generate a tree at the given position.
|
int |
getBlockLightLevel(BlockVector3 position)
Get the light level at the given block.
|
int |
getMaxY()
Get the maximum Y.
|
int |
getMinY()
Get the minimum Y.
|
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.
|
java.nio.file.Path |
getStoragePath()
Get the folder in which this world is stored.
|
WeatherType |
getWeather()
Gets the weather type of the world.
|
int |
hashCode() |
default boolean |
notifyAndLightBlock(BlockVector3 position,
BlockState previousType)
Deprecated.
|
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.
|
default boolean |
regenerate(Region region,
EditSession editSession)
Regenerate an area.
|
default boolean |
regenerate(Region region,
Extent extent)
Regenerate an area.
|
default boolean |
regenerate(Region region,
Extent extent,
RegenOptions options)
Regenerate an area.
|
default <B extends BlockStateHolder<B>> |
setBlock(BlockVector3 position,
B block,
boolean notifyAndLight)
Deprecated.
|
<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.
|
boolean |
useItem(BlockVector3 position,
BaseItem item,
Direction face)
Use the given item on the block at the given location on the given side.
|
createEntity, getEntities, getEntities, getMaximumPoint, getMinimumPoint
getBiome, getBiome, getBlock, getFullBlock
commit, fullySupports3DBiomes, setBiome, setBiome, setBlock
java.lang.String getName()
@Nullable java.nio.file.Path getStoragePath()
int getMinY()
int getMaxY()
Mask createLiquidMask()
Implementations should override this so that custom liquids are supported.
boolean useItem(BlockVector3 position, BaseItem item, Direction face)
item
- The itemface
- The face@Deprecated default <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException
OutputExtent.setBlock(BlockVector3, 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
<B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException
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
@Deprecated default boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException
position
- position of the blockpreviousType
- the type of the previous block that was thereWorldEditException
java.util.Set<SideEffect> applySideEffects(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) throws WorldEditException
position
- position of the blockpreviousType
- the type of the previous block that was theresideEffectSet
- which side effects to performWorldEditException
int getBlockLightLevel(BlockVector3 position)
position
- the positionboolean clearContainerBlockContents(BlockVector3 position)
position
- the positionvoid dropItem(Vector3 position, BaseItemStack item, int count)
position
- the positionitem
- the item to dropcount
- the number of individual stacks to drop (number of item entities)void dropItem(Vector3 position, BaseItemStack item)
position
- the positionitem
- the item to dropshortcut method to specify the number of stacks
void simulateBlockMine(BlockVector3 position)
position
- the positiondefault boolean canPlaceAt(BlockVector3 position, BlockState blockState)
BlockState
can be placed here.position
- The positionblockState
- The blockstatedefault boolean regenerate(Region region, EditSession editSession)
region
- the regioneditSession
- the EditSession
default boolean regenerate(Region region, Extent extent)
region
- the regionextent
- the Extent
@NonAbstractForCompatibility(delegateName="regenerate", delegateParams={Region.class,EditSession.class}) default boolean regenerate(Region region, Extent extent, RegenOptions options)
region
- the regionextent
- the Extent
options
- the regeneration optionsNonAbstractForCompatibility
for detailsboolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException
type
- the tree typeeditSession
- the EditSession
position
- the positionMaxChangedBlocksException
- thrown if too many blocks were changedvoid checkLoadedChunk(BlockVector3 position)
position
- the positionvoid fixAfterFastMode(java.lang.Iterable<BlockVector2> chunks)
Fast mode makes calls to 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.
chunks
- a list of chunk coordinates to fixvoid fixLighting(java.lang.Iterable<BlockVector2> chunks)
chunks
- a list of chunk coordinates to fixboolean playEffect(Vector3 position, int type, int data)
position
- the positiontype
- the effect typedata
- the effect databoolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority)
server
- the serverposition
- the positionblockType
- the block typepriority
- the priorityWeatherType getWeather()
long getRemainingWeatherDuration()
void setWeather(WeatherType weatherType)
weatherType
- The weather typevoid setWeather(WeatherType weatherType, long duration)
weatherType
- The weather typeduration
- The duration of the weatherBlockVector3 getSpawnPosition()
boolean equals(java.lang.Object other)
equals
in class java.lang.Object
int hashCode()
hashCode
in class java.lang.Object