### All Block Settings Example Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/block/settings This example demonstrates all possible settings for a custom block, showcasing various configuration options. ```yaml blocks: custom:all_settings_block: settings: hardness: 0.5 resistance: 0.5 is_randomly_ticking: true push_reaction: NORMAL map_color: 36 burnable: false fire_spread_chance: 0 burn_chance: 0 item: custom:all_settings_item replaceable: false is_redstone_conductor: true is_suffocating: true is_view_blocking: true sounds: break: minecraft:block.deepslate.break step: minecraft:block.deepslate.step place: minecraft:block.deepslate.place hit: minecraft:block.deepslate.hit fall: minecraft:block.deepslate.fall require_correct_tools: true respect_tool_component: false correct_tools: - minecraft:wooden_pickaxe incorrect_tool_dig_speed: 0.3 tags: - minecraft:mineable/pickaxe instrument: BASEDRUM fluid_state: water support_shape: minecraft:stone luminance: 15 can_occlude: false block_light: 0 propagate_skylight: false jump_factor: 1.0 speed_factor: 1.0 friction: 0.7 ``` -------------------------------- ### Example Configuration with Custom IDs Source: https://xiao-momi.github.io/craft-engine-wiki/api Example configuration demonstrating custom type IDs using lowercase letters and underscores, and hyphenated config parameters. ```yaml type: my_plugin:test_function send-to-all: true message: "Test TeST tEST" ``` -------------------------------- ### Full Item Configuration Example Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/item This example demonstrates a complete item configuration, including material, custom model data, item model, settings, data, model definition, and behavior. ```yaml items: default:palm_log: material: paper custom_model_data: 1000 item_model: default:palm_log settings: fuel_time: 300 tags: - "default:palm_logs" - "minecraft:logs" - "minecraft:logs_that_burn" data: item_name: "Palm Log" model: type: "minecraft:model" path: "minecraft:item/custom/palm_log" generation: parent: "minecraft:block/custom/palm_log" oversized_in_gui: true hand_animation_on_swap: true client_bound_model: false behavior: type: block_item block: default:palm_log ``` -------------------------------- ### Block Model Generation with `cube_all` shorthand Source: https://xiao-momi.github.io/craft-engine-wiki/getting_start/add_custom_model This example demonstrates the shorthand for applying a texture to all sides of a block model using `cube_all`. ```yaml generation: parent: "minecraft:block/cube_all" textures: "all": "minecraft:block/custom/block_texture" ``` -------------------------------- ### Example of Special Parameters in Use Source: https://xiao-momi.github.io/craft-engine-wiki/reference/template Demonstrates how the special parameters `${__NAMESPACE__}` and `${__ID__}` are resolved in a specific item entry. ```yaml items: default:palm_log: data: item_name: "" ``` -------------------------------- ### Full Furniture Configuration Example Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/furniture This snippet shows a complete configuration for a 'default:bench' furniture item, covering its settings, variants, and loot table. ```yaml furniture: default:bench: settings: item: default:bench sounds: break: minecraft:block.bamboo_wood.break place: minecraft:block.bamboo_wood.place variants: ground: loot_spawn_offset: 0.5,0.5,0 entity_culling: true elements: - item: default:bench display_transform: none billboard: fixed position: 0.5,0,0 translation: 0,0.5,0 shadow_radius: 1 shadow_strength: 0.2 apply_dyed_color: true glow_color: 255,255,255 hitboxes: - position: 0,0,0 type: shulker direction: east peek: 100 blocks_building: true interactive: true interaction_entity: true seats: - 0,0,-0.1 0 - 1,0,-0.1 0 loot: template: default:loot_table/furniture arguments: item: default:bench ``` -------------------------------- ### Subpack Configuration with Versioned Loading Source: https://xiao-momi.github.io/craft-engine-wiki/configuration Example of a 'pack.yml' file demonstrating how subpacks can be selectively loaded based on server version using version specifications. ```yaml # pack.yml author: XiaoMoMi version: 0.0.1 description: Default Assets for CraftEngine namespace: default subpacks: $$>=1.21.4: pack_a: true $$<1.21.4: pack_b: true pack_c: true pack_d: false ``` -------------------------------- ### Example of viewer_arg and arg tags Source: https://xiao-momi.github.io/craft-engine-wiki/reference/text_format Demonstrates how 'viewer_arg' and 'arg' tags are used to display player names from different contexts in a broadcast message. ```yaml message: -| Hi, . Did you notice that interacted a custom block? ``` -------------------------------- ### Version-Based Configuration: Value Selection Source: https://xiao-momi.github.io/craft-engine-wiki/configuration Example of using version specifications (e.g., '$$1.20.1~1.21.1') to select different values based on the game version. ```yaml items: default:topaz_trident: material: trident client_bound_material: $$1.20.1~1.21.1: bow $$1.21.2~1.21.3: honey_bottle $$fallback: xxx data: item_name: <#FF8C00> components: minecraft:max_damage: 300 ``` -------------------------------- ### Create Basic Item Config Source: https://xiao-momi.github.io/craft-engine-wiki/getting_start/create_first_item Define the material for your first item. After saving, reload the config and get the item in-game. ```yaml items: tutorial:diamond: material: diamond ``` -------------------------------- ### Example Usage with Cooldown Source: https://xiao-momi.github.io/craft-engine-wiki/reference/conditions Demonstrates using `set_cooldown` function and checking `!on_cooldown` condition. This prevents rapid execution of functions. ```yaml events: - on: right_click functions: - type: set_cooldown id: test time: 30s - type: command command: give minecraft:apple conditions: - type: "!on_cooldown" id: test ``` -------------------------------- ### Configure a Single-State Block Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/block/states This example shows how to configure a single-state block, specifying its default block and custom model with state properties. ```yaml blocks: default:chinese_lantern: state: auto_state: note_block model: path: "minecraft:block/custom/chinese_lantern" generation: parent: "minecraft:block/cube_column" textures: "end": "minecraft:block/custom/chinese_lantern_top" "side": "minecraft:block/custom/chinese_lantern" ``` -------------------------------- ### Handle CraftEngine First Load Event Source: https://xiao-momi.github.io/craft-engine-wiki/compatibility/skript This event triggers specifically on the first load of CraftEngine, typically during server enable. Useful for initial setup tasks. ```skript on craft-engine first loaded: send "Ho, CraftEngine has been loaded on server enable, script will init something now!" to console ``` -------------------------------- ### Special Model Configuration for Player Head Source: https://xiao-momi.github.io/craft-engine-wiki/getting_start/add_custom_model This example shows a configuration for a special model type, specifically a player head, with a defined path. Special models are covered in more detail in future tutorials. ```yaml items: default:gui_head_size_1: material: player_head model: type: minecraft:special # The model here is a parameter required for minecraft:special models # and is unrelated to the outer model. We will cover special models in detail in future tutorials. model: type: minecraft:player_head path: minecraft:item/custom/gui_head_size_1 ``` -------------------------------- ### Basic Category Configuration Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/category Defines a simple category with a name, icon, priority, and a list of items. Use this for straightforward category setups. ```yaml categories: default:palm_tree: name: "" lore: [] hidden: false priority: 1 icon: default:palm_log conditions: - type: permission permission: category.default.palm_tree list: - default:palm_sapling - default:palm_leaves - default:palm_log - default:stripped_palm_log - default:palm_wood - default:stripped_palm_wood - default:palm_planks # all_items: true ``` -------------------------------- ### Self-Hosted Resource Pack with Full URL Source: https://xiao-momi.github.io/craft-engine-wiki/getting_start/set_up_host/self This example shows how to configure self-hosted resource packs using a full URL, which can be used to avoid specifying an IPv4 address directly. Ensure you have an SSL certificate if using HTTPS. ```yaml - type: "self" ip: "111.222.333.444" port: 8163 url: "https://mydomain.com:8163/" # ...more options ``` -------------------------------- ### Version-Based Configuration: Block Merging Source: https://xiao-momi.github.io/craft-engine-wiki/configuration Example of using version comparison (e.g., '$$>=1.21.2') to conditionally merge or override configuration blocks for specific game versions. ```yaml items: default:topaz_trident: material: trident data: item_name: <#FF8C00> components: minecraft:max_damage: 300 $$>=1.21.2: client_bound_data: components: minecraft:consumable: consume_seconds: 128000 animation: spear ``` -------------------------------- ### Configure Ground Variant for Furniture Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/furniture/variants Example configuration for a 'ground' variant of a bench, including loot spawn offsets, display elements, and hitboxes. This demonstrates setting up a basic furniture item with custom properties. ```yaml furniture: default:bench: variants: ground: # create offsets for the drops so they won't spawn in blocks loot_spawn_offset: 0,0,0 # Display Elements elements: - item: default:bench display_transform: NONE billboard: FIXED position: 0.5,0,0 translation: 0,0.5,0 apply_dyed_color: true # default: true # glow_color: 255,255,255 # glow color: r,g,b # Furniture Hitboxes hitboxes: - type: interaction # non-collision hitbox can_use_item_on: false # default: false can_be_hit_by_projectile: false # default: false blocks_building: false # default: true position: 0,0,0 width: 1 height: 2 # 'width'/'height' can be simplified to 'scale' # scale: 1,2 interactive: true # whether the interaction entity is interactive seats: - 0,0,-0.1 0 ``` -------------------------------- ### Set Conditions for Recipe Usage Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/recipe Implement 'conditions' to restrict recipe usage based on player requirements. This example requires players to have the 'recipe.unlock.bench' permission to use the 'default:bench' recipe. ```yaml recipes: default:bench: conditions: - type: permission permission: recipe.unlock.bench ``` -------------------------------- ### Generate Model with CraftEngine Source: https://xiao-momi.github.io/craft-engine-wiki/getting_start/add_custom_model Configure model generation properties like parent, GUI light, and display settings. This example sets up a template skull with specific GUI translation and scale. ```yaml generation: parent: minecraft:item/template_skull gui_light: front display: gui: translation: 0,8,0 scale: 2,2,2 ``` -------------------------------- ### Display image from namespace and ID Source: https://xiao-momi.github.io/craft-engine-wiki/reference/text_format Uses the 'image' tag to display an image from a specified namespace and ID. This example uses default namespace and icons ID. ```yaml item_name: "<#FF8C00> Topaz Rod" ``` -------------------------------- ### Single Block Behavior Configuration Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/block/behaviors Configure a single behavior for a block, such as a bush block. This example shows how to specify tags for the bottom block. ```yaml blocks: default:fairy_flower: behavior: type: bush_block bottom_block_tags: - minecraft:dirt - minecraft:farmland ``` -------------------------------- ### Define a Loot Pool with Entries and Functions Source: https://xiao-momi.github.io/craft-engine-wiki/reference/loot_table This example shows the basic structure of a loot pool, including rolls, conditions, entries, and functions. It's useful for defining how items are dropped in various game scenarios. ```yaml loot: functions: [] pools: - rolls: 1 conditions: - type: survives_explosion entries: - type: item item: "minecraft:apple" functions: [] ``` -------------------------------- ### Basic Emoji Configuration Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/emoji Defines a simple emoji with a permission, content format, associated image, and keywords. Use this for straightforward emoji setups. ```yaml emoji: default:time: permission: emoji.time content: "" image: "default:icons:0:0" keywords: - ":time:" ``` -------------------------------- ### Tree Configuration Example for Minecraft 1.21.4 Source: https://xiao-momi.github.io/craft-engine-wiki/compatibility/datapack Use this JSON to configure custom tree generation in Minecraft 1.21.4 using CraftEngine. Note that custom namespaces like 'craftengine' are used instead of 'minecraft'. ```json { "type": "minecraft:tree", "config": { "ignore_vines": true, "force_dirt": false, "minimum_size": { "type": "minecraft:two_layers_feature_size", "min_clipped_height": 10, "limit": 1, "lower_size": 0, "upper_size": 2 }, "dirt_provider": { "type": "minecraft:simple_state_provider", "state": { "Name": "minecraft:sand" } }, "trunk_provider": { "type": "craftengine:simple_state_provider", "state": { "Name": "default:palm_log", "Properties": { "axis": "y" } } }, "foliage_provider": { "type": "craftengine:simple_state_provider", "state": { "Name": "default:palm_leaves", "Properties": { "distance": "7", "persistent": "false", "waterlogged": "false" } } }, "trunk_placer": { "type": "minecraft:straight_trunk_placer", "base_height": 6, "height_rand_a": 5, "height_rand_b": 0 }, "foliage_placer": { "type": "minecraft:cherry_foliage_placer", "radius": 5, "offset": 0, "height": 4, "wide_bottom_layer_hole_chance": 0.8, "corner_hole_chance": 1, "hanging_leaves_chance": 0.8, "hanging_leaves_extension_chance": 0.4 }, "decorators": [] } } ``` -------------------------------- ### Execute Functions on Recipe Completion Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/recipe Use the 'functions' field to execute specific actions when a recipe is successfully crafted. This example runs a 'say 1' command upon crafting the 'default:bench'. ```yaml recipes: default:bench: functions: - type: command command: say 1 ``` -------------------------------- ### Define a Shapeless Crafting Recipe Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/recipe Create a shapeless crafting recipe where the order of ingredients does not matter. This example shows how to specify ingredients, including support for nested lists. ```yaml recipes: default:palm_planks: type: shapeless category: building group: planks ingredients: - "#default:palm_logs" # nested list is also supported - - test:ingredient1 - test:ingredient2 result: id: default:palm_planks count: 4 ``` ```yaml recipes: default:enchanted_cobblestone: type: shapeless ingredients: - items: "minecraft:cobblestone" count: 32 - items: "minecraft:cobblestone" count: 32 - items: "minecraft:cobblestone" count: 32 - items: "minecraft:cobblestone" count: 32 - items: "minecraft:cobblestone" count: 32 result: id: default:enchanted_cobblestone count: 1 ``` -------------------------------- ### Apply Data Post-Processor to Recipe Result Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/recipe Use the 'apply_data' post-processor to modify the recipe result. This example applies the 'minecraft:efficiency: 5' enchantment to the 'default:topaz_pickaxe'. ```yaml result: id: default:topaz_pickaxe count: 1 post_processors: - type: apply_data data: enchantment: minecraft:efficiency: 5 ``` -------------------------------- ### Get Furniture ID in Skript Source: https://xiao-momi.github.io/craft-engine-wiki/compatibility/skript Use this expression to get the furniture ID from an entity in Skript. This is helpful when you need to identify specific furniture entities. ```skript set {_furnitureId} to {_entity}'s craft-engine furniture id ``` -------------------------------- ### Boolean Property Example Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/block/states/properties Defines a boolean property that accepts true or false. The default value is optional. ```yaml properties: happy: type: boolean default: false ``` -------------------------------- ### Set Consume Replacement Item Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/item/settings Specifies the item that is returned after the current item is consumed. For example, an empty bottle after drinking. ```yaml consume_replacement: minecraft:apple ``` -------------------------------- ### Configure Lobfile Hosting Source: https://xiao-momi.github.io/craft-engine-wiki/getting_start/set_up_host/lobfile Add this configuration to your resource pack to enable Lobfile hosting. Replace 'abcdefghijkl' with your actual API key. Set 'use_environment_variables' to true if you prefer using environment variables. ```yaml resource-pack: delivery: hosting: - type: "lobfile" api_key: "abcdefghijkl" # Optional options use_environment_variables: false ``` -------------------------------- ### Custom Item Id Expression Source: https://xiao-momi.github.io/craft-engine-wiki/compatibility/skript Gets the namespace ID of a custom item from an item stack, item type, or slot. ```APIDOC ## Custom Item Id Expression ### Description Get a namespace id of custom item. ### Syntax `(custom|ce|craft-engine) item [namespace] id of %itemstack/itemtype/slot%` `%itemstack/itemtype/slot%'[s] (custom|ce|craft-engine) item [namespace] id` ### Example ```skript set {_itemId} to craft-engine item id of player's tool ``` ``` -------------------------------- ### Handle CraftEngine Load Event Source: https://xiao-momi.github.io/craft-engine-wiki/compatibility/skript This event triggers when CraftEngine is loaded. Use it to perform actions upon server startup or reload. ```skript on craft-engine loaded: send "Ho, CraftEngine has been loaded, you can get ce items now!" to console ``` -------------------------------- ### Configure Component-Based Equipment with Texture and Dye Options Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/equipment Set up component-based equipment with options for texture, dyeability, and using player textures. ```yaml equipments: default:topaz: type: component humanoid: texture: "minecraft:leather" dyeable: color_when_undyed: -6265536 # leather color # elytra texture use_player_texture: false ``` -------------------------------- ### Composite Block Behaviors Configuration Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/block/behaviors Combine multiple behaviors for a single block. This example configures a gunpowder block with 'concrete_powder_block' and 'falling_block' behaviors. ```yaml blocks: default:gunpowder_block: behaviors: - type: concrete_powder_block solid_block: default:solid_gunpowder_block - type: falling_block ``` -------------------------------- ### Configure GitLab Hosting Source: https://xiao-momi.github.io/craft-engine-wiki/getting_start/set_up_host/gitlab Use this configuration block to set up GitLab as a hosting provider. Ensure you fill in your GitLab URL, access token, and project ID. Optional settings like `use_environment_variables` can be adjusted. ```yaml resource-pack: delivery: hosting: - type: gitlab gitlab_url: "" access_token: "" project_id: "" # Optional options use_environment_variables: false ``` -------------------------------- ### CraftEngine 物品模型配置 Source: https://xiao-momi.github.io/craft-engine-wiki/zh-Hans/getting_start/add_custom_model 此配置将自定义模型分配给 'tutorial:toxic_sword' 物品。确保 'path' 字段与 BlockBench 中定义的模型路径一致。修改后需要运行 `/ce reload all` 来应用更改。 ```yaml items: tutorial:toxic_sword: material: diamond_sword data: item_name: "<#3CB371>剧毒之剑" model: type: minecraft:model path: tutorial:item/toxic_sword ``` -------------------------------- ### Get Custom Item Namespace ID Source: https://xiao-momi.github.io/craft-engine-wiki/compatibility/skript Extract the namespace ID of a custom item. This is useful for identifying or comparing custom items within your Skript. ```skript set {_itemId} to craft-engine item id of player's tool ``` -------------------------------- ### Add Basic Item Info Source: https://xiao-momi.github.io/craft-engine-wiki/getting_start/create_first_item Enhance your item with a custom name and description using MiniMessage formatting. Remember to reload the config after saving. ```yaml items: tutorial:diamond: material: diamond data: item_name: "Shiny Diamond" lore: - "Epic Items" ``` -------------------------------- ### Apply Template with Overrides Source: https://xiao-momi.github.io/craft-engine-wiki/reference/template Use a template and completely replace specific configuration paths. Overrides perform a full swap, ignoring any existing values. ```yaml items: craftengine:custom_bread: template: craftengine:apple_template arguments: nutrition: 1 saturation: 2.5 overrides: material: bread ``` -------------------------------- ### Configure Basic Sound Event Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/sound Use this to define a simple sound event with a single sound file and optional subtitle. Ensure the sound file path is correct. ```yaml sounds: minecraft:custom_block.place: replace: false subtitle: subtitles.custom_block.place sounds: - "block/custom_block_1" ``` -------------------------------- ### Global Variable Text Formatting Source: https://xiao-momi.github.io/craft-engine-wiki/reference/text_format Use global variables defined in configurations to dynamically insert text. Example shows inserting a 'Rare tag' global variable. ```yaml item_name: " Rare spear" ``` -------------------------------- ### Correct Event Configuration for Furniture Source: https://xiao-momi.github.io/craft-engine-wiki/reference/events Demonstrates the correct placement of the 'events' section for furniture interactions. Events for furniture should be configured under the 'furniture' section, not the 'items' section. ```yaml items: default:bench: events: # ❌️ right_click: - type: command behavior: type: furniture_item furniture: events: # ✅️ right_click: - type: command ``` -------------------------------- ### Assign Tags to Items Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/recipe Assign vanilla tags to an item to allow it to be used in recipes that require those tags. This example adds 'minecraft:planks' and 'minecraft:wooden_tool_materials' to 'palm_planks'. ```yaml items: default:palm_planks: material: paper settings: fuel_time: 300 tags: - "minecraft:planks" - "minecraft:wooden_tool_materials" data: item_name: "Palm Planks" ``` -------------------------------- ### Create Trim-Based Equipment (1.20+) Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/equipment For versions 1.20 and above, use the 'trim' type for equipment. This method applies custom trims to invisible vanilla armor to achieve custom textures, but prevents further trimming. ```yaml equipments: # the equipment asset id default:topaz: type: trim humanoid: minecraft:entity/equipment/humanoid/topaz humanoid_leggings: minecraft:entity/equipment/humanoid_leggings/topaz ``` -------------------------------- ### Handle Placing Custom Furniture Source: https://xiao-momi.github.io/craft-engine-wiki/compatibility/skript Use this event to trigger actions when custom CraftEngine furniture is placed. You can filter by furniture type using string matchers. ```skript on place of custom furniture default:chinese_lantern: send "You clicked the custom block!" to event-player ``` -------------------------------- ### Define Custom Block Property Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/block/states Example of defining a custom property 'custom_axis' which does not have special placement behaviors. The block will use its default state regardless of placement direction. ```yaml custom_axis: type: axis default: y ``` -------------------------------- ### Configure OpenList Hosting Source: https://xiao-momi.github.io/craft-engine-wiki/getting_start/set_up_host/openlist This YAML snippet shows how to configure OpenList as a hosting type for resource pack delivery. It includes essential parameters like API URL, username, and password, as well as optional settings for upload paths and environment variable usage. ```yaml resource-pack: delivery: hosting: - type: openlist api-url: "" username: "" password: "" upload_path: "server_resource_pack.zip" # Optional options use_environment_variables: false disable_upload: false # file_password: "" # otp_code: "" ``` -------------------------------- ### Use Translatable Tag for Client-Side Translation Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/lang Insert the translatable tag to render client-side translations. This example shows how to use the tag to display a custom item name. ```yaml items: custom:translate: material: paper data: item_name: "" ``` -------------------------------- ### Define a Basic Template Source: https://xiao-momi.github.io/craft-engine-wiki/reference/template Define a template named 'namespace:my_first_template' with various options. This serves as a base for other configurations. ```yaml templates: namespace:my_first_template: option_1: true option_2: false option_3: - hello option_4: 20.25 option_5: hello: world ``` -------------------------------- ### Extended Range Mining Configuration Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/item/behaviors/range_mining_item Configures a topaz pickaxe with a more extensive range mining behavior. This example demonstrates a larger set of relative coordinates for the mining area. ```yaml items: default:topaz_pickaxe: material: golden_pickaxe behavior: - type: range_mining_item range: - 0,1,0 - 1,1,0 - -1,1,0 - 0,0,0 - 1,0,0 - -1,0,0 - 0,-1,0 - 1,-1,0 - -1,-1,0 ``` -------------------------------- ### Get Custom Block State in Skript Source: https://xiao-momi.github.io/craft-engine-wiki/compatibility/skript Retrieve the custom block state of a block using this expression in Skript. This is useful for checking specific states of custom blocks. ```skript on mine: send event-block's ce block state to event-player ``` -------------------------------- ### Get Custom Item by Namespace ID Source: https://xiao-momi.github.io/craft-engine-wiki/compatibility/skript Retrieve a custom item from CraftEngine using its unique namespace ID. This is essential for obtaining specific custom items in your scripts. ```skript set {_item} to custom item with namespace id "default:topaz" ``` -------------------------------- ### Play Sound Event Configuration Source: https://xiao-momi.github.io/craft-engine-wiki/reference/events Configure this event to play a sound for players. You can specify the sound, its location (if not targeting a specific player), pitch, volume, and sound source. ```yaml type: play_sound sound: minecraft:xxxx.xxx x: # optional if 'target' is specified; number y: # optional if 'target' is specified; number z: # optional if 'target' is specified; number target: "self" # optional; enum[all, self]/player selector pitch: 1 # optional; number; default: 1 volume: 1 # optional; number; default: 1 source: master # optional; enum[music, master, record, weather, block, hostile, neutral, player, ambient, voice, ui]; default: master ``` -------------------------------- ### Emoji with Hover Text and Coordinates Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/emoji Configures an emoji that displays player coordinates on hover using MiniMessage formatting. This example showcases advanced content customization with context-specific parameters. ```yaml emoji: default:emoji_location: permission: emoji.location content: "\"\" to send the \"\" emoji'>Current coordinates: ,," image: "default:icons:0:0" keywords: - ":pos:" ``` -------------------------------- ### Custom Font File Structure Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/image This demonstrates the file tree structure for custom font files. You do not need to create these manually; this is for understanding how vanilla fonts work. ```plaintext assets/[namespace]/font/[font_name].json ``` -------------------------------- ### Define a Global Variable for Image Replacement Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/global_variable Define a global variable that uses an image asset, such as an icon, to be used elsewhere. This example shows how to exclude a shadow effect from an image. ```yaml global_variables: coin_without_shadow: "" ``` -------------------------------- ### Define and Use Template with Arguments Source: https://xiao-momi.github.io/craft-engine-wiki/reference/template Define a template with parameters like '${nutrition}' and '${saturation}', then provide values for these parameters in the 'arguments' section when invoking the template. ```yaml templates: craftengine:apple_template: material: apple data: food: nutrition: "${nutrition}" saturation: "${saturation}" items: craftengine:custom_apple: template: craftengine:apple_template arguments: nutrition: 1 saturation: 2.5 ``` -------------------------------- ### Vertical Crop Block Configuration Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/block/behaviors/vertical_crop_block Configure the vertical_crop_block behavior for a block, specifying maximum height, growth speed, and direction. This example also includes the hanging_block behavior for context. ```yaml blocks: default:flame_cane: behaviors: - type: vertical_crop_block max_height: 4 grow_speed: 0.333 direction: down # up/down - type: hanging_block stackable: true delay: 1 ``` -------------------------------- ### Multi-line Content Formatting for Emojis Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/emoji Demonstrates multi-line support for complex emoji content configurations, which CraftEngine automatically merges into a single string. This improves readability for intricate setups. ```yaml content: - "" to send the "" emoji'> - - "Current coordinates: ,," - ``` -------------------------------- ### Create Component-Based Equipment (1.21.2+) Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/equipment Recommended for 1.21.2+, this method uses the 'component' type for equipment, allowing specification of various asset IDs for different body parts. ```yaml equipments: # the equipment asset id default:topaz: type: component humanoid: "minecraft:entity/equipment/humanoid/topaz" humanoid_leggings: "minecraft:entity/equipment/humanoid_leggings/topaz" # Add more layer types based on your needs happy_ghast_body: "minecraft:entity/equipment/happy_ghast_body/topaz" ``` -------------------------------- ### Define Brewing Recipe (1.20.2+) Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/recipe Defines a brewing recipe for versions 1.20.2 and above. Specify the ingredient, container, and the resulting item. ```yaml tea_art:tea: type: brewing ingredient: tea_art:tea_leaf container: tea_art:cup result: id: tea_art:cup_of_tea count: 1 ``` -------------------------------- ### Configure Multi-State Block IDs Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/block/states Use this configuration to set a starting ID for multi-state blocks. The plugin automatically assigns a range of consecutive IDs based on the total number of variants. ```yaml blocks: default:palm_leaves: states: id: 100 # The starting id properties: waterlogged: type: boolean default: false persistent: type: boolean default: true distance: type: int default: 7 range: 1~7 ``` -------------------------------- ### Spawn Furniture Source: https://xiao-momi.github.io/craft-engine-wiki/reference/events Use this event to spawn a furniture item at a specified location. Optional parameters include position, rotation, and variant. Play sound is enabled by default. ```yaml type: spawn_furniture furniture_id: "default:bench" # required; string x: # optional; number; default: y: # optional; number; default: z: # optional; number; default: pitch: # optional; number; default: yaw: # optional; number; default: variant: ground # optional; play_sound: true # optional; boolean; default: true ``` -------------------------------- ### Configure Furniture Item with Existing Furniture Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/item/behaviors/furniture_item Use this configuration to bind an item to an existing furniture definition. This allows the item to inherit properties and behaviors from the specified furniture. ```yaml items: default:bench: behavior: type: furniture_item rules: # Please refer to the rules below for details. ground: # variant # any / four / eight / sixteen / north / east / west / south rotation: four # any / center / half / quarter / corner alignment: center furniture: default:bench ignore_placer: false # Whether to ignore the placer's collision box during placement ignore_entities: false # Whether to ignore entity collision boxes during placement furniture: default:bench: settings: ... variants: ... loot: ... events: ... ``` -------------------------------- ### Adding a Custom Texture Path to the Atlas Source: https://xiao-momi.github.io/craft-engine-wiki/getting_start/add_custom_model This example demonstrates how to add a custom texture path to Minecraft's texture atlas. This allows the game to load textures from your specified 'custom' directory. ```json { "sources": [ { "type": "directory", "source": "custom", "prefix": "custom/" } ] } ``` -------------------------------- ### Use Multiple Templates Source: https://xiao-momi.github.io/craft-engine-wiki/reference/template Combine multiple templates by listing them under the 'template' key. If settings conflict, the later template overwrites the earlier one, unless the setting is a list, in which case they merge. ```yaml items: craftengine:custom_item: template: - namespace:my_first_template - namespace:my_second_template ``` -------------------------------- ### when Source: https://xiao-momi.github.io/craft-engine-wiki/reference/events Evaluates a source value and executes functions for the first matching case, similar to a switch-case statement. ```APIDOC ## when ### Description Evaluate a source value and executes the functions of the first matching case. It's similar to a switch-case statement in programming languages. ### Parameters #### Required - **source** (string) - The value to evaluate (e.g., a placeholder like ``). - **cases** (array) - A list of cases to match against the source value. - Each case must contain: - **when** (string or array of strings) - The value(s) to match. - **functions** (array) - A list of functions to execute if the case matches. #### Optional - **fallback** (array) - A list of functions to execute if no cases match. ### Example ```yaml type: when source: "" cases: - when: "world" functions: - type: message message: "You are in the overworld." - when: - "world_nether" - "world_the_end" functions: - type: message message: "You are in a dangerous dimension!" fallback: - type: message message: "You are in an unknown world." ``` ``` -------------------------------- ### Translate Built-in Block Names Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/lang Configure translations for block names by prefixing the block ID with 'block_name:'. This ensures compatibility with client-side and server-side translation plugins. Examples are provided for English and Chinese. ```yaml lang: en_us: block_name:default:chinese_lantern: Chinese Lantern block_name:default:netherite_anvil: Netherite Anvil block_name:default:topaz_ore: Topaz Ore zh_cn: block_name:default:chinese_lantern: 灯笼 block_name:default:netherite_anvil: 下界合金砧 block_name:default:topaz_ore: 黄玉矿石 ``` -------------------------------- ### Handle Placing Custom Blocks Source: https://xiao-momi.github.io/craft-engine-wiki/compatibility/skript Use this event to trigger actions when a custom CraftEngine block is placed. You can filter by specific block types using state matchers. ```skript on place of ce block default:palm_log[axis=y]: send "You placed the custom block!" to event-player ``` -------------------------------- ### Configure Simple Particle Block Behavior Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/block/behaviors/simple_particle_block Define a block's behavior to emit particles at a specified interval. This configuration sets up the basic particle emission for a block. ```yaml blocks: default:amethyst_torch: behavior: type: simple_particle_block tick_interval: 10 particles: - particle: smoke x: 0.5 y: 0.7 z: 0.5 count: 1 offset_x: 0 offset_y: 0 offset_z: 0 speed: 0 ``` -------------------------------- ### Use named arguments for context Source: https://xiao-momi.github.io/craft-engine-wiki/reference/text_format Shows how named arguments ('arg') can be used to insert context-specific values into strings. ```yaml # generates a random number between 0 and 1 # gets the last random number ``` -------------------------------- ### Configure Visual Result for Recipes Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/recipe The 'visual_result' feature hides the actual outcome of a recipe, useful for randomized items. This example sets a visual result for 'default:topaz_sword' and applies post-processors to modify its lore and remove attribute modifiers. ```yaml result: id: default:topaz_sword count: 1 visual_result: id: default:topaz_sword count: 1 post_processors: - type: apply_data data: remove_components: - attribute_modifiers lore: - "Attack Damage 1~3" - "Attack Speed 1~2" ``` -------------------------------- ### Configure Detailed Furniture Sounds Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/furniture/settings Allows for precise control over sound volume and pitch for specific furniture actions. You can configure individual sound properties or use a default sound ID. ```yaml sounds: break: id: minecraft:block.deepslate.break pitch: 0.5 volume: 0.25 place: minecraft:block.deepslate.step ``` -------------------------------- ### Loot Table Configuration with CraftEngine Items Source: https://xiao-momi.github.io/craft-engine-wiki/compatibility/datapack Configure loot tables for chests, block drops, or fishing using CraftEngine's `craftengine:item` type for custom items. This example shows a fishing loot table with both custom and vanilla items. ```json { "type": "minecraft:fishing", "pools": [ { "bonus_rolls": 0.0, "entries": [ { "type": "craftengine:item", "name": "default:palm_log", "weight": 60 }, { "type": "craftengine:item", "name": "default:chinese_lantern", "weight": 25 }, { "type": "minecraft:item", "name": "minecraft:tropical_fish", "weight": 2 }, { "type": "minecraft:item", "name": "minecraft:pufferfish", "weight": 13 } ], "rolls": 1.0 } ], "random_sequence": "minecraft:gameplay/fishing/fish" } ``` -------------------------------- ### Configure External Resource Pack Hosting Source: https://xiao-momi.github.io/craft-engine-wiki/getting_start/set_up_host/external Use this configuration to specify an external URL for your resource pack. This is useful for offloading bandwidth usage from your own server. Ensure you have the URL, and optionally UUID and SHA1, from your hosting provider. ```yaml resource-pack: delivery: hosting: - type: external url: "" uuid: "" # Optional sha1: "" # Optional ``` -------------------------------- ### spawn_furniture Source: https://xiao-momi.github.io/craft-engine-wiki/reference/events Spawns a furniture item at a specified location with optional parameters for rotation, sound, and variant. ```APIDOC ## spawn_furniture ### Description Spawn a furniture ### Parameters #### Required - **furniture_id** (string) - The ID of the furniture to spawn. #### Optional - **x** (number) - The X coordinate for the furniture's position. - **y** (number) - The Y coordinate for the furniture's position. - **z** (number) - The Z coordinate for the furniture's position. - **pitch** (number) - The pitch rotation for the furniture. - **yaw** (number) - The yaw rotation for the furniture. - **variant** (string) - The variant of the furniture. - **play_sound** (boolean) - Whether to play a sound when spawning. Defaults to true. ### Example ```yaml type: spawn_furniture furniture_id: "default:bench" x: 10 y: 64 z: 20 variant: "ground" play_sound: false ``` ``` -------------------------------- ### Display Item Furniture Configuration Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/furniture/behaviors/display_item_furniture Configure the display_item_furniture behavior for a furniture item. Specify the data key for the item to be displayed, and define sounds for item placement and removal. The 'variants' section allows for precise item positioning and hitbox definitions. ```yaml furniture: default:showcase: behavior: type: display_item_furniture data_key: craftengine:display_item sounds: put: minecraft:block.decorated_pot.insert take: minecraft:block.decorated_pot.insert_fail variants: ground: item_position: 0,0.07,0 hitboxes: [] # See the [Hitboxes] section under [📍 Furniture Variants] ``` -------------------------------- ### YAML Section Delimiters for Structured Keys Source: https://xiao-momi.github.io/craft-engine-wiki/configuration Demonstrates using '::' to split a standard key into a structured mapping key with complex hierarchies, equivalent to nested mappings. ```yaml # Single-line format key::subkey::nested_key: value # Expanded format key: subkey: nested_key: value ``` -------------------------------- ### Configure Advanced Sound Event with Multiple Sounds Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/sound Configure a sound event with multiple sound files, each with customizable properties like volume, weight, and streaming. This allows for varied playback of ambient sounds. ```yaml sounds: minecraft:custom_ambient.custom_biome: replace: false subtitle: subtitles.custom_ambient.custom_biome sounds: - name: "ambient/custom_biome_1" volume: 0.4 weight: 3 - name: "ambient/custom_biome_2" volume: 0.4 weight: 7 - name: "ambient/custom_biome_3" volume: 0.4 weight: 10 stream: false attenuation_distance: 16 preload: false type: "file" ``` -------------------------------- ### Use PlaceholderAPI placeholders Source: https://xiao-momi.github.io/craft-engine-wiki/reference/text_format Integrates PlaceholderAPI placeholders into item names for dynamic content. Supports basic placeholders. ```yaml item_name: "<#FF8C00>'s Topaz Rod" ``` -------------------------------- ### Add CraftEngine Repository (Maven) Source: https://xiao-momi.github.io/craft-engine-wiki/api Configure your Maven build to use the CraftEngine releases repository. ```xml momirealms-repo https://repo.momirealms.net/releases/ ``` -------------------------------- ### Configure Simple Storage Furniture Source: https://xiao-momi.github.io/craft-engine-wiki/configuration/furniture/behaviors/simple_storage_furniture Defines a storage block with a specific data key, title, number of rows, and sounds for opening and closing. ```yaml furniture: default:storage_core: behavior: type: simple_storage_furniture data_key: craftengine:simple_storage_contents title: Storage Core rows: 3 # 1~6 sounds: open: minecraft:block.iron_trapdoor.open close: minecraft:block.iron_trapdoor.close ```