Link Search Menu Expand Document

Molang

Table of contents
  1. Molang
  2. query.armor_texture_slot
    1. X
    2. Y
    3. Example
  3. query.armor_material_slot
    1. X
    2. Y
  4. query.armor_color_slot
    1. Slot
    2. Channel
    3. Color
  5. query.is_ghost
  6. query.is_grazing
  7. query.is_jumping
  8. query.modified_move_speed
  9. query.on_fire_time
  10. query.structural_integrity
  11. variable.attack_time
    1. Explanation
    2. For entities
    3. For the Player
  12. query.is_roaring

The bedrock documentation for Molang is notoriously bad. This page will attempt to remedy this by providing additional details for individual queries, where possible. This page is intended to be searched, not read in full. Use the side-bar, or use ctrl-f to navigate.

query.armor_texture_slot

Formatted like: query.armor_texture_slot(x) = y.

Where x and y are both integer arguments, from the following table:

X

Argument Slot
0 Helmet
1 Chestplace
2 Leggings
3 Boots

Y

Argument Type
-1 none
0 Chain armor piece
1 Iron armor piece
2 Diamond armor piece
3 Boots of any type
4 Gold armor piece
5 Elytra
6 Turtle helmet
7 Netherite armor piece

Example

query.armor_texture_slot(3) == 1: queries for Iron Boots.

query.armor_material_slot

Formatted like: query.armor_material_slot(x) = y.

Where x and y are both integer arguments, from the following table:

X

Argument Slot
0 Helmet
1 Chestplace
2 Leggings
3 Boots

Y

Unknown, possibly:

Argument Slot
0 Default armor material
1 Enchanted armor material
2 Leather armor material
3 Leather enchanted material

query.armor_color_slot

Notice: As of version 1.16.100.51, this query is crashing minecraft. It might be fixed in later versions.

Formatted like: color = query.armor_color_slot(slot, channel).

Where slot and channel are both integer arguments, from the following tables:

Slot

Argument Slot
0 Helmet
1 Chestplace
2 Leggings
3 Boots

Channel

Argument Slot
0 Red channel
1 Green channel
2 Blue channel
3 Alpha channel

Color

Query returns color value in specified channel.

query.is_ghost

Formatted like: is_ghost = query.is_ghost.

Return 1.0 or 0.0 based on whether the entity is a ghost.

Currently, only returns 1.0 for a guardian ghost and is used by its renderer.

query.is_grazing

Formatted like: is_grazing = query.is_grazing.

Return 1.0 or 0.0 based on whether the entity is eating a block.

Currently, only returns 1.0 for a sheep and entities using runtime identifier of a sheep.

query.is_jumping

Formatted like: is_jumping = query.is_jumping.

Return 1.0 or 0.0 based on whether the entity is jumping.

For the player, conditions for its activation are:

  • the jump button is pressed (includes being in water and climbing a scaffolding)
  • OR auto-jump is triggered
  • OR swimming with auto-jump

query.modified_move_speed

Formatted like: modified_move_speed = query.modified_move_speed.

Returns the current walk speed of the entity modified by status flags such as is_baby or on_fire

Value example:

  • Player is walking: around 0.86
  • Player is sprinting: 1.0
  • Player is sprinting and jumping: 0.35
  • Player is walking on fire: 1.0
  • Player is sprinting on fire: 1.0
  • Player is sprinting and jumping on fire: 0.525

query.on_fire_time

Formatted like: on_fire_time = query.on_fire_time.

Returns the time in ticks since the entity started or stopped being on fire, else it returns 0.0

Value example:

  • Entity is summoned: value is 0
  • Entity is ignited: value is 0 and starts counting up 1 every tick
  • Entity is on fire for 2 seconds already: value is 40 and still counts up 1 every tick
  • Entity stops being on fire: value resets to 0 and continues to count up 1 every tick despite not being on fire
  • Entity is ignited second time: value resets to 0 and continues counting up 1 every tick
  • Entity stops being on fire the second time: value resets to 0 and continues to count up 1 every tick despite not being on fire

Basically it’s tick timer that starts after entity is first ignited and resets every time it changes from/to being on fire.

query.structural_integrity

Formatted like: structural_integrity = query.structural_integrity.

Used by boats and minecrafts for destroying it. It will decrease when attacking the entity and will recover with time. Probably unusable by anything other than boats and minecrafts.

variable.attack_time

Explanation

This variable is setup as IF it was a query. In other words, it can be used on any entity, both on the client and server, regardless of whether you setup/define the variable correctly.

For entities

The variable tracks when the entity is swinging to attack. When not attacking, it will return 0.0, when attacking it will range from 0.0 to the total attack time, which may be around 0.3 or something similar. For players, this value ranges from 0.0 to 1.0. The variable returns a percentage, in the form of a decimal, for how far into the attack the entity is. For example, if an entity is halfway into its attack swing, then the variable will return 0.5. It increments linearly.

For the Player

For the player, the variable will track whenever the arm bones are swinging, this includes:

  • placing blocks
  • placing entities
  • interacting (when swing is enabled)
  • melee attack

query.is_roaring

Evaluates to true when a knockback_roar attack is happening.