### FolderView Example Source: https://wiki.bedrock.dev/contribute-style FolderView displays a file structure, useful for project setup guides. Ensure paths are correctly formatted and avoid empty lines within the paths array. ```xml ``` -------------------------------- ### Corner Transition Biome Setup Source: https://wiki.bedrock.dev/world-generation/biomes Example setup for a transition biome in a corner transition scenario, using values slightly offset from the target biome's extremes. ```json "target_temperature": 0.8, "target_humidity": -0.8 ``` -------------------------------- ### Install Dependencies Source: https://wiki.bedrock.dev/contribute-style Run this command the first time you view the wiki locally to install all necessary dependencies. ```bash npm install ``` -------------------------------- ### Example Function File Structure Source: https://wiki.bedrock.dev/meta/style-guide An example of a function file demonstrating the use of comments and headers for organization. ```text BP/functions/wiki/ability/fire_trail.mcfunction ``` -------------------------------- ### Grid Distribution Iterations Example Source: https://wiki.bedrock.dev/world-generation/feature-types Example showing the 'iterations' property, relevant for grid distributions. ```json "iterations": 21, ``` -------------------------------- ### Execute Align Example Source: https://wiki.bedrock.dev/commands/new-execute An example showing how to align a target to the center of a block using 'as', 'at', and 'align xyz' before teleporting them. ```minecraft-commands /execute as at @s align xyz run tp @s ~0.5 ~0.5 ~0.5 ``` -------------------------------- ### Example BP Animation Controller with Commands Source: https://wiki.bedrock.dev/animation-controllers/animation-controllers-intro This example demonstrates a Behavior Pack animation controller that uses 'on_entry' to play chat commands when entering 'ground' or 'flying' states. ```json { "format_version": "1.10.0", "animation_controllers": { "controller.animation.helicopter.commands": { "initial_state": "ground", "states": { "ground": { "on_entry": ["/say I am now on the ground!"], "transitions": [ { "flying": "!q.is_on_ground" } ] }, "flying": { "on_entry": ["/say I am now in the air!"], "transitions": [ { "ground": "q.is_on_ground" } ] } } } } } ``` -------------------------------- ### Multiple Entry Points Example Source: https://wiki.bedrock.dev/json-ui/best-practices This example demonstrates the use of multiple entry points in `hud_screen.json` for adding custom UI. It is recommended to consolidate UI modifications into a single entry point to minimize the risk of UI breakage. ```json { "root_panel": { "modifications": [ { "array_name": "controls", "operation": "insert_front", "value": [ { "custom_ui_control_1@namespace_1.custom_ui_control_1": {} } ] } ] }, "hud_content": { "modifications": [ { "array_name": "controls", "operation": "insert_front", "value": [ { "custom_ui_control_2@namespace_2.custom_ui_control_2": {} } ] } ] } } ``` -------------------------------- ### Fixed Grid Distribution Example Source: https://wiki.bedrock.dev/world-generation/feature-types Example of fixed grid distribution for x and z coordinates, with extents defined. ```json "x": { "distribution": "fixed_grid", "extent": [0, 15] }, "z": { "distribution": "fixed_grid", "extent": [0, 15] }, "y": 0 ``` -------------------------------- ### Example Function File Source: https://wiki.bedrock.dev/commands/mcfunctions A basic example of a .mcfunction file demonstrating command sequencing. Ensure this file is placed within the correct namespaced folder structure inside the 'functions' directory of your behavior pack. ```mcfunction effect give @a minecraft:regeneration 10 2 true scoreboard players set @a[scores={health=0}] health 1 particle minecraft:flame @a[scores={health=1}] ~ ~ ~ ``` -------------------------------- ### Detect Crawling State (Initial Example) Source: https://wiki.bedrock.dev/commands/detect-movements An initial example command to detect if a player is crawling based on their score. This is a simplified version compared to the detailed detection logic. ```minecraft execute as @a[scores={wiki:q.is_crawling=0}] run say I'm not crawling execute as @a[scores={wiki:q.is_crawling=1}] run say I started crawling execute as @a[scores={wiki:q.is_crawling=1..}] run say I'm still crawling ``` -------------------------------- ### Multiplicative Execution Forking (MEF) Example Source: https://wiki.bedrock.dev/commands/execution-forking This example shows how nesting 'as' subcommands with limited selectors can exponentially increase command executions. In this case, 'hi' will be said 8 times due to three nested forks, each targeting 2 entities. ```minecraft execute as @e[c=2] as @e[c=2] as @e[c=2] run say hi ``` -------------------------------- ### Tree Feature Setup Properties Source: https://wiki.bedrock.dev/world-generation/feature-types Defines setup properties for tree features, including base blocks and cluster configurations. ```json "base_block": [ "minecraft:dirt", "minecraft:grass" ], "base_cluster": { "may_replace": [ ], "num_clusers": 2, "cluster_radius": 3 }, "may_grow_on": [ ], "may_replace": [ ], "may_grow_through": [ ] ``` -------------------------------- ### Example Commands for Player States Source: https://wiki.bedrock.dev/commands/detect-movements Provides example commands to execute based on the detected player states (swimming, crawling, gliding). These can be customized for specific game mechanics. ```minecraft execute as @a[scores={wiki:q.is_swimming=0}] run say I'm not swimming execute as @a[scores={wiki:q.is_crawling=1}] run say I started crawling execute as @a[scores={wiki:q.is_gliding=1..}] run say I'm still gliding ``` -------------------------------- ### Install Script API Modules Source: https://wiki.bedrock.dev/scripting/typescript Installs the necessary beta versions of the Minecraft Script API modules for server, UI, game testing, admin, and networking. ```bash npm install @minecraft/server@beta npm install @minecraft/server-ui@beta npm install @minecraft/server-gametest@beta npm install @minecraft/server-admin@beta npm install @minecraft/server-net@beta ``` -------------------------------- ### Execute In Dimension Example Source: https://wiki.bedrock.dev/commands/new-execute An example demonstrating how to use the 'in' subcommand to check the dimension and execute a command conditionally. ```minecraft-commands /execute in the_end positioned 0 -100 0 as @a[rm=1] run say I'm in the End dimension ``` -------------------------------- ### Install Latest Beta API Modules (Bash) Source: https://wiki.bedrock.dev/scripting/scripting-intro Installs the latest beta versions of various Minecraft Script API modules using npm. This is useful for testing new features in development. ```bash npm i @minecraft/server@2.3.0-beta.1.21.114-stable npm i @minecraft/server-ui@2.1.0-beta.1.21.114-stable npm i @minecraft/server-gametest@1.0.0-beta.1.21.114-stable npm i @minecraft/server-admin@1.0.0-beta.1.21.114-stable npm i @minecraft/server-net@1.0.0-beta.1.21.114-stable npm i @minecraft/debug-utilities@1.0.0-beta.1.21.114-stable ``` -------------------------------- ### Example Function File for Fire Trail Ability Source: https://wiki.bedrock.dev/commands/mcfunctions This example demonstrates a function file for a 'Fire Trail Ability'. It includes sections for giving effects, setting up a particle timer, and deleting the item. It also shows how to emit particle trails and manage a countdown timer for entities. ```minecraft # ON PLAYER ITEM DROP ## Give Effects ### Fire resistance execute at @e[type=item,name="Fire Trail Ability"] run effect @p[r=3] fire_resistance 10 255 ### Speed execute at @e[type=item,name="Fire Trail Ability"] run effect @p[r=3] speed 10 1 true ## Add Particle Time (10s) execute at @e[type=item,name="Fire Trail Ability"] run scoreboard players set @p[r=3] abilities.fire_trail 200 ## Delete Item kill @e[type=item,name="Fire Trail Ability"] # ENTITY TIMER ## Emit Particle Trail execute at @a[scores={wiki:ability.fire_trail=1..}] run particle minecraft:basic_flame_particle ~~~ ## Countdown Timer scoreboard players remove @a [scores={wiki:ability.fire_trail=1..}] wiki:ability.fire_trail 1 ``` -------------------------------- ### Animation File Example for Attachable Source: https://wiki.bedrock.dev/items/attachables An example animation file for an attachable, including both third-person and first-person animations. This file should be saved to your resource pack. ```json { "format_version": "1.8.0", "animations": { "animation.player_head.default": { "loop": true, "animation_controllers": [ "controller.animation.player_head.default" ] }, "animation.player_head.raise": { "loop": true, "animation_controllers": [ "controller.animation.player_head.raise" ] } } } ``` -------------------------------- ### Attachable Guide File for First-Person Animation Source: https://wiki.bedrock.dev/items/attachables A guide animation file to help create first-person animations for attachables. It applies specific rotations and translations to the right arm bone to mimic the first-person view. ```json { "format_version": "1.8.0", "animations": { "animation.player_head.default": { "loop": true, "bones": { "rightArm": { "rotation": [95, -45, 115], "position": [13.5, -10, 12] } } } } } ``` -------------------------------- ### Hardcoded Toggles Example Source: https://wiki.bedrock.dev/json-ui/json-ui-documentation This example shows hardcoded toggle mappings for navigation tabs. These are essential for specific screens like settings or inventory. ```json $search_index - $construction_index $survival_layout_index - $construction_index $recipe_book_layout_index - $equipment_index $creative_layout_index - $items_index ``` -------------------------------- ### Jittered Grid Distribution Example Source: https://wiki.bedrock.dev/world-generation/feature-types Example of jittered grid distribution for the 'x' coordinate, including step size and grid offset. ```json "x": { "distribution": "jittered_grid", "extent": [0, 15], "step_size": 2, "grid_offset": 4 } ``` -------------------------------- ### Shaped Recipe Pattern Normalization Example 1 Source: https://wiki.bedrock.dev/loot/recipes Demonstrates pattern normalization where shorter strings are extended with spaces. This pattern is equivalent to the next example. ```json "pattern": [ "MA", "IFI", "M" ] ``` -------------------------------- ### Material Definition Example Source: https://wiki.bedrock.dev/concepts/shaders An example of a material definition in JSON format, specifying shaders, vertex fields, sampler states, and MSAA support. ```json { "materials": { "version": "1.0.0", "particle_debug": { "vertexShader": "shaders/particle_generic.vertex", "fragmentShader": "shaders/particle_debug.fragment", "vertexFields": [{ "field": "Position" }, { "field": "Color" }, { "field": "UV0" }], "+samplerStates": [ { "samplerIndex": 0, "textureFilter": "Point" } ], "msaaSupport": "Both" } } } ``` -------------------------------- ### Shaped Crafting Recipe Example Source: https://wiki.bedrock.dev/loot/recipes Example of a shaped recipe for crafting a 'cold steel sword'. This defines the pattern, required keys, unlocking conditions, and the resulting item. ```json { "format_version": "1.17.41", "minecraft:recipe_shaped": { "description": { "identifier": "wiki:cold_steel_sword" }, "tags": ["crafting_table", "altar"], "pattern": ["X", "X", "I"], "key": { "X": "wiki:cold_steel", "I": "minecraft:stick" }, "unlock": [ { "item": "wiki:cold_steel" }, { "item": "minecraft:wool", "data": 3 }, { "context": "PlayerInWater" } ], "result": "wiki:cold_steel_sword" } } ``` -------------------------------- ### Boolean Component Example Source: https://wiki.bedrock.dev/world-generation/biomes Demonstrates how boolean-like components are represented using an empty object. ```json "components": { … "minecraft:ignore_automatic_features": {} } ``` -------------------------------- ### Start Local Development Server Source: https://wiki.bedrock.dev/contribute-style Use this command to run a local version of the wiki website. Changes are automatically updated in the browser. ```bash npm run dev ``` -------------------------------- ### CodeHeader Example Source: https://wiki.bedrock.dev/contribute-style Use CodeHeader to provide context for code blocks, specifying file paths and breadcrumbs. ```xml ``` -------------------------------- ### Markdown Unordered List Source: https://wiki.bedrock.dev/contribute-style Provides an example of creating a bulleted list in Markdown. Each list item starts with a hyphen and a space. ```markdown - This - Is - A - List ``` -------------------------------- ### Conditional Rendering with Variables Source: https://wiki.bedrock.dev/json-ui/json-ui-intro Utilize UI variables (properties starting with '$') for conditional rendering. This example shows how '$actionbar_text' is used to display text in the action bar. ```json { ... "hud_actionbar_text": { "type": "image", "size": [ "100%c + 12px", "100%c + 5px" ], "offset": [ 0, "50%-68px" ], "texture": "textures/ui/hud_tip_text_background", "alpha": "@hud.anim_actionbar_text_background_alpha_out", "controls": [ { "actionbar_message": { "type": "label", "anchor_from": "center", "anchor_to": "center", "color": "$tool_tip_text", "layer": 1, "text": "$actionbar_text", "localize": false, "alpha": "@hud.anim_actionbar_text_alpha_out" } } ] } ... } ``` -------------------------------- ### Biome Tagging Example Source: https://wiki.bedrock.dev/world-generation/biomes Shows how arbitrary tags can be added to a biome's components, appearing as empty objects. ```json "components": { … "overworld": {}, "pumpkin_pastures": {}, "animal": {}, "monster": {} } ``` -------------------------------- ### Environment Sensor for In-Game Time Event Source: https://wiki.bedrock.dev/entities/timers Triggers an event based on the in-game clock time using the minecraft:environment_sensor component. This example fires an event 800 ticks after the start of the day. ```json "minecraft:environment_sensor": { "triggers": [ { "filters": { "test": "hourly_clock_time", "operator": "=", "value": 800 }, "event": "wiki:my_daily_event" } ] } ``` -------------------------------- ### Example may_attach_to Configuration Source: https://wiki.bedrock.dev/world-generation/feature-types Defines which block types a feature can attach to on its top and sides. ```json "may_attach_to": { "top": "minecraft:air", "sides": [ "minecraft:planks", "minecraft:water" ] } ``` -------------------------------- ### Set and Get Dynamic Properties for Players Source: https://wiki.bedrock.dev/scripting/script-server Sets and retrieves dynamic properties for individual players. Properties are unique to each player and can store numbers, strings, and booleans. This example runs on an interval and also demonstrates retrieving a property on player block break. ```javascript import { system, world } from "@minecraft/server"; system.runInterval(() => { world.getPlayers().forEach((player) => { // run code for each player the array returns. // all three properties are unique to each player, similar to tags/scoreboard data. player.setDynamicProperty("number_value", 12); // sets a number property on the player. player.setDynamicProperty("string_value", "This is a string :)"); // string property player.setDynamicProperty("boolean_value", true); // boolean property }); }, 20); // run this interval once every 20 game ticks. world.afterEvents.playerBreakBlock.subscribe((data) => { // subscribe to the block break event. const player = data.player; // define the player variable for use later. const numberProperty = player.getDynamicProperty("number_value"); // get the dynamic property that was saved. player.sendMessage(`You have a property of value ${numberProperty}!`); // print the players saved value to the chat. }); ``` -------------------------------- ### Initialize npm Project Source: https://wiki.bedrock.dev/scripting/typescript Creates a `package.json` file in the current directory with default settings, essential for managing project dependencies. ```bash npm init -y ``` -------------------------------- ### Simple HTTP GET Request Source: https://wiki.bedrock.dev/scripting/script-net Performs a simple HTTP GET request. This is a convenience method for GET requests without a request body. ```APIDOC ## http.get(url) Performs a simple HTTP GET request. ### Parameters - **url** (string) - The URL to send the GET request to. ### Returns - `Promise` - A promise that resolves with the HTTP response. ### Example ```js import { http } from "@minecraft/server-net"; http.get("http://example.com/").then((response) => { const body = response.body; }); ``` ``` -------------------------------- ### Preview Built Wiki Source: https://wiki.bedrock.dev/contribute-style After building the pages, run this command to preview the compiled wiki. Open the provided link in your browser. ```bash npm run preview ``` -------------------------------- ### Perform a Simple HTTP GET Request Source: https://wiki.bedrock.dev/scripting/script-net Use http.get for simple GET requests without a request body. It automatically sets the method to GET and returns a Promise resolving to an HttpResponse. ```javascript import { http } from "@minecraft/server-net"; http.get("http://example.com/").then((response) => { // Body content of the HTTP response. // Type: string const body = response.body; }); ``` -------------------------------- ### Husk Start Transforming Trigger Source: https://wiki.bedrock.dev/entities/vuc-full Triggers the start of transformation for a husk when it is underwater. ```json "minecraft:environment_sensor": { "triggers": [ { "filters": { "test": "is_underwater", "subject": "self", "operator": "==", "value": true }, "event": "minecraft:start_transforming" } ] } ``` -------------------------------- ### Initialize a Git Repository Source: https://wiki.bedrock.dev/meta/version-control Run this command in your project folder to create a new, empty Git repository. This is the first step in version controlling your project. ```bash git init ``` -------------------------------- ### Basic 'Hello World' Script Source: https://wiki.bedrock.dev/scripting/scripting-intro This script imports necessary modules and uses system.runInterval to send 'Hello World' to the chat every game tick. Ensure 'Beta APIs' are enabled in world settings if using beta modules. ```javascript // This file demonstrates that the code is working by // Spamming the chat with "Hello World" // Import world & system component from "@minecraft/server", for world & game logic. import { world, system } from "@minecraft/server"; // Create & run an interval that is called every Minecraft tick system.runInterval(() => { // Spams the chat with "Hello World" with world.sendMessage function from the API world.sendMessage("Hello World"); }, 1); ``` -------------------------------- ### Hoglin Start Zombification Trigger Source: https://wiki.bedrock.dev/entities/vuc-full Triggers the start of zombification for a hoglin when it is not in the nether. ```json "minecraft:environment_sensor": { "triggers": { "filters": { "test": "in_nether", "subject": "self", "operator": "==", "value": false }, "event": "start_zombification_event" } } ``` -------------------------------- ### Install TypeScript Globally Source: https://wiki.bedrock.dev/scripting/typescript Installs the TypeScript compiler globally on your system, making the `tsc` command available. ```bash npm install -g typescript ``` -------------------------------- ### Alternative Method: Setup 'is_dead' scoreboard objective Source: https://wiki.bedrock.dev/commands/on-player-death Add the 'wiki:q.is_dead' dummy scoreboard objective. This is required for the alternative direct detection method. ```minecraft /scoreboard objectives add wiki:q.is_dead dummy ``` -------------------------------- ### Set HTTP Method to GET Source: https://wiki.bedrock.dev/scripting/script-net Configure the HttpRequest object to use the GET method. Ensure HttpRequestMethod is imported. ```javascript import { HttpRequestMethod } from "@minecraft/server-net"; request.method = HttpRequestMethod.Get; ``` -------------------------------- ### Basic Client Entity File Source: https://wiki.bedrock.dev/guide/custom-entity Initial setup for a custom entity's client file, defining the format version and the basic client entity structure with an identifier. ```json { "format_version": "1.10.0", "minecraft:client_entity": { "description": { "identifier": "wiki:ghost" } } } ``` -------------------------------- ### Husk Start Transforming Trigger (Duplicate) Source: https://wiki.bedrock.dev/entities/vuc-full Triggers the start of transformation for a husk when it is underwater. This appears to be a duplicate entry. ```json "minecraft:environment_sensor": { "triggers": { "filters": { "test": "is_underwater", "subject": "self", "operator": "==", "value": true }, "event": "minecraft:start_transforming" } } ``` -------------------------------- ### Chaining Executes (Old vs. New Syntax) Source: https://wiki.bedrock.dev/commands/new-execute Demonstrates how to chain multiple /execute commands, including detection, using the new syntax which offers more control and clarity. ```minecraft # Old syntax: /execute @e[type=sheep] ~ ~ ~ execute @e[type=item,r=5] ~ ~ ~ detect ~ ~-1 ~ stone kill @s ``` ```minecraft # New syntax: /execute at @e[type=sheep] as @e[type=item,r=5] at @s if block ~ ~-1 ~ stone run kill @s ``` -------------------------------- ### Bedrock Block State Syntax Examples Source: https://wiki.bedrock.dev/commands/block-states Demonstrates various ways to use Block States in commands, including setting color, growth stage, wood type, and using empty brackets for default states. ```yaml /setblock ~ ~ ~ wool ["color"="white"] /setblock ~ ~ ~ wheat ["growth"=0] /setblock ~ ~ ~ wood ["wood_type"="birch","stripped_bit"=true] /setblock ~ ~ ~ wool [] ``` -------------------------------- ### Vanilla Attack Animation Examples Source: https://wiki.bedrock.dev/entities/entity-attack Examples of vanilla attack animation identifiers. These can be referenced when setting up entity animations. ```plaintext "animation.zombie.attack_bare_hand" ``` ```plaintext "animation.skeleton.attack.v1.0" ``` ```plaintext "animation.humanoid.bow_and_arrow.v1.0" ``` ```plaintext "animation.humanoid.damage_nearby_mobs.v1.0" ``` -------------------------------- ### Record Component Example Source: https://wiki.bedrock.dev/items/item-components Configures an item to be playable on a Jukebox. Specifies the comparator signal output, playback duration, and the associated sound event. ```json "minecraft:record": { "comparator_signal": 1, "duration": 5, "sound_event": "bucket.empty.powder_snow" } ``` -------------------------------- ### Snap-to-Surface Feature Example Source: https://wiki.bedrock.dev/world-generation/feature-types Configures a feature to be placed on a surface (floor or ceiling). The feature will search vertically for a solid block to attach to. ```json { "format_version": "1.16.0", "minecraft:snap_to_surface_feature": { "description": { "identifier": "wiki:underground_silas_plant_snap" }, "feature_to_snap": "wiki:underground_silas_plant", "surface": "floor", "vertical_search_range": 12 } } ``` -------------------------------- ### Minecraft Variant Examples Source: https://wiki.bedrock.dev/entities/vuc-full These examples show the 'minecraft:variant' component with different integer values, representing specific variations of entities. ```json "minecraft:variant": { "value": 6 } ``` ```json "minecraft:variant": { "value": 8 } ``` ```json "minecraft:variant": { "value": 2 } ``` ```json "minecraft:variant": { "value": 12 } ``` ```json "minecraft:variant": { "value": 10 } ``` ```json "minecraft:variant": { "value": 13 } ``` ```json "minecraft:variant": { "value": 14 } ``` ```json "minecraft:variant": { "value": 9 } ``` ```json "minecraft:variant": { "value": 1 } ``` ```json "minecraft:variant": { "value": 7 } ``` ```json "minecraft:variant": { "value": 16 } ``` ```json "minecraft:variant": { "value": 15 } ``` ```json "minecraft:variant": { "value": 11 } ``` ```json "minecraft:variant": { "value": 4 } ``` ```json "minecraft:variant": { "value": 0 } ``` ```json "minecraft:variant": { "value": 3 } ``` ```json "minecraft:variant": { "value": 5 } ``` ```json "minecraft:variant": { "value": 6 } ``` ```json "minecraft:variant": { "value": 7 } ``` ```json "minecraft:variant": { "value": 8 } ``` ```json "minecraft:variant": { "value": 9 } ``` ```json "minecraft:variant": { "value": 10 } ``` ```json "minecraft:variant": { "value": 11 } ``` ```json "minecraft:variant": { "value": 12 } ``` ```json "minecraft:variant": { "value": 13 } ``` ```json "minecraft:variant": { "value": 14 } ``` -------------------------------- ### Consistent Folder Structure Example Source: https://wiki.bedrock.dev/meta/style-guide Demonstrates consistent pluralization for content folders like 'ability' and 'event', and sub-folders like 'players' and 'worlds'. ```plaintext BP/functions/wiki/ability/ice_blast.mcfunction BP/functions/wiki/ability/fire_trail.mcfunction BP/functions/wiki/event/players/on_death.mcfunction BP/functions/wiki/event/worlds/on_initialize.mcfunction ``` -------------------------------- ### XOR Gate Example with Player Selector Source: https://wiki.bedrock.dev/commands/logic-gates Demonstrates the XOR gate using player selectors and tags. The command runs if the player has exactly one of the 'red' or 'green' tags. ```minecraft /execute as @p unless entity @s[tag=!red,tag=!green] unless entity @s[tag=red,tag=green] run say success ``` -------------------------------- ### Build All Wiki Pages Source: https://wiki.bedrock.dev/contribute-style Compiles all markdown files into HTML pages for hosting. This process can take a while. ```bash npm run build ``` -------------------------------- ### Jigsaw Structure Constant Start Height Source: https://wiki.bedrock.dev/world-generation/jigsaw-structures Sets a fixed Y-level offset for placing the start pool piece relative to the heightmap projection. ```json "start_height": { "type": "constant", "value": { "absolute": 10 } } ``` -------------------------------- ### Search Feature Example Source: https://wiki.bedrock.dev/world-generation/feature-types Sets up a search feature that attempts to place a target feature within a defined volume. Placement success depends on meeting a threshold within the search area. ```json { "format_version": "1.13.0", "minecraft:search_feature": { "description": { "identifier": "wiki:search_feature" }, "places_feature": "wiki:search_feature_obsidian", "search_volume": { "min": [0, 0, 0], "max": [7, 7, 7] }, "search_axis": "y", "required_successes": 512 } } ``` -------------------------------- ### Shaped Recipe Symmetry Example 2 Source: https://wiki.bedrock.dev/loot/recipes This pattern is functionally equivalent to the previous example due to the innate horizontal symmetry of shaped recipes. ```json "pattern": [ " Z", " Z ", "Z " ] ``` -------------------------------- ### Shaped Recipe Pattern Normalization Example 2 Source: https://wiki.bedrock.dev/loot/recipes This pattern is equivalent to the previous example due to automatic space padding for shorter strings. ```json "pattern": [ "MA ", "IFI", "M " ] ``` -------------------------------- ### RP/contents.json Example Source: https://wiki.bedrock.dev/blocks/intercardinal-orientation/files/RP/contents.json This JSON file lists all the assets included in the resource pack. Ensure all paths are correct for the pack to function. ```json { "content": [ { "path": "blocks.json" }, { "path": "manifest.json" }, { "path": "models/blocks/mug.geo.json" }, { "path": "pack_icon.png" }, { "path": "textures/terrain_texture.json" }, { "path": "textures/textures_list.json" }, { "path": "textures/wiki/blocks/mug.png" }, { "path": "textures/wiki/blocks/mug.texture_set.json" }, { "path": "textures/wiki/blocks/mug_mers.tga" } ] } ``` -------------------------------- ### Vanilla Attack Animation Controller Examples Source: https://wiki.bedrock.dev/entities/entity-attack Examples of vanilla attack animation controller identifiers. These are used to manage the sequence and conditions of animations. ```plaintext "controller.animation.zombie.attack_bare_hand" ``` ```plaintext "controller.animation.skeleton.attack" ``` ```plaintext "controller.animation.humanoid.bow_and_arrow" ``` ```plaintext "controller.animation.humanoid.attack" ``` -------------------------------- ### OR Gate Example with Entity Type Source: https://wiki.bedrock.dev/commands/logic-gates An example of an OR gate using entity type selectors. The command runs if the entity is neither a chicken nor a cow. ```minecraft /execute unless entity @e[type=!chicken, type=!cow] run ``` -------------------------------- ### JSON UI Animations Example Source: https://wiki.bedrock.dev/json-ui/json-ui-intro Demonstrates how to define and use animations for element properties like size and alpha. Animations can be referenced by other elements. ```json { "namespace": "example_nm", "anim_size": { "anim_type": "size", "easing": "linear", "from": [ "100%", 27 ], "to": [ "100% + 3px", 30 ], "duration": 1.25 }, "anim_alpha": { "anim_type": "alpha", "easing": "linear", "from": 1, "to": 0.5, "duration": 2 }, "test_animated_element": { "...": "", "anims": [ "@example_nm.anim_size", "@example_nm.anim_alpha" ] } } ``` -------------------------------- ### Strider Start Suffocating Sensor Source: https://wiki.bedrock.dev/entities/vuc-full Configures triggers for a strider to start suffocating. This occurs when the entity is not in lava, not riding, and lacks the move-to-liquid component, or when in lava. ```json "minecraft:environment_sensor": { "triggers": [ { "filters": { "all_of": [ { "test": "in_lava", "subject": "self", "operator": "==", "value": false }, { "any_of": [ { "test": "is_riding", "subject": "self", "operator": "==", "value": false }, { "test": "in_lava", "subject": "other", "operator": "==", "value": false } ] } ] }, "event": "start_suffocating" }, { "filters": { "all_of": [ { "test": "is_riding", "subject": "self", "operator": "equals", "value": false }, { "test": "has_component", "subject": "self", "operator": "not", "value": "minecraft:behavior.move_to_liquid" } ] }, "event": "on_not_riding_parent" } ] } ``` -------------------------------- ### Basic Button Mapping Configuration Source: https://wiki.bedrock.dev/json-ui/json-ui-intro This snippet shows a basic example of a button element with the `button_mappings` property, defining how different inputs trigger button actions. ```json { "sample_button@common.button": { "$pressed_button_name": "button_id", "button_mappings": [ { "to_button_id": "$pressed_button_name", "mapping_type": "pressed" }, { "from_button_id": "button.menu_ok", "to_button_id": "$pressed_button_name", "mapping_type": "focused" }, { "from_button_id": "button.menu_select", "to_button_id": "$pressed_button_name", "mapping_type": "pressed" }, { "from_button_id": "button.menu_up", "to_button_id": "$pressed_button_name", "mapping_type": "global" } ] } } ``` -------------------------------- ### OR Gate Example with Scores Source: https://wiki.bedrock.dev/commands/logic-gates An example of an OR gate using score selectors. The command runs if the player's score in either 'objective.a' or 'objective.b' is not 5. ```minecraft /execute unless entity @p[scores={objective.a=!5, objective.b=!5}] run ``` -------------------------------- ### Unconnected Pong Example Source: https://wiki.bedrock.dev/servers/raknet Example format of an unconnected pong packet sent by the server in response to an unconnected ping. It includes server information and game details. ```text MCPE;Dedicated Server;527;1.19.1;0;10;13253860892328930865;Bedrock level;Survival;1;19132;19133; ``` -------------------------------- ### BP/contents.json Example Source: https://wiki.bedrock.dev/blocks/custom-heads/files/BP/contents.json This JSON file lists the content included in the behavior pack, specifying the paths to various assets and scripts. ```json { "content": [ { "path": "blocks/custom_head.json" }, { "path": "items/custom_head.json" }, { "path": "manifest.json" }, { "path": "pack_icon.png" }, { "path": "scripts/headDrops.js" }, { "path": "scripts/index.js" }, { "path": "scripts/intercardinalOrientation.js" } ] } ``` -------------------------------- ### AND Gate Example with Player Selector Source: https://wiki.bedrock.dev/commands/logic-gates Demonstrates the AND gate using player selectors and tags. The command runs if the player has both 'red' and 'green' tags. ```minecraft /execute as @p[tag=red,tag=green] run say success ``` -------------------------------- ### Get Initiator Player from NPC Dialogue Source: https://wiki.bedrock.dev/scripting/script-server When a script event is triggered by an NPC dialogue button, use the 'initiator' property to reliably get the player who interacted with the NPC. ```javascript system.afterEvents.scriptEventReceive.subscribe((event) => { const player = event.initiator; // the player, when fired from an NPC button if (!player || player.typeId !== "minecraft:player") return; // ... }); ``` -------------------------------- ### Entity Animation Setup Source: https://wiki.bedrock.dev/entities/coordinate-space-conversion Defines animations for an entity and specifies which scripts to run before and during animation. The 'pre_animation' script is crucial for coordinate transformations. ```json "animations": { "myAnim": "animation.tut_transform.move" }, "scripts": { "pre_animation": [ "// TODO -- we will fill this in next." ], "animate": [ "myAnim" ] } ``` -------------------------------- ### Example JavaScript Stack Trace Source: https://wiki.bedrock.dev/scripting/troubleshooting A stack trace lists the functions leading to an error, helping to pinpoint the cause. This example shows a SyntaxError on line 16 of index.js. ```plaintext [Scripting][error]-SyntaxError: unexpected character at (index.js:16) at parse (native) at r (bundle.js) at (bundle.js) ``` -------------------------------- ### 2D Blocks Animation Setup Source: https://wiki.bedrock.dev/commands/display-entities Sets up initial rotation and scaling parameters for 2D block animations. This function calculates transformation matrices based on input rotations and scales. ```mcfunction playanimation @e[tag=wiki:fmbe] animation.player.sleeping _ 0 "v.xpos=v.xpos??0;v.ypos=v.ypos??0;v.zpos=v.zpos??0;v.xrot=v.xrot??0;v.yrot=v.yrot??0;v.zrot=v.zrot??0;v.scale=v.scale??1;v.extend_scale=v.extend_scale??1;v.extend_xrot=v.extend_xrot??-90;v.extend_yrot=v.extend_yrot??0;v.xbasepos=v.xbasepos??0;v.ybasepos=v.ybasepos??0;v.zbasepos=v.zbasepos??0;v.F.r5=-math.sin(v.xrot);v.F.r2=-math.sin(v.yrot);v.F.r3=-math.sin(v.zrot);v.F.r4=math.cos(v.zrot);v.F.r8=math.cos(v.yrot);v.F.r0=-v.F.r5*v.F.r2*v.F.r3+v.F.r8*v.F.r4;v.F.r1=-v.F.r5*v.F.r2*v.F.r4-v.F.r8*v.F.r3;v.F.r6=-v.F.r5*v.F.r8*v.F.r3-v.F.r2*v.F.r4;v.F.r7=-v.F.r5*v.F.r8*v.F.r4+v.F.r2*v.F.r3;v.F.r2=v.F.r2*math.cos(v.xrot);v.F.r3=v.F.r3*math.cos(v.xrot);v.F.r4=v.F.r4*math.cos(v.xrot);v.F.r8=v.F.r8*math.cos(v.xrot);v.F.e0=math.cos(v.extend_yrot);v.F.e4=math.cos(v.extend_xrot);v.F.e5=-math.sin(v.extend_xrot);v.F.e6=math.sin(v.extend_yrot);v.F.e1=v.F.e5*v.F.e6;v.F.e2=-v.F.e4*v.F.e6;v.F.e7=-v.F.e5*v.F.e0;v.F.e8=v.F.e4*v.F.e0;v.F.p0=v.F.r0*v.F.e0+v.F.r2*v.F.e6;v.F.p1=v.F.r0*v.F.e1+v.F.r1*v.F.e4+v.F.r2*v.F.e7;v.F.p2=v.F.r0*v.F.e2+v.F.r1*v.F.e5+v.F.r2*v.F.e8;v.F.p3=v.F.r3*v.F.e0+v.F.r5*v.F.e6;v.F.p4=v.F.r3*v.F.e1+v.F.r4*v.F.e4+v.F.r5*v.F.e7;v.F.p5=v.F.r3*v.F.e2+v.F.r4*v.F.e5+v.F.r5*v.F.e8;v.F.p6=v.F.r6*v.F.e0+v.F.r8*v.F.e6;v.F.p7=v.F.r6*v.F.e1+v.F.r7*v.F.e4+v.F.r8*v.F.e7;v.F.p8=v.F.r6*v.F.e2+v.F.r7*v.F.e5+v.F.r8*v.F.e8;" controller.animation.fox.move ``` -------------------------------- ### Focus Container Custom Example Source: https://wiki.bedrock.dev/json-ui/json-ui-documentation Demonstrates how to configure custom focus containers. The 'focus_container_custom_up' property on 'input_panel' specifies that focus should shift to 'other_panel' when navigating upwards from the input panel. ```json { "other_panel": { "focus_container": true, "controls": [ ... ] } }, { "input_panel": { "focus_container_custom_up": [ { "other_focus_container_name": "other_panel" } ] } } ``` -------------------------------- ### Applying Block Components Source: https://wiki.bedrock.dev/blocks/block-components Example of applying multiple block components directly within the 'components' section of a block definition. This sets light dampening, light emission, map color, geometry, and material instances for a custom lamp block. ```json { "format_version": "1.26.30", "minecraft:block": { "description": { "identifier": "wiki:lamp", "menu_category": { "category": "items" } }, "components": { "minecraft:light_dampening": 0, "minecraft:light_emission": 15, "minecraft:map_color": [210, 200, 190], "minecraft:geometry": { "identifier": "geometry.lamp", "culling": "wiki:culling.lamp" }, "minecraft:material_instances": { "*": { "texture": "wiki:lamp" }, "shade": { "texture": "wiki:lamp_shade" } } } } } ``` -------------------------------- ### Example Biome Definition JSON Source: https://wiki.bedrock.dev/world-generation/biomes This is a comprehensive example of a biome definition file in JSON format. It includes surface parameters, height noise, climate settings, and generation rules. ```json { "format_version": "1.13.0", "minecraft:biome": { "description": { "identifier": "pumpkin_pastures" }, "components": { "minecraft:surface_parameters": { "foundation_material": "minecraft:stone", "top_material": "minecraft:grass", "mid_material": "minecraft:dirt", "sea_floor_depth": 4, "sea_material": "minecraft:water", "sea_floor_material": "minecraft:sand" }, "minecraft:overworld_height": { "noise_params": [0.125, 0.0625] }, "minecraft:climate": { "temperature": 0.375, "downfall": 0.25, "snow_accumulation": [0, 0.5] }, "minecraft:overworld_generation_rules": { "generate_for_climates": [["cold", 1]], "hills_transformation": "pumpkin_pastures_hills", "shore_transformation": "pumpkin_pastures" }, "overworld": {}, "pumpkin_pastures": {}, "animal": {}, "monster": {} } } } ``` -------------------------------- ### Setting Lighting Configuration via Renderer Command Source: https://wiki.bedrock.dev/meta/deferred-qna Example of a command to set the active lighting configuration using an identifier. This command would be used in scripting or command blocks to apply specific lighting presets. ```shell /renderer lighting set bao:world_destroyer_event ``` -------------------------------- ### OR Gate Example with Hasitem Source: https://wiki.bedrock.dev/commands/logic-gates An example of an OR gate using the 'hasitem' selector. The command runs if the player has either a diamond sword or an iron sword (quantity 0 implies presence). ```minecraft /execute unless entity @p[hasitem=[{item=diamond_sword,quantity=0},{item=iron_sword,quantity=0}]] run ``` -------------------------------- ### Clone Recipe Output to Crafter (with sound) Source: https://wiki.bedrock.dev/commands/custom-crafting This command clones the recipe output to the crafter if the recipe matches. This is an alternative to the previous example and includes the sound effect. ```minecraft execute if blocks masked run clone ``` -------------------------------- ### textures_list.json Example Source: https://wiki.bedrock.dev/blocks/intercardinal-orientation/files/RP/textures/textures_list.json This JSON file lists the textures to be included in the resource pack. It's an array of strings, where each string is a path to a texture. ```json [ "textures/wiki/blocks/mug" ] ``` -------------------------------- ### Install Latest Stable API Modules (Bash) Source: https://wiki.bedrock.dev/scripting/scripting-intro Installs the latest stable versions of the core Minecraft Script API modules using npm. Use this for production-ready projects. ```bash npm i @minecraft/server npm i @minecraft/server-ui ``` -------------------------------- ### Markdown Container Examples Source: https://wiki.bedrock.dev/contribute-style Demonstrates the usage of different Markdown container types for informational, warning, and detail purposes. Use 'info', 'tip', 'warning', and 'danger' for user guidance. Avoid 'details' as it's not well-styled. ```markdown :::info Some info here ::: :::tip A tip here ::: :::warning A warning here ::: :::danger A dangerous place ::: :::details Some necessary details here ::: ``` ```markdown :::danger STOP! A dangerous place ::: ``` -------------------------------- ### Jigsaw Structure Uniform Start Height Source: https://wiki.bedrock.dev/world-generation/jigsaw-structures Defines a range of Y-levels for placing the start pool piece, based on minimum and maximum values relative to the dimension's top or bottom. ```json "start_height": { "type": "uniform", "min": { "above_bottom": 100 //must be 100 blocks above the bedrock }, "max": { "below_top": 100 //must be below y220 } } ```