WorldRegion
Index
Constructors
Properties
Methods
- addTileEntity
- breakBlock
- breakBlockForResult
- canSeeSky
- destroyBlock
- dropAtBlock
- dropItem
- explode
- getBiome
- getBiomeTemperatureAt
- getBlock
- getBlockData
- getBlockId
- getChunkState
- getChunkStateAt
- getContainer
- getDimension
- getExtraBlock
- getGrassColor
- getLightLevel
- getNativeTileEntity
- getTileEntity
- isChunkLoaded
- isChunkLoadedAt
- listEntitiesInAABB
- playSound
- playSoundAtEntity
- removeTileEntity
- sendPacketInRadius
- setBiome
- setBlock
- setExtraBlock
- spawnEntity
- spawnExpOrbs
- getCurrentWorldGenRegion
- getForActor
- getForDimension
Constructors
constructor
Parameters
blockSource: BlockSource
Returns WorldRegion
Properties
readonlyblockSource
privatereadonlyisDeprecated
Methods
addTileEntity
If the block on the specified coordinates is a TileEntity block and is not initialized, initializes it and returns created TileEntity object.
Parameters
coords: Vector
Returns TileEntity
TileEntity if one was created, null otherwise.
breakBlock
Destroys block on coords by entity using specified item. Partially reverse compatible with Legacy version (doesn't support
item
argument).Parameters
coords: Vector
coords of the block
allowDrop: boolean
whether to provide drop for the block or not
entity: number
Entity id or -1 id if entity is not specified
item: ItemInstance
Tool which broke block
Returns void
breakBlockForResult
Same as breakBlock, but returns object containing drop and experince. Partially reverse compatible with Legacy version (doesn't return experience).
Parameters
coords: Vector
coords of the block
entity: number
Entity id or -1 id if entity is not specified
item: ItemInstance
Tool which broke block
Returns { experience: number; items: ItemInstance[] }
experience: number
items: ItemInstance[]
canSeeSky
Parameters
coords: Vector
Returns boolean
whether the sky can be seen from coords
destroyBlock
Destroys block on coords producing appropriate drop and particles.
Parameters
coords: Vector
coords of the block
optionaldrop: boolean
whether to provide drop for the block or not
optionalplayer: number
player entity if the block was destroyed by player
Returns void
dropAtBlock
Creates dropped item at the block center and returns entity id
Parameters
coords: Vector
coords of the block where item will be dropped
item: ItemInstance
item to drop
Returns number
drop entity id
dropItem
Creates dropped item and returns entity id
Parameters
coords: Vector
coords of the place where item will be dropped
item: ItemInstance
item to drop
Returns number
drop entity id
explode
Causes an explosion on coords.
Parameters
coords: Vector
power: number
defines radius of the explosion and what blocks it can destroy
optionalfire: boolean
if true, puts the crater on fire
Returns void
getBiome
Parameters
x: number
z: number
Returns number
biome id at X and Z coord.
getBiomeTemperatureAt
Parameters
coords: Vector
Returns number
temperature of the biome on coords.
getBlock
Parameters
coords: Vector
Returns BlockState
BlockState object of the block at coords
getBlockData
Parameters
coords: Vector
Returns number
block's data at coords.
getBlockId
Parameters
coords: Vector
Returns number
block's id at coords.
getChunkState
Parameters
chunkX: number
X coord of the chunk
chunkZ: number
Z coord of the chunk
Returns number
the loading state of the chunk by chunk coords.
getChunkStateAt
Parameters
x: number
X coord of the position
z: number
Z coord of the position
Returns number
the loading state of the chunk by coords.
getContainer
Parameters
coords: Vector
Returns any
if the block on the specified coordinates is a
TileEntity
, returns its container, if the block is aNativeTileEntity
, returns its instance, if none of above, returns null.
getDimension
Returns number
the dimension id to which the following object belongs.
getExtraBlock
Doesn't support Legacy version.
Parameters
coords: Vector
Returns BlockState
[[BlockState]] object of the extra block on given coords
getGrassColor
Parameters
coords: Vector
Returns number
grass color on coords
getLightLevel
Parameters
coords: Vector
Returns number
light level on the specified coordinates, from 0 to 15.
getNativeTileEntity
Parameters
coords: Vector
Returns NativeTileEntity
interface to the vanilla TileEntity (chest, furnace, etc.) on the coords.
getTileEntity
Parameters
coords: Vector
Returns TileEntity
TileEntity located on the specified coordinates if it is initialized.
isChunkLoaded
Parameters
chunkX: number
X coord of the chunk
chunkZ: number
Z coord of the chunk
Returns boolean
true if chunk is loaded, false otherwise.
isChunkLoadedAt
Parameters
x: number
X coord of the position
z: number
Z coord of the position
Returns boolean
true if chunk on the position is loaded, false otherwise.
listEntitiesInAABB
Parameters
pos1: Vector
pos2: Vector
optionaltype: number
optionalblacklist: boolean
Returns number[]
the list of entity IDs in given box, that are equal to the given type, if blacklist value is false, and all except the entities of the given type, if blacklist value is true.
playSound
Plays standard Minecraft sound on the specified coordinates.
Parameters
x: number
y: number
z: number
name: string
sound name
optionalvolume: number
sound volume from 0 to 1. Default is 1.
optionalpitch: number
sound pitch, from 0 to 1. Default is 1.
Returns void
playSoundAtEntity
Plays standard Minecraft sound from the specified entity.
Parameters
ent: number
entity id
name: string
sound name
optionalvolume: number
sound volume from 0 to 1. Default is 1.
optionalpitch: number
sound pitch, from 0 to 1. Default is 1.
Returns void
removeTileEntity
If the block on the specified coordinates is a TileEntity, destroys it, dropping its container.
Parameters
coords: Vector
Returns boolean
true if the TileEntity was destroyed successfully, false otherwise.
sendPacketInRadius
Sends network packet for players within a radius from specified coords.
Parameters
coords: Vector
coordinates from which players will be searched
radius: number
radius within which players will receive packet
packetName: string
name of the packet to send
data: object
packet data object
Returns void
setBiome
Sets biome id by coords.
Parameters
x: number
z: number
biomeID: number
id of the biome to set
Returns void
setBlock
Sets block on coords.
Parameters
coords: Vector
state: any
Returns void
setExtraBlock
Sets extra block (for example, water inside another blocks) on given coords by given id and data. Doesn't support Legacy version.
Parameters
coords: Vector
state: BlockState
Returns void
spawnEntity
Spawns entity of given type on coords.
Parameters
x: number
y: number
z: number
type: string | number
entity numeric or string type
Returns number
spawnExpOrbs
Spawns experience orbs on coords.
Parameters
coords: Vector
amount: number
experience amount
Returns void
staticgetCurrentWorldGenRegion
Returns Nullable<WorldRegion>
WorldRegion
for world generation callback.
staticgetForActor
Parameters
entityUid: number
Returns Nullable<WorldRegion>
interface to the dimension where the given entity is (null if given entity does not exist or the dimension is not loaded and interface was not created).
staticgetForDimension
Parameters
dimension: number
Returns Nullable<WorldRegion>
interface to given dimension (null if given dimension is not loaded and this interface was not created yet).
Class to work with world based on
BlockSource