1. Wiki
  2. /Molang
  3. /Molang queries and functions

Molang queries and functions

Molang is the small expression language of Bedrock add-ons, used in animations, render controllers and many components. query.* reads the game state, math.* calculates.

Queries

318 / 318

Query
query.above_top_solidGives the height just above the topmost solid block at a given x and z, handy for placing things on the surface.
query.actor_countGives how many entities were drawn in the last frame.
query.allChecks if every value after the first one equals the first one: 1 if they all match, 0 if not.
query.all_animations_finishedIn an animation controller, gives 1 once every animation in the current state has played at least one full time.
query.all_tagsGives 1 if the item or block has every tag you list.
query.anger_levelGives how angry the entity is (the Warden uses this), or 0 if it has no anger level. Works in behavior packs only.
query.anim_timeGives how many seconds have passed since the current animation started.
query.anyChecks if at least one value after the first one equals the first one: 1 if so, 0 if not.
query.any_animation_finishedIn an animation controller, gives 1 once any animation in the current state has played at least one full time.
query.any_tagGives 1 if the item or block has at least one of the tags you list.
query.approx_eqGives 1 if all the numbers are almost exactly the same, useful for comparing decimals safely.
query.armor_color_slotGives the dye color of the armor in a slot: 0 head, 1 chest, 2 legs, 3 feet, 4 body.
query.armor_damage_slotGives how damaged the armor in a slot is: 0 head, 1 chest, 2 legs, 3 feet, 4 body. Works best on players.
query.armor_material_slotGives the material type of the armor in a slot: 0 head, 1 chest, 2 legs, 3 feet.
query.armor_texture_slotGives the texture type of the armor in a slot: 0 head, 1 chest, 2 legs, 3 feet, 4 body.
query.average_frame_timeGives the average time of one frame in seconds; pass a number to average over that many past frames.
query.base_swing_durationGives how long the mob's attack swing lasts with its held item, ignoring effects like Haste.
query.block_faceGives which face of a block was used, during events like placing or interacting: 0 down, 1 up, 2 north, 3 south, 4 west, 5 east.
query.block_has_all_tagsTakes a world position (x, y, z) and tags, and gives 1 if the block there has all of them.
query.block_has_any_tagTakes a world position (x, y, z) and tags, and gives 1 if the block there has at least one of them.
query.block_neighbor_has_all_tagsTakes an offset from the current block (x, y, z) and tags, and gives 1 if that nearby block has all of them.
query.block_neighbor_has_any_tagTakes an offset from the current block (x, y, z) and tags, and gives 1 if that nearby block has at least one of them.
query.block_propertyOlder name for query.block_state: gives the value of one of the block's states.
query.block_stateGives the current value of one of the block's states, for example q.block_state('my:open').
query.blockingGives 1 while the entity is blocking, like holding up a shield.
query.body_x_rotationGives the up and down tilt (pitch) of the entity's body.
query.body_y_rotationGives the left and right turn (yaw) of the entity's body.
query.bone_aabbGives the box around a bone, with .min and .max corners that each have x, y and z.
query.bone_orientation_matrixGives the full orientation of a named bone as a matrix, for advanced math.
query.bone_orientation_trsGives a named bone's position, rotation and scale as separate parts.
query.bone_originGives the starting pivot of a bone from its geometry file, as x, y and z.
query.bone_rotationGives the starting rotation of a bone from its geometry file, as x, y and z in degrees.
query.camera_distance_range_lerpTakes two distances and gives 0 to 1 depending on where the camera is between them, great for fading things with distance.
query.camera_rotationGives the camera's rotation on one axis: pass 0 for x (up and down) or 1 for y (left and right).
query.can_climbGives 1 if the entity is able to climb.
query.can_damage_nearby_mobsGives 1 if the entity is able to hurt mobs near it.
query.can_dashGives 1 if the entity is able to dash, like a camel.
query.can_flyGives 1 if the entity is able to fly.
query.can_power_jumpGives 1 if the entity is able to do a charged jump, like a horse.
query.can_swimGives 1 if the entity is able to swim.
query.can_walkGives 1 if the entity is able to walk.
query.cape_flap_amountGives how far the player's cape is lifted, from 0 (hanging down) to 1 (fully up).
query.cardinal_block_face_placed_onOld version of query.block_face for when a player places a block; use query.block_face instead.
query.cardinal_facingGives which way the player is facing: 0 down, 1 up, 2 north, 3 south, 4 west, 5 east.
query.cardinal_facing_2dGives which way the player is facing, ignoring up and down: 2 north, 3 south, 4 west, 5 east.
query.cardinal_player_facingGives which way the player is facing: 0 down, 1 up, 2 north, 3 south, 4 west, 5 east.
query.client_max_render_distanceGives the player's maximum render distance in chunks. Works in resource packs only.
query.client_memory_tierGives how much memory the device has, from 0 (very low) to 4 (very high). Use it to turn off heavy effects on weak devices.
query.combine_entitiesJoins entity references into one list, dropping duplicates and invalid ones. The order is not kept.
query.cooldown_timeGives the full cooldown in seconds of the item in an equipment slot, using the same slot names as /replaceitem.
query.cooldown_time_remainingGives how many seconds are left on a cooldown, by cooldown type or by equipment slot.
query.countCounts what you pass in: a list counts as its number of items, anything else counts as 1.
query.current_squish_valueGives how squished the entity is, used for slime bounces.
query.dash_cooldown_progressOld way to read a dash cooldown; no longer works after 1.20.40.
query.dayGives which day number the world is on.
query.death_ticksGives how many ticks have passed since the mob started dying, useful for death animations.
query.debug_outputPrints a value to the debug log in builds that have one, for testing your expressions.
query.delta_timeGives the seconds since the last frame, useful for smooth movement that does not depend on frame rate.
query.distance_from_cameraGives how far the entity or particle emitter is from the camera.
query.effect_emitter_countGives how many emitters of this particle effect are active right now.
query.effect_particle_countGives how many particles of this particle effect are alive right now.
query.entity_biome_has_all_tagsGives 1 if the biome the entity stands in has all the tags you list. Works in resource packs only.
query.entity_biome_has_any_identifierGives 1 if the biome the entity stands in matches any of the biome IDs you list. Works in resource packs only.
query.entity_biome_has_any_tagsGives 1 if the biome the entity stands in has at least one of the tags you list. Works in resource packs only.
query.equipment_countGives how many armor pieces the entity wears, from 0 to 5. Held items are not counted.
query.equipped_item_all_tagsTakes a slot name and tags, and gives 1 if the item in that slot has all of them.
query.equipped_item_any_tagTakes a slot name and tags, and gives 1 if the item in that slot has at least one of them.
query.equipped_item_is_attachableGives 1 if the item in a hand is an attachable: pass 0 or 'main_hand', 1 or 'off_hand'.
query.eye_target_x_rotationGives the up and down rotation of the entity's eyes, if it has any.
query.eye_target_y_rotationGives the left and right rotation of the entity's eyes, if it has any.
query.facing_target_to_range_attackGives 1 while the entity is doing a ranged attack, like a skeleton aiming.
query.frame_alphaGives how far this frame is between two game ticks, from 0 to 1, for smoothing motion.
query.fuse_timeGives how much fuse time is left before the entity explodes, or -1 if it cannot explode.
query.get_actor_info_idGives the number ID of an entity type from its name.
query.get_animation_frameGives which texture frame the item is showing right now.
query.get_default_bone_pivotGives one axis of a bone's default pivot point: pass the bone name and an axis.
query.get_equipped_item_nameOld way to get the held item's name; prefer query.is_item_name_any so renames do not break your pack.
query.get_level_seed_based_fractionGives a number from 0 to 1 that depends on the world seed, so it stays the same in one world.
query.get_locator_offsetGives one axis of a locator's offset: pass the locator name and an axis.
query.get_nameOld way to get the mob's name tag; prefer query.is_name_any so renames do not break your pack.
query.get_pack_settingGives the value of a pack settings slider by its name. Works in resource packs only.
query.get_root_locator_offsetGives one axis of a locator's offset on the root model: pass the locator name and an axis.
query.graphics_mode_is_anyGives 1 if the player's graphics mode is one you list: 'simple', 'fancy', 'deferred' or 'raytraced'. Works in resource packs only.
query.ground_speedGives how fast the entity moves along the ground, in blocks per second.
query.had_component_groupOnly for entity property defaults: gives 1 if the entity was saved with the named component group, handy when upgrading old entities.
query.has_all_biome_tagsGives 1 if the biome where something is being placed has all the tags you list.
query.has_any_biome_tagsGives 1 if the biome where something is being placed has at least one of the tags you list.
query.has_any_familyGives 1 if the entity belongs to any of the families you list, like 'monster'.
query.has_any_leashed_entity_of_typeGives 1 if the entity is holding a lead attached to an entity of a type you list.
query.has_armor_slotGives 1 if the entity wears armor in a slot: 0 head, 1 chest, 2 legs, 3 feet.
query.has_biome_tagGives 1 if the biome has the tag; pass just the tag, or the tag plus x and z, or x, y and z.
query.has_block_propertyOlder name for query.has_block_state.
query.has_block_stateGives 1 if the block has the named state at all.
query.has_capeGives 1 if the player has a cape.
query.has_collisionGives 1 if the entity bumps into things (collision is on).
query.has_dash_cooldownGives 1 while the entity is waiting before it can dash again.
query.has_gravityGives 1 if the entity falls because of gravity.
query.has_head_gearGives 1 if the entity wears something in its head slot.
query.has_ownerGives 1 if the entity has an owner, like a tamed wolf.
query.has_player_riderGives 1 if a player rides the entity in any seat.
query.has_propertyGives 1 if the entity has a property with the given name.
query.has_riderGives 1 if anything rides the entity.
query.has_targetGives 1 if the entity has a target, like a mob it is chasing.
query.head_is_in_waterGives 1 if the entity's head is underwater.
query.head_roll_angleGives the sideways tilt (roll) of the entity's head.
query.head_x_rotationGives the up and down rotation of a head; pass which head (0 for the first).
query.head_y_rotationGives the left and right rotation of a head; pass which head. Horse-like mobs also need a maximum angle in degrees.
query.healthGives the entity's current health.
query.heartbeat_intervalGives how many seconds are between heartbeats (the Warden has one), or 0 with no heartbeat.
query.heartbeat_phaseGives how far through the current heartbeat the entity is, from 0 to 1. Works in resource packs only.
query.heightmapGives the height of the ground surface at a given x and z.
query.hurt_directionGives the direction the entity was last hit from, or 0.
query.hurt_timeGives how long the entity's hurt effect still lasts, or 0 when it is not hurt.
query.in_rangeTakes a value, a minimum and a maximum, and gives 1 if the value is between them (both ends count).
query.invulnerable_ticksGives how many ticks the entity still cannot take damage, like after it was just hit.
query.is_admiringGives 1 while the entity is admiring an item, like a piglin looking at gold.
query.is_aliveGives 1 while the entity is alive and 0 once it is dead.
query.is_angryGives 1 while the entity is angry.
query.is_attachedGives 1 if the entity is attached to another one, like being held or worn. Works in resource packs only.
query.is_attached_to_entityGives 1 if the entity is attached to another entity.
query.is_avoiding_blockGives 1 while the entity is running away from a block.
query.is_avoiding_mobsGives 1 while the entity is running away from mobs.
query.is_babyGives 1 if the entity is a baby, often used to make the head bigger or play baby animations.
query.is_breathingGives 1 while the entity is breathing.
query.is_bribedGives 1 if the entity has been bribed, like a dolphin fed fish.
query.is_carrying_blockGives 1 while the entity carries a block, like an enderman.
query.is_castingGives 1 while the entity is casting a spell, like an evoker.
query.is_celebratingGives 1 while the entity is celebrating, like villagers after a raid.
query.is_celebrating_specialGives 1 while the entity does its special celebration, like a piglin dancing.
query.is_chargedGives 1 while the entity's charged flag is on; the blaze uses it while getting ready to shoot.
query.is_chargingGives 1 while the entity is charging up, like a ghast before it shoots.
query.is_chestedGives 1 if the entity has a chest on it, like a donkey or llama.
query.is_cooldown_categoryGives 1 if the item in a slot uses the named cooldown category: pass the category, the slot name and, if needed, the slot number.
query.is_crawlingGives 1 while the entity is crawling.
query.is_criticalGives 1 while the entity's critical flag is on.
query.is_croakingGives 1 while the entity is croaking, like a frog.
query.is_dancingGives 1 while the entity is dancing, like an allay or parrot near music.
query.is_delayed_attackingGives 1 while the entity does a delayed attack, like a ravager's bite.
query.is_diggingGives 1 while the entity is digging, like a sniffer or a warden going underground.
query.is_eatingGives 1 while the entity is eating.
query.is_eating_mobGives 1 while the entity is eating a mob, like a frog with its tongue.
query.is_elderGives 1 if the entity is the elder version, like an elder guardian.
query.is_emergingGives 1 while the entity is coming out of the ground, like a warden.
query.is_emotingGives 1 while the player is doing an emote.
query.is_enchantedGives 1 if the entity has the enchanted glint flag.
query.is_feeling_happyOld query for a timer flag; it stopped working after 1.20.40.
query.is_fire_immuneGives 1 if fire and lava do not hurt the entity.
query.is_first_personGives 1 when the entity is drawn in first person view, handy for hiding parts of a held item model.
query.is_ghostGives 1 if the entity is a ghost, like the guardian image shown by mining fatigue.
query.is_glidingGives 1 while the entity is gliding, like with an elytra.
query.is_grazingGives 1 while the entity is eating grass, like a sheep or horse.
query.is_idlingGives 1 while the entity is idle.
query.is_ignitedGives 1 while the entity is lit and about to explode, like a creeper.
query.is_illager_captainGives 1 if the entity is an illager captain (carries the banner).
query.is_in_contact_with_waterGives 1 if the entity touches any water: water blocks, rain or splash water bottles.
query.is_in_lavaGives 1 while the entity is in lava.
query.is_in_loveGives 1 while the entity is in love mode and ready to breed.
query.is_in_uiGives 1 when the entity is drawn in a menu, like the inventory player preview.
query.is_in_waterGives 1 while the entity is in water.
query.is_in_water_or_rainGives 1 while the entity is in water or standing in rain.
query.is_interestedGives 1 while the entity looks interested, like a wolf tilting its head at food.
query.is_invisibleGives 1 while the entity is invisible.
query.is_item_equippedGives 1 if there is an item in a hand: pass 0 or 'main_hand', 1 or 'off_hand' (main hand if left out).
query.is_item_name_anyTakes a slot name, a slot number if the slot needs one, then item IDs, and gives 1 if the item in that slot is one of them.
query.is_jump_goal_jumpingGives 1 while the entity does a goal-driven jump, like a frog or breeze leaping.
query.is_jumpingGives 1 while the entity is jumping.
query.is_laying_downGives 1 while the entity is lying down.
query.is_laying_eggGives 1 while the entity is laying an egg, like a turtle.
query.is_leashedGives 1 while the entity is tied with a lead.
query.is_levitatingGives 1 while the entity is levitating.
query.is_lingeringGives 1 while the entity's lingering flag is on.
query.is_local_playerGives 1 if the entity is the player using this screen, useful for effects only you should see. Always 0 in behavior packs.
query.is_movingGives 1 while the entity is moving.
query.is_name_anyGives 1 if the entity's name tag is one of the names you list.
query.is_on_fireGives 1 while the entity is burning.
query.is_on_groundGives 1 while the entity stands on the ground.
query.is_onfireSame as query.is_on_fire: gives 1 while the entity is burning.
query.is_orphanedGives 1 while the entity's orphaned flag is on.
query.is_owner_identifier_anyGives 1 if the main (root) entity's type ID is one of the IDs you list.
query.is_pack_setting_enabledGives 1 if the pack settings toggle with this name is turned on. Works in resource packs only.
query.is_pack_setting_selectedGives 1 if a pack settings dropdown (first value) has the option you name (second value) chosen. Works in resource packs only.
query.is_persona_or_premium_skinGives 1 if the player uses a character creator or Marketplace skin.
query.is_playing_deadGives 1 while the entity is playing dead, like an axolotl.
query.is_poweredGives 1 if the entity is powered, like a creeper struck by lightning.
query.is_pregnantGives 1 while the entity is pregnant.
query.is_ram_attackingGives 1 while the entity is ramming, like a goat.
query.is_restingGives 1 while the entity is resting, like a bat hanging upside down.
query.is_ridingGives 1 while the entity rides something.
query.is_riding_any_entity_of_typeGives 1 if the entity rides an entity of a type you list.
query.is_risingOld query for a timer flag; it stopped working after 1.20.40.
query.is_roaringGives 1 while the entity is roaring, like a ravager or warden.
query.is_rollingGives 1 while the entity is rolling.
query.is_saddledGives 1 if the entity has a saddle on.
query.is_scaredGives 1 while the entity is scared, like a panda during a storm.
query.is_scentingOld query for a timer flag; it stopped working after 1.20.40.
query.is_searchingGives 1 while the entity is searching, like a sniffer looking for seeds.
query.is_selected_itemGives 1 if the player has an item selected in the inventory.
query.is_shakingGives 1 while the entity is shaking, like a strider out of lava.
query.is_shaking_wetnessGives 1 while the entity shakes water off, like a wet wolf.
query.is_shearedGives 1 if the entity can be sheared and already has been.
query.is_shield_poweredGives 1 while the entity's shield is active, like the wither's armor at half health.
query.is_silentGives 1 if the entity makes no sounds.
query.is_sittingGives 1 while the entity is sitting.
query.is_sleepingGives 1 while the entity is sleeping.
query.is_sneakingGives 1 while the entity is sneaking.
query.is_sneezingGives 1 while the entity is sneezing, like a baby panda.
query.is_sniffingGives 1 while the entity is sniffing, like a sniffer or warden.
query.is_sonic_boomGives 1 while the entity fires its sonic boom, like a warden.
query.is_spectatorGives 1 if the player is in spectator mode.
query.is_sprintingGives 1 while the entity is sprinting.
query.is_stackableGives 1 while the entity's stackable flag is on.
query.is_stalkingGives 1 while the entity sneaks up on prey, like a fox.
query.is_standingGives 1 while the entity rears up on its back legs, like a horse.
query.is_stunnedGives 1 while the entity is stunned, like a ravager after its attack is blocked.
query.is_swimmingGives 1 while the entity is swimming.
query.is_tamedGives 1 if the entity is tamed.
query.is_transformingGives 1 while the entity is changing into something else, like a zombie villager being cured.
query.is_using_itemGives 1 while the entity uses an item, like drawing a bow or eating.
query.is_wall_climbingGives 1 while the entity climbs a wall, like a spider.
query.item_in_use_durationGives how many seconds the current item has been used for, like how long a bow is drawn.
query.item_is_chargedGives 1 if the item in a hand is charged, like a loaded crossbow: pass 0 or 'main_hand', 1 or 'off_hand'.
query.item_max_use_durationGives the longest time the item can be used for, like the full draw time of a bow.
query.item_remaining_use_durationGives how much use time is left on the item in 'main_hand' or 'off_hand'; pass a second number to scale the result.
query.item_slot_to_bone_nameTakes an equipment slot name and gives the name of the bone that slot is attached to on this entity.
query.key_frame_lerp_timeGives how far the animation is between the previous and next keyframe, from 0 to 1.
query.kinetic_weapon_damage_durationGives the max_duration of damage_conditions from the held item's minecraft:kinetic_weapon component, or 0 without one.
query.kinetic_weapon_delayGives the delay from the held item's minecraft:kinetic_weapon component, or 0 without one.
query.kinetic_weapon_dismount_durationGives the max_duration of dismount_conditions from the held item's minecraft:kinetic_weapon component, or 0 without one.
query.kinetic_weapon_knockback_durationGives the max_duration of knockback_conditions from the held item's minecraft:kinetic_weapon component, or 0 without one.
query.last_frame_timeGives how long the last frame took in seconds; pass a number to look that many frames back.
query.last_hit_by_playerGives 1 if a player was the last one to hit the entity. Always 0 in resource packs.
query.last_input_mode_is_anyGives 1 if the player last used one of the input types you list: 'keyboard_and_mouse', 'touch' or 'gamepad'. Works in resource packs only.
query.leashed_entity_countGives how many entities this entity is holding on leads.
query.lie_amountGives how far the entity has lain down, for smooth lying animations.
query.life_spanGives how long the entity is allowed to live, or 0 if it lives forever.
query.life_timeGives a time in seconds counted from when the current animation started.
query.lod_indexTakes a list of distances and gives which band the entity is in from the camera (0 for the closest), useful for simpler models far away.
query.logWrites a value to the content log, for checking what your expression gives.
query.main_hand_item_max_durationGives the longest time the main hand item can be used for.
query.main_hand_item_use_durationGives how long the main hand item has been used for.
query.mark_variantGives the number set by the entity's minecraft:mark_variant component, often used to pick a pattern texture.
query.max_durabilityGives the most durability the item can have.
query.max_healthGives the entity's maximum health.
query.max_trade_tierGives the highest trade level the entity can reach, like a villager's top tier.
query.maximum_frame_timeGives the slowest frame time in seconds; pass a number to check that many past frames.
query.minimum_frame_timeGives the fastest frame time in seconds; pass a number to check that many past frames.
query.model_scaleGives the current size scale of the entity.
query.modified_distance_movedGives how far the entity has walked sideways since it was loaded, adjusted for things like being a baby. Walk cycles often use it.
query.modified_move_speedGives the entity's current walk speed, adjusted for things like being a baby. Walk animations often use it.
query.modified_swing_durationGives how long the mob's attack swing lasts with its held item, including effects like Haste.
query.moon_brightnessGives how bright the moon is, from 0 at new moon to 1 at full moon.
query.moon_phaseGives the moon phase from 0 to 7, where 0 is full moon and 4 is new moon.
query.movement_directionGives which way the entity is moving on one axis (0 x, 1 y, 2 z), as a value from -1 to 1.
query.noiseGives a smooth random noise value for a given x and z, handy for natural looking variation.
query.on_fire_timeGives how long the entity has been burning.
query.out_of_controlGives 1 while the entity is out of control, like a boat with no one steering.
query.overlay_alphaOld query that is being removed; do not use it.
query.owner_identifierOld way to get the main entity's type ID; prefer query.is_owner_identifier_any.
query.player_levelGives the player's experience level, or 0 for other entities.
query.positionGives the entity's position in the world on one axis: 0 x, 1 y, 2 z.
query.position_deltaGives how far the entity moved since the last tick on one axis: 0 x, 1 y, 2 z.
query.previous_squish_valueGives the squish value from the tick before, used to smooth slime bounces.
query.propertyGives the value of an entity property by its name, like q.property('my:mode').
query.relative_block_has_all_tagsTakes an offset from the entity (x, y, z) and tags, and gives 1 if the block there has all of them.
query.relative_block_has_any_tagTakes an offset from the entity (x, y, z) and tags, and gives 1 if the block there has at least one of them.
query.remaining_durabilityGives how much durability the item has left.
query.ride_body_x_rotationGives the up and down tilt of the body of the entity being ridden.
query.ride_body_y_rotationGives the left and right turn of the body of the entity being ridden.
query.ride_head_x_rotationGives the up and down rotation of the head of the entity being ridden.
query.ride_head_y_rotationGives the left and right rotation of the head of the entity being ridden; horse-like mounts take a maximum angle.
query.rider_body_x_rotationGives the up and down tilt of the body of the rider in the given seat.
query.rider_body_y_rotationGives the left and right turn of the body of the rider in the given seat.
query.rider_head_x_rotationGives the up and down head rotation of the rider in the given seat.
query.rider_head_y_rotationGives the left and right head rotation of the rider in the given seat; horse-like mounts also take a maximum angle.
query.roll_counterGives the entity's roll counter, used for the panda's rolling.
query.rotation_to_cameraGives the rotation needed to face the camera on one axis (0 for x, 1 for y), great for parts that always look at you.
query.scoreboardGives this entity's score in the named scoreboard objective. Works in behavior packs only.
query.server_memory_tierGives how much memory the server has, from 0 (very low) to 4 (very high). Works in behavior packs only.
query.shake_angleGives the angle of the entity's shake, like a wet wolf.
query.shake_timeGives how long the entity has been shaking.
query.shield_blocking_bobGives how far the off hand shield should dip down when it blocks a hit.
query.show_bottomGives 1 if the entity's bottom part should be drawn, like the base of an end crystal.
query.sit_amountGives how far the entity has sat down, for smooth sitting animations.
query.skin_idGives the number set by the entity's minecraft:skin_id component, often used to pick a texture.
query.sleep_rotationGives the direction of the bed the player is sleeping in.
query.sneeze_counterGives the entity's sneeze counter, used for the baby panda's sneeze.
query.spellcolorGives the entity's spell color with .r, .g, .b and .a parts from 0 to 1.
query.standing_scaleGives how far the entity has stood up on its back legs, like a polar bear.
query.state_timeIn an animation controller, gives how many seconds the controller has been in its current state.
query.structural_integrityGives the entity's structural integrity value, or 0.
query.surface_particle_colorGives the particle color of the ground block under the entity (up to 10 blocks down), with .r, .g, .b and .a parts.
query.surface_particle_texture_coordinateGives the texture spot (u and v) used for particles of the ground block under the entity. Works in resource packs only.
query.surface_particle_texture_sizeGives the texture size used for particles of the ground block under the entity. Works in resource packs only.
query.swell_amountGives how swollen the entity is before exploding; only the creeper and wither use it.
query.swelling_dirGives whether the entity is swelling up or shrinking back, like a creeper.
query.swim_amountGives how much the entity is in its swimming pose, from 0 to 1.
query.tail_angleGives the angle of the entity's tail, like a wolf's tail dropping as it gets hurt.
query.target_x_rotationGives the up and down rotation needed to look at the entity's target.
query.target_y_rotationGives the left and right rotation needed to look at the entity's target.
query.texture_frame_indexGives which icon an experience orb shows.
query.ticks_since_last_kinetic_weapon_hitGives how many ticks have passed since a kinetic weapon last hit something, or -1 if none.
query.time_of_dayGives the time of day from 0 to 1: 0 midnight, 0.25 sunrise, 0.5 noon, 0.75 sunset.
query.time_since_last_vibration_detectionGives how many seconds ago the entity last sensed a vibration, or -1 if never. Works in resource packs only.
query.time_stampGives the world's current time stamp.
query.timer_flag_1Gives 1 while the entity's behavior.timer_flag_1 is running.
query.timer_flag_2Gives 1 while the entity's behavior.timer_flag_2 is running.
query.timer_flag_3Gives 1 while the entity's behavior.timer_flag_3 is running.
query.total_emitter_countGives how many particle emitters are active in the whole world.
query.total_particle_countGives how many particles are alive in the whole world.
query.touch_only_affects_hotbarGives 1 if touch input only controls the hotbar. Works in resource packs only.
query.trade_tierGives the entity's current trade level, like a villager's.
query.unhappy_counterAlways gives 0; it is kept only so old packs still work.
query.variantGives the number set by the entity's minecraft:variant component, often used to pick a texture.
query.vertical_speedGives how fast the entity moves up (positive) or down (negative), in blocks per second.
query.walk_distanceGives how far the entity has walked on the ground without sneaking.
query.wing_flap_positionGives the current position of the entity's wing flap, like a chicken or parrot.
query.wing_flap_speedGives how fast the entity's wings flap.
query.yaw_speedGives how fast the entity is turning left or right.

Math functions

FunctionArgumentsDescription
math.abs1Gives the number without its minus sign, so -5 becomes 5.
math.acos1Gives the angle in degrees whose cosine is the value.
math.asin1Gives the angle in degrees whose sine is the value.
math.atan1Gives the angle in degrees whose tangent is the value.
math.atan22Takes y and x and gives the angle in degrees of that direction, useful for turning toward a point.
math.ceil1Rounds a number up to the next whole number, so 2.1 becomes 3.
math.clamp3Takes a value, a minimum and a maximum, and keeps the value inside that range.
math.copy_sign2Gives the first number with the plus or minus sign of the second.
math.cos1Gives the cosine of an angle in degrees, handy for smooth back and forth motion.
math.die_roll3Takes a count, a low and a high value, and adds up that many random decimal numbers in that range, like rolling dice.
math.die_roll_integer3Takes a count, a low and a high value, and adds up that many random whole numbers in that range, like rolling dice.
math.ease_in_back3Takes a start, an end and a 0 to 1 amount, and moves from start to end slowly at first, then faster; the motion overshoots a little.
math.ease_in_bounce3Takes a start, an end and a 0 to 1 amount, and moves from start to end slowly at first, then faster; the motion bounces.
math.ease_in_circ3Takes a start, an end and a 0 to 1 amount, and moves from start to end slowly at first, then faster; the motion follows a circular curve.
math.ease_in_cubic3Takes a start, an end and a 0 to 1 amount, and moves from start to end slowly at first, then faster; the motion follows a cubic curve.
math.ease_in_elastic3Takes a start, an end and a 0 to 1 amount, and moves from start to end slowly at first, then faster; the motion wobbles like a spring.
math.ease_in_expo3Takes a start, an end and a 0 to 1 amount, and moves from start to end slowly at first, then faster; the motion follows an exponential curve.
math.ease_in_out_back3Takes a start, an end and a 0 to 1 amount, and moves from start to end slow at both ends and fast in the middle; the motion overshoots a little.
math.ease_in_out_bounce3Takes a start, an end and a 0 to 1 amount, and moves from start to end slow at both ends and fast in the middle; the motion bounces.
math.ease_in_out_circ3Takes a start, an end and a 0 to 1 amount, and moves from start to end slow at both ends and fast in the middle; the motion follows a circular curve.
math.ease_in_out_cubic3Takes a start, an end and a 0 to 1 amount, and moves from start to end slow at both ends and fast in the middle; the motion follows a cubic curve.
math.ease_in_out_elastic3Takes a start, an end and a 0 to 1 amount, and moves from start to end slow at both ends and fast in the middle; the motion wobbles like a spring.
math.ease_in_out_expo3Takes a start, an end and a 0 to 1 amount, and moves from start to end slow at both ends and fast in the middle; the motion follows an exponential curve.
math.ease_in_out_quad3Takes a start, an end and a 0 to 1 amount, and moves from start to end slow at both ends and fast in the middle; the motion follows a quadratic curve.
math.ease_in_out_quart3Takes a start, an end and a 0 to 1 amount, and moves from start to end slow at both ends and fast in the middle; the motion follows a quartic curve.
math.ease_in_out_quint3Takes a start, an end and a 0 to 1 amount, and moves from start to end slow at both ends and fast in the middle; the motion follows a quintic curve.
math.ease_in_out_sine3Takes a start, an end and a 0 to 1 amount, and moves from start to end slow at both ends and fast in the middle; the motion follows a sine curve.
math.ease_in_quad3Takes a start, an end and a 0 to 1 amount, and moves from start to end slowly at first, then faster; the motion follows a quadratic curve.
math.ease_in_quart3Takes a start, an end and a 0 to 1 amount, and moves from start to end slowly at first, then faster; the motion follows a quartic curve.
math.ease_in_quint3Takes a start, an end and a 0 to 1 amount, and moves from start to end slowly at first, then faster; the motion follows a quintic curve.
math.ease_in_sine3Takes a start, an end and a 0 to 1 amount, and moves from start to end slowly at first, then faster; the motion follows a sine curve.
math.ease_out_back3Takes a start, an end and a 0 to 1 amount, and moves from start to end fast at first, then slows down; the motion overshoots a little.
math.ease_out_bounce3Takes a start, an end and a 0 to 1 amount, and moves from start to end fast at first, then slows down; the motion bounces.
math.ease_out_circ3Takes a start, an end and a 0 to 1 amount, and moves from start to end fast at first, then slows down; the motion follows a circular curve.
math.ease_out_cubic3Takes a start, an end and a 0 to 1 amount, and moves from start to end fast at first, then slows down; the motion follows a cubic curve.
math.ease_out_elastic3Takes a start, an end and a 0 to 1 amount, and moves from start to end fast at first, then slows down; the motion wobbles like a spring.
math.ease_out_expo3Takes a start, an end and a 0 to 1 amount, and moves from start to end fast at first, then slows down; the motion follows an exponential curve.
math.ease_out_quad3Takes a start, an end and a 0 to 1 amount, and moves from start to end fast at first, then slows down; the motion follows a quadratic curve.
math.ease_out_quart3Takes a start, an end and a 0 to 1 amount, and moves from start to end fast at first, then slows down; the motion follows a quartic curve.
math.ease_out_quint3Takes a start, an end and a 0 to 1 amount, and moves from start to end fast at first, then slows down; the motion follows a quintic curve.
math.ease_out_sine3Takes a start, an end and a 0 to 1 amount, and moves from start to end fast at first, then slows down; the motion follows a sine curve.
math.exp1Gives e raised to the power of the value.
math.floor1Rounds a number down to the whole number below, so 2.9 becomes 2.
math.hermite_blend1Turns a 0 to 1 value into a smooth curve (3t² - 2t³) that starts and ends gently.
math.inverse_lerp3Takes a start, an end and a value, and gives how far the value is between them, from 0 to 1.
math.lerp3Takes a start, an end and a 0 to 1 amount, and gives the point that far between them.
math.lerprotate3Like math.lerp for angles in degrees: it blends the short way around the circle.
math.ln1Gives the natural logarithm of the value.
math.max2Gives the bigger of two numbers.
math.min2Gives the smaller of two numbers.
math.min_angle1Wraps an angle in degrees into the range -180 to 180.
math.mod2Gives the remainder after dividing the first number by the second, useful for repeating cycles.
math.pi0Gives the number pi (about 3.14159).
math.pow2Raises the first number to the power of the second.
math.random2Gives a random decimal number between a low and a high value.
math.random_integer2Gives a random whole number between a low and a high value, both included.
math.round1Rounds a number to the nearest whole number.
math.sign1Gives 1 for a positive number and -1 for a negative one.
math.sin1Gives the sine of an angle in degrees, often used with query.anim_time for bobbing motion.
math.sqrt1Gives the square root of the number.
math.trunc1Cuts off the decimal part of a number, so 2.7 becomes 2 and -2.7 becomes -2.

Molang: Reference

Molang queries and functions ·Molang basics

We use cookies to improve your experience and analyse site traffic. Learn more