### Molang Context Variable Example Source: https://bedrock.dev/docs/stable/Molang Shows an example of a context variable in Molang, which are read-only and provided by the game in specific situations. Their availability and purpose are detailed in the documentation for the context in which they are used. ```molang context.moo ``` -------------------------------- ### Molang Query Function Examples Source: https://bedrock.dev/docs/stable/Molang Provides examples of Molang query functions used to read game data. Functions without arguments do not require parentheses, while those with arguments require them and comma-separated values. A comprehensive list is available separately. ```molang query.is_baby ``` ```molang query.is_item_equipped('main_hand') ``` -------------------------------- ### Resource Expression Examples Source: https://bedrock.dev/docs/stable/Molang Provides examples of resource expressions used in render controllers to select single resources (geometry, materials, textures) based on various conditions and array indexing. ```plaintext "geometry": "array.my_geometries[query.anim_time]" ``` ```plaintext "geometry": "query.is_sheared ? geometry.sheared : geometry.woolly" ``` ```plaintext "geometry": "geometry.my_geo" ``` ```plaintext "geometry": "query.is_sleeping ? geometry.my_sleeping_geo : array.my_geos[math.cos(query.anim_time * 12.3 + 41.9) * 10 + 0.6]" ``` -------------------------------- ### Animation Controller State Transitions Example (JSON) Source: https://bedrock.dev/docs/stable/Animations Provides a concrete example of state transitions in an animation controller. It shows how to define multiple transition conditions for a state, allowing for conditional switching to different states based on Molang expressions. ```json { "controller.animation.tiger.move": { "states": { "default": { "animations": [ "base_pose", "walk" ], "transitions": [ { "angry": "query.is_angry" }, // transition to angry state if query.is_angry returns true { "tired": "variable.is_tired" } // transition to tired state if variable.is_tired returns true ] }, "angry": { "animations": [ "roar", "extend_claws" ], "transitions": [ { "default": "query.any_animation_finished" } // transition back to default state when either the roar animation or extend_claws animation finishes ] }, "tired": { "animations": [ "yawn", "stretch" ], "transitions": [ { "default": "query.all_animations_finished" } // transition back to default state when the yawn and stretch animations have both finished ] } } } } ``` -------------------------------- ### Block Definition Example Source: https://bedrock.dev/docs/stable/Blocks An example of a block definition JSON object, showcasing various components and properties. ```APIDOC ## Block Definition ### Description This section details the structure for defining custom blocks in Minecraft Bedrock Edition. It includes properties for game version compatibility, block identification, and component-based functionalities. ### Method POST ### Endpoint /websites/bedrock_dev_stable ### Parameters #### Request Body - **format_version** (String) - Required - Specifies the version of the game this entity was made in. - **minecraft:block** (Object) - Required - Contains the block's definition and components. - **description** (Object) - Required - Provides metadata for the block. - **identifier** (String) - Required - The identifier for this block. Must include a namespace. - **components** (Object) - Optional - A collection of components that define the block's behavior and appearance. - **minecraft:loot** (String) - Optional - Path to the loot table JSON file. - **minecraft:destroy_time** (Number) - Optional - The time it takes to destroy the block. - **minecraft:friction** (Number) - Optional - The friction applied when moving on the block. - **minecraft:map_color** (String) - Optional - The color of the block on a map. - **minecraft:flammable** (Object) - Optional - Properties related to the block's flammability. - **flame_odds** (Number) - Optional - The chance of catching fire. - **burn_odds** (Number) - Optional - The chance of burning. - **minecraft:light_emission** (Number) - Optional - The light level emitted by the block. - **rotation** (Number) - Optional - The block's rotation in increments of 90 degrees. - **rotation_pivot** (Object) - Optional - The point to apply rotation around. - **scale** (Object) - Optional - The block's scale. - **scale_pivot** (Object) - Optional - The point to apply scale around. - **translation** (Object) - Optional - The block's translation. ### Request Example ```json { "format_version": "1.21.130", "minecraft:block": { "description": { "identifier": "design:lavenderstone" }, "components": { "minecraft:loot": "loot_tables/chests/simple_dungeon.json", "minecraft:destroy_time": 4.0, "minecraft:friction": 0.6, "minecraft:map_color": "#00ff00", "minecraft:flammable": { "flame_odds": 50, "burn_odds": 0 }, "minecraft:light_emission": 1 } } } ``` ### Response #### Success Response (200) - **status** (String) - Indicates the success of the operation. - **message** (String) - A message confirming the block definition was processed. #### Response Example ```json { "status": "success", "message": "Block definition processed successfully." } ``` ``` -------------------------------- ### Entity Definition Script Example Source: https://bedrock.dev/docs/stable/Molang Shows how to define pre-animation scripts in entity definition files for pre-computing values. These scripts run before animation and render controllers. ```json "scripts": { "pre_animation": [ "variable.my_constant = (Math.cos(query.modified_distance_moved * 38.17) * query.modified_move_speed; "variable.my_constant2 = Math.exp(1.5); ] } ``` -------------------------------- ### Example Texture Set JSON with Image References Source: https://bedrock.dev/docs/stable/Texture%20Sets Illustrates a Minecraft texture set JSON file where all PBR layers (color, MER, and heightmap) are defined by referencing texture image files. This is a common approach for complex texture setups. ```json { "format_version": "1.16.100", "minecraft:texture_set": { "color": "grass_carried", "metalness_emissive_roughness": "grass_carried_mer", "heightmap": "grass_carried_heightmap" } } ``` -------------------------------- ### Molang Struct Data Retrieval Examples Source: https://bedrock.dev/docs/stable/Molang Shows various ways to access nested data within Molang structs, demonstrating how to retrieve specific values through chains of assignments and references. These examples all return the value 1.23. ```molang v.cowcow.friend = v.pigpig; v.pigpig->v.test.a.b.c = 1.23; return v.cowcow.friend->v.test.a.b.c; ``` ```molang v.cowcow.friend = v.pigpig; v.pigpig->v.test.a.b.c = 1.23; v.moo = v.cowcow.friend->v.test; return v.moo.a.b.c; ``` ```molang v.cowcow.friend = v.pigpig; v.pigpig->v.test.a.b.c = 1.23; v.moo = v.cowcow.friend->v.test.a; return v.moo.b.c; ``` ```molang v.cowcow.friend = v.pigpig; v.pigpig->v.test.a.b.c = 1.23; v.moo = v.cowcow.friend->v.test.a.b; return v.moo.c; ``` ```molang v.cowcow.friend = v.pigpig; v.pigpig->v.test.a.b.c = 1.23; v.moo = v.cowcow.friend->v.test.a.b.c; return v.moo; ``` -------------------------------- ### Simple Expression Example Source: https://bedrock.dev/docs/stable/Molang Demonstrates a simple expression in Bedrock, which is a single statement returning a value. Semicolons are not permitted in simple expressions. ```plaintext math.sin(query.anim_time * 1.23) ``` -------------------------------- ### Molang Alias Usage Example Source: https://bedrock.dev/docs/stable/Molang Demonstrates how Molang aliases can simplify expressions by using shorter keywords for full variable and query function names. This improves readability and reduces typing effort. ```molang math.cos(query.anim_time * 38) * variable.rotation_scale + variable.x * variable.x * query.life_time; ``` ```molang math.cos(q.anim_time * 38) * v.rotation_scale + v.x * v.x * q.life_time; ``` ```molang math.cos(q.anim_time * 38) * variable.rotation_scale + v.x * variable.x * query.life_time; ``` -------------------------------- ### Simple Event Example with Particle Effect in JSON Source: https://bedrock.dev/docs/stable/Particles A concise example demonstrating a simple event configuration that triggers a particle effect. This showcases the basic integration of particle effects within an event structure. ```json // simple example: "events": { "event_name1": { "particle_effect": { "effect": "a_particle_effect", "type": "emitter" } } } ``` -------------------------------- ### Combined Filter Condition Example Source: https://bedrock.dev/docs/stable/Entities An example demonstrating how to combine multiple filter conditions using 'all_of'. This specific example passes only when the moon intensity is greater than 0.5 AND the caller's target entity is standing in water. ```json "all_of" : [ { "test" : "moon_intensity", "subject" : "self", "operator" : "greater", "value" : "0.5" }, { "test" : "in_water", "subject" : "target", "operator" : "equal", "value" : "true" } ] ``` -------------------------------- ### Potion Brewing Container Recipe Example Source: https://bedrock.dev/docs/stable/Recipes Represents a recipe for the brewing container, specifying the input potion, reagent, and the resulting output potion. This is used in brewing stands. ```json { "format_version": "1.12", "minecraft:recipe_brewing_container": { "description": { "identifier": "minecraft:brew_potion_sulphur" }, "tags": [ "brewing_stand" ], "input": "minecraft:potion", "reagent": "minecraft:gunpowder", "output": "minecraft:splash_potion" } } ``` -------------------------------- ### Discontinuous Linear Interpolation Example (Head Scale) Source: https://bedrock.dev/docs/stable/Animations Illustrates discontinuous linear interpolation for bone scaling. This example scales the 'head' bone: linearly from normal size to double size over 0.5 seconds, instantly at 0.5 seconds to double size, and then linearly back to normal size from 0.5 to 1 second. ```json "head": { "scale": { "0.5": { "pre": [1, 1, 1], "post": 2.0 } "1.0": [ 1.0 ] } } ``` -------------------------------- ### Potion Brewing Mix Recipe Example Source: https://bedrock.dev/docs/stable/Recipes Defines a recipe for mixing potions in a brewing stand. It takes an input potion and a reagent to produce a specified output potion. ```json { "format_version": "1.12", "minecraft:recipe_brewing_mix": { "description": { "identifier": "minecraft:brew_awkward_blaze_powder" }, "tags": [ "brewing_stand" ], "input": "minecraft:potion_type:awkward", "reagent": "minecraft:blaze_powder", "output": "minecraft:potion_type:strength" } } ``` -------------------------------- ### Ocelot Render Controller Example Source: https://bedrock.dev/docs/stable/Animations An example of a render controller JSON file for the ocelot entity. It specifies texture arrays for skins and assigns materials and geometry. The texture array 'Array.skins' is used to select different ocelot skins based on the 'query.variant' value. ```json { "format_version": "1.8.0", "render_controllers": { "controller.render.ocelot": { "arrays": { "textures": { "Array.skins": ["Texture.wild", "Texture.black", "Texture.red", "Texture.siamese"] } }, "geometry": "Geometry.default", "materials": [{ "*": "Material.default" }], "textures": ["Array.skins[query.variant]"] } } } ``` -------------------------------- ### Furnace Recipe Example Source: https://bedrock.dev/docs/stable/Recipes Defines a furnace recipe where input items are smelted into output items. This format is used for recipes in the furnace, smoker, and campfire. ```json { "format_version": "1.12", "minecraft:recipe_furnace": { "description": { "identifier": "minecraft:furnace_beef" }, "tags": ["furnace", "smoker", "campfire", "soul_campfire"], "input": { "item": "minecraft:beef", "data": 0, "count": 4 }, "output ": "minecraft:cooked_beef" } } ``` -------------------------------- ### Complex Expression Example Source: https://bedrock.dev/docs/stable/Molang Illustrates a complex expression with multiple statements, each ending in a semicolon. The last statement must use the 'return' keyword to define the output value. ```plaintext temp.moo = math.sin(query.anim_time * 1.23); temp.baa = math.cos(query.life_time + 2.0); return temp.moo * temp.moo + temp.baa; ``` -------------------------------- ### Molang Temporary Variable Example Source: https://bedrock.dev/docs/stable/Molang Demonstrates the usage of temporary variables in Molang, which are valid for the scope of their definition within an expression. Be cautious as their lifetime can extend beyond the immediate scope for performance reasons. ```molang temp.moo = 1; ``` -------------------------------- ### Shapeless Crafting Recipe Example Source: https://bedrock.dev/docs/stable/Recipes Defines a shapeless crafting recipe where the arrangement of ingredients does not matter. It takes a list of ingredients and produces a specified result. ```json { "format_version": "1.12", "minecraft:recipe_shapeless": { "description": { "identifier": "minecraft:firecharge_coal_sulphur" }, "priority": 0, "ingredients": { "item": "minecraft:fireball", "data": 0, "count": 4 }, "result": { "item": "minecraft:blaze_powder", "data": 4 } } } ``` -------------------------------- ### Animation Controller State Blending Example (JSON) Source: https://bedrock.dev/docs/stable/Animations Demonstrates how to implement state blending in animation controllers. The 'blend_transition' property specifies the duration (in seconds) over which animations between states will cross-fade, creating a smoother transition. ```json { "controller.animation.tiger.move": { "states": { "default": { "animations": [ "base_pose", "walk" ], "transitions": [ { "angry": "query.is_angry" } // transition to angry state if query.is_angry returns true ], "blend_transition": 0.2 // when transitioning away from this state, cross-fade over 0.2 seconds }, "angry": { "animations": [ "roar", "extend_claws" ], "transitions": [ { "default": "query.any_animation_finished" } // transition back to default state when either the roar animation or extend_claws animation finishes ] } } } } ``` -------------------------------- ### Shaped Crafting Recipe Example Source: https://bedrock.dev/docs/stable/Recipes Represents a shaped crafting recipe for a crafting table. It uses a pattern and a key to define the arrangement of input items that result in a specific output. ```json { "format_version": "1.12", "minecraft:recipe_shaped": { "description": { "identifier": "minecraft:acacia_boat" }, "tags": [ "crafting_table" ], "pattern": [ "#P#", "###" ], "key": { "P": { "item": "minecraft:wooden_shovel" }, "#": { "item": "minecraft:planks", "data": 4 } }, "result": { "item": "minecraft:boat", "data": 4 } } } ``` -------------------------------- ### Molang String Literal Examples Source: https://bedrock.dev/docs/stable/Molang Demonstrates the syntax for defining string literals in Molang using single quotes. Empty strings are represented by two consecutive single quotes. Currently, only equality (==) and inequality (!=) operators are supported for strings. ```molang 'minecraft:pig' ``` ```molang 'hello world!' ``` ```molang '' ``` -------------------------------- ### Triggering Additional Events Source: https://bedrock.dev/docs/stable/Entity%20Events Demonstrates how to use the 'trigger' action within a 'randomize' node to fire additional entity events. This example shows conditional spawning of adult or baby entities based on weight. ```json { "sample:spawn_adult": { // add adult component groups }, "sample:spawn_baby": { // add baby component groups }, "minecraft:entity_spawned": { "randomize": [ { "weight": 50.0, "trigger": "sample:spawn_adult" }, { "weight": 50.0, "trigger": "sample:spawn_baby" } ] } } ``` -------------------------------- ### Blaze Flame-up Effect with Animation Controller Source: https://bedrock.dev/docs/stable/Particles This example demonstrates how to trigger a particle effect ('charged_flames') when an entity enters a specific state ('flaming') in its animation controller. The effect starts on state entry and is terminated upon exiting the state. It utilizes the 'particle_effects' array within the animation controller's state definition. ```json { "format_version": "1.8.0", "animation_controllers": { ... "controller.animation.blaze.flame": { "states": { "default": { "transitions": [ { "flaming": "query.is_charged" } ] }, "flaming": { "particle_effects": [ { "effect": "charged_flames" } ], "transitions": [ { "default": "!query.is_charged" } ] } } }, ... } } ``` -------------------------------- ### Queueing a Command Source: https://bedrock.dev/docs/stable/Entity%20Events Shows how to queue a command to be executed on the entity using the 'queue_command' action. The command will run on the next tick. ```json { "queue_command": { "command": "say I have died!" } } ``` -------------------------------- ### Blaze 'charged_flames' Particle Effect Example Source: https://bedrock.dev/docs/stable/Particles An example demonstrating how to bind a specific particle effect, 'minecraft:mobflame_emitter', to a shorthand name 'charged_flames' within the Blaze entity's client definition. ```json { "format_version": "1.8.0", "minecraft:client_entity": { "description": { "identifier": "minecraft:blaze", ... "particle_effects": { "charged_flames": "minecraft:mobflame_emitter" }, ... } } } ``` -------------------------------- ### Environment and Time Queries Source: https://bedrock.dev/docs/stable/Molang These queries retrieve information about the game environment, such as the current day and the time elapsed since the previous frame. ```APIDOC ## Environment and Time Queries ### Description These queries provide information about the current game environment and time. ### Method GET ### Endpoint `/query/#` ### Parameters None ### Request Example None ### Response #### Success Response (200) - **value** (float/integer) - The value related to the environment or time. #### Response Example ```json { "value": 10.5 } ``` ### Available Queries: - `query.day` - `query.delta_time` ``` -------------------------------- ### Emitter Initialization Configuration (Molang) Source: https://bedrock.dev/docs/stable/Particles Sets up initial Molang expressions for an emitter. 'creation_expression' runs once at startup, and 'per_update_expression' runs once per emitter update. ```json "minecraft:emitter_initialization": { "creation_expression": , "per_update_expression": } ``` -------------------------------- ### Continuous Linear Interpolation Example (Head Rotation) Source: https://bedrock.dev/docs/stable/Animations Demonstrates continuous linear interpolation for bone rotation in an animation. This example spins the 'head' bone around the Y-axis by 360 degrees over 1 second. At 0.25 seconds, the rotation will be 90 degrees due to linear interpolation. ```json "head": { "rotation": { "0.0":[0, 0, 0], "0.5": [ 0, 180, 0], "1.0": [0, 360, 0] } } ``` -------------------------------- ### Actor and Pack Setting Queries Source: https://bedrock.dev/docs/stable/Molang Queries for retrieving actor information, animation frames, bone pivots, and pack settings. ```APIDOC ## query.get_actor_info_id# ### Description Retrieves the integer ID of an actor by its string name. ### Method GET (conceptual) ### Endpoint query.get_actor_info_id ### Parameters #### Query Parameters * **actor_name** (string) - Required - The string name of the actor. ### Request Example ```json { "query": "query.get_actor_info_id('zombie')" } ``` ### Response #### Success Response (200) * **actor_id** (integer) - The integer ID of the actor. #### Response Example ```json { "actor_id": 12345 } ``` ## query.get_default_bone_pivot# ### Description Gets the pivot point of a specified axis for a given bone. ### Method GET (conceptual) ### Endpoint query.get_default_bone_pivot ### Parameters #### Query Parameters * **bone_name** (string) - Required - The name of the bone. * **axis** (string) - Required - The axis ('x', 'y', or 'z'). ### Request Example ```json { "query": "query.get_default_bone_pivot('head', 'x')" } ``` ### Response #### Success Response (200) * **pivot** (float) - The pivot value for the specified axis and bone. #### Response Example ```json { "pivot": 0.5 } ``` ## query.get_locator_offset# ### Description Gets the offset of a specified axis for a given locator. ### Method GET (conceptual) ### Endpoint query.get_locator_offset ### Parameters #### Query Parameters * **locator_name** (string) - Required - The name of the locator. * **axis** (string) - Required - The axis ('x', 'y', or 'z'). ### Request Example ```json { "query": "query.get_locator_offset('foot_step', 'y')" } ``` ### Response #### Success Response (200) * **offset** (float) - The offset value for the specified axis and locator. #### Response Example ```json { "offset": -0.1 } ``` ## query.get_pack_setting# ### Description Retrieves the value of a specific Pack Setting slider. Available on the Client (Resource Packs) only. ### Method GET (conceptual) ### Endpoint query.get_pack_setting ### Parameters #### Query Parameters * **slider_name** (string) - Required - The name of the Pack Setting slider. ### Request Example ```json { "query": "query.get_pack_setting('render_distance')" } ``` ### Response #### Success Response (200) * **setting_value** (any) - The value of the specified slider. #### Response Example ```json { "setting_value": 16 } ``` ## query.get_root_locator_offset# ### Description Gets the offset of a specified axis for a given locator on the root model. ### Method GET (conceptual) ### Endpoint query.get_root_locator_offset ### Parameters #### Query Parameters * **locator_name** (string) - Required - The name of the locator on the root model. * **axis** (string) - Required - The axis ('x', 'y', or 'z'). ### Request Example ```json { "query": "query.get_root_locator_offset('origin', 'z')" } ``` ### Response #### Success Response (200) * **offset** (float) - The offset value for the specified axis and root locator. #### Response Example ```json { "offset": 0.0 } ``` ``` -------------------------------- ### Armor 1.0 Render Controller with Tinting Source: https://bedrock.dev/docs/stable/Animations This comprehensive example for Armor 1.0 render controllers showcases defining arrays for materials and textures, and applying color tinting to entity parts based on armor slots and queried color values. It also includes part visibility logic. ```json "format_version": "1.8.0", "render_controllers": { "controller.render.armor.chest.v1.0": { "arrays": { "materials": { "array.armor_material": [ "material.armor", "material.armor_enchanted", "material.armor_leather", "material.armor_leather_enchanted" ] }, "textures": { "array.armor_texture": [ "texture.leather", "texture.chain", "texture.iron", "texture.diamond", "texture.gold" ] } }, "geometry": "geometry.armor", "materials" : [ { "body": "array.armor_material[query.armor_material_slot(1)]" }, { "leftarm": "array.armor_material[query.armor_material_slot(1)]" }, { "rightarm": "array.armor_material[query.armor_material_slot(1)]" } ], "part_visibility" : [ { "*": 0 }, { "body": "query.has_armor_slot(1)" }, { "leftarm": "query.has_armor_slot(1)" }, { "rightarm": "query.has_armor_slot(1)" } ], "color": { "r": "query.armor_color_slot(1, 0)", "g": "query.armor_color_slot(1, 1)", "b": "query.armor_color_slot(1, 2)", "a": "query.armor_color_slot(1, 3)" }, "textures": ["array.armor_texture[query.armor_texture_slot(1)]", "texture.enchanted"] } } ``` -------------------------------- ### Smithing Trim Recipe Example (JSON) Source: https://bedrock.dev/docs/stable/Recipes This JSON defines a Smithing Trim recipe, which applies a pattern and color to an armor piece using a template and a material. It preserves the base item's properties and is restricted to the smithing table. ```json { "format_version": "1.12", "minecraft:recipe_smithing_trim": { "description": { "identifier": "minecraft:smithing_diamond_boots_jungle_quartz_trim" }, "tags": [ "smithing_table" ], "template": "minecraft:jungle_temple_smithing_template", "base": "minecraft:diamond_boots", "addition": "minecraft:quartz" } } ``` -------------------------------- ### minecraft:behavior.swell Source: https://bedrock.dev/docs/stable/Entities Allows the creeper to swell up when a player is nearby. It defines the distances at which swelling starts and stops. ```APIDOC ## minecraft:behavior.swell ### Description Allows the creeper to swell up when a player is nearby. It can only be used by Creepers. ### Parameters * **start_distance** (Decimal) - This mob starts swelling when a target is at least this many blocks away. * **stop_distance** (Decimal) - This mob stops swelling when a target has moved away at least this many blocks. ``` -------------------------------- ### Emitter Initialization Source: https://bedrock.dev/docs/stable/Particles Allows Molang expressions to run at emitter creation and per update. ```APIDOC ## minecraft:emitter_initialization ### Description This component allows the emitter to run some Molang at creation, primarily to populate any Molang variables that get used later. ### Method Not applicable (component definition) ### Endpoint Not applicable (component definition) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **creation_expression** (molang) - Required - This expression is run once at emitter startup. - **per_update_expression** (molang) - Required - This expression is run once per emitter update. ### Request Example ```json { "minecraft:emitter_initialization": { "creation_expression": "variable.my_variable = 10;", "per_update_expression": "variable.my_variable = variable.my_variable + 1;" } } ``` ### Response #### Success Response (200) Not applicable (component definition) #### Response Example Not applicable (component definition) ``` -------------------------------- ### Define Animation Controller with States and Variables (Bedrock) Source: https://bedrock.dev/docs/stable/Animations This example demonstrates how to define an animation controller in Bedrock. It includes a default state with variables that remap input queries to output values, and specifies animations to play based on these variables. The `ground_speed_curve` variable is used to scale the 'walk' animation. ```json { "format_version": "1.17.30", "animation_controllers": { "controller.animation.sheep.move": { "states": { "default": { "variables": { "ground_speed_curve": { "input": "query.ground_speed", "remap_curve": { "0.0": 0.2, "1.0": 0.7 } } }, "animations": [ "wiggle_nose", { "walk": "variable.ground_speed_curve" } ] } } } } } ``` -------------------------------- ### Get Camera Rotation Source: https://bedrock.dev/docs/stable/Molang Retrieves the current rotation of the camera. Requires an argument specifying the axis of rotation: 0 for the X-axis (pitch) and 1 for the Y-axis (yaw). ```plaintext query.camera_rotation(axis) ``` -------------------------------- ### Get Block State Source: https://bedrock.dev/docs/stable/Molang Retrieves the current Block State value for the associated block. Note: 'query.block_property' is deprecated and no longer available in pack min_engine_version 1.20.40. ```plaintext query.block_state ``` ```plaintext query.block_property ``` -------------------------------- ### Get Bone Origin Pivot Source: https://bedrock.dev/docs/stable/Molang Returns the initial pivot point of a specified bone, as defined in the .geo file. The result is a struct with '.x', '.y', and '.z' coordinates. ```plaintext query.bone_origin ``` -------------------------------- ### Animation Controller Format Example (JSON) Source: https://bedrock.dev/docs/stable/Animations Defines the basic structure of an animation controller file, including format version, controller name, states, animations, and transitions. This format is used to dictate animation logic. ```json { "format_version": "1.17.30", "animation_controllers": { "controller.animation.sheep.move": { "states": { "default": { "animations": [ { "walk": "query.modified_move_speed" } ], "transitions": [ { "grazing": "query.is_grazing" } ] }, "grazing": { "animations": [ "grazing" ], "transitions": [ { "default": "query.all_animations_finished" } ] } } } } } ``` -------------------------------- ### Get Entity Body Rotation Source: https://bedrock.dev/docs/stable/Molang Returns the body's rotation around the X (pitch) or Y (yaw) axis when called on an actor. If not called on an actor, it returns 0.0. ```plaintext query.body_x_rotation ``` ```plaintext query.body_y_rotation ``` -------------------------------- ### Molang Entity Variable Example Source: https://bedrock.dev/docs/stable/Molang Illustrates the use of entity variables in Molang, which store their value on an entity for its lifetime. These variables are not saved and will be lost if the entity is despawned or the world is reloaded. ```molang variable.moo = 1; ``` -------------------------------- ### Smithing Transform Recipe Example (JSON) Source: https://bedrock.dev/docs/stable/Recipes This JSON defines a Smithing Transform recipe, used to upgrade an item using a template, base item, and an additional material. It requires specific item tags for validation and is compatible only with the smithing table. ```json { "format_version": "1.12", "minecraft:recipe_smithing_transform": { "description": { "identifier": "minecraft:smithing_netherite_boots" }, "tags": [ "smithing_table" ], "template": "minecraft:netherite_upgrade_smithing_template", "base": "minecraft:diamond_boots", "addition": "minecraft:netherite_ingot", "result": "minecraft:netherite_boots" } } ``` -------------------------------- ### Get Bone Rotation Source: https://bedrock.dev/docs/stable/Molang Returns the initial rotation of a specified bone, as defined in the .geo file. The rotation values are provided in degrees as a struct with '.x', '.y', and '.z' components. ```plaintext query.bone_rotation ``` -------------------------------- ### Emitter Rate Instant Configuration (Molang) Source: https://bedrock.dev/docs/stable/Particles Configures an emitter to emit all its particles at once. This is useful for burst effects where all particles appear simultaneously. ```json "minecraft:emitter_rate_instant": { "num_particles": } ``` -------------------------------- ### Get Bone Bounding Box Source: https://bedrock.dev/docs/stable/Molang Returns the axis-aligned bounding box (AABB) of a specified bone. The result is a struct containing '.min' and '.max' points, each with '.x', '.y', and '.z' coordinates. ```plaintext query.bone_aabb ``` -------------------------------- ### Molang Script Upgrade Path (v1.7 to v1.8) Source: https://bedrock.dev/docs/stable/Animations This section details the mapping of old Molang script syntax to the new format. It covers changes in accessing entity properties and variables, emphasizing the shift to `query` for read-only and `variable` for read-write data. Snake_case is recommended for naming. ```molang entity.flags.foo --> query.foo entity.member.foo --> query.foo entity.foo --> variable.foo params.foo --> global.foo ``` -------------------------------- ### Block and Player State Queries Source: https://bedrock.dev/docs/stable/Molang Queries related to block properties, states, player capes, collisions, and gravity. ```APIDOC ## query.has_block_property# ### Description Checks if the associated block has a given block state. (No longer available in pack min_engine_version 1.20.40.) ### Method GET (conceptual) ### Endpoint query.has_block_property ### Parameters #### Query Parameters * **property_name** (string) - Required - The name of the block property to check. ### Request Example ```json { "query": "query.has_block_property('minecraft:facing')" } ``` ### Response #### Success Response (200) * **has_property** (float) - 1.0 if the block has the property, 0.0 otherwise. #### Response Example ```json { "has_property": 1.0 } ``` ## query.has_block_state# ### Description Checks if the associated block has a given block state. ### Method GET (conceptual) ### Endpoint query.has_block_state ### Parameters #### Query Parameters * **state_name** (string) - Required - The name of the block state to check. ### Request Example ```json { "query": "query.has_block_state('minecraft:redstone_signal')" } ``` ### Response #### Success Response (200) * **has_state** (float) - 1.0 if the block has the state, 0.0 otherwise. #### Response Example ```json { "has_state": 1.0 } ``` ## query.has_cape# ### Description Checks if the player has a cape equipped. ### Method GET (conceptual) ### Endpoint query.has_cape ### Parameters None ### Request Example ```json { "query": "query.has_cape()" } ``` ### Response #### Success Response (200) * **has_cape** (float) - 1.0 if the player has a cape, 0.0 otherwise. #### Response Example ```json { "has_cape": 1.0 } ``` ## query.has_collision# ### Description Checks if the entity has collision enabled. ### Method GET (conceptual) ### Endpoint query.has_collision ### Parameters None ### Request Example ```json { "query": "query.has_collision()" } ``` ### Response #### Success Response (200) * **has_collision** (float) - 1.0 if collision is enabled, 0.0 otherwise. #### Response Example ```json { "has_collision": 1.0 } ``` ## query.has_dash_cooldown# ### Description Checks if the entity has a cooldown on its dash ability. ### Method GET (conceptual) ### Endpoint query.has_dash_cooldown ### Parameters None ### Request Example ```json { "query": "query.has_dash_cooldown()" } ``` ### Response #### Success Response (200) * **has_cooldown** (float) - 1.0 if a dash cooldown is active, 0.0 otherwise. #### Response Example ```json { "has_cooldown": 0.0 } ``` ## query.has_gravity# ### Description Checks if the entity is affected by gravity. ### Method GET (conceptual) ### Endpoint query.has_gravity ### Parameters None ### Request Example ```json { "query": "query.has_gravity()" } ``` ### Response #### Success Response (200) * **is_affected_by_gravity** (float) - 1.0 if affected by gravity, 0.0 otherwise. #### Response Example ```json { "is_affected_by_gravity": 1.0 } ``` ## query.has_head_gear# ### Description Checks if an actor has an item in their head armor slot. ### Method GET (conceptual) ### Endpoint query.has_head_gear ### Parameters None ### Request Example ```json { "query": "query.has_head_gear()" } ``` ### Response #### Success Response (200) * **has_head_gear** (boolean) - True if the actor has head gear, false otherwise. Returns false if no actor is in the current context. #### Response Example ```json { "has_head_gear": true } ``` ## query.has_owner# ### Description Checks if the entity has an owner ID. ### Method GET (conceptual) ### Endpoint query.has_owner ### Parameters None ### Request Example ```json { "query": "query.has_owner()" } ``` ### Response #### Success Response (200) * **has_owner** (boolean) - True if the entity has an owner ID, false otherwise. #### Response Example ```json { "has_owner": true } ``` ## query.has_player_rider# ### Description Checks if any player is riding the entity in any seat. ### Method GET (conceptual) ### Endpoint query.has_player_rider ### Parameters None ### Request Example ```json { "query": "query.has_player_rider()" } ``` ### Response #### Success Response (200) * **has_player_rider** (float) - 1.0 if a player is riding, 0.0 otherwise. #### Response Example ```json { "has_player_rider": 1.0 } ``` ``` -------------------------------- ### Get Block Face Source: https://bedrock.dev/docs/stable/Molang Returns the face of the block. This is primarily used for triggers related to block placement or interaction. Possible return values include Down (0.0) to East (5.0), and Undefined (6.0). ```plaintext query.block_face ``` -------------------------------- ### Emitter Rate Steady Configuration (Molang) Source: https://bedrock.dev/docs/stable/Particles Sets up particle emission at a steady rate over time. It defines the spawn rate (particles per second) and the maximum number of active particles. ```json "minecraft:emitter_rate_steady": { "spawn_rate": , "max_particles": } ``` -------------------------------- ### Get Armor Material Slot Source: https://bedrock.dev/docs/stable/Molang Retrieves the armor material type for a specified armor slot. The valid slot indices are 0 (head), 1 (chest), 2 (legs), and 3 (feet). ```plaintext query.armor_material_slot ``` -------------------------------- ### Material and Part Visibility Order Source: https://bedrock.dev/docs/stable/Animations Demonstrates how materials and part visibility are applied. Later entries in the array override earlier ones. This example shows a material array from Horse render controllers, where 'Saddle' overrides 'Mane', which overrides 'TailA'. ```json { "materials": [ { "*": "Material.default" }, { "TailA": "Material.horse_hair" }, { "Mane": "Material.horse_hair" }, { "*Saddle*": "Material.horse_saddle" } ] } ```