Molang Registry Functions

Revision as of 04:22, 7 December 2025 by UnexpectedlySpicy (talk | contribs) (→‎World Functions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Registry ObjectValue Functions

Name Description Usage
is_in(tag: ResouceLocation): Double
Returns 1.0 if tag is in the registry, otherwise returns 0.0.
v.registry.is_in('#cobblemon:guilded_chest')
is_of(identifier: ResourceLocation): Double
Returns 1.0 if identifier is in the registry, otherwise returns 0.0.
v.registry.is_of('minecraft:dirt')

Biome Functions

Can use the Registry ObjectValue. Type is ObjectValue<Biome>.*

Name Description Usage
None :)

World Functions

Can use the Registry ObjectValue. Type is ObjectValue<Level>.*

Name Description Usage
is_time_of_day(timeOfDay: String): Double
Returns 1.0 if the provided String corresponds to a registered time range, such as day or night. Otherwise, will return 0.0.
q.world.is_time_of_day('morning')
game_time(): Double
Returns the game time in ticks.
q.world.game_time()
time_of_day(): Double
Returns the dayTime in ticks.
q.world.time_of_day()
server(): QueryStruct
Returns a Server object if on a server, otherwise returns 0.0.
q.world.server()
is_raining_at(x: Int, y: Int, z: Int): Double
Takes a block position and returns 1.0 if it is raining there, otherwise returns 0.0.
q.world.is_raining_at(0, 0, 0)
is_snowing_at(x: Int, y: Int, z: Int): Double
Takes a block position and returns 1.0 if it is snowing there, otherwise returns 0.0.
q.world.is_snowing_at(0, 0, 0)
is_chunk_loaded_at(x: Int, y: Int, z: Int): Double
Takes a block position and returns 1.0 if the chunk containing the block is loaded, otherwise returns 0.0.
q.world.is_chunk_loaded_at(0, 0, 0)
is_thundering(): Double
Returns 1.0 if the the world is thundering, otherwise returns 0.0.
q.world.is_thundering()
is_raining(): Double
Returns 1.0 if the the world is raining, otherwise returns 0.0.
q.world.is_raining()
set_block(x: Int, y: Int, z: Int, block: String): Double
Take a block position and set it to be a block. Returns 1.0 if the block was set successfully. Will return 0.0 and log the unknown string if it's an invalid block or already set to the specified block.
q.world.set_block(0, 0, 0, 'minecraft:dirt')
is_air(x: Double, y: Double, z: Double): Double
Takes a block position and returns 1.0 if the block state is air, otherwise returns 0.0.
q.world.is_air(0, 0, 0)
get_block(x: Int, y: Int, z: Int): ObjectValue<Block>
Gets the block at the location x, y, and z.
q.world.get_block(0, 0, 0)
spawn_explosion(x: Double, y: Double, z: Double, range: Double, interaction: String?): Double
Spawns an explosion at x, y, and z with range of range. interaction is a string of what kind of explosion it should be, such as block, mob, tnt, trigger, or none. Is tnt by default. Will return 1.0 if successful, otherwise returns 0.0.
q.world.spawn_explosion(0, 0, 0, 3)
spawn_lightning(x: Double, y: Double, z: Double): Double
Spawns a lightning bolt at the location x, y, and z. Returns 1.0.
q.world.spawn_lightning(0, 0, 0)
spawn_bedrock_particles(particle: String, x: Double, y: Double, z: Double, player: MoValue?): Double
Spawns bedrock particles at the location x, y, and z. When run on the server, if a player value is specified (either a player object or a UUID) then only the player specified will receive the packet, otherwise all nearby players will receive it. If run on a client then it will play the animation for only that player, ignoring the player value, returning 0.0 if the particle is not in the registry. Will return 1.0 if ran successfully, otherwise will return 0.0.
q.world.spawn_bedrock_particles('cobblemon:cherry_leaves_particle', 0, 0, 0)
spawn_pokemon(x: Int, y: Int, z: Int, properties: String): MoValue
Takes a block position and spawns a Pokémon at the given position with the provided properties String. Returns an ObjectValue<PokemonEntity> of the spawned Pokémon. Returns 0.0 if the spawn was not successful.
q.world.spawn_pokemon(0, 0, 0, 'bidoof lvl=100')
spawn_npc(x: Double, y: Double, z: Double, npcClass: String, level: Int): MoValue
Takes a block position and spawns an NPC at that position with the provided npcClass and NPC level. The NPC level is utilized for party pool customization. Returns an ObjectValue<NPCEntity> of the spawned NPC. Returns 0.0 if the spawn was not successful.
q.world.spawn_npc(0, 0, 0, 'sacchi', 1)
play_sound_on_server(sound: String, soundSource: String, x: Double, y: Double, z: Double, player: MoValue?, volume: Double?, pitch: Double?): Double
Plays the given sound on the soundSource track at x, y, and z. If a player value is specified (either a player object or a UUID) then only the player will receive the packet, otherwise all nearby players will receive it. Giving volume or pitch will change their respective values, but will each default to 1.0 if no value is provided. Will return 1.0 if the sound was played successfully, otherwise will return 0.0.
q.world.play_sound_on_server('cobblemon:pokemon.bidoof.cry', 'master', 0, 0, 0)
get_entities_around(x: Double, y: Double, z: Double, range: Double): ArrayStruct<MoValue>
Returns a list of entities within range of x, y, and z. This list contains the most specific MoValue for an entity, either Player, PokemonEntity, NPCEntity, or a regular Entity.
q.world.get_entities_around(0, 0, 0, 10)
is_healer_in_use(position: ArrayStruct<MoValue>): Double
Takes a block position as an ArrayStruct<MoValue> and checks the healing machine at the stated position. Returns 0.0 if a healer exists and it is not being utilized. Otherwise, returns 1.0 if no healer is found or if it is in use.
q.world.is_healer_in_use(q.array(0, 0, 0))

Dimension Functions

Can use the Registry ObjectValue. Type is ObjectValue<Dimension>.*

Name Description Usage
None :)

Block Functions

Can use the Registry ObjectValue. Type is ObjectValue<Block>.*

Name Description Usage
None :)

Footnote: *Technically the type is ObjectValue<Holder<*>>, but for the purposes of this documentation Holder has been omitted.