World
Index
Interfaces
Functions
- addGenerationCallback
- addListenerChunkStateChanged
- addLocalListenerChunkStateChanged
- addTileEntity
- canSeeSky
- canTileBeReplaced
- clip
- destroyBlock
- doesVanillaTileHasUI
- drop
- explode
- getBiome
- getBiomeMap
- getBiomeName
- getBiomeNameById
- getBlock
- getBlockData
- getBlockID
- getChunkState
- getChunkStateAt
- getContainer
- getGrassColor
- getGrassColorRGB
- getInverseBlockSide
- getLightLevel
- getRelativeCoords
- getSeed
- getTemperature
- getThreadTime
- getTileEntity
- getVectorByBlockSide
- getWeather
- getWorldDir
- getWorldTime
- isChunkLoaded
- isChunkLoadedAt
- isWorldLoaded
- nativeGetBlockData
- nativeGetBlockID
- nativeSetBlock
- playSound
- playSoundAtEntity
- registerBlockChangeCallback
- removeTileEntity
- setBiome
- setBiomeMap
- setBlock
- setBlockChangeCallbackEnabled
- setBlockUpdateAllowed
- setBlockUpdateType
- setDayMode
- setFullBlock
- setGrassColor
- setGrassColorRGB
- setLoaded
- setNightMode
- setWeather
- setWorldTime
Interfaces
ChunkStateChangedFunction
Parameters
chunkX: number
chunk X coordinate; multiply by 16 to receive corner block coordinates
chunkZ: number
chunk Z coordinate; multiply by 16 to receive corner block coordinates
dimensionId: number
current dimension's numeric ID
lastState: number
previous chunk loading state
state: number
new chunk loading state
discarded: boolean
was chunk previously loaded and unloaded from memory (only after generation was completed)
Returns void
Functions
addGenerationCallback
Adds a new generation callback using string hash to generate a unique random seed for the chunk generator.
Parameters
callbackName: string
one of the generation callbacks
callback: GenerateChunkFunction
callback function
optionaluniqueHashStr: string
if specified, will be used as string hash for seed generation, otherwise default hash string will be used
Returns void
addListenerChunkStateChanged
Listens for chunk loading state changes.
Parameters
listener: ChunkStateChangedFunction
chunk state function watcher
states: number[]
chunk states that should be received by watcher
Returns void
addLocalListenerChunkStateChanged
Listens for local chunk loading state changes.
Parameters
listener: ChunkStateChangedFunction
chunk state function watcher
states: number[]
chunk states that should be received by watcher
Returns void
addTileEntity
If the block on the specified coordinates is a TileEntity block and is not initialized, initializes it and returns created TileEntity object.
Parameters
x: number
y: number
z: number
optionalregion: BlockSource
Returns Nullable<TileEntity>
Tile if one was created,
null
otherwise.
canSeeSky
Parameters
x: number
y: number
z: number
Returns boolean
true
, if one can see sky from the specified position,false
otherwise.
canTileBeReplaced
Parameters
id: number
data: number
Returns boolean
true
, if tile can be replaced (for example, grass (not block) and water can be replaced),false
otherwise
clip
Parameters
x1: number
y1: number
z1: number
x2: number
y2: number
z2: number
optionalmode: number
certain modes also working with actors
Returns void
destroyBlock
Destroys block on the specified coordinates producing appropriate drop and particles. Do not use for massive tasks due to particles being produced.
Parameters
x: number
y: number
z: number
optionaldrop: boolean
whether to provide drop for the block or not
Returns void
doesVanillaTileHasUI
Parameters
id: number
Returns boolean
drop
Drops item or block with specified ID, count, data and extra on the specified coordinates. For blocks, be sure to use block ID, not the tile ID.
Parameters
x: number
y: number
z: number
id: number
count: number
data: number
optionalextra: ItemExtraData
Returns number
Spawned drop entity ID.
explode
Creates an explosion on the specified coordinates.
Parameters
x: number
y: number
z: number
power: number
defines how many blocks can the explosion destroy and what blocks can or cannot be destroyed
fire: boolean
if true, puts the crater on fire
Returns void
getBiome
Parameters
x: number
z: number
Returns number
Biome ID on the specified coordinates.
getBiomeMap
Gets biome on the specified coordinates when generating biome map. Should be called only in GenerateBiomeMap callback.
Parameters
x: number
block x coordinate
z: number
block z coordinate
Returns number
Biome's numeric ID.
getBiomeName
Parameters
x: number
z: number
Returns string
Biome name on the specified coordinates.
getBiomeNameById
Parameters
biome: number
Returns string
Biome name by specified identifier.
getBlock
Parameters
x: number
y: number
z: number
Returns Tile
Tile object containing tile ID and data of the block located. on the specified coordinates
getBlockData
Parameters
x: number
y: number
z: number
Returns number
Data of the block located on the specified coordinates.
getBlockID
Parameters
x: number
y: number
z: number
Returns number
Tile ID of the block located on the specified coordinates.
getChunkState
Returns chunk state on specified location, like loaded, unloaded or interrupted.
Parameters
x: number
z: number
Returns number
getChunkStateAt
Returns chunk state on specified coordinates, like loaded, unloaded or interrupted.
Parameters
x: number
y: number
z: number
Returns number
getContainer
Parameters
x: number
y: number
z: number
optionalregion: BlockSource
BlockSource *
Returns Nullable<NativeTileEntity | UI.Container | ItemContainer>
If the block on the specified coordinates is a TileEntity, returns
- it's container, if the block is a NativeTileEntity, returns it, if
- none of above, returns
null
.
getGrassColor
Parameters
x: number
z: number
Returns number
Grass color for specified coordinates, uses android integer color model.
getGrassColorRGB
Parameters
x: number
z: number
Returns Color
Grass color for specified coordinates, uses rgb color model.
getInverseBlockSide
Parameters
side: number
number from 0 to 6 (exclusive) *
Returns number
Opposite side to argument.
getLightLevel
Parameters
x: number
y: number
z: number
Returns number
Light level on the specified coordinates, from 0 to 15.
getRelativeCoords
Retrieves coordinates relative to the block.
Parameters
x: number
y: number
z: number
side: number
block side
Returns Vector
Relative coordinates.
getSeed
Returns number
Currently world seed, which is used, for example, in generation callbacks.
getTemperature
Parameters
x: number
y: number
z: number
Returns number
Biome temperature on specified coordinates.
getThreadTime
Returns number
Tick number since the player joined the world.
getTileEntity
Parameters
x: number
y: number
z: number
optionalregion: BlockSource
Returns Nullable<TileEntity>
Requested TileEntity located on the specified coordinates or
null
if it doesn't.
getVectorByBlockSide
Parameters
side: number
block side
Returns Vector
Normalized vector for this side.
getWeather
Returns Weather
Current weather object. This value should not be edited, call World.setWeather to change current weather.
getWorldDir
Returns string
Loaded world directory full path.
getWorldTime
Returns number
Current world's time in ticks.
isChunkLoaded
Parameters
x: number
chunk coordinate
z: number
chunk coordinate
Returns boolean
Whether the chunk with specified coordinates is loaded or not.
isChunkLoadedAt
Parameters
x: number
block coordinate
y: number
block coordinate
z: number
block coordinate
Returns boolean
Whether the chunk containing specified block coordinates is loaded or not.
isWorldLoaded
Returns boolean
Whether the world is loaded or not.
nativeGetBlockData
Parameters
x: number
y: number
z: number
Returns number
Data of the block located on the specified coordinates.
nativeGetBlockID
Parameters
x: number
y: number
z: number
Returns number
Tile ID of the block located on the specified coordinates.
nativeSetBlock
Sets block in the world using it's tile ID and data.
Parameters
x: number
y: number
z: number
id: number
block tile ID
data: number
block data
Returns void
playSound
Plays standart Minecraft sound on the specified coordinates.
Parameters
x: number
y: number
z: number
name: string
sound name
volume: number
sound volume from 0 to 1
optionalpitch: number
sound pitch, from 0 to 1, 0.5 is default value
Returns void
playSoundAtEntity
Plays standart Minecraft sound from the specified entity.
Parameters
entity: number
name: string
sound name
volume: number
sound volume from 0 to 1
optionalpitch: number
sound pitch, from 0 to 1, 0.5 is default value
Returns void
registerBlockChangeCallback
Enables "BlockChanged" event for specified block IDs and registers callback function for the IDs.
Parameters
ids: string | number | (string | number)[]
string or numeric tile ID, or an array of string and/or numeric tile IDs
callback: BlockChangedFunction
function that will be called when "BlockChanged" callback occurs involving one of the blocks. Warning! If both old and new blocks are in the IDs list, callback function will be called twice.
Returns void
removeTileEntity
If the block on the specified coordinates is a TileEntity, destroys it, dropping it's container.
Parameters
x: number
y: number
z: number
optionalregion: BlockSource
Returns boolean
true
if the tile was destroyed successfully,false
otherwise.
setBiome
Overrides currently biome on specified coordinates. Consider using World.setBiomeMap in GenerateBiomeMap callback.
Parameters
x: number
z: number
Returns void
setBiomeMap
Sets biome on the specified coordinates when generating biome map. Should be called only in GenerateBiomeMap callback.
Parameters
x: number
block x coordinate
z: number
block z coordinate
id: number
biome ID to be set on the specified coordinates
Returns void
setBlock
Sets block in the world using it's tile ID and data.
Parameters
x: number
y: number
z: number
id: number
block tile ID
data: number
block data
Returns void
setBlockChangeCallbackEnabled
Enables "BlockChanged" event for the block ID. Event occurs when either old block or new block is registered using this method.
Parameters
id: number
numeric tile ID
enabled: boolean
if true, the block will be watched
Returns void
setBlockUpdateAllowed
Parameters
allowed: boolean
Returns void
setBlockUpdateType
Parameters
type: number
Returns void
setDayMode
Sets current time to day or night.
Parameters
day: boolean
if true, sets time to 10000 (day), else to 13000 (night)
Returns void
setFullBlock
setGrassColor
Sets grass color on the specified coordinates, uses android-like integer color model.
Parameters
x: number
z: number
color: number
grass color to be set for the specified coordinates
Returns void
setGrassColorRGB
Sets grass color on the specified coordinates, uses rgb color model.
Parameters
x: number
z: number
rgb: Color
grass color to be set for the specified coordinates
Returns void
setLoaded
- internal
Setups the module to work properly with the world. Usually called by Core Engine, so you generally shouldn't call it yourself.
Parameters
isLoaded: boolean
whether the world is loaded or not
Returns boolean
setNightMode
Sets current time to day or night.
Parameters
night: boolean
if true, sets time to 13000 (night), else to 10000 (day)
Returns void
setWeather
setWorldTime
Sets current world time.
Parameters
time: number
time in ticks
Returns number
Module that allows to work with current Minecraft world. Most of the methods are client-side, use BlockSource instead.