public abstract class AbstractWorld extends java.lang.Object implements World
World
.Constructor and Description |
---|
AbstractWorld() |
Modifier and Type | Method and Description |
---|---|
void |
checkLoadedChunk(Vector 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(Vector pt,
BaseItemStack item,
int times)
Drop an item at the given position.
|
void |
fixAfterFastMode(java.lang.Iterable<BlockVector2D> chunks)
Fix the given chunks after fast mode was used.
|
void |
fixLighting(java.lang.Iterable<BlockVector2D> chunks)
Relight the given chunks if possible.
|
boolean |
generateBigTree(EditSession editSession,
Vector pt) |
boolean |
generateBirchTree(EditSession editSession,
Vector pt) |
boolean |
generateRedwoodTree(EditSession editSession,
Vector pt) |
boolean |
generateTallRedwoodTree(EditSession editSession,
Vector pt) |
boolean |
generateTree(EditSession editSession,
Vector pt) |
int |
getBlockData(Vector pt) |
int |
getBlockType(Vector pt) |
Vector |
getMaximumPoint()
Get the maximum point in the extent.
|
int |
getMaxY()
Get the maximum Y.
|
Vector |
getMinimumPoint()
Get the minimum point in the extent.
|
boolean |
isValidBlockType(int type)
Checks whether the given block ID is a valid block ID.
|
boolean |
playEffect(Vector position,
int type,
int data)
Play the given effect.
|
boolean |
queueBlockBreakEffect(Platform server,
Vector position,
int blockId,
double priority)
Queue a block break effect.
|
boolean |
setBlock(Vector pt,
BaseBlock block)
Change the block at the given location to the given block.
|
void |
setBlockData(Vector position,
int data) |
boolean |
setBlockType(Vector position,
int type) |
boolean |
setTypeIdAndData(Vector position,
int type,
int data) |
void |
simulateBlockMine(Vector pt)
Simulate a block being mined at the given position.
|
boolean |
usesBlockData(int type)
Checks whether the given block ID uses data values for differentiating
types of blocks.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearContainerBlockContents, dropItem, equals, generateTree, getBlockLightLevel, getName, getWorldData, hashCode, regenerate, setBlock
createEntity, getEntities, getEntities
getBiome, getBlock, getLazyBlock
setBiome
public final boolean setBlockType(Vector position, int type)
setBlockType
in interface World
public final void setBlockData(Vector position, int data)
setBlockData
in interface World
public final boolean setTypeIdAndData(Vector position, int type, int data)
setTypeIdAndData
in interface World
public final boolean setBlock(Vector pt, BaseBlock block) throws WorldEditException
OutputExtent
BaseBlock
to the world, so future changes to the
BaseBlock
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 int getMaxY()
World
public boolean isValidBlockType(int type)
World
isValidBlockType
in interface World
type
- the block IDpublic boolean usesBlockData(int type)
World
usesBlockData
in interface World
type
- the block IDpublic Mask createLiquidMask()
World
Implementations should override this so that custom liquids are supported.
createLiquidMask
in interface World
public int getBlockType(Vector pt)
getBlockType
in interface World
public int getBlockData(Vector pt)
getBlockData
in interface World
public void dropItem(Vector pt, BaseItemStack item, int times)
World
public void simulateBlockMine(Vector pt)
World
simulateBlockMine
in interface World
pt
- the positionpublic boolean generateTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException
generateTree
in interface World
MaxChangedBlocksException
public boolean generateBigTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException
generateBigTree
in interface World
MaxChangedBlocksException
public boolean generateBirchTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException
generateBirchTree
in interface World
MaxChangedBlocksException
public boolean generateRedwoodTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException
generateRedwoodTree
in interface World
MaxChangedBlocksException
public boolean generateTallRedwoodTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException
generateTallRedwoodTree
in interface World
MaxChangedBlocksException
public void checkLoadedChunk(Vector pt)
World
checkLoadedChunk
in interface World
pt
- the positionpublic void fixAfterFastMode(java.lang.Iterable<BlockVector2D> chunks)
World
Fast mode makes calls to World.setBlock(Vector, BaseBlock, 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<BlockVector2D> chunks)
World
fixLighting
in interface World
chunks
- a list of chunk coordinates to fixpublic boolean playEffect(Vector position, int type, int data)
World
playEffect
in interface World
position
- the positiontype
- the effect typedata
- the effect datapublic boolean queueBlockBreakEffect(Platform server, Vector position, int blockId, double priority)
World
queueBlockBreakEffect
in interface World
server
- the serverposition
- the positionblockId
- the block IDpriority
- the prioritypublic Vector getMinimumPoint()
Extent
If the extent is unbounded, then a large (negative) value may be returned.
getMinimumPoint
in interface Extent
public Vector 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