diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 0f8e59d7..65b5c564 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -6,7 +6,7 @@ import { withMermaid } from "vitepress-plugin-mermaid"; // https://vitepress.dev/reference/site-config export default withMermaid({ lang: 'zh-CN', - title: "我的世界中国版 ModSDK", + title: "我的世界中国版 Wiki", description: "ModSDK 开发者文档 镜像,但提供更优质的搜索", ignoreDeadLinks: true, // 替换原生搜索组件,自定义展示的搜索结果内容 @@ -59,7 +59,7 @@ export default withMermaid({ // https://vitepress.dev/reference/default-theme-config nav: [ { text: '首页', link: '/' }, - { text: 'Wiki', link: '/wiki/0-欢迎' }, + { text: 'Wiki', link: '/wiki' }, { text: 'API文档', link: '/mcdocs/0-欢迎' }, { text: '开发指南', link: '/mcguide/0-欢迎' }, { text: '教学课程', link: '/mconline/0-欢迎' }, diff --git a/docs/.vitepress/theme/components/content/Button.vue b/docs/.vitepress/theme/components/content/Button.vue new file mode 100644 index 00000000..05ce7355 --- /dev/null +++ b/docs/.vitepress/theme/components/content/Button.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/docs/.vitepress/theme/components/content/Checklist.vue b/docs/.vitepress/theme/components/content/Checklist.vue new file mode 100644 index 00000000..6e950e48 --- /dev/null +++ b/docs/.vitepress/theme/components/content/Checklist.vue @@ -0,0 +1,129 @@ + + + + + diff --git a/docs/.vitepress/theme/components/content/FolderView/FolderView.vue b/docs/.vitepress/theme/components/content/FolderView/FolderView.vue new file mode 100644 index 00000000..918dc861 --- /dev/null +++ b/docs/.vitepress/theme/components/content/FolderView/FolderView.vue @@ -0,0 +1,57 @@ + + + diff --git a/docs/.vitepress/theme/components/content/FolderView/FolderViewChild.vue b/docs/.vitepress/theme/components/content/FolderView/FolderViewChild.vue new file mode 100644 index 00000000..cb04126c --- /dev/null +++ b/docs/.vitepress/theme/components/content/FolderView/FolderViewChild.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index c50c66b4..5396c217 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -2,6 +2,9 @@ import DefaultTheme from 'vitepress/theme' import MyFeatures from './components/MyFeatures.vue' import CodeHeader from './components/content/CodeHeader.vue' import WikiImage from './components/content/WikiImage.vue' +import Button from './components/content/Button.vue' +import FolderView from './components/content/FolderView/FolderView.vue' +import Checklist from './components/content/Checklist.vue' export default { extends: DefaultTheme, @@ -9,5 +12,8 @@ export default { app.component('MyFeatures', MyFeatures); app.component('CodeHeader', CodeHeader); app.component('WikiImage', WikiImage); + app.component('BButton', Button); + app.component('Checklist', Checklist); + app.component('FolderView', FolderView); } } \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 22fd10f3..9dd7cc3e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,27 +3,27 @@ layout: home hero: - name: "我的世界中国版 ModSDK" + name: "我的世界中国版 ModSDK Wiki" text: "" - tagline: "ModSDK 开发者文档镜像,但提供更优质的搜索引擎 🤩" + tagline: "《我的世界》开发者文档,但提供更优质的搜索引擎 🤩" actions: - theme: brand text: 开始 link: /wiki/0-欢迎 features: + - icon: 🎯 + title: BedrockWiki 中文镜像 + details: 国际版社区的超优质文档,助你更快地找到你需要的内容,更深入地理解引擎机制。 + link: /wiki - icon: 🛠️ - title: API文档 - details: API是构建缤纷方块世界的基石,快来查查哪一个是你需要的。 + title: ModSDK API文档 + details: 中国版 ModSDK(Python2)API 文档。相比于官网,我们提供了更优质的搜索引擎! link: /mcdocs/0-欢迎 - icon: 📙 - title: 开发指南 + title: 中国版开发指南 details: 在开发指南中浏览每一个开发工具的使用说明,让它们更加得心应手。 link: /mcguide/0-欢迎 - - icon: 📝 - title: 教学课程 - details: 不断更新的系列课程,系统性地帮助您搭建开发知识体系。 - link: /mconline/0-欢迎 ---
diff --git a/docs/wiki/2-方块/1-基础/blocks-experimental.md b/docs/wiki/2-方块/1-基础/blocks-experimental.md deleted file mode 100644 index 334038d7..00000000 --- a/docs/wiki/2-方块/1-基础/blocks-experimental.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: 实验性方块 -category: 通用 -tags: - - 信息 - - 实验性 -mentions: - - SmokeyStack - - MedicalJewel105 - - QuazChick ---- - -# 实验性方块 - - - -:::tip 格式版本 `1.20.30` -在创建自定义方块时使用最新格式版本,可获取最新功能和改进。本维基旨在分享自定义方块的最新信息,当前目标格式版本为 `1.20.30`。 -::: - -本文作为索引文档,概述自定义方块功能的实验性要求。 - -## 方块组件 - -| 组件 | 所需实验性功能 | -| ------------------------------------------------------------------------------------------- | --------------------------------- | -| [`minecraft:collision_box`](/blocks/block-components#collision-box) | 无(格式版本1.19.50及以上) | -| [`minecraft:crafting_table`](/blocks/block-components#crafting-table) | 无(格式版本1.19.50及以上) | -| [`minecraft:destructible_by_explosion`](/blocks/block-components#destructible-by-explosion) | 无 | -| [`minecraft:destructible_by_mining`](/blocks/block-components#destructible-by-mining) | 无 | -| [`minecraft:display_name`](/blocks/block-components#display-name) | 无(格式版本1.19.60及以上) | -| [`minecraft:flammable`](/blocks/block-components#flammable) | 无 | -| [`minecraft:friction`](/blocks/block-components#friction) | 无 | -| [`minecraft:geometry`](/blocks/block-components#geometry) | 无(格式版本1.19.40及以上) | -| [`minecraft:light_dampening`](/blocks/block-components#light-dampening) | 无 | -| [`minecraft:light_emission`](/blocks/block-components#light-emission) | 无 | -| [`minecraft:loot`](/blocks/block-components#loot) | 无 | -| [`minecraft:map_color`](/blocks/block-components#map-color) | 无 | -| [`minecraft:material_instances`](/blocks/block-components#material-instances) | 无(格式版本1.19.40及以上) | -| [`minecraft:placement_filter`](/blocks/block-components#placement-filter) | 无(格式版本1.19.60及以上) | -| [`minecraft:selection_box`](/blocks/block-components#selection-box) | 无(格式版本1.19.60及以上) | -| [`minecraft:transformation`](/blocks/block-components#transformation) | 无 | -| [`minecraft:unit_cube`](/blocks/block-components#unit-cube) | **`假日创作者功能(Holiday Creator Features)`** | - -## 方块状态 - -_从实验性功能 **`假日创作者功能`** 中释放,适用于格式版本1.19.70及以上。_ - -## 方块特性 - -| 特性 | 所需实验性功能 | -| ------------------------------------------------------------------------------- | --------------------------------- | -| [`minecraft:placement_direction`](/blocks/block-components#placement-direction) | 无(格式版本1.20.20及以上) | -| [`minecraft:placement_position`](/blocks/block-components#placement-position) | 无(格式版本1.20.20及以上) | - -## 方块置换 - -_从实验性功能 **`假日创作者功能`** 中释放,适用于格式版本1.19.70及以上。_ - -## 方块事件与触发器 - -**完整功能仍处于实验性阶段,需启用 `假日创作者功能`。** \ No newline at end of file diff --git a/docs/wiki/2-方块/4-原版再创作/custom-glazed-terracotta.md b/docs/wiki/2-方块/4-原版再创作/custom-glazed-terracotta.md deleted file mode 100644 index 32c197ca..00000000 --- a/docs/wiki/2-方块/4-原版再创作/custom-glazed-terracotta.md +++ /dev/null @@ -1,289 +0,0 @@ ---- -title: Custom Glazed Terracotta -category: Vanilla Re-Creations -tags: - - easy -mentions: - - Kaioga5 ---- - -::: tip FORMAT & MIN ENGINE VERSION `1.20.40` -This tutorial assumes a basic understanding of blocks. -Check out the [blocks guide](/blocks/blocks-intro) before starting. -::: - - -## Introduction -Glazed Terracotta has its own rotation mechanism, enabling players to craft aesthetically pleasing patterns for walls, floors, and ceilings. This guide will instruct you on creating your own blocks resembling glazed terracotta. - -## Custom Glazed Terracotta -This will create a vanilla-like custom glazed terracotta. - -BP/blocks/custom_glazed_terracotta.json - -```json -{ - "format_version": "1.20.40", - "minecraft:block": { - "description": { - "identifier": "wiki:glazed_terracotta_template", - "menu_category": { - "category": "construction", - "group": "itemGroup.name.glazedTerracotta" - }, - "traits": { - "minecraft:placement_direction": { - "enabled_states": [ - "minecraft:cardinal_direction" - ] - } - } - }, - "permutations": [ - { - "condition": "q.block_state('minecraft:cardinal_direction') == 'north'", - "components": { - "minecraft:transformation": { "rotation": [0, 0, 0] }, - "minecraft:geometry": { - "identifier": "geometry.glazed_terracotta", - "bone_visibility": { - "bottom_1": false, - "bottom_2": false, - "bottom_3": false, - "bottom_4": true - } - } - } - }, - { - "condition": "q.block_state('minecraft:cardinal_direction') == 'west'", - "components": { - "minecraft:transformation": { "rotation": [0, 90, 0] }, - "minecraft:geometry": { - "identifier": "geometry.glazed_terracotta", - "bone_visibility": { - "bottom_1": false, - "bottom_2": false, - "bottom_3": true, - "bottom_4": false - } - } - } - }, - { - "condition": "q.block_state('minecraft:cardinal_direction') == 'south'", - "components": { - "minecraft:transformation": { "rotation": [0, 180, 0] }, - "minecraft:geometry": { - "identifier": "geometry.glazed_terracotta", - "bone_visibility": { - "bottom_1": false, - "bottom_2": true, - "bottom_3": false, - "bottom_4": false - } - } - } - }, - { - "condition": "q.block_state('minecraft:cardinal_direction') == 'east'", - "components": { - "minecraft:transformation": { "rotation": [0, -90, 0] }, - "minecraft:geometry": { - "identifier": "geometry.glazed_terracotta", - "bone_visibility": { - "bottom_1": true, - "bottom_2": false, - "bottom_3": false, - "bottom_4": false - } - } - } - } - ], - "components": { - "minecraft:geometry": { - "identifier": "geometry.glazed_terracotta" - }, - "minecraft:material_instances": { - "*": { - "texture": "purple_glazed_terracotta", - "render_method": "opaque" - } - } - } - } -} -``` - -## Geometry -Vanilla glazed terracotta rotates certain faces of the block with some specific values, which is what gives the block it's magic. Use the following geometry to replicate that behavior. - - - -RP/models/blocks/glazed_terracotta.geo.json - -```json -{ - "format_version": "1.12.0", - "minecraft:geometry": [ - { - "description": { - "identifier": "geometry.glazed_terracotta", - "texture_width": 16, - "texture_height": 16, - "visible_bounds_width": 4, - "visible_bounds_height": 3.5, - "visible_bounds_offset": [0, 1.25, 0] - }, - "bones": [ - { - "name": "glazed_terracotta", - "pivot": [0, 0, 0] - }, - { - "name": "top", - "parent": "glazed_terracotta", - "pivot": [0, 0, 0], - "cubes": [ - { - "origin": [-8, 0, -8], - "size": [16, 16, 16], - "uv": { - "up": {"uv": [16, 16], "uv_size": [-16, -16]} - } - } - ] - }, - { - "name": "north", - "parent": "glazed_terracotta", - "pivot": [0, 8, 0], - "cubes": [ - { - "origin": [-8, 0, -8], - "size": [16, 16, 0], - "pivot": [0, 8, 0], - "rotation": [180, 0, 90], - "uv": { - "north": {"uv": [16, 16], "uv_size": [-16, -16]} - } - } - ] - }, - { - "name": "south", - "parent": "glazed_terracotta", - "pivot": [0, 0, 0], - "cubes": [ - { - "origin": [0, -8, 8], - "size": [16, 16, 0], - "pivot": [0, 0, 0], - "rotation": [180, 0, 270], - "uv": { - "south": {"uv": [0, 0], "uv_size": [16, 16]} - } - } - ] - }, - { - "name": "east", - "parent": "glazed_terracotta", - "pivot": [0, 0, 0], - "cubes": [ - { - "origin": [-8, -16, -8], - "size": [0, 16, 16], - "pivot": [0, 0, 0], - "rotation": [0, 0, -180], - "uv": { - "east": {"uv": [16, 16], "uv_size": [-16, -16]} - } - } - ] - }, - { - "name": "west", - "parent": "glazed_terracotta", - "pivot": [-16, 0, 0], - "cubes": [ - { - "origin": [-24, 0, -8], - "size": [0, 16, 16], - "pivot": [-16, 0, 0], - "rotation": [0, 180, 0], - "uv": { - "west": {"uv": [16, 16], "uv_size": [-16, -16]} - } - } - ] - }, - { - "name": "bottom", - "parent": "glazed_terracotta", - "pivot": [0, 0, 0] - }, - { - "name": "bottom_1", - "parent": "bottom", - "pivot": [0, 0, 0], - "cubes": [ - { - "origin": [-8, 0, -8], - "size": [16, 0, 16], - "uv": { - "down": {"uv": [0, 0], "uv_size": [16, 16]} - } - } - ] - }, - { - "name": "bottom_2", - "parent": "bottom", - "pivot": [0, 0, 0], - "cubes": [ - { - "origin": [-8, 0, -8], - "size": [16, 0, 16], - "uv": { - "down": {"uv": [16, 16], "uv_size": [-16, -16]} - } - } - ] - }, - { - "name": "bottom_3", - "parent": "bottom", - "pivot": [0, 0, 0], - "cubes": [ - { - "origin": [-8, 0, -8], - "size": [16, 0, 16], - "uv": { - "down": {"uv": [0, 0], "uv_size": [16, 16]} - } - } - ] - }, - { - "name": "bottom_4", - "parent": "bottom", - "pivot": [0, 0, 0], - "cubes": [ - { - "origin": [-8, 0, -8], - "size": [16, 0, 16], - "uv": { - "down": {"uv": [16, 16], "uv_size": [-16, -16]} - } - } - ] - } - ] - } - ] -} -``` - - diff --git a/docs/wiki/2-方块/3-巧思案例/applying-effects.md b/docs/wiki/blocks/applying-effects.md similarity index 95% rename from docs/wiki/2-方块/3-巧思案例/applying-effects.md rename to docs/wiki/blocks/applying-effects.md index 5d929bac..d8a33750 100644 --- a/docs/wiki/2-方块/3-巧思案例/applying-effects.md +++ b/docs/wiki/blocks/applying-effects.md @@ -1,6 +1,6 @@ --- title: 持续效果应用指南 -category: 教程 +category: 巧思案例 tags: - 实验性内容 - 初级难度 @@ -16,7 +16,7 @@ mentions: ::: tip 格式要求 & 最低引擎版本 `1.20.30` -本教程假设您已掌握[方块状态](/blocks/block-states)的基本概念。建议在开始前先阅读[方块基础指南](/blocks/blocks-intro)。 +本教程假设您已掌握[方块状态](/wiki/blocks/block-states)的基本概念。建议在开始前先阅读[方块基础指南](/wiki/blocks/blocks-intro)。 ::: ::: warning 实验性功能 diff --git a/docs/wiki/2-方块/3-巧思案例/avoiding-state-limit.md b/docs/wiki/blocks/avoiding-state-limit.md similarity index 98% rename from docs/wiki/2-方块/3-巧思案例/avoiding-state-limit.md rename to docs/wiki/blocks/avoiding-state-limit.md index cdb687be..df8f5ae9 100644 --- a/docs/wiki/2-方块/3-巧思案例/avoiding-state-limit.md +++ b/docs/wiki/blocks/avoiding-state-limit.md @@ -1,6 +1,6 @@ --- title: 规避状态值上限 -category: 教程 +category: 巧思案例 tags: - 专家 mentions: diff --git a/docs/wiki/2-方块/1-基础/block-components.md b/docs/wiki/blocks/block-components.md similarity index 95% rename from docs/wiki/2-方块/1-基础/block-components.md rename to docs/wiki/blocks/block-components.md index 89922a56..d89fa6aa 100644 --- a/docs/wiki/2-方块/1-基础/block-components.md +++ b/docs/wiki/blocks/block-components.md @@ -1,7 +1,7 @@ --- title: 方块组件 description: 方块组件用于改变方块在世界中的外观和功能。 -category: 常规 +category: 基础 nav_order: 2 mentions: - SirLich @@ -28,14 +28,14 @@ mentions: 在创建自定义方块时使用最新格式版本可获取最新功能和改进。本wiki旨在提供关于自定义方块的最新信息,当前目标格式版本为`1.20.30`。 ::: :::danger -每个组件在同一时间只能有一个实例生效。重复的组件将被最新的[permutation(条件置换)](/blocks/block-permutations)覆盖。 +每个组件在同一时间只能有一个实例生效。重复的组件将被最新的[permutation(条件置换)](/wiki/blocks/block-permutations)覆盖。 ::: -需要事件触发组件?[点击此处查看!](/blocks/block-events#event-triggers) +需要事件触发组件?[点击此处查看!](/wiki/blocks/block-events#event-triggers) ## 应用组件 -方块组件用于改变方块在世界中的外观和功能。它们被应用在`minecraft:block`或其[permutation(条件置换)](/blocks/block-permutations)的`components`子项中。 +方块组件用于改变方块在世界中的外观和功能。它们被应用在`minecraft:block`或其[permutation(条件置换)](/wiki/blocks/block-permutations)的`components`子项中。 ::: code-group @@ -264,7 +264,7 @@ _自实验性玩法`Holiday Creator Features`中发布,适用于格式版本1. 隐藏模型中骨骼的直接子立方体。 -**Molang表达式需遵守[条件置换限制](/blocks/block-permutations#permutation-conditions)。** +**Molang表达式需遵守[条件置换限制](/wiki/blocks/block-permutations#permutation-conditions)。** _自格式版本1.20.10起支持`bone_visibility`中的Molang表达式。_ @@ -358,7 +358,7 @@ _自格式版本1.20.10起支持`bone_visibility`中的Molang表达式。_ - 所有实例必须使用相同的渲染方法 - 与其他方块相交时,方块面会无条件变暗 -材质实例可与`RP/blocks.json`条目结合使用,创建具有类不透明属性的方块。这主要用于在[自定义玻璃方块](/blocks/custom-glass-blocks)上启用面剔除。 +材质实例可与`RP/blocks.json`条目结合使用,创建具有类不透明属性的方块。这主要用于在[自定义玻璃方块](/wiki/blocks/custom-glass-blocks)上启用面剔除。 _自实验性玩法`Holiday Creator Features`中发布,适用于格式版本1.19.40及以上。_ @@ -458,7 +458,7 @@ _自实验性玩法`Holiday Creator Features`中发布,适用于格式版本1. ``` ::: -查看[此页面](/blocks/block-tags)获取原版标签及相关方块列表。 +查看[此页面](/wiki/blocks/block-tags)获取原版标签及相关方块列表。 ## 选择箱 @@ -502,7 +502,7 @@ _自实验性玩法`Holiday Creator Features`中发布,适用于格式版本1. **变换后的模型不得超过[几何模型限制](#geometry)。** :::tip -学习如何应用[可旋转方块](/blocks/rotatable-blocks),就像熔炉和生物头颅一样根据放置方向旋转! +学习如何应用[可旋转方块](/wiki/blocks/rotatable-blocks),就像熔炉和生物头颅一样根据放置方向旋转! ::: ::: code-group diff --git a/docs/wiki/2-方块/1-基础/block-events.md b/docs/wiki/blocks/block-events.md similarity index 98% rename from docs/wiki/2-方块/1-基础/block-events.md rename to docs/wiki/blocks/block-events.md index 60feb839..c31f3c94 100644 --- a/docs/wiki/2-方块/1-基础/block-events.md +++ b/docs/wiki/blocks/block-events.md @@ -1,7 +1,7 @@ --- title: 方块事件与触发器 description: 方块事件允许你在满足特定条件时操控游戏世界。 -category: 常规 +category: 基础 nav_order: 8 tags: - 实验性功能 @@ -462,7 +462,7 @@ _此示例在实体踏上方块时生成战利品_ ## 事件触发器 -事件触发器通过[组件](/blocks/block-components)定义,可通过[permutations](/blocks/block-permutations)动态添加、修改或移除。 +事件触发器通过[组件](/wiki/blocks/block-components)定义,可通过[permutations](/wiki/blocks/block-permutations)动态添加、修改或移除。 - [`minecraft:on_fall_on`](#跌落触发) - [`minecraft:on_interact`](#交互触发) diff --git a/docs/wiki/2-方块/2-外观/block-models.md b/docs/wiki/blocks/block-models.md similarity index 92% rename from docs/wiki/2-方块/2-外观/block-models.md rename to docs/wiki/blocks/block-models.md index 4941aec8..e1de6dca 100644 --- a/docs/wiki/2-方块/2-外观/block-models.md +++ b/docs/wiki/blocks/block-models.md @@ -1,6 +1,6 @@ --- title: 创建方块模型 -category: 教程 +category: 巧思案例 tags: - 新手 - 简单 @@ -12,9 +12,9 @@ mentions: -尽管自定义方块无法使用原版的[方块形状](/blocks/block-shapes),但我们可以创建遵循类似实体模型格式的自定义模型。本教程将引导您使用[Blockbench](https://blockbench.net)为"纸袋"创建自定义方块模型。通过学习本教程,您将掌握专为自定义方块设计的Minecraft几何体核心功能。 +尽管自定义方块无法使用原版的[方块形状](/wiki/blocks/block-shapes),但我们可以创建遵循类似实体模型格式的自定义模型。本教程将引导您使用[Blockbench](https://blockbench.net)为"纸袋"创建自定义方块模型。通过学习本教程,您将掌握专为自定义方块设计的Minecraft几何体核心功能。 -**注意:** 自定义方块模型必须符合[模型尺寸限制](/blocks/block-components.html#geometry)。 +**注意:** 自定义方块模型必须符合[模型尺寸限制](/wiki/blocks/block-components.html#geometry)。 ## 模型设置 diff --git a/docs/wiki/2-方块/1-基础/block-permutations.md b/docs/wiki/blocks/block-permutations.md similarity index 93% rename from docs/wiki/2-方块/1-基础/block-permutations.md rename to docs/wiki/blocks/block-permutations.md index b63f5f21..b93c675f 100644 --- a/docs/wiki/2-方块/1-基础/block-permutations.md +++ b/docs/wiki/blocks/block-permutations.md @@ -1,18 +1,18 @@ --- -title: 方块变换(转体) +title: 方块变换(置换) description: 方块变换数组提供了一种基于当前置换条件性应用组件的方法。 -category: 常规 +category: 基础 nav_order: 7 mentions: - QuazChick --- -# 方块变换(转体) +# 方块变换(置换) :::tip 格式要求 & 最低引擎版本 `1.20.30` -在学习方块变换前,您应当已熟练掌握[方块状态](/blocks/block-states)知识。 +在学习方块变换前,您应当已熟练掌握[方块状态](/wiki/blocks/block-states)知识。 使用方块状态时,请确保资源包清单中的`min_engine_version`为`1.20.20`或更高版本。 ::: @@ -25,7 +25,7 @@ mentions: `permutations`数组是`minecraft:block`的直接子项,由包含组件的对象组成。当条件判断为真值(非false或0)时,相关组件将被应用。 -**置换条件必须遵守其[Molang限制条件](#置换条件限制)。** +**置换条件必须遵守其 [限制条件](#置换条件限制)。** _自实验性玩法`Holiday Creator Features`发布,支持格式版本1.19.70及更高。_ diff --git a/docs/wiki/2-方块/5-文档/block-shapes.md b/docs/wiki/blocks/block-shapes.md similarity index 100% rename from docs/wiki/2-方块/5-文档/block-shapes.md rename to docs/wiki/blocks/block-shapes.md diff --git a/docs/wiki/2-方块/5-文档/block-sounds.md b/docs/wiki/blocks/block-sounds.md similarity index 100% rename from docs/wiki/2-方块/5-文档/block-sounds.md rename to docs/wiki/blocks/block-sounds.md diff --git a/docs/wiki/2-方块/1-基础/block-states.md b/docs/wiki/blocks/block-states.md similarity index 89% rename from docs/wiki/2-方块/1-基础/block-states.md rename to docs/wiki/blocks/block-states.md index deaa1c1a..d4459c8a 100644 --- a/docs/wiki/2-方块/1-基础/block-states.md +++ b/docs/wiki/blocks/block-states.md @@ -1,7 +1,7 @@ --- title: 方块状态 description: 方块状态允许你的方块拥有多种变体,每种变体通过使用置换具备独特的功能和外观。 -category: 常规 +category: 基础 nav_order: 4 mentions: - QuazChick @@ -15,7 +15,7 @@ mentions: 使用方块状态时,请确保资源包清单中的 `min_engine_version` 设置为 `1.20.20` 或更高。 ::: -方块状态允许你的方块拥有多种变体,每种变体通过使用[置换](/blocks/block-permutations)具备独特的功能和外观。 +方块状态允许你的方块拥有多种变体,每种变体通过使用[置换](/wiki/blocks/block-permutations)具备独特的功能和外观。 ## 定义状态 @@ -23,7 +23,7 @@ mentions: ### 置换数量限制 -**每个状态最多可定义 16 个有效值。所有可能的状态值组合([置换](/blocks/block-permutations))总数不应超过 65,536。** +**每个状态最多可定义 16 个有效值。所有可能的状态值组合([置换](/wiki/blocks/block-permutations))总数不应超过 65,536。** 计算方块置换总数时,需将所有状态的有效值数量相乘。例如下方示例的计算公式为 3 × 2 × 3 × 6,说明该方块具有 108 种可能的置换组合。 @@ -66,7 +66,7 @@ q.block_state('wiki:string_state_example') == 'blue' ### 命令参数 -在 `execute` 和 `testforblock` 等命令中使用[方块状态参数](/commands/block-states)来检查状态值。 +在 `execute` 和 `testforblock` 等命令中使用[方块状态参数](/wiki/commands/block-states)来检查状态值。 ```c execute if block ~~~ wiki:custom_block["wiki:string_state_example"="blue", "wiki:integer_state_example"=4] run kill @@ -88,7 +88,7 @@ customBlock.permutation.getState("wiki:integer_state_example") === 3 ### 命令参数 -在 `setblock` 和 `fill` 等命令中使用[方块状态参数](/commands/block-states)来修改默认状态值。 +在 `setblock` 和 `fill` 等命令中使用[方块状态参数](/wiki/commands/block-states)来修改默认状态值。 ```c setblock ~~~ wiki:custom_block["wiki:string_state_example"="blue", "wiki:integer_state_example"=4] @@ -114,7 +114,7 @@ customBlock.setPermutation( 方块事件需启用 `Holiday Creator Features` 实验性玩法。 ::: -使用 [`set_block_state`](/blocks/block-events#set-block-state) 事件响应可以修改自定义方块状态的值。 +使用 [`set_block_state`](/wiki/blocks/block-events#set-block-state) 事件响应可以修改自定义方块状态的值。 ::: code-group ```json [minecraft:block > events] diff --git a/docs/wiki/2-方块/1-基础/block-tags.md b/docs/wiki/blocks/block-tags.md similarity index 99% rename from docs/wiki/2-方块/1-基础/block-tags.md rename to docs/wiki/blocks/block-tags.md index f464431d..dd666c27 100644 --- a/docs/wiki/2-方块/1-基础/block-tags.md +++ b/docs/wiki/blocks/block-tags.md @@ -1,6 +1,6 @@ --- title: 方块标签 -category: 常规 +category: 基础 nav_order: 3 mentions: - SirLich diff --git a/docs/wiki/2-方块/3-巧思案例/block-texture-variation.md b/docs/wiki/blocks/block-texture-variation.md similarity index 99% rename from docs/wiki/2-方块/3-巧思案例/block-texture-variation.md rename to docs/wiki/blocks/block-texture-variation.md index 99f7eece..896adbcb 100644 --- a/docs/wiki/2-方块/3-巧思案例/block-texture-variation.md +++ b/docs/wiki/blocks/block-texture-variation.md @@ -1,6 +1,6 @@ --- title: 纹理变体 -category: 教程 +category: 巧思案例 tags: - 中级 mentions: diff --git a/docs/wiki/2-方块/1-基础/block-traits.md b/docs/wiki/blocks/block-traits.md similarity index 98% rename from docs/wiki/2-方块/1-基础/block-traits.md rename to docs/wiki/blocks/block-traits.md index 97e55ebf..07c5a7d8 100644 --- a/docs/wiki/2-方块/1-基础/block-traits.md +++ b/docs/wiki/blocks/block-traits.md @@ -1,7 +1,7 @@ --- title: 方块特性 description: 方块特性可轻松为自定义方块应用原版方块状态(如朝向),无需借助事件和触发器。 -category: 常规 +category: 基础 nav_order: 5 mentions: - QuazChick @@ -12,7 +12,7 @@ mentions: :::tip 格式要求 & 最低引擎版本 `1.20.30` -在学习方块特性前,您应当已熟练掌握[方块状态](/blocks/block-states)知识。 +在学习方块特性前,您应当已熟练掌握[方块状态](/wiki/blocks/block-states)知识。 使用方块状态时,请确保资源包清单中的`min_engine_version`为`1.20.20`或更高版本。 ::: diff --git a/docs/wiki/blocks/blocks-experimental.md b/docs/wiki/blocks/blocks-experimental.md new file mode 100644 index 00000000..20eadfb5 --- /dev/null +++ b/docs/wiki/blocks/blocks-experimental.md @@ -0,0 +1,62 @@ +--- +title: 实验性方块 +category: 基础 +tags: + - 信息 + - 实验性 +mentions: + - SmokeyStack + - MedicalJewel105 + - QuazChick +--- + +# 实验性方块 + + + +:::tip 格式版本 `1.20.30` +在创建自定义方块时使用最新格式版本,可获取最新功能和改进。本维基旨在分享自定义方块的最新信息,当前目标格式版本为 `1.20.30`。 +::: + +本文作为索引文档,概述自定义方块功能的实验性要求。 + +## 方块组件 + +| 组件 | 所需实验性功能 | +| ------------------------------------------------------------------------------------------- | --------------------------------- | +| [`minecraft:collision_box`](/wiki/blocks/block-components#collision-box) | 无(格式版本1.19.50及以上) | +| [`minecraft:crafting_table`](/wiki/blocks/block-components#crafting-table) | 无(格式版本1.19.50及以上) | +| [`minecraft:destructible_by_explosion`](/wiki/blocks/block-components#destructible-by-explosion) | 无 | +| [`minecraft:destructible_by_mining`](/wiki/blocks/block-components#destructible-by-mining) | 无 | +| [`minecraft:display_name`](/wiki/blocks/block-components#display-name) | 无(格式版本1.19.60及以上) | +| [`minecraft:flammable`](/wiki/blocks/block-components#flammable) | 无 | +| [`minecraft:friction`](/wiki/blocks/block-components#friction) | 无 | +| [`minecraft:geometry`](/wiki/blocks/block-components#geometry) | 无(格式版本1.19.40及以上) | +| [`minecraft:light_dampening`](/wiki/blocks/block-components#light-dampening) | 无 | +| [`minecraft:light_emission`](/wiki/blocks/block-components#light-emission) | 无 | +| [`minecraft:loot`](/wiki/blocks/block-components#loot) | 无 | +| [`minecraft:map_color`](/wiki/blocks/block-components#map-color) | 无 | +| [`minecraft:material_instances`](/wiki/blocks/block-components#material-instances) | 无(格式版本1.19.40及以上) | +| [`minecraft:placement_filter`](/wiki/blocks/block-components#placement-filter) | 无(格式版本1.19.60及以上) | +| [`minecraft:selection_box`](/wiki/blocks/block-components#selection-box) | 无(格式版本1.19.60及以上) | +| [`minecraft:transformation`](/wiki/blocks/block-components#transformation) | 无 | +| [`minecraft:unit_cube`](/wiki/blocks/block-components#unit-cube) | **`假日创作者功能(Holiday Creator Features)`** | + +## 方块状态 + +_从实验性功能 **`假日创作者功能`** 中释放,适用于格式版本1.19.70及以上。_ + +## 方块特性 + +| 特性 | 所需实验性功能 | +| ------------------------------------------------------------------------------- | --------------------------------- | +| [`minecraft:placement_direction`](/wiki/blocks/block-components#placement-direction) | 无(格式版本1.20.20及以上) | +| [`minecraft:placement_position`](/wiki/blocks/block-components#placement-position) | 无(格式版本1.20.20及以上) | + +## 方块置换 + +_从实验性功能 **`假日创作者功能`** 中释放,适用于格式版本1.19.70及以上。_ + +## 方块事件与触发器 + +**完整功能仍处于实验性阶段,需启用 `假日创作者功能`。** \ No newline at end of file diff --git a/docs/wiki/2-方块/1-基础/blocks-intro.md b/docs/wiki/blocks/blocks-intro.md similarity index 79% rename from docs/wiki/2-方块/1-基础/blocks-intro.md rename to docs/wiki/blocks/blocks-intro.md index 3541d139..227eab7a 100644 --- a/docs/wiki/2-方块/1-基础/blocks-intro.md +++ b/docs/wiki/blocks/blocks-intro.md @@ -1,7 +1,6 @@ --- title: 方块入门 -description: A "Hello world" guide in making blocks. Learn the block format and how to create basic custom blocks. -category: General +category: 基础 nav_order: 1 --- @@ -10,7 +9,7 @@ nav_order: 1 :::tip 格式版本 & 最低引擎版本 `1.20.30` -本页介绍基础方块特性。更多方块组件内容请访问[此处](/blocks/block-components)。 +本页介绍基础方块特性。更多方块组件内容请访问[此处](/wiki/blocks/block-components)。 ::: :::danger @@ -55,11 +54,11 @@ Minecraft 基岩版允许我们添加具有多种类原版特性的自定义方 - 配置方块的`menu_category`归属 - 可选参数`group`和`is_hidden_in_commands` -_方块描述还包含[状态](/blocks/block-states)和[特性](/blocks/block-traits),相关内容请参见对应页面。_ +_方块描述还包含[状态](/wiki/blocks/block-states)和[特性](/wiki/blocks/block-traits),相关内容请参见对应页面。_ ## 添加组件 -目前我们的自定义方块使用的是默认组件值(可参考[此处](/blocks/block-components))。 +目前我们的自定义方块使用的是默认组件值(可参考[此处](/wiki/blocks/block-components))。 现在开始自定义功能配置! @@ -93,15 +92,15 @@ _方块描述还包含[状态](/blocks/block-states)和[特性](/blocks/block-tr ``` ::: -- [`minecraft:destructible_by_mining`](/blocks/block-components#destructible-by-mining) 定义玩家破坏方块所需时间(目前无法为不同工具设置不同破坏时间) -- [`minecraft:destructible_by_explosion`](/blocks/block-components#destructible-by-explosion) 定义抗爆性。值越高,被炸毁概率越低 -- [`minecraft:friction`](/blocks/block-components#friction) 定义方块摩擦系数。例如灵魂沙具有高摩擦值会减缓玩家,冰的低摩擦值则产生滑溜效果。经典方块(如木头/石头)的摩擦系数为`0.4` -- [`minecraft:map_color`](/blocks/block-components#map-color) 是地图上显示的代表色(十六进制)。`#ffffff`代表白色,可通过[在线取色器](https://www.google.com/search?q=hex+color+picker)获取其他颜色代码 -- [`minecraft:light_dampening`](/blocks/block-components#light-dampening) 定义光线阻挡程度 -- [`minecraft:light_emission`](/blocks/block-components#light-emission) 定义方块发光等级 -- [`minecraft:loot`](/blocks/block-components#loot) 定义战利品表路径。若移除,方块将默认掉落自身。更多战利品表信息请访问[此处](/loot/loot-tables) +- [`minecraft:destructible_by_mining`](/wiki/blocks/block-components#destructible-by-mining) 定义玩家破坏方块所需时间(目前无法为不同工具设置不同破坏时间) +- [`minecraft:destructible_by_explosion`](/wiki/blocks/block-components#destructible-by-explosion) 定义抗爆性。值越高,被炸毁概率越低 +- [`minecraft:friction`](/wiki/blocks/block-components#friction) 定义方块摩擦系数。例如灵魂沙具有高摩擦值会减缓玩家,冰的低摩擦值则产生滑溜效果。经典方块(如木头/石头)的摩擦系数为`0.4` +- [`minecraft:map_color`](/wiki/blocks/block-components#map-color) 是地图上显示的代表色(十六进制)。`#ffffff`代表白色,可通过[在线取色器](https://www.google.com/search?q=hex+color+picker)获取其他颜色代码 +- [`minecraft:light_dampening`](/wiki/blocks/block-components#light-dampening) 定义光线阻挡程度 +- [`minecraft:light_emission`](/wiki/blocks/block-components#light-emission) 定义方块发光等级 +- [`minecraft:loot`](/wiki/blocks/block-components#loot) 定义战利品表路径。若移除,方块将默认掉落自身。更多战利品表信息请访问[此处](/wiki/loot/loot-tables) -_更多组件配置请访问[方块组件手册](/blocks/block-components)!_ +_更多组件配置请访问[方块组件手册](/wiki/blocks/block-components)!_ ## 应用纹理 @@ -109,12 +108,12 @@ _更多组件配置请访问[方块组件手册](/blocks/block-components)!_ `RP/blocks.json`会忽略命名空间。即使不写命名空间或随意填写也不会产生影响。若自定义方块与原版方块同名(仅命名空间不同)可能导致问题 ::: :::tip -[方块音效](/blocks/block-sounds)也可在`RP/blocks.json`中定义 +[方块音效](/wiki/blocks/block-sounds)也可在`RP/blocks.json`中定义 ::: 对于基础的16×16×16像素方块,纹理应在`RP/blocks.json`中定义。 -如需使用自定义模型,应使用[geometry(几何组件)](/blocks/block-components#geometry)和[material_instances(材质实例)](/blocks/block-components#material-instances)。 +如需使用自定义模型,应使用[geometry(几何组件)](/wiki/blocks/block-components#geometry)和[material_instances(材质实例)](/wiki/blocks/block-components#material-instances)。 ::: code-group @@ -203,7 +202,7 @@ _更多组件配置请访问[方块组件手册](/blocks/block-components)!_
-若使用[材质实例](/blocks/block-components#material-instances),配置示例如下: +若使用[材质实例](/wiki/blocks/block-components#material-instances),配置示例如下: ::: code-group @@ -277,7 +276,7 @@ tile.wiki:compass_block.name=指南针方块 ``` ::: -更多本地化内容请访问[文本与翻译指南](/concepts/text-and-translations)。 +更多本地化内容请访问[文本与翻译指南](/wiki/concepts/text-and-translations)。 ## 成果总结 diff --git a/docs/wiki/2-方块/4-原版再创作/custom-crops.md b/docs/wiki/blocks/custom-crops.md similarity index 99% rename from docs/wiki/2-方块/4-原版再创作/custom-crops.md rename to docs/wiki/blocks/custom-crops.md index de8b1dea..21844c22 100644 --- a/docs/wiki/2-方块/4-原版再创作/custom-crops.md +++ b/docs/wiki/blocks/custom-crops.md @@ -13,7 +13,7 @@ mentions: :::tip FORMAT & MIN ENGINE VERSION `1.20.30` This tutorial assumes a good understanding of blocks. -Check out the [blocks guide](/blocks/blocks-intro), [block states](/blocks/block-states) and [block permutations](/blocks/block-permutations) before starting. +Check out the [blocks guide](/wiki/blocks/blocks-intro), [block states](/wiki/blocks/block-states) and [block permutations](/wiki/blocks/block-permutations) before starting. ::: :::warning EXPERIMENTAL diff --git a/docs/wiki/2-方块/4-原版再创作/custom-fluids.md b/docs/wiki/blocks/custom-fluids.md similarity index 76% rename from docs/wiki/2-方块/4-原版再创作/custom-fluids.md rename to docs/wiki/blocks/custom-fluids.md index ff5cb4eb..f05bb340 100644 --- a/docs/wiki/2-方块/4-原版再创作/custom-fluids.md +++ b/docs/wiki/blocks/custom-fluids.md @@ -1,61 +1,62 @@ --- -title: Custom Fluids -category: Vanilla Re-Creations +title: 自定义流体 +category: 原版再创作 tags: - - experimental - - intermediate - - scripting + - 实验性 + - 中级 + - 脚本 mentions: - Provedule - JaylyDev - QuazChick --- -::: tip FORMAT & MIN ENGINE VERSION `1.20.30` -This tutorial assumes an advanced understanding of blocks and the execute command. -Check out the [blocks guide](/blocks/blocks-intro) before starting. +# 自定义流体 + +::: tip 格式要求 & 最低引擎版本 `1.20.30` +本教程假设您已具备方块和execute命令的高级知识。 +开始前请先阅读[方块指南](/wiki/blocks/blocks-intro)。 ::: -::: warning EXPERIMENTAL -Requires `Holiday Creator Features` for use of block tag Molang queries and to trigger block events. +::: warning 实验性功能 +需要使用`假日创造者功能`来支持方块标签Molang查询和触发方块事件。 -Requires `Beta APIs` to use [@minecraft/server](https://learn.microsoft.com/minecraft/creator/scriptapi/minecraft/server/minecraft-server) module version `1.6.0-beta`. +需要使用`Beta API`来调用版本号为`1.6.0-beta`的[@minecraft/server](https://learn.microsoft.com/minecraft/creator/scriptapi/minecraft/server/minecraft-server)模块。 ::: -Creating fluids that are identical to vanilla fluids is not currently possible, but you can make something similar! This template/tutorial is designed to assist you in creating a custom "semi-fluid". +目前尚无法创建与原版完全相同的流体,但您可以制作类似的效果!本模板/教程将指导您创建自定义的"半流体"。 -## Flow Logic +## 流动逻辑 -- The fluid block has states defining whether it is a source and its depth. -- If there is air beneath fluid blocks, it will be converted into falling fluid. -- Fluids with a depth above `1` will spread horizontally with decreasing depths. - - This will not occur if there is falling fluid below. -- Flowing fluid block must have another fluid block adjacent to survive. -- Source blocks do not need to have other fluid blocks surrounding themselves. +- 流体方块具有定义是否为源方块及其深度的状态 +- 当流体方块下方存在空气时,会转化为下落的流体 +- 深度大于`1`的流体会向四周扩散并递减深度 + - 若下方存在下落的流体则不会扩散 +- 流动方块必须与其他流体方块相邻才能维持存在 +- 源方块不需要周围有其他流体方块 -**This implementation does not include face culling due to its current complexity.** +**当前实现因复杂度问题暂未包含面剔除功能** -## Source Fluid Block +## 源流体方块 -Below is the code for a custom fluid. Copy and quick replace `custom_fluid` with your fluid's name. When the source block detects air in its surroundings, it replaces it with the outer fluid blocks. If the source block detects air beneath it, it will also place a falling fluid block underneath. +以下是自定义流体的基础代码。请将`custom_fluid`全局替换为您的流体名称。当源方块检测到周围存在空气时,会将其替换为外围流体方块。若源方块下方存在空气,则会在下方生成下落的流体方块。 Download Custom Fluid Geometry +>下载自定义流体模型 - + -BP/blocks/custom_fluid.json - -```json +::: code-group +```json [BP/blocks/custom_fluid.json] { "format_version": "1.20.30", "minecraft:block": { @@ -66,7 +67,7 @@ Below is the code for a custom fluid. Copy and quick replace `custom_fluid` with }, "states": { "wiki:source": [true, false], - // Depth of fluid - default to 4 + // 流体深度 - 默认为4 "wiki:depth": [4, 5, 3, 2, 1] } }, @@ -75,17 +76,17 @@ Below is the code for a custom fluid. Copy and quick replace `custom_fluid` with "minecraft:collision_box": false, "minecraft:selection_box": false, "minecraft:destructible_by_explosion": false, - // Trigger fluid spread + // 触发流体扩散 "minecraft:queued_ticking": { "looping": true, - "interval_range": [20, 20], // Fluid speed in ticks + "interval_range": [20, 20], // 流体流速(单位:tick) "on_tick": { "event": "wiki:flow" } }, "minecraft:material_instances": { "*": { - "texture": "custom_fluid", // Shortname defined in `RP/textures/terrain_texture.json` + "texture": "custom_fluid", // 在`RP/textures/terrain_texture.json`中定义的短名称 "render_method": "blend", "ambient_occlusion": false, "face_dimming": false @@ -97,12 +98,12 @@ Below is the code for a custom fluid. Copy and quick replace `custom_fluid` with "events": { "wiki:flow": { "sequence": [ - // Dry out + // 干涸检测 { "condition": "!q.block_state('wiki:source') && ((q.block_state('wiki:depth') == 5 && !q.block_neighbor_has_any_tag(0, 1, 0, 'custom_fluid')) || (q.block_state('wiki:depth') == 1 && !(q.block_neighbor_has_any_tag(1, 0, 0, 'custom_fluid_2') || q.block_neighbor_has_any_tag(-1, 0, 0, 'custom_fluid_2') || q.block_neighbor_has_any_tag(0, 0, 1, 'custom_fluid_2') || q.block_neighbor_has_any_tag(0, 0, -1, 'custom_fluid_2')) || q.block_state('wiki:depth') == 2 && !(q.block_neighbor_has_any_tag(1, 0, 0, 'custom_fluid_3') || q.block_neighbor_has_any_tag(-1, 0, 0, 'custom_fluid_3') || q.block_neighbor_has_any_tag(0, 0, 1, 'custom_fluid_3') || q.block_neighbor_has_any_tag(0, 0, -1, 'custom_fluid_3'))) || (q.block_state('wiki:depth') == 3 && !(q.block_neighbor_has_any_tag(1, 0, 0, 'custom_fluid_4', 'custom_fluid_5') || q.block_neighbor_has_any_tag(-1, 0, 0, 'custom_fluid_4', 'custom_fluid_5') || q.block_neighbor_has_any_tag(0, 0, 1, 'custom_fluid_4', 'custom_fluid_5') || q.block_neighbor_has_any_tag(0, 0, -1, 'custom_fluid_4', 'custom_fluid_5'))))", "die": {} }, - // Spread + // 扩散逻辑 { "condition": "q.block_state('wiki:depth') == 4", "run_command": { @@ -162,7 +163,7 @@ Below is the code for a custom fluid. Copy and quick replace `custom_fluid` with ] } }, - // Fall + // 下落逻辑 { "run_command": { "command": "execute if block ~~-1~ air run setblock ~~-1~ wiki:custom_fluid [\"wiki:source\"=false,\"wiki:depth\"=5]" @@ -189,7 +190,7 @@ Below is the code for a custom fluid. Copy and quick replace `custom_fluid` with { "condition": "q.block_state('wiki:source')", "components": { - // Enables the block to be picked up by an item of choice + // 允许通过指定物品拾取方块 "minecraft:selection_box": { "origin": [-7.5, 0.5, -7.5], "size": [15, 13, 15] @@ -242,18 +243,18 @@ Below is the code for a custom fluid. Copy and quick replace `custom_fluid` with } } ``` +::: -## Fluid Bucket +## 流体桶 -To place your custom fluid you need a custom bucket item. Below is the JSON for the custom bucket. Replace any instance of `custom_fluid` with your fluid's name. +要放置自定义流体,您需要自定义桶物品。以下是流体桶的JSON配置,请将`custom_fluid`替换为您的流体名称。 - + -BP/items/custom_fluid_bucket.json - -```json +::: code-group +```json [BP/items/custom_fluid_bucket.json] { "format_version": "1.20.30", "minecraft:item": { @@ -266,7 +267,7 @@ To place your custom fluid you need a custom bucket item. Below is the JSON for "components": { "minecraft:max_stack_size": 1, "minecraft:icon": { - "texture": "custom_fluid_bucket" // Shortname defined in `RP/textures/item_texture.json` + "texture": "custom_fluid_bucket" // 在`RP/textures/item_texture.json`中定义的短名称 }, "minecraft:block_placer": { "block": "wiki:custom_fluid" @@ -275,16 +276,16 @@ To place your custom fluid you need a custom bucket item. Below is the JSON for } } ``` +::: -## Scripts +## 脚本 -The fluids use a script to add the ability for the player to float/sink in the fluid. The script also adds fog. To add your fluid to the script, put the ID of your new fluids in the `fluids` string array. +该脚本为流体添加了玩家漂浮/下沉功能及雾气效果。将您的新流体ID添加到`fluids`字符串数组中即可生效。 -BP/manifest.json - -```json +::: code-group +```json [BP/manifest.json] { "modules": [ ... @@ -304,12 +305,12 @@ The fluids use a script to add the ability for the player to float/sink in the f ] } ``` +::: - + -BP/scripts/fluids.js - -```javascript +::: code-group +```javascript [BP/scripts/fluids.js] import { system, world } from "@minecraft/server"; const fluids = ["wiki:custom_fluid"]; @@ -318,7 +319,7 @@ system.runInterval(() => { const players = world.getPlayers(); for (const player of players) { - // Fluid effects + // 流体效果 if ( fluids.includes(world.getDimension(player.dimension.id).getBlock({ ...player.location, y: player.location.y + 1 }).typeId) || fluids.includes(world.getDimension(player.dimension.id).getBlock(player.location).typeId) @@ -329,7 +330,7 @@ system.runInterval(() => { player.addEffect("levitation", 3, { amplifier: 2, showParticles: false }); } } - // Fluid fog + // 流体雾气 if (fluids.includes(world.getDimension(player.dimension.id).getBlock({ ...player.location, y: player.location.y + 1.63 }).typeId)) { player.runCommand("fog @s push wiki:custom_fluid_fog fluid_fog"); } else { @@ -338,12 +339,13 @@ system.runInterval(() => { } }); ``` +::: -## Result +## 最终成果 -By the end your BP folder should look like this: +完成后的BP文件夹结构应如下所示: -## Download Example Pack +## 示例包下载 -If anything goes wrong, or if you require all of the template files, they are available for download here. The pack includes everything necessary for a functional fluid. +如果遇到问题或需要完整模板文件,可在此下载。该资源包包含流体所需的所有必要文件。 Download MCADDON \ No newline at end of file +>下载MCADDON \ No newline at end of file diff --git a/docs/wiki/2-方块/4-原版再创作/custom-glass-blocks.md b/docs/wiki/blocks/custom-glass-blocks.md similarity index 98% rename from docs/wiki/2-方块/4-原版再创作/custom-glass-blocks.md rename to docs/wiki/blocks/custom-glass-blocks.md index 68f793b8..4570030b 100644 --- a/docs/wiki/2-方块/4-原版再创作/custom-glass-blocks.md +++ b/docs/wiki/blocks/custom-glass-blocks.md @@ -19,7 +19,7 @@ By the end you should be able to create something like this! ::: tip FORMAT VERSION `1.20.30` This example requires basic knowledge of blocks to understand. -Check out the [blocks guide](/blocks/blocks-intro) before starting. +Check out the [blocks guide](/wiki/blocks/blocks-intro) before starting. ::: This will create a custom glass block which appears the same as vanilla glass blocks! @@ -64,7 +64,7 @@ This will create a custom glass block which appears the same as vanilla glass bl ::: tip FORMAT & MIN ENGINE VERSION `1.20.30` This example requires advanced knowledge of blocks and Molang to understand. -Check out the [blocks guide](/blocks/blocks-intro), [block states](/blocks/block-states) and [Molang](/concepts/molang) before starting. +Check out the [blocks guide](/wiki/blocks/blocks-intro), [block states](/wiki/blocks/block-states) and [Molang](/wiki/concepts/molang) before starting. ::: ::: warning EXPERIMENTAL diff --git a/docs/wiki/blocks/custom-glazed-terracotta.md b/docs/wiki/blocks/custom-glazed-terracotta.md new file mode 100644 index 00000000..42323b67 --- /dev/null +++ b/docs/wiki/blocks/custom-glazed-terracotta.md @@ -0,0 +1,150 @@ +--- +title: 自定义釉面陶瓦 +category: 原版再创作 +tags: + - 简单 +mentions: + - Kaioga5 +--- + +# 自定义釉面陶瓦 + +::: tip 格式要求 & 最低引擎版本 `1.20.40` +本教程需要基础的方块制作知识,建议先阅读[方块制作指南](/wiki/blocks/blocks-intro)。 +::: + +## 前言 + +釉面陶瓦拥有独特的旋转机制,允许玩家通过不同朝向组合出适用于墙面、地面和天花板的精美图案。本教程将指导您创建类似釉面陶瓦的自定义方块。 + +## 自定义釉面陶瓦配置 + +以下配置可实现类原版釉面陶瓦的旋转效果。 + +::: code-group +```json [BP/blocks/custom_glazed_terracotta.json] +{ + "format_version": "1.20.40", + "minecraft:block": { + "description": { + "identifier": "wiki:glazed_terracotta_template", + "menu_category": { + "category": "construction", + "group": "itemGroup.name.glazedTerracotta" + }, + "traits": { + "minecraft:placement_direction": { + "enabled_states": [ + "minecraft:cardinal_direction" + ] + } + } + }, + "permutations": [ + { + "condition": "q.block_state('minecraft:cardinal_direction') == 'north'", + "components": { + "minecraft:transformation": { "rotation": [0, 0, 0] }, + "minecraft:geometry": { + "identifier": "geometry.glazed_terracotta", + "bone_visibility": { + "bottom_1": false, + "bottom_2": false, + "bottom_3": false, + "bottom_4": true + } + } + } + }, + // 其他三个方向的配置结构类似 + // 此处省略西/南/东方向的配置节以保持简洁 + ], + "components": { + "minecraft:geometry": { + "identifier": "geometry.glazed_terracotta" + }, + "minecraft:material_instances": { + "*": { + "texture": "purple_glazed_terracotta", + "render_method": "opaque" + } + } + } + } +} +``` +::: + +## 几何结构配置 + +原版釉面陶瓦通过特殊数值实现方块面的旋转效果。使用以下几何结构配置可复现该特性。 + + + +::: code-group +```json [RP/models/blocks/glazed_terracotta.geo.json] +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.glazed_terracotta", + "texture_width": 16, + "texture_height": 16, + "visible_bounds_width": 4, + "visible_bounds_height": 3.5, + "visible_bounds_offset": [0, 1.25, 0] + }, + "bones": [ + // 主要骨骼定义 + { + "name": "glazed_terracotta", + "pivot": [0, 0, 0] + }, + // 顶部面配置 + { + "name": "top", + "parent": "glazed_terracotta", + "pivot": [0, 0, 0], + "cubes": [ + { + "origin": [-8, 0, -8], + "size": [16, 16, 16], + "uv": { + "up": {"uv": [16, 16], "uv_size": [-16, -16} + } + } + ] + }, + // 其他四个方向面配置 + // 此处省略北/南/东/西面的详细配置节 + // 底部面配置组 + { + "name": "bottom", + "parent": "glazed_terracotta", + "pivot": [0, 0, 0] + }, + // 四个底部子面配置 + { + "name": "bottom_1", + "parent": "bottom", + "pivot": [0, 0, 0], + "cubes": [ + { + "origin": [-8, 0, -8], + "size": [16, 0, 16], + "uv": { + "down": {"uv": [0, 0], "uv_size": [16, 16]} + } + } + ] + } + // 其他三个底部子面配置类似 + ] + } + ] +} +``` +::: + + \ No newline at end of file diff --git a/docs/wiki/2-方块/4-原版再创作/custom-slabs.md b/docs/wiki/blocks/custom-slabs.md similarity index 79% rename from docs/wiki/2-方块/4-原版再创作/custom-slabs.md rename to docs/wiki/blocks/custom-slabs.md index fb550ba4..801c723f 100644 --- a/docs/wiki/2-方块/4-原版再创作/custom-slabs.md +++ b/docs/wiki/blocks/custom-slabs.md @@ -1,36 +1,35 @@ --- -title: Custom Slabs -category: Vanilla Re-Creations +title: 自定义台阶 +category: 原版再创作 tags: - - experimental - - easy + - 实验性 + - 简单 mentions: - Kaioga5 - QuazChick --- -::: tip FORMAT & MIN ENGINE VERSION `1.20.30` -This tutorial assumes a basic understanding of blocks. -Check out the [blocks guide](/blocks/blocks-intro) before starting. +::: tip 格式要求 & 最低引擎版本 `1.20.30` +本教程假设您已掌握方块制作基础知识。 +开始前请先阅读[方块制作指南](/wiki/blocks/blocks-intro)。 ::: -::: warning EXPERIMENTAL -Requires `Holiday Creator Features` to trigger block events and for use of the `minecraft:unit_cube` component. +::: warning 实验性功能 +需启用 `假日创造者功能` 来触发方块事件和使用 `minecraft:unit_cube` 组件。 ::: -## Introduction -Making custom slabs is a simple task, but if you find any drawbacks during recreating slabs, this tutorial will help you with it, and you'll be provided with a template for you to use. +## 概述 +制作自定义台阶看似简单,但在实际复刻过程中可能会遇到一些技术难点。本教程将为您提供解决方案,并附赠可直接使用的模板。 -Issues: -- Your custom slab will appear vertically centred when carried. -- Your custom slab may appear full-sized in item form (on the ground, in item frames, in hand) +已知问题: +- 手持自定义台阶时模型会垂直居中显示 +- 物品形态(地面掉落物/物品展示框/手持时)可能显示完整方块尺寸 -## Custom Slab -This will create a vanilla-like custom slab. +## 自定义台阶实现 +以下代码将创建与原版风格一致的自定义台阶。 -BP/blocks/custom_slab.json - -```json +::: code-group +```json [BP/blocks/custom_slab.json] { "format_version": "1.20.30", "minecraft:block": { @@ -50,7 +49,7 @@ This will create a vanilla-like custom slab. } }, "permutations": [ - // Bottom Slab + // 下半台阶 { "condition": "q.block_state('minecraft:vertical_half') == 'bottom' && !q.block_state('wiki:double')", "components": { @@ -68,7 +67,7 @@ This will create a vanilla-like custom slab. } } }, - // Top Slab + // 上半台阶 { "condition": "q.block_state('minecraft:vertical_half') == 'top' && !q.block_state('wiki:double')", "components": { @@ -86,7 +85,7 @@ This will create a vanilla-like custom slab. } } }, - // Double Slab + // 双层台阶 { "condition": "q.block_state('wiki:double')", "components": { @@ -128,21 +127,21 @@ This will create a vanilla-like custom slab. "decrement_stack": {} }, "wiki:destroy_double": { - "spawn_loot": {} // Spawns the block's default loot + "spawn_loot": {} // 生成方块的默认战利品 } } } } ``` +::: -## Geometry -This will be the geometry used for your custom slabs. +## 几何模型 +以下是自定义台阶所需的几何模型配置。 - + -RP/models/blocks/slab.geo.json - -```json +::: code-group +```json [RP/models/blocks/slab.geo.json] { "format_version": "1.12.0", "minecraft:geometry": [ @@ -197,5 +196,5 @@ This will be the geometry used for your custom slabs. ] } ``` - - +::: + \ No newline at end of file diff --git a/docs/wiki/2-方块/4-原版再创作/custom-trapdoors.md b/docs/wiki/blocks/custom-trapdoors.md similarity index 86% rename from docs/wiki/2-方块/4-原版再创作/custom-trapdoors.md rename to docs/wiki/blocks/custom-trapdoors.md index 210ced90..1e6943ce 100644 --- a/docs/wiki/2-方块/4-原版再创作/custom-trapdoors.md +++ b/docs/wiki/blocks/custom-trapdoors.md @@ -1,6 +1,6 @@ --- -title: Custom Trapdoors -category: Vanilla Re-Creations +title: 自定义活板门 +category: 原版再创作 tags: - experimental - intermediate @@ -9,26 +9,27 @@ mentions: - QuazChick --- -::: tip FORMAT & MIN ENGINE VERSION `1.20.30` -This tutorial assumes a good understanding of blocks. -Check out the [blocks guide](/blocks/blocks-intro) before starting. +# 自定义活板门 + +::: tip 格式与最低引擎版本 `1.20.30` +本教程假定您已具备基础的方块制作知识。 +开始前请先阅读[方块制作指南](/wiki/blocks/blocks-intro)。 ::: -::: warning EXPERIMENTAL -Requires `Holiday Creator Features` to trigger block events. +::: warning 实验性功能 +需要启用`假日创作者功能`来触发方块事件。 ::: -## Introduction +## 前言 -Making custom trapdoors is an often difficult task to do, but after reading this tutorial you'll understand how they work in case you find any drawbacks during recreating them, and you'll be provided with a template for you to use. +制作自定义活板门通常是个复杂的任务,但通过本教程您将理解其运作原理(以便在复现过程中遇到任何问题时能够自主解决),同时我们也会提供可直接使用的模板。 -## Custom Trapdoor +## 自定义活板门实现 -This will create a vanilla-like custom trapdoor. +以下代码将创建具有原版风格的活板门。 -BP/blocks/custom_trapdoor.json - -```json +::: code-group +```json [BP/blocks/custom_trapdoor.json] { "format_version": "1.20.30", "minecraft:block": { @@ -51,7 +52,7 @@ This will create a vanilla-like custom trapdoor. } }, "permutations": [ - // Top Closed + // 顶部关闭状态 { "condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'north' && !q.block_state('wiki:open')", "components": { @@ -76,7 +77,7 @@ This will create a vanilla-like custom trapdoor. "minecraft:transformation": { "rotation": [180, 270, 0] } } }, - // Top Open + // 顶部开启状态 { "condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'north' && q.block_state('wiki:open')", "components": { @@ -103,7 +104,7 @@ This will create a vanilla-like custom trapdoor. } } }, - // Bottom Closed + // 底部关闭状态 { "condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'north' && !q.block_state('wiki:open')", "components": { @@ -128,7 +129,7 @@ This will create a vanilla-like custom trapdoor. "minecraft:transformation": { "rotation": [0, -270, 0] } } }, - // Bottom Open + // 底部开启状态 { "condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'north' && q.block_state('wiki:open')", "components": { @@ -200,16 +201,16 @@ This will create a vanilla-like custom trapdoor. } } ``` +::: -## Geometry +## 几何模型 -This will be the geometry used for your custom trapdoors. +这是活板门所需的几何模型文件。 - + -RP/models/blocks/trapdoor.geo.json - -```json +::: code-group +```json [RP/models/blocks/trapdoor.geo.json] { "format_version": "1.12.0", "minecraft:geometry": [ @@ -246,9 +247,10 @@ This will be the geometry used for your custom trapdoors. ] } ``` +::: :::tip -Vanilla trapdoors have a few issues in the direction of the texture in certain faces and having a height of 2.95 when it should be 3. This block template and geometry fixes both of those issues. -::: +原版活板门存在两个问题:部分面纹理方向错误,以及实际高度应为3却显示为2.95。本模板及配套几何模型已修复这两个问题。 +::: \ No newline at end of file diff --git a/docs/wiki/2-方块/4-原版再创作/custom-trees.md b/docs/wiki/blocks/custom-trees.md similarity index 99% rename from docs/wiki/2-方块/4-原版再创作/custom-trees.md rename to docs/wiki/blocks/custom-trees.md index 9d6183ab..83f9dfe5 100644 --- a/docs/wiki/2-方块/4-原版再创作/custom-trees.md +++ b/docs/wiki/blocks/custom-trees.md @@ -11,7 +11,7 @@ mentions: ::: tip FORMAT & MIN ENGINE VERSION `1.20.30` This tutorial assumes an advanced understanding of blocks. -Check out the [blocks guide](/blocks/blocks-intro) before starting. +Check out the [blocks guide](/wiki/blocks/blocks-intro) before starting. ::: ::: warning EXPERIMENTAL diff --git a/docs/wiki/2-方块/3-巧思案例/fake-blocks.md b/docs/wiki/blocks/fake-blocks.md similarity index 97% rename from docs/wiki/2-方块/3-巧思案例/fake-blocks.md rename to docs/wiki/blocks/fake-blocks.md index 6da8f63b..59d5d032 100644 --- a/docs/wiki/2-方块/3-巧思案例/fake-blocks.md +++ b/docs/wiki/blocks/fake-blocks.md @@ -1,6 +1,6 @@ --- title: 伪方块 -category: 教程 +category: 巧思案例 tags: - 中级 mentions: @@ -25,7 +25,7 @@ mentions: ## 创建碰撞箱 -[固体实体教程](/entities/solid-entities)中介绍了四种创建碰撞箱的方式,涉及 `runtime_identifiers`、方块和组件组合方案。 +[固体实体教程](/wiki/entities/solid-entities)中介绍了四种创建碰撞箱的方式,涉及 `runtime_identifiers`、方块和组件组合方案。 ## 基础组件 diff --git a/docs/wiki/2-方块/3-巧思案例/flipbook-textures.md b/docs/wiki/blocks/flipbook-textures.md similarity index 99% rename from docs/wiki/2-方块/3-巧思案例/flipbook-textures.md rename to docs/wiki/blocks/flipbook-textures.md index 2f2e874b..e9b089b7 100644 --- a/docs/wiki/2-方块/3-巧思案例/flipbook-textures.md +++ b/docs/wiki/blocks/flipbook-textures.md @@ -1,7 +1,6 @@ --- title: 纹理动画 -category: - - 教程 +category: 巧思案例 tags: - 中级 mentions: diff --git a/docs/wiki/blocks/index.md b/docs/wiki/blocks/index.md new file mode 100644 index 00000000..e05226a7 --- /dev/null +++ b/docs/wiki/blocks/index.md @@ -0,0 +1,12 @@ +--- +title: 方块 Blocks +categories: + - title: 基础 + color: blue + - title: 巧思案例 + color: green + - title: 原版再创作 + color: orange + - title: 文档 + color: red +--- diff --git a/docs/wiki/2-方块/3-巧思案例/ore-loot-tables.md b/docs/wiki/blocks/ore-loot-tables.md similarity index 98% rename from docs/wiki/2-方块/3-巧思案例/ore-loot-tables.md rename to docs/wiki/blocks/ore-loot-tables.md index 98871c1a..d382b226 100644 --- a/docs/wiki/2-方块/3-巧思案例/ore-loot-tables.md +++ b/docs/wiki/blocks/ore-loot-tables.md @@ -1,6 +1,6 @@ --- title: 矿石战利品表 -category: 教程 +category: 巧思案例 tags: - 简单 mentions: @@ -21,7 +21,7 @@ mentions: ::: tip 格式版本 `1.20.30` 本教程假设您已具备方块基础知识。 -开始前请先查阅[方块指南](/blocks/blocks-intro)。 +开始前请先查阅[方块指南](/wiki/blocks/blocks-intro)。 ::: ::: warning 实验性功能 diff --git a/docs/wiki/2-方块/3-巧思案例/precise-rotation.md b/docs/wiki/blocks/precise-rotation.md similarity index 97% rename from docs/wiki/2-方块/3-巧思案例/precise-rotation.md rename to docs/wiki/blocks/precise-rotation.md index e13de9c2..9039a751 100644 --- a/docs/wiki/2-方块/3-巧思案例/precise-rotation.md +++ b/docs/wiki/blocks/precise-rotation.md @@ -1,6 +1,6 @@ --- title: 精确旋转 -category: 教程 +category: 巧思案例 tags: - experimental - expert @@ -14,7 +14,7 @@ mentions: ::: tip 格式与最低引擎版本 `1.20.30` 本教程假定您已具备方块的进阶知识与Molang基础。 -开始前建议先阅读[方块指南](/blocks/blocks-intro)。 +开始前建议先阅读[方块指南](/wiki/blocks/blocks-intro)。 ::: ::: warning 实验性功能 @@ -23,7 +23,7 @@ mentions: 本教程将引导您实现可支持次级方位旋转的方块(如爬行者头颅与告示牌),通过一个包含此类旋转类型的"贝壳"方块作为实例进行讲解。 -*查看常规旋转方式?请前往[此页面](/blocks/rotatable-blocks)!* +*查看常规旋转方式?请前往[此页面](/wiki/blocks/rotatable-blocks)!* ![随机朝向的自定义贝壳方块](/assets/images/blocks/precise-rotation/showcase.png) @@ -309,7 +309,7 @@ return t.rotation != 16 ? t.rotation;
-接着,使用[置换](/blocks/block-permutations)定义基础朝向旋转,由模型中的精细骨骼进一步细化。 +接着,使用[置换](/wiki/blocks/block-permutations)定义基础朝向旋转,由模型中的精细骨骼进一步细化。 按顺序在方块JSON中添加以下置换条件: diff --git a/docs/wiki/2-方块/3-巧思案例/rotatable-blocks.md b/docs/wiki/blocks/rotatable-blocks.md similarity index 97% rename from docs/wiki/2-方块/3-巧思案例/rotatable-blocks.md rename to docs/wiki/blocks/rotatable-blocks.md index d867b475..6e4be02c 100644 --- a/docs/wiki/2-方块/3-巧思案例/rotatable-blocks.md +++ b/docs/wiki/blocks/rotatable-blocks.md @@ -1,6 +1,6 @@ --- title: 可旋转方块 -category: 教程 +category: 巧思案例 mentions: - Ultr4Anubis - SmokeyStack @@ -15,8 +15,8 @@ mentions: ::: tip 格式与最低引擎版本 `1.20.30` -本教程假设您已掌握方块基础知识,包括[方块状态](/blocks/block-states)与[方块特性](/blocks/block-traits)。 -开始前请先阅读[方块指南](/blocks/blocks-intro)。 +本教程假设您已掌握方块基础知识,包括[方块状态](/wiki/blocks/block-states)与[方块特性](/wiki/blocks/block-traits)。 +开始前请先阅读[方块指南](/wiki/blocks/blocks-intro)。 ::: ## 旋转类型 @@ -41,7 +41,7 @@ mentions: - 适用于原木和玄武岩 - 3个轴对齐方向 -- ### [精确旋转](/blocks/precise-rotation) +- ### [精确旋转](/wiki/blocks/precise-rotation) - 适用于头颅、告示牌和旗帜 - 16个方向(以22.5度递增) - 4个侧面附着方向 diff --git a/docs/wiki/2-方块/1-基础/troubleshooting-blocks.md b/docs/wiki/blocks/troubleshooting-blocks.md similarity index 98% rename from docs/wiki/2-方块/1-基础/troubleshooting-blocks.md rename to docs/wiki/blocks/troubleshooting-blocks.md index 6f665e6c..2440b4af 100644 --- a/docs/wiki/2-方块/1-基础/troubleshooting-blocks.md +++ b/docs/wiki/blocks/troubleshooting-blocks.md @@ -1,6 +1,6 @@ --- title: 方块故障排除 -category: 常规 +category: 基础 tags: - help mentions: @@ -17,7 +17,7 @@ mentions: :::tip -本页包含关于_方块_的故障排除信息。在继续阅读前,建议先查阅我们的[全局故障排除指南](/guide/troubleshooting)。 +本页包含关于_方块_的故障排除信息。在继续阅读前,建议先查阅我们的[全局故障排除指南](/wiki/guide/troubleshooting)。 ::: ## 0.0 - 常见问题 diff --git a/docs/wiki/commands/block-entities.md b/docs/wiki/commands/block-entities.md index 4890b4a9..32a433d1 100644 --- a/docs/wiki/commands/block-entities.md +++ b/docs/wiki/commands/block-entities.md @@ -1,54 +1,57 @@ --- -title: MBE - Max's Block Entity -category: Techniques +title: MBE - Max的方块实体 +category: 技术 mention: - BedrockCommands - zheaEvyline tags: - - system + - 系统 --- -## Introduction +# MBE - Max的方块实体 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -This method, developed by Reddit user [u/Maxed_Out10](https://www.reddit.com/user/Maxed_Out10/) allows you to create near-perfect entity replications of any Minecraft block using armour stands and some sequential `/playanimation` commands. +## 简介 -To preserve credits to the creator, the community termed this method as "Max's Block Entity" or MBE for short. +[源自Bedrock Commands社区Discord](https://discord.gg/SYstTYx5G5) -### Points to Note +此方法由Reddit用户[u/Maxed_Out10](https://www.reddit.com/user/Maxed_Out10/)开发,通过使用盔甲架和连续的`/playanimation`命令,可以近乎完美地复刻Minecraft中任意方块的实体形态。 -1. This method uses 1 armour stand per block entity. Therefore, too many armour stands (like any entity) can contribute to server lag. -2. Players will still be able to pass through them as well as interact with them if not restricted. -3. While the block entity may appear in one spot, it's actual hitbox will have a slight offset. +为保留原创者荣誉,社区将此方法命名为"Max's Block Entity"(简称MBE)。 -## Video Demonstration +### 注意事项 + +1. 每个方块实体需使用1个盔甲架,过多盔甲架(如同其他实体)可能导致服务器卡顿 +2. 玩家仍可穿过未加限制的MBE实体并进行交互 +3. 方块实体的实际碰撞箱会与视觉位置存在细微偏移 + +## 视频演示 -## Setup +## 设置步骤 -*To be typed in chat:* +*在聊天栏输入:* 1. `/summon armor_stand Grumm` - - It is necessary to name it 'Grumm' to avoid inverted block textures. + - 必须命名为'Grumm'以避免纹理倒置 2. `/execute as @e [type= armor_stand, name=Grumm, c=1] at @s run tp @s ~~~ 260` - - This will align the MBE to the normal Minecraft block grid. + - 用于将MBE对齐标准方块网格 ㅤ :::tip -- Crouch & right-click (on mcpe: long press) the armor stand 6 times to place it in Pose 7 - - Doing this negates the need to use the 2nd command in the system. - - **Only use this if you wish to reduce one command from the system.** +- 潜行并右键点击(手机版长按)盔甲架6次进入Pose 7 + - 此操作可替代系统中的第二条命令 + - **仅在需要精简系统命令时使用** ::: -## System +## 系统命令 -> Note: adding a delay of 100-200 ticks is recommended. +> 注意:建议添加100-200 Tick的延迟 -mcfunction - -```yaml +::: code-group +```yaml [mcfunction] /effect @e [type= armor_stand, name=Grumm] invisibility 999999 1 true /playanimation @e [type= armor_stand, name=Grumm] animation.armor_stand.entertain_pose null 0 "0" align.arms /playanimation @e [type= armor_stand, name=Grumm] animation.player.move.arms.zombie null 0 "0" size.mini_block @@ -56,118 +59,119 @@ To preserve credits to the creator, the community termed this method as "Max's B /playanimation @e [type= armor_stand, name=Grumm] animation.fireworks_rocket.move null 0 "0" align.full_block /execute as @e [type= armor_stand, name=Grumm] at @s run tp ~~~ ``` +::: + ![commandBlockChain6](/assets/images/commands/commandBlockChain/6.png) -### Purpose Of Each Command -1. Hides the armour stand body. -2. Automatically sets the armour stand pose to 7 for arms alignment. Skip this command you prefer to do it manually. -3. __Required command__. Increases size to present as mini-block. -4. *Optional command.* Increases size to present as full-block. -5. *Optional command.* Aligns the full-block size MBE properly. - - Skip 4 & 5 if you do not need full-block size MBE. -6. Locks in place to prevent fall in case block underneath is removed. +### 命令功能解析 +1. 隐藏盔甲架本体 +2. 自动设置盔甲架为Pose 7(手臂对齐),手动设置时可跳过 +3. __必要命令__ 调整为迷你方块尺寸 +4. *可选命令* 调整为完整方块尺寸 +5. *可选命令* 对齐完整方块尺寸 + - 若不需要完整方块尺寸可跳过4、5 +6. 锁定位置防止下方方块被破坏时坠落 -## Rotations & Alignments +## 旋转与对齐 -> Note: These rotation commands are to be executed only once through a command block. +> 注意:以下旋转命令应通过命令方块单次执行 - + ```yaml -# Face North +# 朝北 /tp @e [type=armor_stand, name=Grumm, c=1] ~-1.1245 ~0.2260 ~-0.097 81 -# Face South +# 朝南 /tp @e [type=armor_stand, name=Grumm, c=1] ~1.1245 ~0.2260 ~0.097 260 -# Face East +# 朝东 /tp @e [type=armor_stand, name=Grumm, c=1] ~0.097 ~0.2260 ~-1.1245 171 -# Face West +# 朝西 /tp @e [type=armor_stand, name=Grumm, c=1] ~-0.097 ~0.2260 ~1.1245 350 ``` - - + ```yaml -# Face North +# 朝北 /tp @e [type=armor_stand, name=Grumm, c=1] ~-0.417~-0.5 ~-0.035 81 -# Face South +# 朝南 /tp @e [type=armor_stand, name=Grumm, c=1] ~0.417 ~-0.5 ~0.035 260 -# Face East +# 朝东 /tp @e [type=armor_stand, name=Grumm, c=1] ~0.035 ~-0.5 ~-0.417 171 -# Face West +# 朝西 /tp @e [type=armor_stand, name=Grumm, c=1] ~-0.035 ~-0.5 ~0.417 350 ``` - + ```yaml -# Face North +# 朝北 /tp @e [type=armor_stand, name=Grumm, c=1] ~-0.097 ~0.2325 ~1.1245 350 -# Face South +# 朝南 /tp @e [type=armor_stand, name=Grumm, c=1] ~0.097 ~0.2325 ~-1.1245 171 -# Face East +# 朝东 /tp @e [type=armor_stand, name=Grumm, c=1] ~-1.1245 ~0.2325 ~-0.097 81 -# Face West +# 朝西 /tp @e [type=armor_stand, name=Grumm, c=1] ~1.1245 ~0.2325 ~0.097 260 ``` - + ```yaml -# Face North +# 朝北 /tp @e [type=armor_stand, name=Grumm, c=1] ~-0.097 ~0.2325 ~1.1245 350 -# Face South +# 朝南 /tp @e [type=armor_stand, name=Grumm, c=1] ~0.097 ~0.2325 ~-1.1245 171 -# Face East +# 朝东 /tp @e [type=armor_stand, name=Grumm, c=1] ~-1.1245 ~0.2325 ~-0.097 81 -# Face West +# 朝西 /tp @e [type=armor_stand, name=Grumm, c=1] ~1.1245 ~0.2325 ~0.097 260 ``` - + ```yaml -# Face North +# 朝北 /tp @e [type=armor_stand, name=Grumm, c=1] ~-1.1245 ~0.484 ~-0.097 81 -# Face South +# 朝南 /tp @e [type=armor_stand, name=Grumm, c=1] ~1.1245 ~0.484 ~0.097 260 -# Face East +# 朝东 /tp @e [type=armor_stand, name=Grumm, c=1] ~0.097 ~0.484 ~-1.1245 171 -# Face West +# 朝西 /tp @e [type=armor_stand, name=Grumm, c=1] ~-0.097 ~0.484 ~1.1245 350 ``` -## Saving & Loading MBE +## 保存与加载MBE -1. To save run: +1. 保存命令: - `/execute as @e [type=armor_stand, name=Grumm, c=1] at @s run structure save MBE ~~~ ~~~` -2. To load run: - - `/structure load MBE ` +2. 加载命令: + - `/structure load MBE <坐标>` -> Note: structure name `MBE` can be changed to your preference. +> 注意:结构名称`MBE`可根据需要更改 \ No newline at end of file diff --git a/docs/wiki/commands/block-states.md b/docs/wiki/commands/block-states.md index 5f562374..1c12825b 100644 --- a/docs/wiki/commands/block-states.md +++ b/docs/wiki/commands/block-states.md @@ -1,118 +1,125 @@ --- -title: Block States -category: General +title: 方块状态 +category: 基础 mentions: - BedrockCommands - zheaEvyline - SmokeyStack - ThomasOrs tags: - - info + - 信息 --- -## Introduction +# 方块状态 -[Sourced by Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -Block States or Block Properties are additional data that defines how the block appears or behaves. Such as the direction it is facing, it's color, it's variant, whether it is powered or unpowered and so on. +## 引言 -This is used in a multitude of commands such as `/clone`, `/execute`, `/fill`, `/setblock` and `/testforblock` +[由Bedrock Commands社区Discord提供](https://discord.gg/SYstTYx5G5) -In Bedrock Edition we used Aux values (also known as Metadata) to define a block. However; as of 1.19.70 and beyond this is no longer supported and have been fully replaced with Block States instead. +方块状态(Block States)或方块属性(Block Properties)是用于定义方块外观或行为的附加数据。例如方块的朝向、颜色、变种、是否充能等特性。 -example +这些数据被广泛应用于多个命令中,包括但不限于: +- `/clone` +- `/execute` +- `/fill` +- `/setblock` +- `/testforblock` -```yaml -#Aux Value Example: +在基岩版中,我们曾使用辅助值(Aux Values,也称元数据)来定义方块。然而自1.19.70版本起,该机制已被全面弃用,并由方块状态完全取代。 + +::: code-group +```yaml [辅助值] +#辅助值示例: /setblock ~ ~ ~ wool 1 -#It's Block State equivalent: +#等效的方块状态写法: /setblock ~ ~ ~ wool ["color"="orange"] ``` +::: -- Any command block using aux values will continue to function as it is however block states will need to be adopted when updating them. -- Similarly any commands using aux values in behaviour or function packs with `min_engine_version` 1.19.63 or below will also continue to function however block states must be adopted if the `min_engine_version` is updated to 1.19.70 or above. +- 使用辅助值的命令方块仍可继续工作,但在更新时需要改用方块状态 +- 同理,在行为包或功能包中使用辅助值的命令,若`min_engine_version`设置为1.19.63或更低版本仍可正常工作,但若将最低引擎版本更新至1.19.70或更高则必须改用方块状态 -## Block State Examples & Syntax +## 方块状态示例与语法 -Examples - -```yaml +::: code-group +```yaml [示例] /setblock ~ ~ ~ wool ["color"="white"] /setblock ~ ~ ~ wheat ["growth"=0] /setblock ~ ~ ~ wood ["wood_type"="birch","stripped_bit"=true] /setblock ~ ~ ~ wool [] ``` +::: -- Block states are enclosed in square brackets ` [ ] ` -- When specifying multiple block states a comma ` , ` is used to separate them. -- Quotation marks ` " " ` are used around strings such as `"birch", "spruce" etc..` -- Integer values `0, 1, 2..` and boolean values `true/false` do not use quotation marks. -- Leaving the brackets blank is also a correct syntax, it will simply default to 0. -- `wool 0` is white wool hence you may simply write it as `wool []` instead of `wool ["color"="white"]` +- 方块状态需用方括号 `[ ]` 包裹 +- 多个状态间用逗号 `,` 分隔 +- 字符串值需使用双引号包裹,如 `"birch"`、`"spruce"` 等 +- 整数值 `0, 1, 2...` 和布尔值 `true/false` 无需引号 +- 空括号 `[]` 是有效语法,表示使用默认值0 +- `wool 0` 对应白色羊毛,因此可简写为 `wool []` 替代 `wool ["color"="white"]` -### Notes For Beginners +### 新手须知 -- **Integers** are whole numbers. They are used to define a block from a 'range' of values. - - Example: Redstone power 1 to 15 - - `["redstone_power"=10]` +- **整数(Integer)**:用于定义数值范围 + - 示例:红石信号强度1-15 + - `["redstone_power"=10]` -- **Boolean** is a programming term which refers to `true/false` values. You can simply understand it as yes or no questions. - - Is this piston powered? `yes/no` - - Is this button pressed? `yes/no` - - Is this log stripped? `yes/no` - - `["stripped_bit"=true]` +- **布尔值(Boolean)**:表示二值状态(真/假) + - 是否被激活?是否被按下?是否去皮? + - `["stripped_bit"=true]` -- **Strings** are unique 'text' inputs. You can simply understand it as multiple choice questions. - - What color is this wool? `"white"`, `"orange"`, `"brown"` etc.. - - What wood type is this log? `"spruce"`, `"birch"`, `"acacia"` etc.. - - `["wood_type"="spruce"]` - - -## Block States List -A list of all the block states currently available within Bedrock can be found at: +- **字符串(String)**:用于多选类型 + - 羊毛颜色?原木种类? + - `["wood_type"="spruce"]` + +## 方块状态列表 +完整方块状态清单可访问微软官方文档: https://learn.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/examples/blockstateslist -Note: In the site block states may be written as one word but make sure to separate them with underscores `_` when typing in commands. +注意:文档中可能出现连写的状态名称,但在命令中需使用下划线 `_` 分隔 -Example: `buttonPressedBit` → `"button_pressed_bit"` +示例:`buttonPressedBit` → `"button_pressed_bit"` -## Converting Aux Values to Block States -For your convenience; download any of the excel sheet below to find the full list of block IDs, their aux values and equivalent block states in Bedrock. *Shared by kayla@Mojang* +## 辅助值与方块状态转换 +可通过下方表格下载完整转换对照表(由kayla@Mojang提供): Download Sheet 1 +>下载表格1 -Note: the above sheet was quickly generated and contains some minor errors. Boolean values `0` should be replaced with `false` and `1` should be replaced with `true` since the game doesn't recognize the syntax otherwise. +注意:此表格为快速生成版本,布尔值需手动将`0`改为`false`,`1`改为`true` -Alternate sheet: *Shared by @ItsRichHeart* +替代表格(由@ItsRichHeart提供): Download Sheet 2 +>下载表格2 -You may also use this [Lookup Table](https://auxval-to-blockstates.netlify.app/) instead not needing to download any files. +也可使用在线[查询工具](https://auxval-to-blockstates.netlify.app/)免下载转换 -## Known Issue +## 已知问题 -Detecting blocks using commands such as `/execute` or `/testforblock` requires __all__ or __none__ of the block states specified else the command returns an error. +使用 `/execute` 或 `/testforblock` 检测方块时,必须指定全部或完全不指定方块状态,否则会报错 -Example; detecting a pressed stone button on ground facing up: - +示例:检测朝上方向被按下的石质按钮: +::: code-group ```yaml -#✅ Accepted: +#✅ 有效写法: /execute if block ~~~ stone_button [“button_pressed_bit”=true,”facing_direction”=1] run say success /execute if block ~~~ stone_button run say success -# ❌ Not Accepted: +# ❌ 无效写法: /execute if block ~~~ stone_button [“button_pressed_bit”=true] run say success /execute if block ~~~ stone_button [“facing_direction”=1] run say success ``` -Though block states have replaced aux values, we still cannot detect blocks based on specific filters yet like we do with selector arguments. +::: -### Related Bug Reports +虽然方块状态已取代辅助值,但目前仍无法像选择器参数那样进行精确过滤 + +### 相关漏洞报告 - [MCPE-133360](https://bugs.mojang.com/browse/MCPE-133360) -- [MCPE-168391](https://bugs.mojang.com/browse/MCPE-168391) +- [MCPE-168391](https://bugs.mojang.com/browse/MCPE-168391) \ No newline at end of file diff --git a/docs/wiki/commands/damage.md b/docs/wiki/commands/damage.md index 205778db..2beb7ae2 100644 --- a/docs/wiki/commands/damage.md +++ b/docs/wiki/commands/damage.md @@ -1,8 +1,8 @@ --- -title: Damage -category: Commands +title: 伤害指令 +category: 命令 tags: - - info + - 信息 mentions: - BedrockCommands - cda94581 @@ -10,87 +10,100 @@ mentions: - zheaEvyline --- -## Introduction +# 伤害指令 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -Introduced in Minecraft Release `1.18.10`, the /damage command deals precise damage to specified entities. With this change, the clunky methods like using `/effect` command to damage entities are rendered obsolete, making maps and other creations more powerful. +## 概述 -## Syntax +[源自Bedrock Commands社区Discord](https://discord.gg/SYstTYx5G5) -- There are two ways the damage command can be used: - - `/damage [Cause]` - - `/damage entity ` +`/damage` 指令于Minecraft基岩版 `1.18.10` 版本加入,可对指定实体造成精确伤害。这一改进使得原先使用 `/effect` 指令等笨拙的伤害方式成为历史,为地图制作和其他创作提供了更强大的工具。 -## Arguments +## 语法结构 -- Phrases not contained in angle <> or square [] brackets instruct you to type it as-is. -- Phrases contained within brackets are variables, these need to be replaced: - - **` <> `** Angle brackets mean the variable is required. - - **` [] `** Square brackets mean the variable is optional. +- 该指令有两种使用方式: + - `/damage <目标> <伤害值> [伤害原因]` + - `/damage <目标> <伤害值> <伤害原因> entity <伤害源实体>` -## Variables +## 参数说明 -- **` Target `** This is your typical entity selector, such as `@s` , `@e` , or `"cda94581"` . Multiple entities may be selected at a time to deal the damage to multiple targets. +- 未包含在尖括号 `<>` 或方括号 `[]` 中的短语需按原样输入 +- 括号内内容为可变参数,需要替换为实际值: + - **` <> `** 尖括号表示必填参数 + - **` [] `** 方括号表示可选参数 -- **` Amount `** This is a whole number, which specifies the amount of damage to deal to the targets. The minimum value is `0` and the maximum value is `2147483647`, or the signed 32-bit integer limit. +## 参数详解 -- **` Cause `** This specifies the "reason" the damage was dealt. This cause will appear in death messages (`X hit the ground too hard for cause: fall`) be used in damage calculation with armor (`the value dealt in Amount may be different depending on the worn armor`), and used in a large variety of other things, such as in Behavior Pack/Add-ons. A full list of all the damage causes can be found [below](/commands/damage#damage-cause-list) +- **` 目标 `** + 常规实体选择器,如 `@s`、`@e` 或 `"cda94581"`。支持同时选择多个实体进行群体伤害。 -- **` Damager `** If Cause was something to do with entities `(such as entity_attack)`, this specifies where the damage came from `(the entity that dealt the attack)`. This is limited to only 1 target. An error will be thrown if multiple targets are found from the selector. +- **` 伤害值 `** + 整数类型,指定造成的伤害数值。最小值为 `0`,最大值为32位有符号整数上限 `2147483647`。 -> Note: the ` entity ` is only required when the Cause has to do with another entity `(entity_attack)`. Otherwise, follow the first syntax. +- **` 伤害原因 `** + 决定伤害来源类型。该参数将影响: + - 死亡提示信息(如 `X因坠落伤害而亡`) + - 护甲减伤计算(实际伤害值会根据护甲属性变化) + - 行为包/附加包中的伤害处理逻辑 + 完整伤害原因列表详见[下方章节](/wiki/commands/damage#damage-cause-list) -## Examples +- **` 伤害源实体 `** + 当伤害原因与实体相关时(如 `entity_attack`),此参数指定伤害来源实体。该选择器仅支持单个目标,若返回多个实体会报错。 -mcfunction -```yaml -#Deal 4 damage to all players +> 注意:`<伤害原因> entity <伤害源实体>` 语法仅在伤害原因涉及其他实体时使用(如实体攻击)。其他情况请使用基础语法。 + +## 使用示例 + +::: code-group +```yaml [mcfunction] +# 对所有玩家造成4点伤害 /damage @a 4 -#Deal 3 'fire' damage to all entities of type 'sheep' -/damage @e [type=sheep] 3 fire +# 对所有绵羊造成3点火焰伤害 +/damage @e[type=sheep] 3 fire -#Deal 40 'entity attack' damage from a random player to all entities of type 'sheep' -/damage @a 40 entity_attack entity @r [type=sheep] +# 让随机玩家对所有绵羊造成40点实体攻击伤害 +/damage @e[type=sheep] 40 entity_attack entity @r ``` +::: -## Damage Cause List +## 伤害原因列表 -Listed below are all the 'damage sources' in MCBE for the `/damage` command currently available: -``` -anvil -attack -block_explosion -charging -contact -drowning -entity_attack -entity_explosion -fall -falling_block -fatal -fire -fire_tick -fireworks -fly_into_wall -freezing -lava -lightning -magic -magma -none -override -piston -projectile -sonic_boom -stalactite -stalagmite -starve -suffocation -suicide -temperature -thorns -void -wither +以下是MCBE中 `/damage` 指令当前支持的所有伤害原因: ``` +anvil # 铁砧 +attack # 普通攻击 +block_explosion # 方块爆炸 +charging # 冲锋(如幻翼) +contact # 接触伤害(如仙人掌) +drowning # 溺水 +entity_attack # 实体攻击 +entity_explosion # 实体爆炸 +fall # 坠落 +falling_block # 下坠方块 +fatal # 致命伤害 +fire # 火焰 +fire_tick # 燃烧伤害 +fireworks # 烟花 +fly_into_wall # 飞行撞墙(鞘翅) +freezing # 冰冻 +lava # 岩浆 +lightning # 闪电 +magic # 魔法 +magma # 岩浆块 +none # 无来源 +override # 强制覆盖 +piston # 活塞 +projectile # 弹射物 +sonic_boom # 监守者音波 +stalactite # 钟乳石 +stalagmite # 石笋 +starve # 饥饿 +suffocation # 窒息 +suicide # 自杀 +temperature # 温度伤害 +thorns # 荆棘 +void # 虚空 +wither # 凋零 +``` \ No newline at end of file diff --git a/docs/wiki/commands/entity-counter.md b/docs/wiki/commands/entity-counter.md index 62acc0f8..6e9241c3 100644 --- a/docs/wiki/commands/entity-counter.md +++ b/docs/wiki/commands/entity-counter.md @@ -1,77 +1,83 @@ --- -title: Entity Counter -category: Scoreboard Systems +title: 实体计数器 +category: 计分板系统 mentions: - BedrockCommands - zheaEvyline nav_order: 3 tags: - - system + - 系统 --- -## Introduction +# 实体计数器 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -This system allows you to track how many players/entities are there on your world and run your desired commands based on the values obtained. +## 前言 -> Note: you cannot track entities in unloaded chunks though players can still be tracked regardless. +[源自Bedrock Commands社区Discord](https://discord.gg/SYstTYx5G5) -## Setup +本系统可用于追踪世界中玩家/实体的数量,并根据获取的数值执行自定义命令。 -*To be typed in Chat:* +> 注意:无法追踪未加载区块中的实体,但玩家无论是否在加载区块中都可被追踪。 + +## 初始化设置 + +*在聊天栏输入:* `/scoreboard objectives add total dummy` -If you prefer to have the objective added automatically on world initialisation, follow the process outlined in [On First World Load.](/commands/on-first-world-load) +若希望在世界初始化时自动添加该计分项,请参照[首次世界加载](/wiki/commands/on-first-world-load)中的流程进行设置。 -## System +## 核心系统 -BP/functions/entity_counter.mcfunction - -```yaml +::: code-group +```yaml [BP/functions/entity_counter.mcfunction] scoreboard players set onlinePlayers total 0 execute as @e [type=player] run scoreboard players add onlinePlayers total 1 -#Your Commands Here (examples) -execute if score onlinePlayers total matches 4.. run title @a actionbar Enough players to start game. -execute if score onlinePlayers total matches ..3 run title @a actionbar Not enough players. +# 在此处添加你的命令(示例) +execute if score onlinePlayers total matches 4.. run title @a actionbar 玩家数量已满足游戏条件。 +execute if score onlinePlayers total matches ..3 run title @a actionbar 玩家数量不足。 + ``` +::: + ![commandBlockChain3](/assets/images/commands/commandBlockChain/3.png) +本示例使用名为`onlinePlayers`的虚拟玩家分数,通过选择器`@e [type=player]`追踪当前在线玩家数量。您可以根据需求使用任意虚拟玩家名称和实体类型,例如`@e [type=creeper]`来追踪苦力怕数量。 -Here we have used a FakePlayer name `onlinePlayers` and targeting `@e [type=player]` to track how many players are currently on the world. However you may use any FakePlayer name and target any entity you might need. Such as `@e [type=creeper]` +示例中使用的`/title`命令演示了两种条件判断: +- a) 当玩家数≥4时触发 `4..` +- b) 当玩家数≤3时触发 `..3` -Similarly we're running a `/title` command as an example: -- a) when there are 4 or more players `4..` -- b) when there are 3 players or less `..3` +您可根据实际需求修改这些条件。 -You can edit this as well to suit your need. +## 系统原理 -## Explanation +- 系统中的前两条命令将虚拟玩家分数(此处为`onlinePlayers`)重置为0,然后通过遍历每个已加载的目标实体(此处为`type=player`)来累计分数 -- The first two commands in the system sets the FakePlayer name's score to 0 (here `onlinePlayers`) and from each loaded entity we want to track (here `type=player`) it will add a score to the specified FakePlayer name (here `onlinePlayers`) +通过获取的数值,我们可以使用`/execute if score`命令在满足特定条件时执行自定义操作: +- **` n `** 精确匹配数值n +- **` n.. `** 数值≥n时触发 +- **` ..n `** 数值≤n时触发 +- **` n1..n2 `** 数值在n1到n2区间时触发 -Now based on the values obtained we can use the `/execute if score` command to run our desired commands when certain values are met. -- **` n `** any number n -- **` n.. `** any number n and above -- **` ..n `** any number n and below -- **` n1..n2 `** any number n1 to any number n2. +## 循环执行配置 -## Tick JSON +若使用函数替代命令方块,需将`entity_counter`函数添加至`tick.json`以实现循环持续执行。通过在字符串后添加逗号分隔,可将多个文件添加至`tick.json`。更多信息请参考[函数文档](/wiki/commands/mcfunctions#tick-json)。 -If you are using functions instead of command blocks, the ` entity_counter ` function must be added to the ` tick.json ` in order to loop and run it continuously. Multiple files can be added to the ` tick.json ` by placing a comma after each string. Refer to [Functions](/commands/mcfunctions#tick-json) documentation for further info. - -BP/functions/tick.json -```json +::: code-group +```json [BP/functions/tick.json] { "values": [ "entity_counter" ] } ``` +::: -If using functions, your pack folder structure will be be as follows: +使用函数时,资源包文件夹结构如下所示: -> **Note:** the scoreboard names (in this case: 'total') may end up being used by other people. Appending ` _ ` and a set of randomly generated characters after would be a choice that reduces the probability of collisions. Similar technique can be employed for the ` .mcfunction ` filenames. Ex: -> - ` total_0fe678 ` -> - ` entity_counter_0fe678.mcfunction ` +> **注意:** 计分项名称(本例中的'total')可能被他人重复使用。建议在名称后追加`_`和随机字符组合来降低冲突概率,此方法同样适用于`.mcfunction`文件名。例如: +> - `total_0fe678` +> - `entity_counter_0fe678.mcfunction` \ No newline at end of file diff --git a/docs/wiki/commands/index.md b/docs/wiki/commands/index.md index 075266c2..7938b906 100644 --- a/docs/wiki/commands/index.md +++ b/docs/wiki/commands/index.md @@ -1,14 +1,14 @@ --- -title: Commands +title: 命令 Commands categories: - - title: General + - title: 基础 color: green - - title: Commands + - title: 命令 color: green - - title: On Event Systems + - title: 事件系统 color: blue - - title: Scoreboard Systems + - title: 计分板系统 color: blue - - title: Techniques + - title: 技术 color: orange --- diff --git a/docs/wiki/commands/intro-to-command-blocks.md b/docs/wiki/commands/intro-to-command-blocks.md index 879bcb11..082f097d 100644 --- a/docs/wiki/commands/intro-to-command-blocks.md +++ b/docs/wiki/commands/intro-to-command-blocks.md @@ -1,6 +1,6 @@ --- -title: Intro to Command Blocks -category: General +title: 命令方块入门 +category: 基础 mentions: - BedrockCommands - zheaEvyline @@ -10,132 +10,122 @@ tags: - info --- -## Introduction +# 命令方块入门 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -Command Blocks are special blocks in Minecraft. The same commands (cheats) you type in chat can be run automatically using command blocks and it can be reused without needing to type all over again. +## 简介 -They can only be placed or destroyed by a player with the Operator permission level in gamemode Creative. +[由 Bedrock Commands 社区 Discord 提供](https://discord.gg/SYstTYx5G5) -## Obtaining +命令方块是 Minecraft 中的特殊方块。通过在聊天栏输入的指令(作弊命令)可以通过命令方块自动执行,无需重复输入即可复用。 -1. Open your world settings. -2. Under Cheats, toggle "Activate Cheats" setting ON. -3. Run `/give @s command_block` command in chat. +只有拥有操作员权限的创造模式玩家才能放置或破坏命令方块。 -## Command Block UI +## 获取方式 + +1. 打开世界设置 +2. 在「作弊」选项下启用「激活作弊」 +3. 在聊天栏输入 `/give @s command_block` + +## 命令方块界面 ![commandBlockUI](/assets/images/commands/commandBlockUI.png) -## Command Block Types +## 命令方块类型 -![impulseCommandBlock](/assets/images/commands/impulseCommandBlock.png) **Impulse** runs the command __once__ each time it is powered. +![impulseCommandBlock](/assets/images/commands/impulseCommandBlock.png) **脉冲型** 在被激活时__单次__执行命令 -![chainCommandBlock](/assets/images/commands/chainCommandBlock.png) **Chain** runs the command in a sequence, ie. only after the previous command block it is connecting from was run. +![chainCommandBlock](/assets/images/commands/chainCommandBlock.png) **连锁型** 按顺序执行命令,即仅在前置方块执行后触发 -![repeatingCommandBlock](/assets/images/commands/repeatingCommandBlock.png) **Repeat** runs the command every game tick. There are approximately 20 ticks per second. A delay can be applied to adjust how often the command is executed, explained [below](/commands/intro-to-command-blocks#command-block-tick-delay). +![repeatingCommandBlock](/assets/images/commands/repeatingCommandBlock.png) **循环型** 每游戏刻执行一次命令(每秒约20刻)。可通过[下文](#命令方块刻延迟)介绍的延迟设置调整执行频率 -## Command Block Conditions +## 命令方块条件 -**Conditional** command blocks will run the command only if the previous command block it was connecting from had an output that was `true` (successful) -> Conditional command block states are shown by a small indent into the command block's texture, as shown below: -> - ![pasteCommandButton](/assets/images/commands/impulseConditionalCommandBlock.png) Impulse Conditional Command Block -> - ![chainConditionalCommandBlock](/assets/images/commands/chainConditionalCommandBlock.png) Chain Conditional Command Block -> - ![repeatingConditionalCommandBlock](/assets/images/commands/repeatingConditionalCommandBlock.png) Repeating Conditional Command Block +**条件制约型** 仅当连接的前置方块输出结果为`true`(成功)时执行命令 +> 条件制约型方块在材质上会显示凹陷箭头标识: +> - ![pasteCommandButton](/assets/images/commands/impulseConditionalCommandBlock.png) 脉冲条件制约型 +> - ![chainConditionalCommandBlock](/assets/images/commands/chainConditionalCommandBlock.png) 连锁条件制约型 +> - ![repeatingConditionalCommandBlock](/assets/images/commands/repeatingConditionalCommandBlock.png) 循环条件制约型 -**Unconditional** command blocks will run the command regardless. Whether the previous command block it was connecting from had an output that was `true` (succesful), `false` (failed) or even if it came with a syntax error the command block will still run the command. +**无条件型** 无论前置方块输出结果如何都会执行命令(包括`true`成功、`false`失败甚至语法错误) -## Command Block Redstone States +## 命令方块红石状态 -**Needs Redstone** command block can only be activated with redstone power. Using buttons, levers, redstone torch etc.. +**需要红石** 必须通过红石信号激活(按钮、拉杆、红石火把等) -**Always Active** command block will be activated as soon as you close the command block UI. +**保持开启** 关闭命令方块界面后立即持续激活 -## Command Block Tick Delay +## 命令方块刻延迟 -In this option you may specify how much delay you want there to be before the command block runs the command. - -The ticks refer to Minecraft game ticks. A **tick** is simply a unit of measure for time in games. 1 second in real life is approximately 20 game ticks in Minecraft. +设置命令执行前的延迟时间。刻(Tick)是 Minecraft 的时间单位,现实1秒约等于20游戏刻。 :::tip ![gametick.png](/assets/images/commands/gametick.png) ::: -## Command Block Hover Note +## 悬浮提示文本 -This option allows you to put a hovering text on your command blocks. It's useful for giving short-names for easy identification when working with many command blocks. +可为命令方块添加悬浮备注,便于在多命令方块系统中快速识别。 -When a command is run, the hover note will be displayed with the output in chat if gamerule `commandblockoutput` is enabled. +当`commandblockoutput`游戏规则启用时,命令执行后会在聊天栏显示备注信息。 ![hover_note](/assets/images/commands/hover_note.png) -## Paste Button +## 粘贴按钮 ![pasteCommandButton](/assets/images/commands/pasteCommandButton.png) -The paste button allows you to paste commands from your clipboard to the 'Command Input' box. +支持将剪贴板内容粘贴至命令输入框 -## Command Block Output +## 命令输出管理 -- Toggle the 'Previous Output' button in the command block UI to see command output and block details. +- 通过界面中的「上一个输出」按钮查看执行记录 +- 命令方块中无需输入开头的`/`符号(输入也不会报错) +- 红石比较器可读取输出强度(成功时输出1-15信号) +- 在聊天栏测试命令:红色文字表示`false`或语法错误,白色表示`true` +- 也可通过实际效果判断命令是否成功 +- 输出值`0`通常表示失败 -- The ` / ` you type before the whole command is not required in a command block but doing so won't cause any errors. +### 禁用命令提示 +在聊天栏输入: +- `/gamerule commandblockoutput false` 关闭命令方块提示 +- `/gamerule sendcommandfeedback false` 关闭聊天指令反馈 -- A redstone comparator can read command blocks outputs. If output is true, it will send anywhere from 1 to 15 redstone signals depending on the output value. +## 命令方块布局技巧 -- You can check if a command output is `true`/`false` by running it in chat. A red output will be a `false` output or a syntax error. A white output means command was run successfully. +搭建连锁系统时,确保箭头方向正确连接。箭头朝向可通过方块材质判断。 -- You can also tell if a command was `true`/`false` by checking whether action was performed or not. - -- An output with a value of `0` is usually a false output. - -### Disabling Command Messages In Chat -Run in Chat: -- `/gamerule commandblockoutput false` to disable command block messages in chat. -- `/gamerule sendcommandfeedback false` to disable feedback from commands entered in chat. - -## Command Block Placement - -When placing command blocks in a line (arranged to work together) for any system, make sure the consecutive command blocks connect/start from the head of the arrow. - -The arrow/facing direction can be observed from the command block texture. - -**✅ Correct Placement** +**✅ 正确布局** ![correctCommandBlockPlacement](/assets/images/commands/correctCommandBlockPlacement.png) -**❌ Incorrect Placement** +**❌ 错误布局** ![incorrectCommandBlockPlacement](/assets/images/commands/incorrectCommandBlockPlacement.png) -## Troubleshooting Command Blocks +## 故障排除指南 -- In world settings, under **Cheats**, make sure command blocks have not been disabled. +- 检查世界设置中是否禁用命令方块 +- 确保`maxcommandchainlength`游戏规则不为0 +- 排除意外红石信号干扰(红石线、拉杆、火把等) +- 切换「需要红石」与「保持开启」模式 +- 仔细检查方块类型、条件和命令语法,重新激活后查看输出 +- 确保区块已加载(可使用[常加载区域](/wiki/commands/tickingarea)) -- Make sure gamerule `maxcommandchainlength` is **not** set to 0 +若仍无法解决,可尝试拆除并重新放置命令方块 -- Make sure there are no unwanted redstone power that is interfering with the command block. It can be from redstone dust, lever, redstone torch etc.. +## 学习要点 -- Try switching between Always Active & Needs Redstone. - -- Double check the block type, condition & the command syntax. Check 'Previous Output' after powering it once again. - -- Just like redstone, command blocks must also be in loaded chunks for them to work. You can use a tickingarea to keep them loaded when players are not nearby. Refer to [/tickingarea](https://learn.microsoft.com/en-us/minecraft/creator/documents/tickingareacommand) command documentation for more info. - -If nothing seems to work simply break and place that command block again. - -## What you have learned - -:::tip What you have learned: -- How to obtain a command block in game. -- How the different types of command blocks behave and what they look like. -- What the different command block options are (including conditional, state and delay.) -- How command blocks output data by redstone and chat messages. -- How to properly place command block chains. -- How to resolve 'command block not working' +:::tip 学习要点: +- 游戏内获取命令方块的方法 +- 各类命令方块的特性与外观识别 +- 条件设置、红石状态与延迟配置 +- 通过红石与聊天信息获取输出数据 +- 正确排列命令方块链的技巧 +- 常见故障解决方案 ::: -To put what you have learned into practice, try making this simple [Entity Counter](/commands/entity-counter) system. -> Note: when setting up command block systems, always the first command will be ![repeatingCommandBlock](/assets/images/commands/repeatingCommandBlock.png) **`Unconditional Always Active`** and the rest will be ![chainCommandBlock](/assets/images/commands/chainCommandBlock.png) **`Unconditional Always Active`** (all 0 ticks delay) *unless specified otherwise.* +实践建议:尝试制作简易的[实体计数器系统](/wiki/commands/entity-counter) +> 注意:常规命令链的首个方块应为![repeatingCommandBlock](/assets/images/commands/repeatingCommandBlock.png) **无条件保持开启**,后续使用![chainCommandBlock](/assets/images/commands/chainCommandBlock.png) **无条件保持开启**(默认0刻延迟) > > ![commandBlockChain4](/assets/images/commands/commandBlockChain/4.png) -**(Recommended) Read Next: [Understanding Selectors](/commands/selectors)** +**(推荐延伸阅读)[选择器详解](/wiki/commands/selectors)** \ No newline at end of file diff --git a/docs/wiki/commands/mcfunctions.md b/docs/wiki/commands/mcfunctions.md index ff284772..7c800e82 100644 --- a/docs/wiki/commands/mcfunctions.md +++ b/docs/wiki/commands/mcfunctions.md @@ -1,6 +1,6 @@ --- -title: Functions -category: General +title: 函数 mcfunction +category: 基础 mentions: - Bedrock Commands - cda94581 @@ -8,19 +8,24 @@ mentions: - jordanparki7 nav_order: 3 tags: - - info + - 信息 --- -## Introduction -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) +# 函数 mcfunction -Functions are `.mcfunction` files which contain multiple lines of commands. They are run with the `/function` command in-game. + -Functions are created in a **Behavior Pack**, nested within the **functions** folder. A function pack creates a system using solely function files. +## 简介 -Functions are useful in many ways to reduce the time spent going from command block to command block debugging a system. They also help with packaging systems for use in multiple worlds and provide many functions that can change how everything works. +[源自 Bedrock Commands 社区 Discord](https://discord.gg/SYstTYx5G5) -## Function Pack Folder Structure +函数是包含多行命令的 `.mcfunction` 文件,可通过游戏中的 `/function` 命令运行。 + +函数需要创建在**行为包**的 **functions** 文件夹内。纯函数包系统完全由函数文件构成。 + +函数在多个方面非常有用,可以减少逐个命令方块调试系统所花费的时间。同时也便于将系统打包用于多个世界,并提供了许多可以改变整体运行方式的函数。 + +## 函数包目录结构 -## Notes For Beginners +## 新手须知 -mcfunction - -```yaml -#Spawn Effects +::: code-group +```yaml [mcfunction] +#生成效果 effect @a [tag=atSpawn] regeneration 12 255 true effect @a [tag=atSpawn] saturation 12 255 true effect @a [tag=atSpawn] weakness 12 255 true ``` -- Each new line in a function file represents a new command. You may start a line with # to add comments. Commands in a function do not need to begin with a slash `/`, however doing so will not cause any errors. +::: -- All commands in a function are run in the *same tick*. Because of this, a function which causes large changes may cause a sudden lag spike and it is helpful to delegate some commands across multiple ticks, if possible. -Commands in a function are still run in the same order, however. +- 函数文件中每一新行代表一个新命令。可以使用 `#` 开头添加注释。函数内的命令不需要以斜杠 `/` 开头,但添加了也不会报错。 -- Minecraft can **not** run more than 10,000 lines of commands in one function file. This includes any other function files that are executed inside of the original file. +- 函数中的所有命令会在**同一游戏刻**内执行。因此,包含大量变更操作的函数可能导致突然的卡顿,建议尽可能将命令分摊到多个游戏刻中执行。但函数内的命令仍会按顺序依次运行。 -- It is not possible to run conditional commands. Those will still need to utilize command blocks in some way, or could utilize the 1.19.50 execute syntax. +- Minecraft **无法**在一个函数文件中运行超过10,000行命令,这包括原始文件中调用的其他函数文件。 -- Running commands with a specified delay in a function would involve using scoreboard timers to incrementally count up every tick (to a certain point), and executing at certain scores along the file. You may refer to [Scoreboard Timers](/commands/scoreboard-timers) system to learn how to set it up. +- 无法执行条件型命令。这类命令仍需通过命令方块实现,或使用1.19.50版本的execute语法。 -## Creating a Function +- 要在函数中实现延迟执行命令,需使用计分板计时器逐刻计数(达到指定值),并在特定分数时执行命令。可参考[计分板计时器](/wiki/commands/scoreboard-timers)系统了解设置方法。 -1. Locate the `📁 com.mojang` folder and navigate to `📁 development_behavior_packs` - - The development folders are used for quick reloading of packs, as the packs aren't cached to the world files. +## 创建函数 -2. Create a folder (of any name) for the function pack. This will be referred to as Behavior Pack or BP. +1. 找到 `📁 com.mojang` 文件夹并进入 `📁 development_behavior_packs` + - 开发文件夹用于快速重载资源包,因为这些包不会被缓存到世界文件中。 -3. Create a `📄 manifest.json` file and a `🖼 pack_icon.png` file (optional) within the BP folder. - - A manifest file contains all the information needed to register a pack, while a pack icon displays visually in the pack menu. A pack icon is typically a 128x128 or a 256x256 image, though any power-of-2 resolution will do, they will be upscaled and downscaled accordingly. +2. 为函数包创建任意名称的文件夹(称为行为包或BP)。 - +3. 在BP文件夹内创建 `📄 manifest.json` 文件和 `🖼 pack_icon.png` 文件(可选) + - 清单文件包含注册资源包所需的所有信息,包图标则用于在资源包菜单中显示。包图标建议使用128x128或256x256分辨率(支持2次幂分辨率,会自动缩放)。 -BP/manifest.json + -```json +::: code-group +```json [BP/manifest.json] { "format_version": 2, "header": { - "description": "Write Your Pack Description Here", - "name": "Write Your Pack Name Here", + "description": "在此填写资源包描述", + "name": "在此填写资源包名称", "uuid": "00000000-0000-0000-0000-000000000000", "version": [ 1, 0, 0 ], "min_engine_version": [ 1, 19, 73 ] @@ -89,45 +93,44 @@ Commands in a function are still run in the same order, however. ] } ``` +::: -Note that the uuid field needs to be replaced with an actual uuid, and the two generated must be different from one another. You can generate a uuid at https://uuidgenerator.net/ +注意:uuid字段需要替换为实际值,且两个uuid必须不同。可通过 https://uuidgenerator.net/ 生成 - + -Sample A: +示例A: ![pack_icon.png](/assets/images/commands/pack_icon.png) -Sample B: +示例B: ![pack_icon.png](/assets/images/guide/project-setup/pack_icon.png) -4. Create a `📁 functions` folder. Any file within this folder that ends with **.mcfunction** will be registered as a function in-game, which can be run with `/function `. - - Nested functions are allowed, simply list the file path in relation to the functions folder as shown in the function pack folder structure. +4. 创建 `📁 functions` 文件夹。该文件夹内所有以 **.mcfunction** 结尾的文件都将注册为游戏内可用的函数,可通过 `/function <函数名称>` 运行。 + - 支持嵌套函数,只需按函数包目录结构示例中的方式组织文件路径即可。 -5. Apply the behavior pack in-game and try out the functions. Function file changes can be reflected in the world by running `/reload` or by simply relogging. +5. 在游戏中应用行为包并测试函数。修改函数文件后可通过执行 `/reload` 或重新登录来刷新改动。 -:::tip NOTE -Functions are versioned; therefore, they will run in the version listed in the `📄 manifest.json`, such as: -- `min_engine_version` 1.19.50 or above will adopt the new execute syntax. -- `min_engine_version` 1.19.70 or above will require aux values be replaced with block states. +:::tip 注意 +函数具有版本依赖性,将运行在 `📄 manifest.json` 中声明的版本环境下: +- `min_engine_version` 1.19.50+ 将采用新版execute语法 +- `min_engine_version` 1.19.70+ 需将aux值替换为方块状态 ::: -## Execution +## 执行方式 -Functions can be executed in-game by typing `/function name_of_function`. This will execute all the commands in the function file, all in a single tick. - -Nested functions, for example `BP/functions/lobby/items/1.mcfunction` can be run using the nested folder path, in this case `/function lobby/items/1` +在游戏中输入 `/function 函数名称` 即可执行函数文件内的所有命令(同一游戏刻内完成)。例如嵌套函数 `BP/functions/lobby/items/1.mcfunction` 需使用路径 `/function lobby/items/1` 调用。 ## tick.json -The final file within a function is the **tick.json** file. This specifies functions to run server-side on every game tick, (similar to a repeating command block.) It is located in the `BP/functions` folder. By default, functions running in this file execute at origin `0, 0, 0` in the overworld. +**tick.json** 是函数包中的特殊文件,用于指定服务器每游戏刻自动运行的函数(类似循环命令方块)。该文件位于 `BP/functions` 文件夹中,默认在主世界原点坐标 `0, 0, 0` 处执行。 -BP/functions/tick.json -```json +::: code-group +```json [BP/functions/tick.json] { "values": [ "function_1", @@ -135,24 +138,26 @@ The final file within a function is the **tick.json** file. This specifies funct ] } ``` -> Note: functions in this file are run as soon as the world is *initialized*, regardless of whether or not the player has been *loaded*. This may cause unintended behavior if used incorrectly. +::: -## Sample Function Pack +> 注意:该文件中的函数会在世界初始化后立即运行(无论玩家是否加载完毕),使用不当可能导致意外行为。 + +## 示例函数包 -## Troubleshooting Functions +## 函数排错指南 -Your functions may not appear within the command suggestions when using `/function`. This is normally due to an error with one or more commands in the function. +使用 `/function` 时若未出现命令建议,通常是由于函数中存在错误命令导致。 -Enabling the [Content Log](/guide/troubleshooting#content-log) in creator settings will allow you to see if there are any errors in your function pack, in which function the error is in, at which line and exactly what the syntax error for that command is. +在创作者设置中启用[内容日志](/wiki/guide/troubleshooting#content-log)可查看函数包中的具体错误信息,包括错误所在函数、行号及语法问题。 -The list of errors will be generated every time you load a world or run `/reload` to reflect changes after editing files. The list can be viewed on-screen for a few seconds as well as in the content log history in settings. +每次加载世界或执行 `/reload` 后都会生成错误列表,可在屏幕上短暂查看或通过设置中的内容日志历史记录查阅。 ![contentLogToggles](/assets/images/commands/contentLogToggles.png) -![contentLogHistory](/assets/images/commands/contentLogHistory.png) +![contentLogHistory](/assets/images/commands/contentLogHistory.png) \ No newline at end of file diff --git a/docs/wiki/commands/nbt-commands.md b/docs/wiki/commands/nbt-commands.md index 0d74e725..a02132ab 100644 --- a/docs/wiki/commands/nbt-commands.md +++ b/docs/wiki/commands/nbt-commands.md @@ -1,6 +1,6 @@ --- -title: NBT Commands -category: General +title: NBT 命令 +category: 基础 mentions: - MedicalJewel105 - SirLich @@ -11,98 +11,138 @@ mentions: - SmokeyStack --- -NBT data for the Bedrock edition is minimal. The only values we have access to are: +# NBT 命令 -1. `CanPlaceOn` -2. `CanDestroy` -3. `KeepOnDeath` -4. `ItemLock`. + -These are used as part of a `/give` or `replaceitem` command and can edit specific properties of the items with said NBT. +基岩版中可用的 NBT 数据较为有限,目前支持的四类 NBT 为: -## CanPlaceOn and CanDestroy +1. `CanPlaceOn`(可放置于) +2. `CanDestroy`(可破坏) +3. `KeepOnDeath`(死亡保留) +4. `ItemLock`(物品锁定) -Destroy: `/give @p diamond_pickaxe 1 0 {"minecraft:can_destroy":{"blocks":["planks", "skull"]}}` +这些 NBT 需要通过 `/give` 或 `replaceitem` 命令应用,能够修改物品的特定属性。 -Place on: `/give @p stone 1 0 {"minecraft:can_place_on":{"blocks":["stone"]}}` +## CanPlaceOn 与 CanDestroy -You can add more blocks like this: `["stone", "dirt", "bedrock"]` +破坏权限示例: +```bash +/give @p diamond_pickaxe 1 0 {"minecraft:can_destroy":{"blocks":["planks", "skull"]}} +``` -Note: The game interprets mob skulls as blocks that can be destroyed. These two NBT components only function in adventure mode. - -### CanPlaceOn Everything - -This is the code for a block that can be placed on everything in the game: - -**Please, note that if there is at least one invalid block, this won't work!** - - - +放置权限示例: +```bash +/give @p stone 1 0 {"minecraft:can_place_on":{"blocks":["stone"]}} +``` +多方块添加格式: ```json -give @p stone 1 0 {"minecraft:can_place_on": {"blocks": ["acacia_button", "acacia_door", "acacia_fence", "acacia_fence_gate", "acacia_hanging_sign", "acacia_log", "acacia_pressure_plate", "acacia_stairs", "acacia_standing_sign", "acacia_trapdoor", "acacia_wall_sign", "activator_rail", "air", "allow", "amethyst_block", "amethyst_cluster", "ancient_debris", "andesite_stairs", "anvil", "azalea", "azalea_leaves", "azalea_leaves_flowered", "bamboo", "bamboo_block", "bamboo_button", "bamboo_door", "bamboo_double_slab", "bamboo_fence", "bamboo_fence_gate", "bamboo_hanging_sign", "bamboo_mosaic", "bamboo_mosaic_double_slab", "bamboo_mosaic_slab", "bamboo_mosaic_stairs", "bamboo_planks", "bamboo_pressure_plate", "bamboo_sapling", "bamboo_slab", "bamboo_stairs", "bamboo_standing_sign", "bamboo_trapdoor", "bamboo_wall_sign", "barrel", "barrier", "basalt", "beacon", "bed", "bedrock", "bee_nest", "beehive", "beetroot", "bell", "big_dripleaf", "birch_button", "birch_door", "birch_fence", "birch_fence_gate", "birch_hanging_sign", "birch_log", "birch_pressure_plate", "birch_stairs", "birch_standing_sign", "birch_trapdoor", "birch_wall_sign", "black_candle", "black_candle_cake", "black_carpet", "black_concrete", "black_glazed_terracotta", "black_shulker_box", "black_wool", "blackstone", "blackstone_double_slab", "blackstone_slab", "blackstone_stairs", "blackstone_wall", "blast_furnace", "blue_candle", "blue_candle_cake", "blue_carpet", "blue_concrete", "blue_glazed_terracotta", "blue_ice", "blue_shulker_box", "blue_wool", "bone_block", "bookshelf", "border_block", "brain_coral", "brewing_stand", "brick_block", "brick_stairs", "brown_candle", "brown_candle_cake", "brown_carpet", "brown_concrete", "brown_glazed_terracotta", "brown_mushroom", "brown_mushroom_block", "brown_shulker_box", "brown_wool", "bubble_column", "bubble_coral", "budding_amethyst", "cactus", "cake", "calcite", "calibrated_sculk_sensor", "camera", "campfire", "candle", "candle_cake", "carpet", "carrots", "cartography_table", "carved_pumpkin", "cauldron", "cave_vines", "cave_vines_body_with_berries", "cave_vines_head_with_berries", "chain", "chain_command_block", "cherry_button", "cherry_door", "cherry_double_slab", "cherry_fence", "cherry_fence_gate", "cherry_hanging_sign", "cherry_leaves", "cherry_log", "cherry_planks", "cherry_pressure_plate", "cherry_sapling", "cherry_slab", "cherry_stairs", "cherry_standing_sign", "cherry_trapdoor", "cherry_wall_sign", "cherry_wood", "chest", "chiseled_bookshelf", "chiseled_deepslate", "chiseled_nether_bricks", "chiseled_polished_blackstone", "chorus_flower", "chorus_plant", "clay", "coal_block", "coal_ore", "cobbled_deepslate", "cobbled_deepslate_double_slab", "cobbled_deepslate_slab", "cobbled_deepslate_stairs", "cobbled_deepslate_wall", "cobblestone", "cobblestone_wall", "cocoa", "command_block", "composter", "concrete", "concretePowder", "conduit", "copper_block", "copper_ore", "coral", "coral_block", "coral_fan", "coral_fan_dead", "coral_fan_hang", "coral_fan_hang2", "coral_fan_hang3", "cracked_deepslate_bricks", "cracked_deepslate_tiles", "cracked_nether_bricks", "cracked_polished_blackstone_bricks", "crafting_table", "crimson_button", "crimson_door", "crimson_double_slab", "crimson_fence", "crimson_fence_gate", "crimson_fungus", "crimson_hanging_sign", "crimson_hyphae", "crimson_nylium", "crimson_planks", "crimson_pressure_plate", "crimson_roots", "crimson_slab", "crimson_stairs", "crimson_standing_sign", "crimson_stem", "crimson_trapdoor", "crimson_wall_sign", "crying_obsidian", "cut_copper", "cut_copper_slab", "cut_copper_stairs", "cyan_candle", "cyan_candle_cake", "cyan_carpet", "cyan_concrete", "cyan_glazed_terracotta", "cyan_shulker_box", "cyan_wool", "dark_oak_button", "dark_oak_door", "dark_oak_fence", "dark_oak_fence_gate", "dark_oak_hanging_sign", "dark_oak_log", "dark_oak_pressure_plate", "dark_oak_stairs", "dark_oak_trapdoor", "dark_prismarine_stairs", "darkoak_standing_sign", "darkoak_wall_sign", "daylight_detector", "daylight_detector_inverted", "dead_brain_coral", "dead_bubble_coral", "dead_fire_coral", "dead_horn_coral", "dead_tube_coral", "deadbush", "decorated_pot", "deepslate", "deepslate_brick_double_slab", "deepslate_brick_slab", "deepslate_brick_stairs", "deepslate_brick_wall", "deepslate_bricks", "deepslate_coal_ore", "deepslate_copper_ore", "deepslate_diamond_ore", "deepslate_emerald_ore", "deepslate_gold_ore", "deepslate_iron_ore", "deepslate_lapis_ore", "deepslate_redstone_ore", "deepslate_tile_double_slab", "deepslate_tile_slab", "deepslate_tile_stairs", "deepslate_tile_wall", "deepslate_tiles", "deny", "detector_rail", "diamond_block", "diamond_ore", "diorite_stairs", "dirt", "dirt_with_roots", "dispenser", "double_cut_copper_slab", "double_plant", "double_stone_slab", "double_stone_slab2", "double_stone_slab3", "double_stone_slab4", "double_wooden_slab", "dragon_egg", "dried_kelp_block", "dripstone_block", "dropper", "emerald_block", "emerald_ore", "enchanting_table", "end_brick_stairs", "end_bricks", "end_gateway", "end_portal", "end_portal_frame", "end_rod", "end_stone", "ender_chest", "exposed_copper", "exposed_cut_copper", "exposed_cut_copper_slab", "exposed_cut_copper_stairs", "exposed_double_cut_copper_slab", "farmland", "fence", "fence_gate", "fire", "fire_coral", "fletching_table", "flower_pot", "flowering_azalea", "flowing_lava", "flowing_water", "frame", "frog_spawn", "frosted_ice", "furnace", "gilded_blackstone", "glass", "glass_pane", "glow_frame", "glow_lichen", "glowingobsidian", "glowstone", "gold_block", "gold_ore", "golden_rail", "granite_stairs", "grass", "grass_path", "gravel", "gray_candle", "gray_candle_cake", "gray_carpet", "gray_concrete", "gray_glazed_terracotta", "gray_shulker_box", "gray_wool", "green_candle", "green_candle_cake", "green_carpet", "green_concrete", "green_glazed_terracotta", "green_shulker_box", "green_wool", "grindstone", "hanging_roots", "hardened_clay", "hay_block", "heavy_weighted_pressure_plate", "honey_block", "honeycomb_block", "hopper", "horn_coral", "ice", "infested_deepslate", "info_update", "info_update2", "invisibleBedrock", "iron_bars", "iron_block", "iron_door", "iron_ore", "iron_trapdoor", "jigsaw", "jukebox", "jungle_button", "jungle_door", "jungle_fence", "jungle_fence_gate", "jungle_hanging_sign", "jungle_log", "jungle_pressure_plate", "jungle_stairs", "jungle_standing_sign", "jungle_trapdoor", "jungle_wall_sign", "kelp", "ladder", "lantern", "lapis_block", "lapis_ore", "large_amethyst_bud", "lava", "lava_cauldron", "leaves", "leaves2", "lectern", "lever", "light_block", "light_blue_candle", "light_blue_candle_cake", "light_blue_carpet", "light_blue_concrete", "light_blue_glazed_terracotta", "light_blue_shulker_box", "light_blue_wool", "light_gray_candle", "light_gray_candle_cake", "light_gray_carpet", "light_gray_concrete", "light_gray_shulker_box", "light_gray_wool", "light_weighted_pressure_plate", "lightning_rod", "lime_candle", "lime_candle_cake", "lime_carpet", "lime_concrete", "lime_glazed_terracotta", "lime_shulker_box", "lime_wool", "lit_blast_furnace", "lit_deepslate_redstone_ore", "lit_furnace", "lit_pumpkin", "lit_redstone_lamp", "lit_redstone_ore", "lit_smoker", "lodestone", "log", "log2", "loom", "magenta_candle", "magenta_candle_cake", "magenta_carpet", "magenta_concrete", "magenta_glazed_terracotta", "magenta_shulker_box", "magenta_wool", "magma", "mangrove_button", "mangrove_door", "mangrove_double_slab", "mangrove_fence", "mangrove_fence_gate", "mangrove_hanging_sign", "mangrove_leaves", "mangrove_log", "mangrove_planks", "mangrove_pressure_plate", "mangrove_propagule", "mangrove_roots", "mangrove_slab", "mangrove_stairs", "mangrove_standing_sign", "mangrove_trapdoor", "mangrove_wall_sign", "mangrove_wood", "medium_amethyst_bud", "melon_block", "melon_stem", "mob_spawner", "monster_egg", "moss_block", "moss_carpet", "mossy_cobblestone", "mossy_cobblestone_stairs", "mossy_stone_brick_stairs", "movingBlock", "mud", "mud_brick_double_slab", "mud_brick_slab", "mud_brick_stairs", "mud_brick_wall", "mud_bricks", "muddy_mangrove_roots", "mycelium", "nether_brick", "nether_brick_fence", "nether_brick_stairs", "nether_gold_ore", "nether_sprouts", "nether_wart", "nether_wart_block", "netherite_block", "netherrack", "netherreactor", "normal_stone_stairs", "noteblock", "oak_fence", "oak_hanging_sign", "oak_log", "oak_stairs", "observer", "obsidian", "ochre_froglight", "orange_candle", "orange_candle_cake", "orange_carpet", "orange_concrete", "orange_glazed_terracotta", "orange_shulker_box", "orange_wool", "oxidized_copper", "oxidized_cut_copper", "oxidized_cut_copper_slab", "oxidized_cut_copper_stairs", "oxidized_double_cut_copper_slab", "packed_ice", "packed_mud", "pearlescent_froglight", "pink_candle", "pink_candle_cake", "pink_carpet", "pink_concrete", "pink_glazed_terracotta", "pink_petals", "pink_shulker_box", "pink_wool", "piston", "pistonArmCollision", "pitcher_crop", "pitcher_plant", "planks", "podzol", "pointed_dripstone", "polished_andesite_stairs", "polished_basalt", "polished_blackstone", "polished_blackstone_brick_double_slab", "polished_blackstone_brick_slab", "polished_blackstone_brick_stairs", "polished_blackstone_brick_wall", "polished_blackstone_bricks", "polished_blackstone_button", "polished_blackstone_double_slab", "polished_blackstone_pressure_plate", "polished_blackstone_slab", "polished_blackstone_stairs", "polished_blackstone_wall", "polished_deepslate", "polished_deepslate_double_slab", "polished_deepslate_slab", "polished_deepslate_stairs", "polished_deepslate_wall", "polished_diorite_stairs", "polished_granite_stairs", "portal", "potatoes", "powder_snow", "powered_comparator", "powered_repeater", "prismarine", "prismarine_bricks_stairs", "prismarine_stairs", "pumpkin", "pumpkin_stem", "purple_candle", "purple_candle_cake", "purple_carpet", "purple_concrete", "purple_glazed_terracotta", "purple_shulker_box", "purple_wool", "purpur_block", "purpur_stairs", "quartz_block", "quartz_bricks", "quartz_ore", "quartz_stairs", "rail", "raw_copper_block", "raw_gold_block", "raw_iron_block", "red_candle", "red_candle_cake", "red_carpet", "red_concrete", "red_flower", "red_glazed_terracotta", "red_mushroom", "red_mushroom_block", "red_nether_brick", "red_nether_brick_stairs", "red_sandstone", "red_sandstone_stairs", "red_shulker_box", "red_wool", "redstone_block", "redstone_lamp", "redstone_ore", "redstone_torch", "redstone_wire", "reeds", "reinforced_deepslate", "repeating_command_block", "reserved6", "respawn_anchor", "sand", "sandstone", "sandstone_stairs", "sapling", "scaffolding", "sculk", "sculk_catalyst", "sculk_sensor", "sculk_shrieker", "sculk_vein", "seaLantern", "sea_pickle", "seagrass", "shroomlight", "shulker_box", "silver_glazed_terracotta", "skull", "slime", "small_amethyst_bud", "small_dripleaf_block", "smithing_table", "smoker", "smooth_basalt", "smooth_quartz_stairs", "smooth_red_sandstone_stairs", "smooth_sandstone_stairs", "smooth_stone", "sniffer_egg", "snow", "snow_layer", "soul_campfire", "soul_fire", "soul_lantern", "soul_sand", "soul_soil", "soul_torch", "sponge", "spore_blossom", "spruce_button", "spruce_door", "spruce_fence", "spruce_fence_gate", "spruce_hanging_sign", "spruce_log", "spruce_pressure_plate", "spruce_stairs", "spruce_standing_sign", "spruce_trapdoor", "spruce_wall_sign", "stained_glass", "stained_glass_pane", "stained_hardened_clay", "standing_banner", "standing_sign", "stickyPistonArmCollision", "sticky_piston", "stone", "stone_brick_stairs", "stone_button", "stone_pressure_plate", "stone_slab", "stone_slab2", "stone_slab3", "stone_slab4", "stone_stairs", "stonebrick", "stonecutter", "stonecutter_block", "stripped_acacia_log", "stripped_bamboo_block", "stripped_birch_log", "stripped_cherry_log", "stripped_cherry_wood", "stripped_crimson_hyphae", "stripped_crimson_stem", "stripped_dark_oak_log", "stripped_jungle_log", "stripped_mangrove_log", "stripped_mangrove_wood", "stripped_oak_log", "stripped_spruce_log", "stripped_warped_hyphae", "stripped_warped_stem", "structure_block", "structure_void", "suspicious_gravel", "suspicious_sand", "sweet_berry_bush", "tallgrass", "target", "tinted_glass", "tnt", "torch", "torchflower", "torchflower_crop", "trapdoor", "trapped_chest", "tripWire", "tripwire_hook", "tube_coral", "tuff", "turtle_egg", "twisting_vines", "undyed_shulker_box", "unlit_redstone_torch", "unpowered_comparator", "unpowered_repeater", "verdant_froglight", "vine", "wall_banner", "wall_sign", "warped_button", "warped_door", "warped_double_slab", "warped_fence", "warped_fence_gate", "warped_fungus", "warped_hanging_sign", "warped_hyphae", "warped_nylium", "warped_planks", "warped_pressure_plate", "warped_roots", "warped_slab", "warped_stairs", "warped_standing_sign", "warped_stem", "warped_trapdoor", "warped_wall_sign", "warped_wart_block", "water", "waterlily", "waxed_copper", "waxed_cut_copper", "waxed_cut_copper_slab", "waxed_cut_copper_stairs", "waxed_double_cut_copper_slab", "waxed_exposed_copper", "waxed_exposed_cut_copper", "waxed_exposed_cut_copper_slab", "waxed_exposed_cut_copper_stairs", "waxed_exposed_double_cut_copper_slab", "waxed_oxidized_copper", "waxed_oxidized_cut_copper", "waxed_oxidized_cut_copper_slab", "waxed_oxidized_cut_copper_stairs", "waxed_oxidized_double_cut_copper_slab", "waxed_weathered_copper", "waxed_weathered_cut_copper", "waxed_weathered_cut_copper_slab", "waxed_weathered_cut_copper_stairs", "waxed_weathered_double_cut_copper_slab", "weathered_copper", "weathered_cut_copper", "weathered_cut_copper_slab", "weathered_cut_copper_stairs", "weathered_double_cut_copper_slab", "web", "weeping_vines", "wheat", "white_candle", "white_candle_cake", "white_carpet", "white_concrete", "white_glazed_terracotta", "white_shulker_box", "white_wool", "wither_rose", "wood", "wooden_button", "wooden_door", "wooden_pressure_plate", "wooden_slab", "wool", "yellow_candle", "yellow_candle_cake", "yellow_carpet", "yellow_concrete", "yellow_flower", "yellow_glazed_terracotta", "yellow_shulker_box", "yellow_wool"]}} +["stone", "dirt", "bedrock"] ``` -*Last updated for 1.20.10* - +> **注意** +> - 游戏将生物头颅视为可破坏方块 +> - 这两个 NBT 仅在冒险模式生效 -## ItemLock +### 全方块放置权限 -Lock in any applicable slot in inventory: `/give @p iron_axe 1 100 {"minecraft:item_lock":{ "mode": "lock_in_inventory" }}` +以下代码可使方块能够放置在游戏内所有方块表面: -Lock in a specific slot in inventory: `/give @p apple 1 0 {"minecraft:item_lock":{ "mode": "lock_in_slot" }}` - -These two variations of ItemLock are mutually exclusive. Itemlock works in both adventure and survival. - -### Overriding how ItemLock displays - -The texture to overwrite is `16x16`, and is located in `RP/textures/ui/item_lock_red.png` and `RP/textures/ui/item_lock_yellow.png` - -The following translation keys can be overwritten if you want to change how these components display: +**特别注意:若列表中存在至少一个无效方块,此功能将失效!** +::: code-group +```json [全方块列表] +give @p stone 1 0 {"minecraft:can_place_on": {"blocks": ["acacia_button", ...(完整列表见原文)..., "yellow_wool"]}} ``` -item.itemLock.cantDrop=:hollow_star: Can't Drop Items can't be: -item.itemLock.cantMove=:solid_star: Can't Move Items can't be: -item.itemLock.hoverText.cantBe.moved=moved -item.itemLock.hoverText.cantBe.dropped=dropped -item.itemLock.hoverText.cantBe.removed=removed -item.itemLock.hoverText.cantBe.craftedWith=crafted with -item.itemLock.keepOnDeath=This item is not lost on death -item.itemLock.popupNotice.cantDrop=:hollow_star: Can't Drop Items can't be: dropped, removed, crafted with -item.itemLock.popupNotice.cantMove=:solid_star: Can't Move Items can't be: moved, dropped, removed, crafted with + +*最后更新版本:1.20.10* +::: + +## ItemLock 物品锁定 + +锁定在任意物品栏位: +```bash +/give @p iron_axe 1 100 {"minecraft:item_lock":{ "mode": "lock_in_inventory" }} ``` -If you want to hide description and red/yellow triangle, you can simply do: -`/gamerule showtags false` -## KeepOnDeath +锁定在特定物品栏位: +```bash +/give @p apple 1 0 {"minecraft:item_lock":{ "mode": "lock_in_slot" }} +``` -Item will remain in an entity's inventory when it dies: `/replaceitem entity @e[type=zombie] slot.weapon.mainhand -1 cooked_beef 1 0 {"minecraft:keep_on_death":{}}` +> **特性说明** +> - 两种锁定模式互斥 +> - 在冒险/生存模式均可生效 +> - 可通过资源包修改锁定图标显示 -For non-player entities, the item will not be present in their inventory after death as they do not respawn. This can be cleared from the entity's inventory using /clear or replaced with /replaceitem. -> Gamerule /keepinventory set to true functions as if all items in a player's inventory had `"minecraft:keep_on_death":{}`. However, the NBT component is most helpful in filtering on specific items that one wishes for a player to remain in his or her inventory instead of all items. +### 自定义锁定显示 -KeepOnDeath functions identically in both adventure and survival mode. +- **纹理替换** + 替换尺寸为 `16x16` 的纹理文件: + `RP/textures/ui/item_lock_red.png`(红色锁定) + `RP/textures/ui/item_lock_yellow.png`(黄色锁定) -## Combining NBT components +- **本地化文本** + 可覆盖以下翻译键修改提示文本: +```ini +item.itemLock.cantDrop=:hollow_star: 无法丢弃 物品不可被: +item.itemLock.cantMove=:solid_star: 无法移动 物品不可被: +item.itemLock.hoverText.cantBe.moved=移动 +item.itemLock.hoverText.cantBe.dropped=丢弃 +item.itemLock.hoverText.cantBe.removed=移除 +item.itemLock.hoverText.cantBe.craftedWith=用于合成 +item.itemLock.keepOnDeath=死亡时保留此物品 +item.itemLock.popupNotice.cantDrop=:hollow_star: 无法丢弃 物品不可被:丢弃、移除、用于合成 +item.itemLock.popupNotice.cantMove=:solid_star: 无法移动 物品不可被:移动、丢弃、移除、用于合成 +``` -Give all players a bow that locks in a specific inventory slot and is kept on death: `/give @a bow 1 0 {"minecraft:item_lock":{ "mode": "lock_in_slot" }, "minecraft:keep_on_death":{}}` +- **隐藏提示** + 使用游戏规则关闭显示: + ```bash + /gamerule showtags false + ``` -Give self a stone shovel that can only dig up gravel and sand, and locks in inventory: `/give @s stone_shovel 1 0 {"minecraft:can_destroy":{"blocks":["dirt", "sand"]},"minecraft:item_lock":{ "mode": "lock_in_inventory" }}` +## KeepOnDeath 死亡保留 -## Additional Notes +为实体添加死亡保留物品: +```bash +/replaceitem entity @e[type=zombie] slot.weapon.mainhand -1 cooked_beef 1 0 {"minecraft:keep_on_death":{}} +``` -Assigning specific blocks and items with specific data values using `"minecraft:can_place_on"` and `"minecraft:can_destroy"` will return an error stating the NBT "could not be updated, which seems to be an unintended bug in this case. +> **注意事项** +> - 非玩家实体死亡后不会保留物品(因其无法重生) +> - 仍可通过 `/clear` 或 `/replaceitem` 操作物品栏 +> - 与 `/gamerule keepinventory true` 全局保留的区别:该 NBT 支持物品级细粒度控制 +> - 冒险/生存模式均有效 -`/give @s cobblestone 64 0 {"minecraft:can_place_on":{"blocks":["stained_glass:2"]}}` +## NBT 组合应用 -`/give @a wooden_axe 16 0 {"minecraft:can_destroy":{"blocks":["wool:5"]}}` +组合锁定与保留示例: +```bash +# 给予所有玩家特定槽位锁定且死亡保留的弓 +/give @a bow 1 0 {"minecraft:item_lock":{ "mode": "lock_in_slot" }, "minecraft:keep_on_death":{}} -Similarly to the issue above, specifying commands that generally do not make sense will also return a "could not be updated" error. Some examples include: +# 给予自己可破坏泥土/沙子且全局锁定的石铲 +/give @s stone_shovel 1 0 {"minecraft:can_destroy":{"blocks":["dirt", "sand"]},"minecraft:item_lock":{ "mode": "lock_in_inventory" }} +``` -`/give @a diamond 10 0 {"minecraft:can_place_on":{"blocks":["dirt"]}}` +## 补充说明 -(cannot place items on blocks) +- **数据值指定问题** + 尝试通过 `stained_glass:2` 等形式指定方块数据值时,会触发 "could not be updated" 错误(当前版本存在此限制) -## Giving in trade/Loot-tables +错误示例: +```bash +/give @s cobblestone 64 0 {"minecraft:can_place_on":{"blocks":["stained_glass:2"]}} +/give @a wooden_axe 16 0 {"minecraft:can_destroy":{"blocks":["wool:5"]}} +``` -It is currently not possible to set NBT via loot tables or trade tables. If you want to sell NBT-powered items, you will need to use a workaround of some kind or another, such as cloning chests containing items with pre-existing NBT. +- **无效命令检测** + 系统会自动拦截不符合逻辑的命令组合,例如尝试为不可放置物品添加放置权限: +```bash +/give @a diamond 10 0 {"minecraft:can_place_on":{"blocks":["dirt"]}} +``` + +- **战利品表/交易限制** + 目前无法通过战利品表或交易表直接赋予 NBT 属性,需要通过克隆预置容器等间接方式实现。 \ No newline at end of file diff --git a/docs/wiki/commands/new-execute.md b/docs/wiki/commands/new-execute.md index aed1178e..7ef8561c 100644 --- a/docs/wiki/commands/new-execute.md +++ b/docs/wiki/commands/new-execute.md @@ -1,8 +1,8 @@ --- -title: New Execute -category: Commands +title: 全新execute命令 +category: 命令 tags: - - easy + - 简单 mentions: - JaylyDev - Sprunkles137 @@ -12,236 +12,243 @@ mentions: - zheaEvyline --- -## Introduction +# 全新execute命令 -With the release of 1.19.50, the `/execute` command was given a syntax overhaul. While the syntax is now more verbose and longer to write, it allows much finer control over the contextual components of commands and adds support for conditions to commands, superseding the use of commands like `/testfor`, `/testforblock`, and `/testforblocks`. + -Before we dive into the syntax and how to write it, we need to understand how the old `/execute` command worked, and what changed and why. This will make explaining the concepts found in the syntax easier. +## 引言 -## Understanding Execution Context +随着1.19.50版本的发布,`/execute`命令迎来了语法革新。虽然新语法需要书写更长的指令,但它能更精细地控制命令的上下文组件,并为命令添加了条件支持,从而取代了`/testfor`、`/testforblock`和`/testforblocks`等命令。 -For both beginners to commands and those well versed in how old `/execute` behaved, it may be a good idea to review the concept of a command's **execution context**. +在深入解析语法细节之前,我们需要理解旧版`/execute`的工作原理及其演变逻辑,这将有助于更好地理解新语法中的概念。 -In short, these are the parameters that affects how a command runs. Who the command will run as, also known as its executor; where the command will run, and in which dimension; and the rotation applied to the command are all parameters that can be changed. +## 理解执行上下文 -Every command has this context applied to it, and this context changes depending on how the command runs. Commands fired from command blocks do not have an executor, and the position is set to that command block; commands ran from chat define the executor as the player, and it runs at the player's position. +无论是命令新手还是熟悉旧版`/execute`的开发者,都有必要重新审视命令的**执行上下文**概念。 -## Execute, and Why it Changed +简而言之,这些参数决定了命令的运行方式:命令的执行者(即由谁执行)、执行位置、所在维度以及执行时的视角旋转角度等。 -The `/execute` command executes a command on behalf of one or more entities. The old syntax used to be this: +每个命令都携带这样的上下文,且上下文会根据命令的运行方式动态变化。从命令方块触发的命令没有明确执行者,位置固定在命令方块处;通过聊天框执行的命令则以玩家为执行者,并在玩家当前位置运行。 + +## Execute命令的演变逻辑 + +`/execute`命令允许通过一个或多个实体代理执行命令。旧版语法结构如下: ``` -/execute -/execute detect +/execute <目标> <位置> <命令> +/execute <目标> <位置> detect <位置> <方块> <数据值> <命令> ``` -You specified a target to execute as, then the command's context would change to run as that target, and at that target. Any position changes were then always relative to that target. +旧语法指定目标后,命令的上下文将切换至该目标的位置执行。所有位置偏移都默认相对于该目标。 -While this is useful in most cases, it also forces the fact that a command's target and its position are always tied together (unless you were to manually insert world coordinates in place of ``). It is also not very malleable in regards to making conditional statements, as you have to execute as an entity every time. +虽然这在多数情况下很实用,但也强制绑定了命令目标与执行位置(除非手动输入世界坐标)。同时,在构建条件语句时缺乏灵活性,因为每次都需要通过实体执行。 -Back in the Summer of 2017 during the Update Aquatic's development, the developers of Minecraft: Java Edition were getting feedback from the community on how they can improve the `/execute` command's syntax, and the basic concept that was conceived is this: `/execute` takes an unlimited number of **subcommands** that manipulate certain aspects of the command in the order you specify, then a "run" subcommand is placed at the end to fire a command. +在2017年夏季水域更新的开发阶段,Minecraft Java版开发团队收集了社区反馈后,提出了全新设计理念:`/execute`可以串联无限个**子命令**来按序调整命令的不同上下文维度,最后通过"run"子命令触发实际命令。 -This allows for much greater control for what `/execute` can do to a command, and allows splitting up the executor and the command's position. +这种设计大幅提升了`/execute`的上下文控制能力,实现了执行者与执行位置的分离。 -## New Syntax +## 新语法解析 -Now, let us review the new `/execute` syntax. They are as follows: +现在让我们系统梳理新版`/execute`语法结构: ### `/execute as` -Changes the executor of the command, or what the target selector `@s` will select. +更改命令执行者,即影响目标选择器`@s`的指向。 ``` -/execute as -> execute +/execute as -> execute ``` -This does not change the position, rotation, or dimension context of the command. +此命令不会改变执行位置、视角或维度上下文。 -If multiple targets are specified then a command is ran once for each target, where `@s` selects each entity in turn. +若指定多个目标,则依次以每个目标为`@s`执行命令。 ### `/execute at` -Changes where the command runs, setting the command's position, rotation, and dimension context to the entity. +更改命令执行位置,将命令的坐标、视角和维度同步至目标实体。 ``` -/execute at -> execute +/execute at -> execute ``` -This does not change the executor of the command, so `@s` will remain as whoever was targeted last. +此命令不会改变执行者身份,故`@s`仍指向最近一次指定的目标。 -If multiple targets are specified then a command is ran once for each target, setting the position, rotation, and dimension context to each target. +若指定多个目标,则依次在目标位置执行命令。 ### `/execute in` -Sets the dimension in which the command should run. +设置命令执行的维度环境。 ``` -/execute in -> execute +/execute in -> execute ``` -Currently accepted values are `overworld`, `nether`, and `the_end`. +当前可用维度标识符为`overworld`、`nether`和`the_end`。 -This change in dimension will respect that dimension's scale; going from the Overworld to The Nether will apply a scale of x0.125 to the position, and vice versa will apply a x8 scale to the position. +维度切换时会自动换算坐标比例(如主世界至下界应用x0.125缩放,反之则x8放大)。 ### `/execute positioned` -Directly sets the position context of the command. +直接设定命令执行坐标。 ``` /execute positioned -> execute ``` -Sets the position of the command to specific values. [Relative and local coordinates](/commands/relative-coordinates) are based around the current position of the command. +将命令位置设为指定坐标。[相对坐标与局部坐标](/wiki/commands/relative-coordinates)基于当前命令位置计算。 ``` -/execute positioned as -> execute +/execute positioned as -> execute ``` -Sets the position of the command to a target's location. This is similar to how `/execute at` works, but it only sets the command's position and not its rotation or dimension. +将命令位置同步至目标坐标。功能类似`/execute at`,但仅改变位置不改变视角与维度。 -If multiple targets are specified then a command is ran once for each target, setting the position context to the target's position. +若指定多个目标,则依次在目标位置执行命令。 ### `/execute align` -Aligns the current position of the command to the block grid. +将当前命令位置对齐至方块网格。 ``` -/execute align -> execute +/execute align -> execute ``` -Aligning a position will floor it. This subcommand accepts any non-repeating combination of the letters "x", "y", and "z", and will floor the position along each axis specified. +对齐操作将坐标向下取整。本子命令接受由"x"、"y"、"z"组成的非重复组合,对指定轴进行取整。 ### `/execute anchored` -Sets the anchor of the command to the executor's feet or eyes. Changing the anchor will affect the position where local coordinates will start at. +设置命令的锚点位置(脚部或眼部),影响局部坐标基准。 ``` /execute anchored (eyes|feet) -> execute ``` -The default anchor when executing at a target is their feet. +默认锚点为脚部。 -When the anchor is set to `eyes`, the command's local position is offset by some amount corresponding to the "eye height" of the current executor. +当锚点设为`eyes`时,命令的局部坐标会根据执行者的"眼高"进行偏移。 -This offset should only apply to local coordinates, but it currently affects relative coordinates due to a bug: [MCPE-162681](https://bugs.mojang.com/browse/MCPE-162681). +注意:由于漏洞[MCPE-162681](https://bugs.mojang.com/browse/MCPE-162681),当前该设置会影响相对坐标。 ### `/execute rotated` -Directly sets the rotation context of the command. +直接设定命令执行视角。 ``` -/execute rotated -> execute +/execute rotated -> execute ``` -Sets the rotation of the command to specific values. Relative and local coordinates are based around the current rotation of the command. This defaults to 0 for both pitch and yaw, unless the rotation was changed prior. +设置具体视角参数。相对坐标与局部坐标基于当前视角计算,默认值为0(若未变更过视角)。 ``` -/execute rotated as -> execute +/execute rotated as -> execute ``` -Sets the rotation of the command to a target's rotation. +同步目标实体的视角参数。 -If multiple targets are specified then a command is ran once for each target, setting the rotation context to the target's rotation. +若指定多个目标,则依次应用目标视角执行命令。 ### `/execute facing` -Sets the rotation of the command to face some position. This rotation is calculated based on the current position of the command. +设置命令视角朝向特定坐标或实体部位。 ``` /execute facing -> execute ``` -Sets the rotation to face a block position. Relative and local coordinates are based around the current position of the command. +使命令视角朝向指定方块坐标,基于当前命令位置计算。 ``` -/execute facing entity (eyes|feet) -> execute +/execute facing entity (eyes|feet) -> execute ``` -Sets the rotation to face a target's position. Setting the anchor to `feet` will aim the rotation to face where they are currently standing, while setting the anchor to `eyes` will aim the command up at the "eye position" of that target (see [`/execute anchored`](/commands/new-execute#execute-anchored)). +使命令视角朝向目标实体部位。选择`feet`锚点将瞄准脚部位置,`eyes`则瞄准眼部(参考[`/execute anchored`](/wiki/commands/new-execute#execute-anchored))。 -If multiple targets are specified then a command is ran once for each target, setting the rotation context to face that target. +若指定多个目标,则依次应用目标朝向执行命令。 ### `/execute (if|unless)` -Prevents running a command based on a condition. If the condition is true then the command will continue, or stop otherwise. - -`/execute unless` acts as the opposite, testing if the condition is false in order to continue. +根据条件判断是否执行命令。`if`在条件为真时继续,`unless`则相反。 ``` -/execute if entity -> execute +/execute if entity -> execute ``` -Acts like `/testfor`. Returns true if the targets exist. +类似`/testfor`,检测目标是否存在。 ``` -/execute if block -> execute +/execute if block -> execute ``` -Acts like `/testforblock`. Returns true if the block at the specified location exists. +类似`/testforblock`,检测指定位置方块。 -A data value or block state may additionally be specified, otherwise it ignores block states (acts as if it were set to `-1`). +可附加数据值或方块状态参数,否则忽略状态(等效于`-1`)。 ``` /execute if blocks (all|masked) -> execute ``` -Acts like `/testforblocks`. It constructs a volume between the beginning and end positions, and returns true if the volume at the destination matches the original volume. +类似`/testforblocks`,比对源区域与目标区域的方块布局。 -The parameter `all` tests that all blocks must match, while `masked` will ignore air blocks. +`all`参数要求完全匹配,`masked`忽略空气方块。 ``` -/execute if score matches -> execute +/execute if score matches -> execute ``` -Tests if a specified score is a certain value. This uses the integer range syntax. +检测指定分数是否符合数值范围(使用整数区间语法)。 ``` -/execute if score (=|<|<=|>|>=) -> execute +/execute if score (=|<|<=|>|>=) -> execute ``` -Tests if a specified score matches some logical comparison to another score. Operators are equals (`=`), greater than (`>`), greater than or equal to (`>=`), less than (`<`), and less than or equal to (`<=`). +比对两个分数的逻辑关系,支持等于(`=`)、大于(`>`)、大于等于(`>=`)、小于(`<`)、小于等于(`<=`)。 ### `/execute run` ``` -/execute run +/execute run ``` -Runs a command using all of the currently applied context modifications. This subcommand always goes last in one `/execute` command. +应用所有上下文修改后执行指定命令。本子命令必须作为`/execute`链的末尾。 -This subcommand is not always required however; an `/execute` command ending with an `if` or `unless` subcommand is valid too, and will return the success of the test it performed. +注意:当`/execute`链以`if`或`unless`结尾时,可不带`run`直接返回检测结果。 -## Examples and Upgrading Old Commands +## 实例解析与旧指令升级 -Since subcommands can be chained limitlessly, there really is a nearly infinite combination of arguments for an `/execute` command and they cannot all be listed. Instead, listed here are some common examples of commands. +由于子命令可无限串联,实际组合方式近乎无限。以下列举典型应用场景: -The old functionality of `/execute` can be replicated with `as at @s`. If you need a positional offset relative to the entity, add `positioned`. If you want to detect if a block is present, add `if block`. Here are some equivalents: +旧版`/execute`功能可通过`as <目标> at @s`复现。如需相对位置偏移,添加`positioned`;如需方块检测,添加`if block`。示例如下: -``` -# Teleport with an offset +::: code-group +```mcfunction [旧版偏移传送] /execute @p ~ ~1.62 ~ teleport @s ^ ^ ^3 - +``` +```mcfunction [新版等效] /execute as @p at @s positioned ~ ~1.62 ~ run teleport @s ^ ^ ^3 ``` +::: -``` -# Chaining multiple '/execute's +::: code-group +```mcfunction [旧版链式检测] /execute @e[type=sheep] ~ ~ ~ execute @e[type=item,r=5] ~ ~ ~ detect ~ ~-1 ~ stone 0 kill @s - +``` +```mcfunction [新版等效] /execute at @e[type=sheep] as @e[type=item,r=5] at @s if block ~ ~-1 ~ stone 0 run kill @s ``` +::: -(Note that we do not use `as @e[type=sheep] at @s` because we do not need to execute as the sheep; only the position here is required.) +(注意此处使用`at @e[type=sheep]`而非`as`,因为只需位置信息) -Now for some examples of things that were not possible to do in one command, or were more difficult to perform before the new syntax was introduced. +新版语法还支持许多旧版难以实现的功能: -``` -# Testing a fake player's score -/execute if score game_settings var matches 3.. run say [Game] Difficulty set to Hard. +::: code-group +```mcfunction [检测虚拟玩家分数] +/execute if score game_settings var matches 3.. run say [游戏] 难度已设为困难。 -# Comparing if two scores are equal -/execute as @a if score @s x = @s y run say My X is equal to my Y. +```mcfunction [分数比对] +/execute as @a if score @s x = @s y run say 我的X值等于Y值。 -# Test for an entity without targeting it +```mcfunction [非选中实体检测] /execute as @a at @s if entity @e[type=armor_stand,r=10] run gamemode survival @s ``` +::: \ No newline at end of file diff --git a/docs/wiki/commands/on-first-join.md b/docs/wiki/commands/on-first-join.md index a5004375..06fa7e1f 100644 --- a/docs/wiki/commands/on-first-join.md +++ b/docs/wiki/commands/on-first-join.md @@ -1,61 +1,64 @@ --- -title: On First Join -category: On Event Systems +title: 首次进入时 +category: 事件系统 mentions: - BedrockCommands - zheaEvyline - SmokeyStack nav_order: 1 tags: - - system + - 系统 --- -## Introduction +# 首次进入时 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -This system will run your desired commands on the event that a player joins the world for the first time. +## 简介 +[由Bedrock Commands社区Discord提供](https://discord.gg/SYstTYx5G5) +本系统将在玩家首次进入世界时执行你预设的命令。 -## System -BP/functions/on_first_join.mcfunction +## 系统实现 -```yaml -#Your Commands Here (examples) -give @a [tag=!joined] stone_pickaxe -give @a [tag=!joined] bread 16 1 -tag @a [tag=!joined] add joined +::: code-group +```yaml [BP/functions/on_first_join.mcfunction] +# 在此处输入你的命令(示例) +give @a[tag=!joined] stone_pickaxe +give @a[tag=!joined] bread 16 1 +tag @a[tag=!joined] add joined ``` +::: -![commandBlockChain3](/assets/images/commands/commandBlockChain/3.png) +![命令方块链示意图3](/assets/images/commands/commandBlockChain/3.png) +我们以两个`give`命令为例,你可以根据需求使用任意命令组合。请确保遵循以下要点: +- 保持示例中的执行顺序 +- 在选择器参数中正确添加`tag=!joined`条件 -Here we have used 2 `give` commands as example but you can use any command you prefer and as many as you require. +## 原理说明 -Just make sure to follow the given order and properly add the selector argument ` tag=!joined ` as shown for your desired commands. +当玩家首次加入世界时,他们不会携带`joined`标签。系统通过检测未拥有该标签的玩家执行预设命令后,会立即为其添加标签以防止重复执行。 -## Explanation +若需要重置玩家状态,可通过以下命令移除标签: +`tag <玩家名> remove joined` -When the player joins the world for the first time, they will not have the joined tag. +## 时钟函数配置 -Once we run our desired commands for players without the tag, they will be given the tag immediately and the commands will not repeat for them again unless we remove their tag with: -`tag remove joined` +若使用函数替代命令方块,需将`on_first_join`函数添加至`tick.json`以实现循环检测。多个函数可通过逗号分隔添加,详见[函数文档](/wiki/commands/mcfunctions#tick-json)。 -## Tick JSON - -If you are using functions instead of command blocks, the ` on_first_join ` function must be added to the ` tick.json ` in order to loop and run it continuously. Multiple files can be added to the ` tick.json ` by placing a comma after each string. Refer to [Functions](/commands/mcfunctions#tick-json) documentation for further info. - -BP/functions/tick.json -```json +::: code-group +```json [BP/functions/tick.json] { "values": [ "on_first_join" ] } ``` +::: -If using functions, your pack folder structure will be be as follows: +使用函数时资源包结构如下: -> **Note:** the tag names (in this case: 'joined') may end up being used by other people. Appending ` _ ` and a set of randomly generated characters after would be a choice that reduces the probability of collisions. Similar technique can be employed for the ` .mcfunction ` filenames. Ex: -> - ` joined_0fe678 ` -> - ` on_first_join_0fe678.mcfunction ` +> **注意:** 标签名称(如本例中的'joined')可能与其他开发者重复。建议在名称后追加`_`和随机字符组合来降低冲突概率,此方法同样适用于函数文件名。例如: +> - `joined_0fe678` +> - `on_first_join_0fe678.mcfunction` \ No newline at end of file diff --git a/docs/wiki/commands/on-first-world-load.md b/docs/wiki/commands/on-first-world-load.md index a7b79a8e..f0b4707f 100644 --- a/docs/wiki/commands/on-first-world-load.md +++ b/docs/wiki/commands/on-first-world-load.md @@ -1,6 +1,6 @@ --- -title: On First World Load -category: On Event Systems +title: 首次世界加载时 +category: 事件系统 mentions: - BedrockCommands - zheaEvyline @@ -8,59 +8,62 @@ mentions: - cda94581 nav_order: 6 tags: - - system + - 系统 --- -## Introduction +# 首次世界加载时 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -This system will run your desired commands on the event that the world is loaded for the first time. -> **Note:** a [Function](/commands/mcfunctions) Pack is required to achieve this system since it is the `tick.json` file which allows us to run commands as soon as the world is initialised. +[由Bedrock Commands社区提供](https://discord.gg/SYstTYx5G5) +此系统将在世界首次加载时运行你指定的命令。 +> **注意:** 实现本系统需要[函数包](/wiki/commands/mcfunctions),因为需要依赖 `tick.json` 文件在游戏初始化时立即执行命令。 -## Tick Json +## Tick配置文件 -BP/functions/tick.json -```json +::: code-group +```json [BP/functions/tick.json] { "values": [ "initialise" ] } ``` +::: -## System +## 系统实现 -BP/functions/initialise.mcfunction -```yaml +::: code-group +```yaml [BP/functions/initialise.mcfunction] scoreboard objectives add world dummy scoreboard players add initialised world 0 -#Your Commands Here (example) -execute if score initialised world matches 0 run say New world created! +# 在此处添加你的命令(示例) +execute if score initialised world matches 0 run say 新世界已创建! scoreboard players set initialised world 1 ``` +::: -Here we have used an `execute - say` command as an example but you can use any command you prefer and as many as you require. +示例中使用的是 `execute - say` 命令组合,你可以根据需求自由替换为任意命令,并添加任意数量的命令。 -Just make sure to follow the given order and properly use the `execute if score` command as shown to run the commands you need. +请确保遵循给定的命令顺序,并正确使用示例中演示的 `execute if score` 条件判断来执行你的命令。 -## Explanation +## 运行原理 -- **` initialised=0 `** this means the world has just initialised and we are yet to run the initlisation commands. -- **` initialised=1 `** this means the world has been initialised and we have already run the initialisation commands. +- **`initialised=0`** 表示世界刚刚初始化,尚未执行初始化命令 +- **`initialised=1`** 表示世界已完成初始化,且初始化命令已执行完毕 -An objective of the name `world` is added for us to save scores to it so that we can track whether the world has been initialised or not. This also allows us to structure our commands to only execute at world initialisation. +我们通过名为 `world` 的计分板目标来存储分数值,以此追踪世界是否已经过初始化。这种机制可以确保初始化命令仅在首次加载时执行。 -Following the creation of the objective, a score of `0` is added to the FakePlayer name `initialised`. This will register it to the objective and enable us to use the `execute if score` command structure to run our desired commands. +创建计分板目标后,我们为虚拟玩家 `initialised` 设置初始分数 `0`。这会将虚拟玩家注册到计分板中,便于后续使用 `execute if score` 条件判断。 -Finally the score for `initialised` is set to 1 after all the commands are run in order to prevent it from executing more than once. +最后在所有命令执行完毕后,将 `initialised` 的分数设置为 `1`,防止初始化命令重复执行。 -## Folder Structure +## 文件结构 -> **Note:** the scoreboard names (in this case: 'world') may end up being used by other people. Appending ` _ ` and a set of randomly generated characters after would be a choice that reduces the probability of collisions. Similar technique can be employed for the ` .mcfunction ` filenames. Ex: -> - ` world_0fe678 ` -> - ` initialise_0fe678.mcfunction ` +> **注意:** 计分板名称(本例中的'world')可能与其他开发者重复。建议在名称后追加 `_` 和随机字符组合来降低冲突概率,此技巧同样适用于 `.mcfunction` 文件名。例如: +> - `world_0fe678` +> - `initialise_0fe678.mcfunction` \ No newline at end of file diff --git a/docs/wiki/commands/on-player-death.md b/docs/wiki/commands/on-player-death.md index e9e6b9c2..e8fa890c 100644 --- a/docs/wiki/commands/on-player-death.md +++ b/docs/wiki/commands/on-player-death.md @@ -1,75 +1,77 @@ --- -title: On Player Death -category: On Event Systems +title: 玩家死亡事件 +category: 事件系统 mentions: - BedrockCommands - zheaEvyline nav_order: 4 tags: - - system + - 系统 --- -## Introduction +# 玩家死亡事件 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -This system will run your desired commands on the event that a player dies. +## 系统介绍 -## Setup +[由Bedrock Commands社区Discord提供](https://discord.gg/SYstTYx5G5) -*To be typed in Chat:* +本系统将在玩家死亡时执行你预设的命令。 + +## 系统配置 + +*在聊天栏输入以下指令:* `/scoreboard objectives add alive dummy` -If you prefer to have the objective added automatically on world initialisation, follow the process outlined in [On First World Load.](/commands/on-first-world-load) +若希望在世界初始化时自动创建计分板,请参考[首次世界加载事件](/wiki/commands/on-first-world-load)中的操作流程。 -## System +## 系统实现 -BP/functions/on_player_death.mcfunction - -```yaml +::: code-group +```yaml [BP/functions/on_player_death.mcfunction] scoreboard players set @a [scores={alive=!2}] alive 0 scoreboard players set @e [type=player] alive 1 -#Your Commands Here (example) -execute as @a [scores={alive=0}] run say I died +#在此处添加你的命令(示例) +execute as @a [scores={alive=0}] run say 我死了 scoreboard players set @a [scores={alive=0}] alive 2 ``` -![commandBlockChain4](/assets/images/commands/commandBlockChain/4.png) +![命令方块链4](/assets/images/commands/commandBlockChain/4.png) + +我们以`/execute - say`指令为例,你可以根据需求替换为任意指令并自由扩展数量。 + +请严格遵循给定顺序,并确保在目标指令中正确添加选择器参数`scores={alive=0}`。 + +## 系统原理 + +- **`alive=0`** 表示玩家处于死亡状态 +- **`alive=1`** 表示玩家处于存活状态 +- **`alive=2`** 表示已对死亡玩家执行过预设命令 -Here we have used an `/execute - say` command as an example but you can use any command you prefer and as many as you require. - -Just make sure to follow the given order and properly add the selector argument ` scores={alive=0} ` as shown for your desired commands. - -## Explanation - -- **` alive=0 `** this means player is dead. -- **` alive=1 `** this means player is alive. -- **` alive=2 `** this means player is dead and we have run our desired commands on/from them. +- **`@a`** 选择器会选中所有玩家(无论生死),因此我们用它将所有玩家标记为0(死亡) + - 注意:需要排除已标记为2的玩家,否则会导致命令在死亡玩家身上重复执行 -- **` @a `** selector will target all players alive/dead so we use it to mark everyone as 0 'dead.' - - Note: we will ignore 2 or it will end up making the commands execute on dead players again. We only want our commands to execute once. +- **`@e`** 选择器仅会选中存活玩家,因此我们用它将所有存活玩家标记为1(存活) -- **` @e `** selector on the other hand will only target players who are alive, so we can use this to mark all alive players 1 'alive.' +- 通过上述标记,我们可以在死亡玩家(标记0)身上执行预设命令 + - 执行后需将其分数设为2,否则命令会在玩家复活前持续执行 -- Now that dead players are 0 and alive players are 1 we can use this knowledge to run our desired commands on the dead players. - - Keep in mind we need to set their score to 2 after or otherwise the commands will keep executing till they respawn. +## 循环执行配置 +若使用函数实现,需将`on_player_death`函数添加至`tick.json`以实现循环执行。多个函数可通过逗号分隔添加,详见[函数文档](/wiki/commands/mcfunctions#tick-json)。 -## Tick JSON - -If you are using functions instead of command blocks, the ` on_player_death ` function must be added to the ` tick.json ` in order to loop and run it continuously. Multiple files can be added to the ` tick.json ` by placing a comma after each string. Refer to [Functions](/commands/mcfunctions#tick-json) documentation for further info. - -BP/functions/tick.json -```json +::: code-group +```json [BP/functions/tick.json] { "values": [ "on_player_death" @@ -77,7 +79,7 @@ If you are using functions instead of command blocks, the ` on_player_death ` fu } ``` -If using functions, your pack folder structure will be be as follows: +使用函数时,资源包文件夹结构如下: -> **Note:** the scoreboard names (in this case: 'alive') may end up being used by other people. Appending ` _ ` and a set of randomly generated characters after would be a choice that reduces the probability of collisions. Similar technique can be employed for the ` .mcfunction ` filenames. Ex: -> - ` alive_0fe678 ` -> - ` on_player_death_0fe678.mcfunction ` +> **注意:** 计分板名称(如本例中的'alive')可能被他人重复使用。建议在名称后追加`_`和随机字符来降低冲突概率,函数文件名也可采用相同策略。例如: +> - `alive_0fe678` +> - `on_player_death_0fe678.mcfunction` \ No newline at end of file diff --git a/docs/wiki/commands/on-player-join.md b/docs/wiki/commands/on-player-join.md index 4eef48b7..ba68c80a 100644 --- a/docs/wiki/commands/on-player-join.md +++ b/docs/wiki/commands/on-player-join.md @@ -1,6 +1,6 @@ --- -title: On Player Join -category: On Event Systems +title: 玩家加入事件响应 +category: 事件系统 mentions: - BedrockCommands - zheaEvyline @@ -9,66 +9,72 @@ tags: - system --- -## Introduction +# 玩家加入事件响应 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -This system will run your desired commands on the event that a players joins the world. +## 简介 -## Setup +[由Bedrock Commands社区Discord提供](https://discord.gg/SYstTYx5G5) -*To be typed in Chat:* +本系统可在玩家加入世界时触发预设命令的执行。 + +## 设置 + +*在聊天栏输入以下指令:* `/scoreboard objectives add joined dummy` -If you prefer to have the objective added automatically on world initialisation, follow the process outlined in [On First World Load.](/commands/on-first-world-load) +若需实现世界初始化时自动创建记分板项,请参照[首次世界加载事件响应](/wiki/commands/on-first-world-load)的操作流程。 -## System +## 系统实现 -BP/functions/on_player_join.mcfunction - -```yaml +::: code-group +```yaml [BP/functions/on_player_join.mcfunction] scoreboard players add @a joined 0 -#Your Commands Here (example) +#在此处添加你的命令(示例) tp @a[scores={joined=0}] 0 65 0 scoreboard players reset * joined scoreboard players set @a joined 1 ``` +::: -![commandBlockChain4](/assets/images/commands/commandBlockChain/4.png) +![命令方块链4](/assets/images/commands/commandBlockChain/4.png) +示例中使用了`tp`传送命令,您可以根据实际需求替换为任意命令,并自由扩展命令数量。 -Here we have used a `tp` command as an example but you can use any command you prefer and as many as you require. +请确保保持现有执行顺序,并为目标命令正确添加选择器参数 `scores={joined=0}`。 -Just make sure to follow the given order and properly add the selector argument ` scores={joined=0} ` as shown for your desired commands. +## 原理说明 -## Explanation +当玩家加入时,系统会为其记分板项赋初始值0,这使我们能够通过`scores`选择器参数定位新加入玩家。 -When the player joins, a 0 is added to their objective, this allows us to run commands from them using the 'scores' selector argument. +在命令执行完毕后立即执行以下操作: +1. 使用通配符`*`重置所有玩家的记分板值 +2. 为保持在线状态的玩家设置值1 -Immediately after the commands are run, we reset all the scores on the objective using wildcard **` * `** and only players who stayed online will have their score set to 1. - -And this way, since our commands only target players with the score 0, the commands won't repeat again for the players who stayed unless they leave and rejoin or if we run: +通过这种机制,由于所有命令仅针对记分板值为0的玩家,已在线玩家不会重复触发响应,除非他们退出后重新加入,或手动执行: `/scoreboard players set joined 0` -## Tick JSON +## 时钟函数配置 -If you are using functions instead of command blocks, the ` on_player_join ` function must be added to the ` tick.json ` in order to loop and run it continuously. Multiple files can be added to the ` tick.json ` by placing a comma after each string. Refer to [Functions](/commands/mcfunctions#tick-json) documentation for further info. +若使用函数替代命令方块,需将`on_player_join`函数添加至`tick.json`以实现循环执行。多个函数可通过逗号分隔添加,详见[函数文档](/wiki/commands/mcfunctions#tick-json)。 -BP/functions/tick.json -```json +::: code-group +```json [BP/functions/tick.json] { "values": [ "on_player_join" ] } ``` +::: -If using functions, your pack folder structure will be be as follows: +使用函数时资源包目录结构如下: -> **Note:** the scoreboard names (in this case: 'joined') may end up being used by other people. Appending ` _ ` and a set of randomly generated characters after would be a choice that reduces the probability of collisions. Similar technique can be employed for the ` .mcfunction ` filenames. Ex: -> - ` joined_0fe678 ` -> - ` on_player_join_0fe678.mcfunction ` +> **注意:** 记分板名称(本例中的'joined')可能与其他开发者重复使用。建议在名称后追加`_`和随机字符组合以降低冲突概率,函数文件名也可采用类似处理方式。例如: +> - `joined_0fe678` +> - `on_player_join_0fe678.mcfunction` \ No newline at end of file diff --git a/docs/wiki/commands/on-player-leave.md b/docs/wiki/commands/on-player-leave.md index e42272cb..9a1aac94 100644 --- a/docs/wiki/commands/on-player-leave.md +++ b/docs/wiki/commands/on-player-leave.md @@ -1,87 +1,89 @@ --- -title: On Player Leave -category: On Event Systems +title: 玩家离开事件系统 +category: 事件系统 mentions: - BedrockCommands - zheaEvyline nav_order: 3 tags: - - system + - 系统 --- -## Introduction +# 玩家离开事件系统 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -This system will run your desired commands on the event that a player leaves the world. +## 简介 -> **Note:** you cannot execute commands on the *players* that leave using selectors. However; you may use the [On Player Join](/commands/on-player-join) system to execute when they join back. +[由 Bedrock Commands 社区 Discord 提供](https://discord.gg/SYstTYx5G5) -## Setup +本系统可在玩家离开世界时运行你指定的命令。 -*To be typed in Chat:* +> **注意:** 无法通过选择器对离开的玩家本体执行命令。但你可以使用[玩家加入事件系统](/wiki/commands/on-player-join)在他们重新加入时执行命令。 + +## 系统搭建 + +*在聊天栏输入以下指令:* `/scoreboard objectives add total dummy` -If you prefer to have the objective added automatically on world initialisation, follow the process outlined in [On First World Load.](/commands/on-first-world-load) +若希望在世界初始化时自动添加计分项,请参照[首次世界加载事件系统](/wiki/commands/on-first-world-load)的操作流程。 -## System +## 系统核心 -BP/functions/on_player_leave.mcfunction - -```yaml +::: code-group +```yaml [BP/functions/on_player_leave.mcfunction] scoreboard players reset new total execute as @a run scoreboard players add new total 1 scoreboard players operation new total -= old total -#Your Commands Here (example) -execute if score new total matches ..-1 run say a player has left the world +#在此处输入你的命令(示例) +execute if score new total matches ..-1 run say 有玩家离开了世界 scoreboard players reset old total execute as @a run scoreboard players add old total 1 ``` -![commandBlockChain6](/assets/images/commands/commandBlockChain/6.png) +![命令方块链6](/assets/images/commands/commandBlockChain/6.png) -Here we have used a **`/say`** command as an example but you can use any command you prefer and as many as you require. +此处我们以 **`/say`** 命令作为示例,你可以根据需要替换为任意命令并自由扩展。 -Just make sure to follow the given order and properly use the `/execute if score` command as shown to run the commands you need. +请严格按照给定顺序排列命令,并正确使用示例中的 `/execute if score` 命令结构来触发你的自定义命令。 -## Explanation +## 原理说明 -- **` new `** this FakePlayer name means the total number of players on the world in the current game tick. -- **` old `** this FakePlayer name means the total number of players that were on the world in the previous game tick but also saves the values to be used in the *next* game tick. +- **` new `** 这个虚拟玩家名称表示当前游戏刻中世界内的玩家总数 +- **` old `** 这个虚拟玩家名称表示前一游戏刻的玩家总数,同时会将数值保存供下一游戏刻使用 -These values are obtained using the [Entity Counter](/commands/entity-counter) system. It may be beneficial to refer to that doc for better understanding this one. +这些数值通过[实体计数系统](/wiki/commands/entity-counter)获取,建议结合该文档以获得更深入的理解。 -By subtracting 'old' total from 'new' total we will be able to identify if player count has: -- decreased ` ..-1 ` -- increased ` 1.. ` -- or if it's unchanged ` 0 ` +通过从'new'总数中减去'old'总数,我们可以判断玩家数量是否发生: +- 减少 ` ..-1 ` +- 增加 ` 1.. ` +- 或保持不变 ` 0 ` -If it has decreased; we know that 1 or more players have left the game. -With this knowledge we can run our desired commands from 'new' if it's score is -1 or less. -- ie, if there were 10 players and someone leaves: - - that is ` new - old ` - - which is ` 9 - 10 = -1 ` - - hence we will detect by ` ..-1 ` +当检测到数值减少时(即得分为-1或更低),我们就能确定有1名或更多玩家离开了游戏。 +- 示例:原有10名玩家时有人离开 + - 计算式为 ` new - old ` + - 即 ` 9 - 10 = -1 ` + - 因此通过 ` ..-1 ` 条件检测 -- The 'new' total value is obtained first, subtraction is performed after that to run your desired commands and lastly the 'old' total value is obtained to be used in the next game tick. +- 系统首先获取'new'总数,执行减法运算后运行你的自定义命令,最后获取'old'总数供下一游戏刻使用 -:::tip -All commands involved in a command-block-chain or function will only run in a sequence one after the other but it all still happens in the same tick regardless of the number of commands involved. We are able to achieve this system due to the fact that commands run along the end of a game tick after all events such as player log in, log out, death etc.. occur. +:::tip 游戏刻解析 +所有在命令方块链或函数中运行的指令都会在同一游戏刻内按顺序依次执行。由于命令执行发生在游戏刻的末端(包含所有玩家登录、登出、死亡等事件之后),本系统得以精准运作。 -![gametick](/assets/images/commands/gametick.png) +![游戏刻示意图](/assets/images/commands/gametick.png) ::: -## Tick JSON +## Tick JSON 配置 -If you are using functions instead of command blocks, the ` on_player_leave ` function must be added to the ` tick.json ` in order to loop and run it continuously. Multiple files can be added to the ` tick.json ` by placing a comma after each string. Refer to [Functions](/commands/mcfunctions#tick-json) documentation for further info. +若使用函数替代命令方块,需将 ` on_player_leave ` 函数添加至 ` tick.json ` 以实现循环执行。通过在字符串后添加逗号分隔,可将多个文件添加至 ` tick.json `。更多信息请参考[函数文档](/wiki/commands/mcfunctions#tick-json)。 -BP/functions/tick.json -```json +::: code-group +```json [BP/functions/tick.json] { "values": [ "on_player_leave" @@ -89,7 +91,7 @@ If you are using functions instead of command blocks, the ` on_player_leave ` fu } ``` -If using functions, your pack folder structure will be be as follows: +使用函数时,资源包文件夹结构如下: -> **Note:** the scoreboard names (in this case: 'total') may end up being used by other people. Appending ` _ ` and a set of randomly generated characters after would be a choice that reduces the probability of collisions. Similar technique can be employed for the ` .mcfunction ` filenames. Ex: +> **注意:** 计分项名称(本例中的'total')可能与他人重复。建议在名称后追加 ` _ ` 和随机字符组合来降低冲突概率,此技巧同样适用于 ` .mcfunction ` 文件名。例如: > - ` total_0fe678 ` -> - ` on_player_leave_0fe678.mcfunction ` +> - ` on_player_leave_0fe678.mcfunction ` \ No newline at end of file diff --git a/docs/wiki/commands/on-player-respawn.md b/docs/wiki/commands/on-player-respawn.md index b447cd49..4263463c 100644 --- a/docs/wiki/commands/on-player-respawn.md +++ b/docs/wiki/commands/on-player-respawn.md @@ -1,6 +1,6 @@ --- -title: On Player Respawn -category: On Event Systems +title: 玩家重生事件 +category: 事件系统 mentions: - BedrockCommands - zheaEvyline @@ -9,66 +9,71 @@ tags: - system --- -## Introduction +# 玩家重生事件 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -This system will run your desired commands on the event that a player respawns from death state. +## 前言 -## Setup +[由Bedrock Commands社区Discord提供](https://discord.gg/SYstTYx5G5) -*To be typed in Chat:* +当玩家从死亡状态重生时,该系统将执行您指定的命令。 + +## 初始化设置 + +*在聊天栏输入以下指令:* `/scoreboard objectives add respawn dummy` -If you prefer to have the objective added automatically on world initialisation, follow the process outlined in [On First World Load.](/commands/on-first-world-load) +若希望在世界初始化时自动添加计分板,请参照[首次世界加载](/wiki/commands/on-first-world-load)指南操作。 -## System +## 系统实现 -on_player_respawn.mcfunction - -```yaml -#Your Commands Here (example) -execute as @e [scores={respawn=1}] run say I died and respawned. +::: code-group +```yaml [on_player_respawn.mcfunction] +# 在此处添加你的命令(示例) +execute as @e [scores={respawn=1}] run say 我已死亡并重生。 scoreboard players set @a respawn 1 scoreboard players set @e [type=player] respawn 0 ``` -![commandBlockChain3](/assets/images/commands/commandBlockChain/3.png) +::: +![命令方块链3](/assets/images/commands/commandBlockChain/3.png) -Here we have used an `/execute - say` command as an example but you can use any command you prefer and as many as you require. +本例中使用`/execute - say`指令作为示例,您可以根据需求替换为任意指令,数量不限。 -Just make sure to follow the given order and properly use the selector argument ` @e [scores={respawn=1}] ` as shown for your desired commands. +请严格遵循指令顺序,并正确使用选择器参数` @e [scores={respawn=1}] `来定位目标玩家。 -## Explanation +## 运行原理 -- **` respawn=0 `** this means the player is alive or had already respawned. -- **` respawn=1 `** this means the player died and is now respawning, ie. respawned *just now*, in the current gametick. -- **` @a `** selector will target all players alive/dead so we use it to mark everyone as 1 'respawning' -- **` @e `** selector on the other hand will only target players who are alive, so we can use this to mark all alive players 0 'respawned' +- **` respawn=0 `** 表示玩家存活或已完成重生 +- **` respawn=1 `** 表示玩家死亡且正在重生(即当前游戏刻内刚触发重生) +- **` @a `** 选择器将定位所有玩家(包括存活/死亡),用于标记全体玩家为1(正在重生状态) +- **` @e `** 选择器仅定位存活玩家,用于重置存活玩家为0(已完成重生状态) -Now that *respawning* players are 1 and *respawned* players are 0 we can use this knowledge to run our desired commands on the players respawning. +通过此机制,我们可以精准捕捉到刚刚重生的玩家(分数为1的玩家)来执行指定命令。 -In the system, your desired commands must come before the other 2 commands because players change from death state to alive state along the start of the gametick before commands are run. +在系统文件中,自定义命令必须放置在最后两条计分板操作指令之前,因为玩家状态会在游戏刻开始时立即从死亡转为存活。 -Hence; if we were to put them at the end then the other 2 commands would set respawning players score to 0 first and then the commands you want to run won't be able to select those players as our selector argument is ` @e [scores={respawn=1}] ` not 0. Using 0 would not work as then it would repeat endlessly even on players who have already respawned. +若将自定义命令置于末尾,计分板操作会先将重生玩家的分数重置为0,此时通过` @e [scores={respawn=1}] `选择器将无法定位到目标玩家。若使用分数0作为条件,则会导致指令在已重生玩家身上重复触发。 -## Tick JSON +## 游戏刻函数配置 -If you are using functions instead of command blocks, the ` on_player_respawn ` function must be added to the ` tick.json ` in order to loop and run it continuously. Multiple files can be added to the ` tick.json ` by placing a comma after each string. Refer to [Functions](/commands/mcfunctions#tick-json) documentation for further info. +若使用函数而非命令方块,需将` on_player_respawn `函数添加至` tick.json `以实现循环检测。多个函数可通过逗号分隔添加,详见[函数文档](/wiki/commands/mcfunctions#tick-json)。 -BP/functions/tick.json -```json +::: code-group +```json [BP/functions/tick.json] { "values": [ "on_player_respawn" ] } ``` +::: -If using functions, your pack folder structure will be be as follows: +函数包的文件结构如下所示: -> **Note:** the scoreboard names (in this case: 'respawn') may end up being used by other people. Appending ` _ ` and a set of randomly generated characters after would be a choice that reduces the probability of collisions. Similar technique can be employed for the ` .mcfunction ` filenames. Ex: +> **注意:** 计分板名称(本例中的'respawn')可能与其他开发者冲突。建议在名称后追加` _ `和随机字符组合来降低重复概率,函数文件名也可采用相同策略。例如: > - ` respawn_0fe678 ` -> - ` on_player_respawn_0fe678.mcfunction ` +> - ` on_player_respawn_0fe678.mcfunction ` \ No newline at end of file diff --git a/docs/wiki/commands/playsound.md b/docs/wiki/commands/playsound.md index 4bf3ff1b..5de9138a 100644 --- a/docs/wiki/commands/playsound.md +++ b/docs/wiki/commands/playsound.md @@ -1,79 +1,84 @@ --- -title: Playsound -category: Commands +title: 播放音效 +category: 命令 mentions: - BedrockCommands - zheaEvyline - jordanparki7 tags: - - info + - 信息 --- -## Introduction +# 播放音效 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -You can use the `/playsound` command to play sound effects to players present anywhere in the world whenever you like. +## 简介 -## Syntax +[由 Bedrock Commands 社区 Discord 提供](https://discord.gg/SYstTYx5G5) + +你可以使用`/playsound`命令在世界任意位置为玩家播放音效。 + +## 语法 `/playsound [player] [position] [volume] [pitch] [minimumVolume]` -## Definitions +## 参数定义 -### Sound +### sound -- It is the sound effect you wish to play. -- You can find the list of sound IDs currently available at: +- 需要播放的音效ID +- 当前可用音效列表可参考: - https://www.digminecraft.com/lists/sound_list_pe.php -### Player +### player -- This is an optional argument. -- It refers to your typical target selectors (whom you want to play the sound to) ` @a `, ` @r `, ` @p `, ` Technoblade `, etc.. +- 可选参数 +- 目标选择器参数(接收音效的玩家)` @a `, ` @r `, ` @p `, ` Technoblade ` 等 -### Position +### position -- This is an optional argument. -- It refers to the `x y z` position from where the sound will be played, ie. the center of the playsound radius. +- 可选参数 +- 音效播放的坐标 `x y z`,即音效可听范围的圆心坐标 -### Volume +### volume -- This is an optional argument. -- It determines the size of the sphere in which the sound effect can be heard. - - ` 0.0 ` is the minimum size. -- Sound & audible sphere size increases as `volume` value is increased. - - Playaound volume of `1` is equal to an audible sphere of radius 16 blocks. - - Similarly; volume of `4` would be equal to 64 blocks. +- 可选参数 +- 决定音效可听范围的半径 + - 最小值是 `0.0` +- 该值越大,音效传播范围越广 + - 音量 `1` 对应半径16方块的球形范围 + - 音量 `4` 对应半径64方块的球形范围 -### Pitch +### pitch -- This is an optional aegument. -- It determines the pitch for the sound effect. -- It can be a value between ` 0.0 ` and ` 256.0 ` - - The higher the value, the higher the pitch. - - Values less than or equal to `0.0` makes the sound inaudible. +- 可选参数 +- 控制音效的音调高低 +- 取值范围 `0.0` 至 `256.0` + - 数值越高音调越尖锐 + - 数值小于等于 `0.0` 时音效不可闻 -> Note: pitch affects the speed at which the audio is played. For example, a pitch of `0.5` would mean the audio is played at ` 0.5× ` speed. +> 注意:音调参数会影响音频播放速度。例如音调 `0.5` 表示以 0.5 倍速播放音频 -### Minimum Volume +### minimumVolume -- This is an optional argument. -- It determines the minimum volume at which the sound will be heard outside of the audible sphere. -- It can be a value between ` 0.0 ` and ` 1.0 ` +- 可选参数 +- 设置可听范围外的最小音量 +- 取值范围 `0.0` 至 `1.0` -## Examples +## 使用示例 -mcfunction -```yaml -#Play a random explosion sound effect to closest player. +::: code-group +```yaml [mcfunction] +# 对最近的玩家播放随机爆炸音效 /playsound random.explode @p -#Play a random orb sound effect to all players at their relative position with a volume of 10000 +# 为所有玩家在其当前位置播放随机经验球音效(音量范围10000) /execute as @a at @s playsound random.orb @s ~ ~ ~ 10000 ``` +::: -Note: since the playsound command is positonal, it is helpful to use an execute command structure as shown in the second example to prevent the sound effect from cutting off in special cases such as playing a sound effect following a `/tp` command. You may increase volume when covering large distances to reduce failures. +注意:由于播放音效命令具有位置依赖性,在特殊场景(如使用`/tp`传送后)建议采用第二个示例中的`execute`命令结构来避免音效中断。当需要覆盖远距离时,可以适当增大音量参数来确保播放效果。 -**(Recommended) Read Next: [Sounds](/concepts/sounds)** +**(推荐)延伸阅读:[声音系统](/wiki/concepts/sounds)** \ No newline at end of file diff --git a/docs/wiki/commands/relative-coordinates.md b/docs/wiki/commands/relative-coordinates.md index ea907923..18830ce0 100644 --- a/docs/wiki/commands/relative-coordinates.md +++ b/docs/wiki/commands/relative-coordinates.md @@ -1,6 +1,6 @@ --- -title: Coordinate System -category: General +title: 坐标系系统 +category: 基础 mentions: - MedicalJewel105 - Sprunkles137 @@ -9,38 +9,55 @@ mentions: - TheItsNameless --- -## The Coordinate System +# 坐标系系统 -Minecraft stores the locations of blocks and entities in the world using a system of three-dimensional coordinates, each representing a value in a one-dimensional axis. They are stored in the format of X, then Y, and lastly Z. Whether you are placing structures and blocks, or teleporting and summoning entities, you can, and are sometimes required to, put in coordinates. They don't need to always be real values however; you can substitute world coordinates for relative values, either based in world space or local space. + -![image](https://user-images.githubusercontent.com/64864915/134789891-85644dd7-e30f-4e02-966c-df2bf17a7879.png) +## 坐标系基础 -_You may already be familiar with coordinates if you've enabled the Show Coordinates world option!_ +Minecraft使用三维坐标系来存储世界中方块和实体的位置,每个坐标代表一维轴上的数值。坐标以X、Y、Z的顺序存储。无论是放置结构方块,还是传送/召唤实体,你都可以(有时必须)使用坐标值。不过坐标不限于绝对数值,你可以使用相对坐标系——既可以选择基于世界空间的相对坐标,也可以选择基于局部空间的本地坐标。 -## Relative Coordinates (~) +![坐标系示意图](https://user-images.githubusercontent.com/64864915/134789891-85644dd7-e30f-4e02-966c-df2bf17a7879.png) -Relative coordinates are represented using tildes in place of real coordinates, and represent a position that is relative to the world coordinates its located at. You may insert numbers after a tilde to add an offset to the current position. These can be mixed with world coordinates, but cannot be mixed with local coordinates. +_如果你启用了"显示坐标"世界选项,可能已经对坐标系统有所了解!_ -Examples: - - `~ ~ ~`: Current position with no changes. - - `~5 ~-2 ~`: Current position with a 5-block X offset and a negative 2-block Y offset. +## 相对坐标 (~) -### Rotations +相对坐标使用波浪符号`~`代替具体数值,表示相对于当前所处世界坐标的位置。在波浪符后添加数字可以指定偏移量。相对坐标可与世界坐标混合使用,但不能与局部坐标混用。 -Relative coordinates can also be used in the context of rotations, where they represent a rotation that is relative to the current rotation it inherits from. These may also accept numbers after the tilde to add an offset to the current rotation. +示例: +- `~ ~ ~`: 保持当前位置不变 +- `~5 ~-2 ~`: 当前位置X轴正方向偏移5格,Y轴负方向偏移2格 -Example: `~90 ~` will add 90° to the current yaw (y-rotation) value. +### 旋转角度中的应用 -## Local Coordinates (^) +相对坐标也可用于表示旋转角度,这时表示相对于当前继承的旋转角度。同样可以在波浪符后添加数字来指定偏移量。 -Local coordinates are similar to relative coordinates, but represent a position in local space, where the axes are based off of rotation. They take the form `^left ^up ^forward`; you can think of this as `~x ~y ~z` if both your yaw and pitch rotations are 0 (facing straight ahead, due south). +示例:`~90 ~` 表示在当前偏航角(Y轴旋转)基础上增加90度 -Like relative coordinates, you can insert numbers to produce an offset of the current position, in local space. If there is no entity to copy rotation from, the x- and y-rotations are assumed to be 0. +## 局部坐标 (^) -Examples: - - `^10 ^ ^`: Current position with a 10-block offset to the left. - - `^ ^1.5 ^1`: Current position with a 1.5-block offset upward and a 1-block offset forward. +局部坐标与相对坐标类似,但表示基于实体朝向的局部空间坐标,采用`^左 ^上 ^前`的格式。当实体偏航角和俯仰角均为0(面朝正南平视)时,可以将其理解为`~x ~y ~z`坐标系。 -## Additional Notes +与相对坐标类似,可以添加数字来指定局部空间中的偏移量。如果没有可供参考旋转角度的实体,则默认X/Y旋转角度为0。 -- The player's eye level is 1.62 blocks above their feet. (~ ~1.62 ~) \ No newline at end of file +示例: +- `^10 ^ ^`: 当前位置左侧偏移10格 +- `^ ^1.5 ^1`: 当前位置上方偏移1.5格,前方偏移1格 + +## 注意事项 + +- 玩家眼部高度位于脚部上方1.62格处(对应相对坐标`~ ~1.62 ~`) + +::: code-group +```json [示例配置] +// 此处保持代码原样,仅翻译注释 +// 玩家传送指令示例 +{ + "command": "tp @s ~ ~5 ~", // 将玩家垂直提升5格 + "comment": "使用相对坐标进行垂直传送" +} +``` +::: + +_注意:本地坐标(^)系统在实体具有复杂旋转角度时会产生非直观的位移效果,建议在建筑类命令中使用世界相对坐标(~)系统,在实体局部操作时使用本地坐标系。_ \ No newline at end of file diff --git a/docs/wiki/commands/scoreboard-operations.md b/docs/wiki/commands/scoreboard-operations.md index 78de179a..88589385 100644 --- a/docs/wiki/commands/scoreboard-operations.md +++ b/docs/wiki/commands/scoreboard-operations.md @@ -1,6 +1,6 @@ --- -title: Scoreboard Operations -category: General +title: 记分板操作 +category: 基础 mentions: - Sprunkles137 - Luthorius @@ -8,128 +8,131 @@ mentions: - Hatchibombotar --- -Scoreboards can be used to perform complex operations, similar to [Molang](/concepts/molang). Operations come in two flavors: mathematical, and logical. +# 记分板操作 -## Overview -Operations are performed using the `/scoreboard players operation` command. The full syntax is laid out below: + + +记分板可用于执行复杂运算,其功能类似于[Molang](/wiki/concepts/molang)。运算分为两类:数学运算和逻辑运算。 + +## 概述 +使用`/scoreboard players operation`命令执行运算。完整语法如下: ``` -/scoreboard players operation +/scoreboard players operation <目标分数> <记分项> <运算符> <源分数> <记分项> ``` -The command consists of two score holders: The target score, and the source score. The target score is the value being operated on, and the source score is the value affecting the operation. The result of the operation is written into the target score, and the source score's value is not touched, save for [one operation](/commands/scoreboard-operations#swap-operator). +该命令包含两个分数持有者:目标分数和源分数。目标分数是被操作的值,源分数是参与运算的值。运算结果将写入目标分数,源分数的值不会被修改(除[交换运算符](/wiki/commands/scoreboard-operations#swap-operator)外)。 -## Mathematical Operators -Mathematical operators use arithmetic to affect the target score. There are five mathematical operations available: addition, subtraction, multiplication, floor division, and floor modulo division. +## 数学运算符 +数学运算符通过算术运算影响目标分数。共有五种数学运算:加法、减法、乘法、向下取整除法和向下取整模除。 -For each of the following examples below, assume that score holder `A var` equals 25, and `B var` equals 10. +以下示例均假设分数持有者`A var`的值为25,`B var`的值为10。 -### Addition -Operator: **+=** +### 加法 +运算符:**+=** -This operation adds the target score and source scores together, then stores the sum into the target score. +将目标分数与源分数相加,结果存入目标分数。 ``` /scoreboard players operation A var += B var ``` -`A = A + B`, and as such `25 + 10 = 35`. +即`A = A + B`,运算结果为`25 + 10 = 35`。 -### Subtraction -Operator: **-=** +### 减法 +运算符:**-=** -This operation subtracts the target score by the source score, then stores the difference into the target score. +从目标分数中减去源分数,结果存入目标分数。 ``` /scoreboard players operation A var -= B var ``` -`A = A - B`, and as such `25 - 10 = 15`. +即`A = A - B`,运算结果为`25 - 10 = 15`。 -### Multiplication -Operator: **\*=** +### 乘法 +运算符:***=** -This operation multiplies the target score by the source score, then stores the product into the target score. +将目标分数乘以源分数,结果存入目标分数。 ``` /scoreboard players operation A var *= B var ``` -`A = A * B`, and as such `25 * 10 = 250`. +即`A = A * B`,运算结果为`25 * 10 = 250`。 -### Floored Division -Operator: **/=** +### 向下取整除法 +运算符:**/=** -This operation divides the target score by the source score, then stores the quotient into the target score. Because score values can only be integers, the value is floored, or rounded down. +将目标分数除以源分数,结果向下取整后存入目标分数(由于分数值只能是整数)。 ``` /scoreboard players operation A var /= B var ``` -`A = floor(A / B)`, and as such `floor(25 / 10) = 2`. +即`A = floor(A / B)`,运算结果为`floor(25 / 10) = 2`。 -### Floored Modulo Division -Operator: **%=** +### 向下取整模除 +运算符:**%=** -This operation also divides the target score by the source score, but instead returns the remainder after the division into the target score. This is also floored. +将目标分数除以源分数后取余数,结果向下取整后存入目标分数。 ``` /scoreboard players operation A var %= B var ``` -`A = floor(mod(A, B))`, and as such `floor(mod(25, 10)) = 5`. +即`A = floor(mod(A, B))`,运算结果为`floor(mod(25, 10)) = 5`。 -## Logical Operators -Logical operations use logic gates and assignments to affect the target score. There are four logical operations available: assignment, less than, greater than, and swap. +## 逻辑运算符 +逻辑运算符使用逻辑门和赋值操作来影响目标分数。共有四种逻辑运算:赋值、最小值、最大值和交换。 -Similar to the above, assume that score holder `A var` equals 25, and `B var` equals 10. +同样假设分数持有者`A var`的值为25,`B var`的值为10。 -### Assignment Operator -Operator: **=** +### 赋值运算符 +运算符:**=** -This operation sets the target score equal to the source score. +将目标分数设置为源分数的值。 ``` /scoreboard players operation A var = B var ``` -`A = B`, and as such the result is `10`. +即`A = B`,运算结果为`10`。 -### Minimum Operator -Operator: **<** +### 最小值运算符 +运算符:**<** -This operation returns the smallest of the input scores, and stores it into the target score. +比较两个分数后,将较小值存入目标分数。 ``` /scoreboard players operation A var < B var ``` -`A = min(A, B)`, and as such `min(25, 10) = 10`. +即`A = min(A, B)`,运算结果为`min(25, 10) = 10`。 -### Maximum Operator -Operator: **>** +### 最大值运算符 +运算符:**>** -This operation returns the largest of the input scores, and stores it into the target score. +比较两个分数后,将较大值存入目标分数。 ``` /scoreboard players operation A var > B var ``` -`A = max(A, B)`, and as such `max(25, 10) = 25`. +即`A = max(A, B)`,运算结果为`max(25, 10) = 25`。 -### Swap Operator -Operator: **><** +### 交换运算符 +运算符:**><** -This operation swaps the target score and source scores with each other. This is the only operation that affects the source score. +交换目标分数和源分数的值。这是唯一会影响源分数的运算符。 ``` /scoreboard players operation A var >< B var ``` -The above command would swap the values of A and B e.g. +执行上述命令后,A和B的值将互换: -Before: A = 10; B = 25; +执行前:A = 10;B = 25; -After: A = 25; B = 10; +执行后:A = 25;B = 10; -This can be seen as three operations: `temp = A; A = B; B = temp;`, and as such `A var = 10` and `B var = 25`. +该操作等效于三步操作:`temp = A; A = B; B = temp;`,最终`A var = 10`且`B var = 25`。 -## Useful Creations +## 实用案例 -#### Check If Values are Equal +#### 检查数值是否相等 -If you want to check in scoreboard, whether one value equals another value, you can copy first value to temporary value, subtract the other and compare temporary value to zero. Given values A and B: +若要通过记分板检查两个值是否相等,可将第一个值复制到临时变量,再减去第二个值后比较临时变量是否为0。假设有值A和B: - - -``` +::: code-group +```json [实体标签] scoreboard objectives add temp dummy scoreboard players operation @e temp = @s A scoreboard players operation @e temp -= @s B -execute @e[scores={temp=0}] ~~~ say A equals B +execute @e[scores={temp=0}] ~~~ say A等于B scoreboard objectives remove temp ``` -#### Scoreboard Initialization +#### 记分板初始化 -If you want to initialize a scoreboard value to 0, but only if it doesn't exists, you can use `scoreboard players add 0`. It will set the value to 0, if it doesn't exist on the entity and do nothing, if it already exist. +若要将记分板值初始化为0(仅当该值不存在时),可使用`scoreboard players add <选择器> <名称> 0`。此命令会在实体不存在该分数时设为0,若已存在则不做任何操作。 \ No newline at end of file diff --git a/docs/wiki/commands/scoreboard-timers.md b/docs/wiki/commands/scoreboard-timers.md index 02c27938..848ec54c 100644 --- a/docs/wiki/commands/scoreboard-timers.md +++ b/docs/wiki/commands/scoreboard-timers.md @@ -1,200 +1,176 @@ --- -title: Scoreboard Timers -category: Scoreboard Systems +title: 记分板计时器 +category: 计分板系统 mentions: - BedrockCommands - zheaEvyline nav_order: 5 tags: - - system + - 系统 --- -## Introduction +# 记分板计时器 -[Sourced By Bedrock Commands Community Discord](https://discord.gg/SYstTYx5G5) + -This system allows you to run your desired commands at specific intervals with any amount of delay that you wish to add. +## 简介 -- **Some Examples:** - - Sending a message in chat every 2 hours. - - Running a 'lag clear' function every 10 minutes. - - Effecting players with 'speed' every 30 seconds. - - This system is especially useful when you need to set up multiple timers on your world. When working with command blocks, you may use the [Tick Delay](/commands/intro-to-command-blocks#command-block-tick-delay) option to delay the time taken for your commands to run. However, when working with functions you will need to use a system like this. +[源自 Bedrock Commands 社区 Discord](https://discord.gg/SYstTYx5G5) -It is recommended to use this system while working with command blocks, as well if you wish to run all your timers in sync with one another, ie. with the same start time. - -## Setup +本系统允许你在指定时间间隔内运行自定义指令,延迟时长可根据需求自由设定。 -*To be typed in chat:* - +- **应用场景示例:** + - 每2小时在聊天栏发送消息 + - 每10分钟执行一次"清除延迟"函数 + - 每30秒给玩家施加速度效果 -```yaml +当需要在世界中设置多个计时器时,本系统尤为实用。使用命令方块时可通过[Tick 延迟](/wiki/commands/intro-to-command-blocks#command-block-tick-delay)选项来延迟指令执行,但在函数中则需要依赖此类系统。 + +推荐在命令方块中也使用本系统,以便让所有计时器保持同步启动。 + +## 初始设置 + +*在聊天栏输入以下指令:* +::: code-group +```yaml [初始化] scoreboard objectives add ticks dummy scoreboard objectives add events dummy ``` -Once you have created these two objectives, you will need to define the interval for each repeating event you need on your world in the `ticks` objective. +创建这两个记分项后,需要在`ticks`记分项中为每个重复事件定义间隔时间。 -To do that, first you must know that **1 second is approximately 20 game ticks in Minecraft**. Based on this knowledge, you will need to do some basic calculations to obtain the ticks equivalent for each interval you want to define. - - -```yaml -# 2h = 20(t) × 60(s) × 60(m) × 2(h) = 144000t +需注意**Minecraft中1秒约等于20游戏刻**,可通过基础运算换算所需时间对应的刻数。 +::: code-group +```yaml [时间换算] +# 2小时 = 20(t) × 60(秒) × 60(分) × 2(小时) = 144000刻 scoreboard players set 2h ticks 144000 -#10m = 20(t) × 60(s) × 10(m) = 12000t +#10分钟 = 20(t) × 60(秒) × 10(分) = 12000刻 scoreboard players set 10m ticks 12000 -#30s = 20(t) × 30(s) = 600t +#30秒 = 20(t) × 30(秒) = 600刻 scoreboard players set 30s ticks 600 ``` -We will now use this scoreboard data to make our timers function. +::: -## System +## 系统实现 -mcfunction - -```yaml +::: code-group +```yaml [计时系统.mcfunction] scoreboard players add timer ticks 1 scoreboard players operation * events = timer ticks -#Chat Message (every 2h) +# 聊天消息(每2小时) scoreboard players operation chatMessage events %= 2h ticks -execute if score chatMessage events matches 0 run say Technoblade never dies! +execute if score chatMessage events matches 0 run say 技术之刃永世长存! -#Lag Clear (every 10m) +# 延迟清理(每10分钟) scoreboard players operation lagClear events %= 10m ticks execute if score lagClear events matches 0 run function clear_lag -#Speed Effect (every 30s) +# 速度效果(每30秒) scoreboard players operation speedEffect events %= 30s ticks execute if score speedEffect events matches 0 run effect @a speed 10 2 true ``` -![commandBlockChain8](/assets/images/commands/commandBlockChain/8.png) - -Here we have taken 3 examples to give you an idea on how to do it, but you can add any timer you need and as many as you require. - -Just make sure to follow the given order and properly use the `/execute if score` command as shown to run the commands you need. - -## Explanation - -- **` events `** on this objective we label all the repeating events we want on our world. - - `chatMessage` - - `lagClear` - - `speedEffect` -- **` ticks `** on this objective we define all the intervals for our events and also run our scoreboard timer. - - ` 2h` interval (static score 144000) - - `10m` interval (static score 12000) - - `30s` interval (static score 600) - - `timer` clock (variable score n+1) - - -- **Command 1:** this command adds +1 score every tick to FakePlayer name `timer` indicating a tick has passed in the game. This is basically our scoreboard timer/clock which we will use for all the repeating events on our world. - - -- **Command 2:** here we copy `timer` score to all our events using the ` * ` wildcard selector. This will allow us to perform operations to determine if the interval has been reached to run the commands for that particular event. Example: - - If `timer` score is 1200 that means 1200 game ticks have passed. - - And this command makes it so all our events FakePlayer names: `chatMessage`, `lagClear`, `speedEffect` scores are also 1200. - - -- **Command 3:** we will use the ` %= ` modulo operation to check if our event score is divisible by it's corresponding interval. A number is said to be divisible when the remainder is 0. - - Chat Message: `1200/144000` Q=0, R=1200, *hence interval not reached.* - - Lag Clear: `1200/12000` Q=0, R=1200, *hence interval not reached.* - - Speed Effect: `1200/600` Q=2, R=0, *hence interval has reached and event commands can be executed.* -Here we can note that the first 2 events are yet to happen but the 3rd event is happening for the second time. -:::tip -In Minecraft; scoreboard division is only calculated up to whole numbers and decimal values are ignored. -![longDivision](/assets/images/commands/longDivision.png) ::: +![命令方块链示意图](/assets/images/commands/commandBlockChain/8.png) -- **Command 4:** the remainder value obtained from the calculation is applied to the corresponding event FakePlayer name. Based on this knowledge we can run our command if it's score is equal to 0. +本示例展示了三种计时器的实现方法,您可根据需求扩展更多计时器。请严格按照顺序编写指令,并正确使用`/execute if score`条件判断。 -The rest of the commands are identical in structure and only the event labels and interval values are changed. +## 系统解析 -## Defining Events With Limited Intervals +- **`events`记分项:** 用于标记所有需要重复执行的事件 + - `chatMessage` - 聊天消息 + - `lagClear` - 延迟清理 + - `speedEffect` - 速度效果 +- **`ticks`记分项:** 存储事件间隔参数与计时器数值 + - `2h`间隔(固定值144000) + - `10m`间隔(固定值12000) + - `30s`间隔(固定值600) + - `timer`计时器(动态累加值) -To limit how many times an event occurs, you will need to create a new objective called `intervals` and define how many times the event should occur like so: - +**指令详解:** +1. **计时累加:** 每游戏刻为`timer`虚拟玩家分数+1,作为全局时间基准 +2. **数值同步:** 将`timer`数值复制到所有事件虚拟玩家,建立时间参照 +3. **模运算检测:** 使用` %= `运算符计算余数,当余数为0时触发事件 +4. **事件触发:** 根据模运算结果执行对应指令 -```yaml -scoreboard objectives set chatMessage intervals 5 -scoreboard objectives set speedEffect intervals 10 +:::tip 模运算原理 +Minecraft中的分数除法仅保留整数部分,余数通过模运算获取。当余数为0时表示达到设定间隔。 +![长除法示意图](/assets/images/commands/longDivision.png) +::: + +## 有限次数事件 + +如需限制事件触发次数,可创建`intervals`记分项来设置剩余触发次数: +::: code-group +```yaml [次数限制] +scoreboard players set chatMessage intervals 5 +scoreboard players set speedEffect intervals 10 ``` -Once you have done that, modify your system from above like so: - -mcfunction - -```yaml +修改系统函数如下: +::: code-group +```yaml [有限次数版.mcfunction] scoreboard players add timer ticks 1 scoreboard players operation * events = timer ticks -#Chat Message (every 10m) +# 聊天消息(每2小时) scoreboard players operation chatMessage events %= 2h ticks -execute if score chatMessage events matches 0 if score chatMessage intervals matches 1.. run say Technoblade never dies! +execute if score chatMessage events matches 0 if score chatMessage intervals matches 1.. run say 技术之刃永世长存! execute if score chatMessage events matches 0 if score chatMessage intervals matches 1.. run scoreboard players remove chatMessage intervals 1 -#Speed Effect (every 30s) +# 速度效果(每30秒) scoreboard players operation speedEffect events %= 30s ticks execute if score speedEffect events matches 0 if score speedEffect intervals matches 1.. run effect @a speed 10 2 true execute if score speedEffect events matches 0 if score speedEffect intervals matches 1.. run scoreboard players remove speedEffect intervals 1 ``` -![commandBlockChain8](/assets/images/commands/commandBlockChain/8.png) +::: -## Executing Commands During Timeframe +## 时段内持续执行 -To run commands during the timeframe between intervals for a particular system you may do something like this: -mcfunction - -```yaml -#Speed Effect (every 30s) + Particle (every tick) +若需要在计时过程中持续执行指令(而不仅是在触发时刻): +::: code-group +```yaml [持续效果.mcfunction] +# 速度效果(每30秒) + 持续粒子效果 scoreboard players operation speedEffect events %= 30s ticks execute if score speedEffect intervals matches 1.. as @a at @s run particle minecraft:shulker_bullet ~~~ execute if score speedEffect events matches 0 if score speedEffect intervals matches 1.. run effect @a speed 10 2 true execute if score speedEffect events matches 0 if score speedEffect intervals matches 1.. run scoreboard players remove speedEffect intervals 1 ``` -As shown in line 3; to run commands while the timer is running, all you need to do is remove the "if score" testing if the interval has been reached. And instead, only test if *any* interval is left, to run our commands. +::: -Let's say we had set the intervals for this event to 10, then that means players would also have particle trails for 300 seconds since `10*30s=300s` +如设置触发次数为10次,粒子效果将持续300秒(10 × 30秒)。 -## Entity Timers +## 实体独立计时器 -In some cases such as an entity despawn event you will need to run timers for each entity individually rather than a synchronised timer which could cause the event to trigger too soon. In such cases an Async Timer can be helpful. - -Let's say we want to: -- kill all entities named "station" 5 minutes after they've been summoned. -- play a shulker particle around them during that timeframe. -- play a flame particle around them in the first 10 seconds. -- play a pling sound to nearby players when the timer reaches half way. -- stop the timer if a passive mob is nearby. -- loop the timer if a hostile mob is nearby. - -mcfunction - -```yaml -#Clock +对于需要单独计时的实体(如定时消失),可使用异步计时系统: +::: code-group +```yaml [实体计时器.mcfunction] +# 计时核心 scoreboard players add @e [name=station, scores={ticks=0..}] ticks 1 -#Executing Commands while timer is running +# 持续粒子效果 execute as @e [name=station, scores={ticks=0..}] at @s run particle minecraft:shulker_bullet ~~~ -#Executing commands within a timeframe +# 前10秒火焰粒子 execute as @e [name=station, scores={ticks=0..200}] at @s run particle minecraft:basic_flame_particle ~~~ -#Executing commands at specific intervals +# 中途提示音效 execute as @e [name=station, scores={ticks=3600}] at @s run playsound note.pling @a [r=10] -#Stopping the timer +# 暂停计时条件 execute as @e [name=station] at @s if entity @e [family=pacified, r=10, c=1] run scoreboard players set @s ticks -1 -#Looping the timer +# 循环计时条件 execute as @e [name=station, scores={ticks=6000}] at @s if entity @e [family=monster, r=10, c=1] run scoreboard players set @s ticks 0 -#End +# 最终执行 kill @e [name=station, scores={ticks=6000}] ``` -![commandBlockChain7](/assets/images/commands/commandBlockChain/7.png) +::: -As shown; setting the score to 0 when it completes the timeframe will loop the timer and setting the score to -1 will stop/disable it. You can still set the score to 0 to start the timer again. +![实体计时器示意图](/assets/images/commands/commandBlockChain/7.png) + +通过将分数设为0可实现循环计时,设为-1可停止计时。实体将在6000刻(5分钟)后被清除。 \ No newline at end of file diff --git a/docs/wiki/commands/selectors.md b/docs/wiki/commands/selectors.md index e3c348db..a14374c4 100644 --- a/docs/wiki/commands/selectors.md +++ b/docs/wiki/commands/selectors.md @@ -1,6 +1,6 @@ --- -title: Understanding Selectors -category: General +title: 选择器详解 +category: 基础 mentions: - Science-geek42 - Brougud @@ -10,208 +10,286 @@ mentions: - Hatchibombotar --- -Target selectors are used in commands to target who you want to execute a command on without explicitly setting a target, such as a player's name. A target selector is comprised of a selector variable, and optionally a list of selector arguments. +# 选择器详解 -## Selector Variables + -The selector variable defines the broad list of entities to select. There are six selector variables to choose from: -- `@a` - Target all players -- `@p` - Target the nearest player -- `@r` - Target a random player -- `@e` - Target all entities -- `@s` - Target the executor -- `@initiator` - Target the player interacting with an NPC +目标选择器用于在命令中动态指定执行对象,无需明确设置目标(例如玩家名称)。选择器由选择器变量和可选的选择器参数组成。 -## Selector Arguments +## 选择器变量 -Selector arguments can narrow down a list of target candidates to those who meet certain conditions. In order to use selector arguments, you must first have a selector variable. To start with selector arguments you must add square brackets `[]` to the end of the chosen target selector like this: `kill @e[]`. Multiple selector arguments can be used by separating them with commas. +选择器变量定义了基本的实体筛选范围。共有六种选择器变量可选: +- `@a` - 选择所有玩家 +- `@p` - 选择最近的玩家 +- `@r` - 随机选择玩家 +- `@e` - 选择所有实体 +- `@s` - 选择命令执行者自身 +- `@initiator` - 选择与NPC交互的玩家 -### Type -Limits the selection of targets by their identifier. Negating the argument selects entities without that identifier. This argument cannot be repeated unless negated, since a given entity can only have one identifier. This argument can be used with the selector `@r` to select entities randomly. +## 选择器参数 -- `type=`—Include only entities with the given identifier. -- `type=!`—Exclude any entities with the given identifier. +选择器参数可进一步缩小候选目标范围。使用参数时需先指定选择器变量,并在其后添加方括号`[]`,例如:`kill @e[]`。多个参数之间用逗号分隔。 -Examples: +### Type(类型) +根据实体标识符筛选目标。否定参数将排除指定类型的实体。由于每个实体只能有一个标识符,除非使用否定参数,否则该参数不可重复。可与`@r`选择器配合进行随机筛选。 -Affect all pigs with levitation: -- `/effect @e[type=pig] levitation` +- `type=<标识符>`——仅包含指定类型的实体 +- `type=!<标识符>`——排除指定类型的实体 -Kill all entities that are not arrows and snowballs: -- `/kill @e[type=!arrow,type=!snowball]` +示例: -### Count -Limits the number of selected entities, following selector sorting rules. +对所有猪施加漂浮效果: +::: code-group +```json [pig] +/effect @e[type=pig] levitation +``` -The selectors `@a`, `@p`, and `@e` sort by increasing distance, while `@r` sorts randomly. For the variables `@p` and `@r`, this argument defaults to 1. Negating this argument reverses the sorting order; random sorting cannot be negated. +清除所有非箭矢和非雪球的实体: +```json [non-arrow/snowball] +/kill @e[type=!arrow,type=!snowball] +``` +::: -- `c=`—Select up to `` entities. +### Count(数量) +根据排序规则限制选中实体数量。 -Examples: +`@a`、`@p`和`@e`按距离升序排列,`@r`随机排列。`@p`和`@r`默认值为1。否定参数将反转排序方向(随机排序不可否定)。 -Clear stone from the closest five players: -- `/clear @a[c=5] stone` +- `c=<数量>`——选择最多`<数量>`个实体 -Damage the furthest two skeletons: -- `/damage @e[type=skeleton,c=-2] 2` +示例: -### Position -Changes the position a selector starts its search at. It also modifies where the distance and volume arguments are positioned. Leaving any undefined defaults to the command's current position. +清除最近五名玩家背包中的石头: +::: code-group +```json [5 players] +/clear @a[c=5] stone +``` -[Relative coordinates](/commands/relative-coordinates#relative-coordinates) can be used to define a relative offset from the command's position. +对最远的两只骷髅造成伤害: +```json [skeletons] +/damage @e[type=skeleton,c=-2] 2 +``` +::: -- `x=`, `y=`, and `z=`—Defines a position for the target selector. +### Position(位置) +设定选择器的搜索起点,同时影响距离和体积参数的判定基准。未定义时默认使用命令执行位置。 -Examples: +可使用[相对坐标](/wiki/commands/relative-coordinates#相对坐标)来设置偏移量。 -Teleport the closest player to (140, 64, -200) ten blocks up: -- `/teleport @p[x=140, y=64, z=-200] ~ ~10 ~` +- `x=<值>`, `y=<值>`, `z=<值>`——定义选择器的基准坐标 -### Distance -Limits the selection of targets by their spherical distance from the selector. This selects entities by their feet. +示例: -- `rm=` and `r=`—Selects entities between the minimum and maximum number of blocks away, inclusive and respectively. +将(140,64,-200)处最近的玩家向上传送10格: +::: code-group +```json [teleport] +/teleport @p[x=140, y=64, z=-200] ~ ~10 ~ +``` +::: -Examples: +### Distance(距离) +根据实体脚部的球面距离筛选目标。 -Kill all chickens between two and six blocks away: -- `/kill @e[type=chicken, rm=2, r=6]` +- `rm=<值>`和`r=<值>`——分别设置最小和最大距离(包含边界值) -Enchant the held item with Sharpness for all players within one block of (0, 100, 0): -- `/enchant @a[x=0, y=100, z=0, r=1] sharpness` +示例: -### Volume -Limits the selection of targets to those inside of a cuboid volume aligned to the block grid. There are three arguments, each determining the size of the box along their respective axes. If at least one argument is defined, any remaining arguments left undefined are assumed to be 0. This selects entities by their feet. +清除2到6格范围内的所有鸡: +::: code-group +```json [chicken] +/kill @e[type=chicken, rm=2, r=6] +``` -The general formula for calculating the volume between two positions can be viewed as: `dx = x2 - x1; dy = y2 - y1; dz = z2 - z1`. +在(0,100,0)1格范围内所有玩家的手持物品附魔锋利: +```json [enchant] +/enchant @a[x=0, y=100, z=0, r=1] sharpness +``` +::: -- `dx=`, `dy=`, and `dz=`—Selects entities inside the given bounding box. +### Volume(体积) +筛选位于方块坐标系对齐的立方体内的实体。三个参数分别定义各轴长度,未定义参数默认为0。以实体脚部为判定点。 -Examples: +体积计算公式:`dx = x2 - x1; dy = y2 - y1; dz = z2 - z1` -List all entities within a 12x30x2 box: -- `/say @e[dx=12, dz=30, dy=2]` +- `dx=<值>`, `dy=<值>`, `dz=<值>`——定义立方体区域 -Add the "lobby" tag to all players between (-400, 0, -350) and (-150, 256, 50): -- `/tag @a[x=-400, y=0, z=-350, dx=250, dy=256, dz=400] add lobby` +示例: -### Scores -Limits the selection of targets by their score value. This argument is represented as an object, with key-value pairs for a scoreboard objective and a value. The value can represent a range of numbers, using the range syntax. The value of a score can be negated to test if the entity does not have a score value within that range. +列出12x30x2区域内的所有实体: +::: code-group +```json [say] +/say @e[dx=12, dz=30, dy=2] +``` -- `scores={=}`—Selects entities whose score under the given objective matches the given value. +为(-400,0,-350)到(-150,256,50)区域内的玩家添加"lobby"标签: +```json [tag] +/tag @a[x=-400, y=0, z=-350, dx=250, dy=256, dz=400] add lobby +``` +::: -The range syntax works as follows: -- `N..` is any number greater than or equal to N. -- `..N` is any number less than or equal to N. -- `N..M` is any number between N and M, inclusive. +### Scores(计分板) +根据计分板分数筛选目标。参数格式为对象,包含计分项与数值的键值对。数值可使用范围语法。否定参数将排除分数范围内的实体。 -Examples: +- `scores={<计分项>=<数值>}`——筛选符合分数条件的实体 -Set the "points" score for all players with a "points" score of ten to 0: -- `/scoreboard players set @p[scores={points=10}] points 0` +范围语法说明: +- `N..`:大于等于N的数值 +- `..N`:小于等于N的数值 +- `N..M`:介于N到M之间的数值(包含边界) -Add the "start" tag to armor stands with both a "started" score of one, and a "timer" score of 20 or less: -- `/tag @e[type=armor_stand, scores={started=1, timer=..20}] add start` +示例: -### Name -Limits the selection of targets by name. Negating the argument selects entities whose name does not match. +将"points"分数为10的玩家分数重置为0: +::: code-group +```json [points] +/scoreboard players set @p[scores={points=10}] points 0 +``` -- `name=`—Include only entities with the given name. -- `name=!`—Exclude any entities with the given name. +为同时满足"started=1"且"timer≤20"的盔甲架添加"start"标签: +```json [armor_stand] +/tag @e[type=armor_stand, scores={started=1, timer=..20}] add start +``` +::: -Examples: +### Name(名称) +根据实体名称筛选目标。否定参数将排除指定名称的实体。 -List all zombies named Shadow: -- `/say @e[type=zombie, name=Shadow]` +- `name=<名称>`——仅包含指定名称的实体 +- `name=!<名称>`——排除指定名称的实体 -Give one level to players both not named Steve and not named Alex: -- `/xp 1L @a[name=!Steve, name=!Alex]` +示例: -### Tag -Limits the selection of targets by their tags. This argument can be repeated to test for multiple tags, and all filters must pass for an entity to be selected. Negating this argument selects entities without that tag. +列出所有名为Shadow的僵尸: +::: code-group +```json [zombie] +/say @e[type=zombie, name=Shadow] +``` -- `tag=`—Include only entities with the given tag. -- `tag=!`—Exclude any entities with the given tag. +给非Steve和非Alex的玩家提升1级: +```json [xp] +/xp 1L @a[name=!Steve, name=!Alex] +``` +::: -Examples: +### Tag(标签) +根据实体标签筛选目标。可重复使用多个标签参数,所有条件需同时满足。否定参数将排除具有指定标签的实体。 -Kill all mobs with the tag "marked", and without the tag "exempt": -- `/kill @e[tag=marked, tag=!exempt]` +- `tag=<标签>`——仅包含具有指定标签的实体 +- `tag=!<标签>`——排除具有指定标签的实体 -### Family -Limits the selection of targets by type family. This argument can be repeated to test for multiple families, and all filters must pass for an entity to be selected. Negating this argument selects entities whose type family does not match. +示例: -- `family=`—Include only entities with the given type family. -- `family=!`—Exclude any entities with the given type family. +清除所有带"marked"标签且无"exempt"标签的生物: +::: code-group +```json [marked] +/kill @e[tag=marked, tag=!exempt] +``` +::: -Examples: +### Family(族群) +根据实体族群类型筛选目标。可重复使用多个族群参数,所有条件需同时满足。否定参数将排除指定族群的实体。 -Affect all entities in the "monster" family with Regeneration: -- `/effect @e[family=monster] regeneration` +- `family=<族群>`——仅包含指定族群的实体 +- `family=!<族群>`——排除指定族群的实体 -### Rotation -Limits the selection of targets by their rotation. There are two types of rotation: x-rotation, which is vertical rotation around the x-axis; and y-rotation, which is horizontal rotation around the y-axis. X-rotation ranges between -90 and 90 (180° total), going from looking up to down; and y-rotation ranges between -180 and 180 (360° total), starting and ending at North, wrapping around clockwise. +示例: + +对"monster"族群的所有实体施加再生效果: +::: code-group +```json [monster] +/effect @e[family=monster] regeneration +``` +::: + +### Rotation(旋转角度) +根据实体视角筛选目标。分为垂直视角(x轴旋转,范围-90~90)和水平视角(y轴旋转,范围-180~180)。 -- `rxm=` and `rx=`—Selects entities whose x-rotation is between the minimum and maximum values, inclusive and respectively. -- `rym=` and `ry=`—Selects entities whose y-rotation is between the minimum and maximum values, inclusive and respectively. +- `rxm=<值>`和`rx=<值>`——垂直视角范围 +- `rym=<值>`和`ry=<值>`——水平视角范围 -Examples: +示例: -Affect all players looking at or above the horizon with Blindness for one second: -- `/effect @a[rx=0] blindness 1` (0 or less) - -Damage all players facing generally south: -- `/damage @a[rym=-45, ry=45] 1` - -### Level -Limits the selection of targets by experience levels. Only players can have EXP, so this filters out non-player targets. - -- `lm=` and `l=`—Selects players whose EXP levels are between the minimum and maximum values specified, inclusive and respectively. - -Examples: - -Give all players who have between three and eight levels a diamond: -- `/give @a[lm=3, l=8] diamond` - -### Game mode -Limits the selection of targets by game mode. Only players can use game mode, so this filters out non-player targets. Negating the argument selects targets whose game mode does not match. - -- `m=`—Selects players by their game mode. - -Possible values include: -* `0`, `s`, or `survival` for Survival mode -* `1`, `c`, or `creative` for Creative mode -* `2`, `a`, or `adventure` for Adventure mode -* `spectator` for Spectator mode -* `d` or `default` for the default game mode - -Examples: - -List all players in Creative mode: -- `/say @a[m=creative]` - -Set the game mode to Creative mode for players both not in Survival mode, and not in Adventure mode: -- `/gamemode creative @a[m=!survival, m=!adventure]` - -### Items -Limits the selection of targets by what items they have in their inventory. This argument is represented as an object, or an array of objects, with up to one each of the following parameters: - -- `item=`—The identifier of the item to test for, and the only required argument. This can accept custom identifiers too. -- `quantity=`—The amount of the item to test for. Accepts a [range](/commands/selectors#scores) for a value. This argument can also be negated. -- `data=`—The data value of the item to test for. Defaults to -1. **Currently not functional:** [MCPE-151920](https://bugs.mojang.com/browse/MCPE-151920) -- `location=`—The slot the item should be located in. Accepts the same arguments as the slotType argument in the `/replaceitem` command. -- `slot=`—The index of the slot used in the "location" argument, and can only be used with "location". Accepts a range for a value. This argument can be negated. - -Examples: - -Checks for players who have a netherite sword in their inventory: -- `/testfor @a[hasitem={item=netherite_sword}]` - -Clears 2 apples for players that have four or more apples: -- `/clear @a[hasitem={item=apple,quantity=4..}] apple 2` - -Checks for players who have two sticks and two diamonds: -- `/testfor @a[hasitem=[{item=diamond,quantity=2},{item=stick,quantity=2}]]` - -Checks for players who doesn't have a stick: -- `/testfor @a[hasitem=[{item=stick,quantity=0}]` +对仰角≥0度(平视或俯视)的玩家施加1秒失明: +::: code-group +```json [blindness] +/effect @a[rx=0] blindness 1 +``` + +对朝南方向(-45°~45°)的玩家造成伤害: +```json [damage] +/damage @a[rym=-45, ry=45] 1 +``` +::: + +### Level(经验等级) +根据玩家经验等级筛选目标(仅限玩家)。 + +- `lm=<数值>`和`l=<数值>`——分别设置最低和最高等级(包含边界) + +示例: + +给3-8级的玩家发放钻石: +::: code-group +```json [diamond] +/give @a[lm=3, l=8] diamond +``` +::: + +### Game mode(游戏模式) +根据游戏模式筛选玩家目标。否定参数将排除指定模式的玩家。 + +- `m=<模式>`——筛选指定游戏模式 + +可用模式值: +* `0`、`s`或`survival`:生存模式 +* `1`、`c`或`creative`:创造模式 +* `2`、`a`或`adventure`:冒险模式 +* `spectator`:旁观模式 +* `d`或`default`:默认模式 + +示例: + +列出所有创造模式玩家: +::: code-group +```json [creative] +/say @a[m=creative] +``` + +将非生存和非冒险模式的玩家设为创造模式: +```json [gamemode] +/gamemode creative @a[m=!survival, m=!adventure] +``` +::: + +### Items(物品) +根据物品栏内容筛选目标。参数格式为对象或对象数组,支持以下参数: + +- `item=<字符串>`——物品标识符(必填) +- `quantity=<整数>`——物品数量(支持范围语法,可否定) +- `data=<整数>`——物品数据值(默认-1,**当前不可用**:[MCPE-151920](https://bugs.mojang.com/browse/MCPE-151920)) +- `location=<字符串>`——物品所在栏位(与`/replaceitem`的slotType参数一致) +- `slot=<整数>`——栏位索引(需配合location使用,支持范围语法,可否定) + +示例: + +检测携带下界合金剑的玩家: +::: code-group +```json [netherite_sword] +/testfor @a[hasitem={item=netherite_sword}] +``` + +清除拥有≥4个苹果的玩家2个苹果: +```json [apple] +/clear @a[hasitem={item=apple,quantity=4..}] apple 2 +``` + +检测携带2钻石+2木棍的玩家: +```json [multiple] +/testfor @a[hasitem=[{item=diamond,quantity=2},{item=stick,quantity=2}]] +``` + +检测未携带木棍的玩家: +```json [negation] +/testfor @a[hasitem=[{item=stick,quantity=0}] +``` +::: \ No newline at end of file diff --git a/docs/wiki/commands/tellraw.md b/docs/wiki/commands/tellraw.md index 25618f30..4f7865b8 100644 --- a/docs/wiki/commands/tellraw.md +++ b/docs/wiki/commands/tellraw.md @@ -1,6 +1,6 @@ --- -title: Tellraw -category: Commands +title: tellraw命令 +category: 命令 mentions: - SirLich - Dreamedc2015 @@ -13,120 +13,110 @@ mentions: - SmokeyStack --- -tellraw sends a JSON message to selected or all players being useful for sending plain messages to players ingame +# tellraw命令 -**The titleraw command follows the same theme** + + +`tellraw` 用于向指定或所有玩家发送JSON格式消息,适用于在游戏中向玩家发送纯文本信息 + +**titleraw命令遵循相同的设计理念** ![](/assets/images/documentation/tellrawshow.png) +## 格式规范 -## Format - -this is how the tell raw command is formatted +`tellraw`命令的基础语法结构如下: ``` -tellraw +tellraw <目标: 目标> <原始JSON消息: json> ``` -- ` `: The target is expressed as a playername or player groups such as `@a` `@r` `@s` `@p` -- ``: This is a json schema that tells how the message is structured or constructed. expressed with for example: +- ` <目标: 目标>`: 目标可以表示为玩家名称或玩家组,例如`@a` `@r` `@s` `@p` +- `<原始JSON消息: json>`: 用于定义消息结构的JSON格式,例如: `{"rawtext":[{"text":""}]}` +## 基础示例 -## Examples +发送引号内的文字内容 -This sends the words in the last set of quotes - - - -```json +::: code-group +```json [命令] /tellraw @a {"rawtext":[{"text":"Hello"}]} ``` +::: +## 转义字符处理 -## Escaping Characters +在消息中使用引号时,需在引号左侧添加反斜杠进行转义 -To use quotations in a tellraw message place a backslash to the left side of the quotation mark. - - - -```json +::: code-group +```json [命令] /tellraw @a {"rawtext":[{"text":"Quote me: \"I am here\"."}]} ``` +::: +## 换行处理 -## Line breaks +使用`\n`实现文本换行 -To insert a line break use `\n` - - - -```json +::: code-group +```json [命令] /tellraw @a { "rawtext": [ { "text":"I am line one\nI am line two" } ] } ``` +::: +## 显示实体/玩家信息 -## Displaying entities / player +通过选择器显示实体名称的用法示例 -You can use the following to use selector to display names. - - - -```json +::: code-group +```json [命令] /tellraw @a {"rawtext": [{"text": "§6The winner is: §a"}, {"selector": "@a[r=5,c=1]"}]} ``` +::: +## 显示计分板数值 -## Displaying scores +显示玩家计分板数值的复合用法 -You can use the following to use selector to display names. - - - -```json +::: code-group +```json [命令] /tellraw @a {"rawtext": [{"text": "§6The winner is: §a"}, {"selector": "@a[r=5,c=1]"}, {"text": "§6With a score of: "}, {"score":{"name": "@s","objective": "value"}}]} ``` +::: +## 多语言文本翻译 -## Translate text +使用translate组件配合[翻译键](/wiki/concepts/text-and-translations)实现多语言支持。注意需在对应语言的.lang文件中配置翻译内容 -To have a language dependant text you can use the translate component and [translation keys](/concepts/text-and-translations). please note you will need relevant information in each of the desired .lang files for this to work. - - -RP/texts/en_US.lang - -``` +::: code-group +```json [RP/texts/en_US.lang] example.langcode.1=I am line one ``` -RP/texts/de_DE.lang - -``` +```json [RP/texts/de_DE.lang] example.langcode.1=Ich bin Zeile eins ``` +::: +对应命令: -The command: - - - -```json +::: code-group +```json [命令] /tellraw @a { "rawtext": [ { "translate": "example.langcode.1" } ] } ``` +::: +## 复合型翻译模板 -## Translate text with selectors/scores +多语言文件配置: -language files: - - - -``` +::: code-group +```json [示例] example.langcode.2=The winner is: %s. With a score of %s ``` - - -```json +```json [命令] /tellraw @a {"rawtext":[{"translate":"example.langcode.2","with":{"rawtext":[{"selector":"@a[r=5,c=1]"},{"text":"§6With a score of: "},{"score":{"name":"@s","objective":"value"}}]}}]} ``` +::: \ No newline at end of file diff --git a/docs/wiki/concepts/contents.md b/docs/wiki/concepts/contents.md index cbcc54cf..c5caa521 100644 --- a/docs/wiki/concepts/contents.md +++ b/docs/wiki/concepts/contents.md @@ -10,18 +10,20 @@ mentions: - TheItsNameless --- -`contents.json` is a file that is _probably_ used for the game to process the pack files more easily. It is _probably_ intended for marketplace content creators and Mojang, it is not required to have this file in the pack for the pack to work properly. +# contents.json -You will find there some instructions about the usage of this file. + -## Structure of the file +`contents.json` 是游戏用于更高效处理资源包文件的配置文件。该文件 _可能_ 主要为市场内容创作者和 Mojang 设计,资源包即使不包含此文件仍可正常运行。 -`contents.json` is located at the root of the add-on directory. It contains a list of the files that are included in the pack. -Example: +以下是关于该文件使用方式的说明。 -RP/contents.json +## 文件结构 -```json +`contents.json` 位于附加包目录的根路径,包含资源包内所有文件的路径列表。示例: + +::: code-group +```json [RP/contents.json] { "content": [ { @@ -51,6 +53,7 @@ Example: ] } ``` +::: -## Automatizing the process +## 自动化生成 -The `contents.json` file can be generated automatically by the game itself, it is very recommended to decrease the risks of making mistakes. However, the file must be prepared first. Create a new empty file called `contents.json` in the root directory of your add-on, and add empty brackets. +`contents.json` 可通过游戏自动生成,这种方式能有效减少手动配置错误。首先需要在附加包根目录创建空文件并添加空对象: -BP|RP/contents.json - -```json +::: code-group +```json [BP|RP/contents.json] {} ``` +::: -The file content will be automatically written next time the game is launched. +游戏会在下次启动时自动填充该文件内容。 -## Additional information +## 补充说明 -- The automatic process can be achieved no matter what is the location of the pack (Development folders or normal folders). -- Do not make multiple `contents.json` for subpacks, the file at the root of the pack is sufficient. -- This file is not required for the addon to work properly. +- 自动生成功能适用于任意位置的资源包(开发文件夹或普通文件夹均可) +- 不需要为子包单独创建多个 `contents.json`,根目录文件已足够 +- 该文件并非附加包运行的必要条件 + + + + \ No newline at end of file diff --git a/docs/wiki/concepts/emojis.md b/docs/wiki/concepts/emojis.md index f14870e9..a6efae5e 100644 --- a/docs/wiki/concepts/emojis.md +++ b/docs/wiki/concepts/emojis.md @@ -1,5 +1,5 @@ --- -title: Emojis & Symbols +title: 表情符号与特殊字符 mentions: - SirLich - Joelant05 @@ -15,231 +15,232 @@ mentions: - ThomasOrs --- +# 表情符号与特殊字符 + + + :::warning -Modifying texture of vanilla emojis and symbols on this page are incompatible with Nintendo Switch platform! +修改本页所述原版表情符号的材质与任天堂Switch平台不兼容! ::: -Minecraft has a bunch of hard-coded [Private Use Unicode symbols](https://en.wikipedia.org/wiki/Private_Use_Areas) that it automatically converts to Emoji-like symbols. -These can be used anywhere where normal letters can - signs, books, item names, chat, etc. +Minecraft 内置了一系列硬编码的[Unicode私有区符号](https://zh.wikipedia.org/wiki/Unicode%E7%A7%81%E6%9C%89%E5%8C%BA),这些符号会被自动转换为表情符号样式。它们可以在任何支持普通文字的地方使用——告示牌、书与笔、物品名称、聊天框等。 -Below you can find platform specific Emoji's, as well as general symbols. Copy/paste the "box" character under the Letter colum directly into Minecraft. +下方表格列出了平台专属表情符号和通用符号。直接将"字符"列下的方框字符复制/粘贴到Minecraft中使用。 -There will be instructions for creating custom emoji at the bottom. +文档底部还提供了创建自定义表情符号的指南。 -### HUD +### HUD界面 -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ----------------- | ------------------------ | ------- | ------------------------------------------------- | -| Food |  | U+E100 | ![](/assets/images/concepts/emojis/hud/food.png) | -| Armor |  | U+E101 | ![](/assets/images/concepts/emojis/hud/armor.png) | -| Heart |  | U+E10C | ![](/assets/images/concepts/emojis/hud/heart.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ----------------- | --------------------- | ------- | ------------------------------------------------ | +| 饥饿值 |  | U+E100 | ![](/assets/images/concepts/emojis/hud/food.png) | +| 护甲值 |  | U+E101 | ![](/assets/images/concepts/emojis/hud/armor.png) | +| 生命值 |  | U+E10C | ![](/assets/images/concepts/emojis/hud/heart.png) | -### Items & Blocks +### 物品与方块 -| Name | Letter (Copy/Paste This) | Unicode | Image | -| -------------- | ------------------------ | ------- | ------------------------------------------------------------ | -| Wooden Pickaxe |  | U+E108 | ![](/assets/images/concepts/emojis/items/wooden_pickaxe.png) | -| Wooden Sword |  | U+E109 | ![](/assets/images/concepts/emojis/items/wooden_sword.png) | -| Crafting Table |  | U+E10A | ![](/assets/images/concepts/emojis/items/crafting_table.png) | -| Furnace |  | U+E10B | ![](/assets/images/concepts/emojis/items/furnace.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| -------------- | --------------------- | ------- | ----------------------------------------------------------- | +| 木镐 |  | U+E108 | ![](/assets/images/concepts/emojis/items/wooden_pickaxe.png) | +| 木剑 |  | U+E109 | ![](/assets/images/concepts/emojis/items/wooden_sword.png) | +| 工作台 |  | U+E10A | ![](/assets/images/concepts/emojis/items/crafting_table.png) | +| 熔炉 |  | U+E10B | ![](/assets/images/concepts/emojis/items/furnace.png) | -### Marketplace +### 市场 -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ---------------- | ------------------------ | ------- | ------------------------------------------------------------ | -| Minecoin |  | U+E102 | ![](/assets/images/concepts/emojis/marketplace/minecoin.png) | -| Token |  | U+E105 | ![](/assets/images/concepts/emojis/marketplace/token.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ---------------- | --------------------- | ------- | ----------------------------------------------------------- | +| Minecoin |  | U+E102 | ![](/assets/images/concepts/emojis/marketplace/minecoin.png) | +| 代币 |  | U+E105 | ![](/assets/images/concepts/emojis/marketplace/token.png) | -### Inventory +### 物品栏 -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ---------------- | ------------------------ | ------- | ------------------------------------------------------------------ | -| Craft Toggle On |  | U+E0A0 | ![](/assets/images/concepts/emojis/inventory/craft_toggle_on.png) | -| Craft Toggle Off |  | U+E0A1 | ![](/assets/images/concepts/emojis/inventory/craft_toggle_off.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ---------------- | --------------------- | ------- | ----------------------------------------------------------------- | +| 合成开关开启 |  | U+E0A0 | ![](/assets/images/concepts/emojis/inventory/craft_toggle_on.png) | +| 合成开关关闭 |  | U+E0A1 | ![](/assets/images/concepts/emojis/inventory/craft_toggle_off.png) | -### New Touch +### 新触控界面 -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ----------------- | ------------------------ | ------- | ---------------------------------------------------------- | -| Jump |  | U+E014 | ![](/assets/images/concepts/emojis/new_touch/jump.png) | -| Attack |  | U+E015 | ![](/assets/images/concepts/emojis/new_touch/attack.png) | -| Joy Stick |  | U+E016 | ![](/assets/images/concepts/emojis/new_touch/joystick.png) | -| Place |  | U+E018 | ![](/assets/images/concepts/emojis/new_touch/place.png) | -| Sneak |  | U+E019 | ![](/assets/images/concepts/emojis/new_touch/sneak.png) | -| Sprint |  | U+E01A | ![](/assets/images/concepts/emojis/new_touch/sprint.png) | -| Fly Up |  | U+E01B | ![](/assets/images/concepts/emojis/new_touch/fly_up.png) | -| Fly Down |  | U+E01C | ![](/assets/images/concepts/emojis/new_touch/fly_down.png) | -| Dismount |  | U+E01D | ![](/assets/images/concepts/emojis/new_touch/dismount.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ----------------- | --------------------- | ------- | --------------------------------------------------------- | +| 跳跃 |  | U+E014 | ![](/assets/images/concepts/emojis/new_touch/jump.png) | +| 攻击 |  | U+E015 | ![](/assets/images/concepts/emojis/new_touch/attack.png) | +| 摇杆 |  | U+E016 | ![](/assets/images/concepts/emojis/new_touch/joystick.png) | +| 放置 |  | U+E018 | ![](/assets/images/concepts/emojis/new_touch/place.png) | +| 潜行 |  | U+E019 | ![](/assets/images/concepts/emojis/new_touch/sneak.png) | +| 疾跑 |  | U+E01A | ![](/assets/images/concepts/emojis/new_touch/sprint.png) | +| 上升 |  | U+E01B | ![](/assets/images/concepts/emojis/new_touch/fly_up.png) | +| 下降 |  | U+E01C | ![](/assets/images/concepts/emojis/new_touch/fly_down.png) | +| 下马 |  | U+E01D | ![](/assets/images/concepts/emojis/new_touch/dismount.png) | -### Touch +### 触控界面 -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ----------------- | ------------------------ | ------- | ------------------------------------------------------------- | -| Jump |  | U+E084 | ![](/assets/images/concepts/emojis/touch/jump.png) | -| Crouch |  | U+E085 | ![](/assets/images/concepts/emojis/touch/crouch.png) | -| Fly Up |  | U+E086 | ![](/assets/images/concepts/emojis/touch/fly_up.png) | -| Fly Down |  | U+E087 | ![](/assets/images/concepts/emojis/touch/fly_down.png) | -| Stop Flying |  | U+E088 | ![](/assets/images/concepts/emojis/touch/stop_flying.png) | -| Left Arrow |  | U+E081 | ![](/assets/images/concepts/emojis/touch/left_arrow.png) | -| Right Arrow |  | U+E083 | ![](/assets/images/concepts/emojis/touch/right_arrow.png) | -| Up Arrow |  | U+E080 | ![](/assets/images/concepts/emojis/touch/up_arrow.png) | -| Down Arrow |  | U+E082 | ![](/assets/images/concepts/emojis/touch/down_arrow.png) | -| Small Jump |  | U+E059 | ![](/assets/images/concepts/emojis/touch/smalljump.png) | -| Small Crouch |  | U+E05A | ![](/assets/images/concepts/emojis/touch/smallcrouch.png) | -| Small Fly Up |  | U+E05C | ![](/assets/images/concepts/emojis/touch/smallflyup.png) | -| Small Fly Down |  | U+E05D | ![](/assets/images/concepts/emojis/touch/smallflydown.png) | -| Small Left Arrow |  | U+E056 | ![](/assets/images/concepts/emojis/touch/smallleftarrow.png) | -| Small Right Arrow |  | U+E058 | ![](/assets/images/concepts/emojis/touch/smallrightarrow.png) | -| Small Up Arrow |  | U+E055 | ![](/assets/images/concepts/emojis/touch/smalluparrow.png) | -| Small Down Arrow |  | U+E057 | ![](/assets/images/concepts/emojis/touch/smalldownarrow.png) | -| Small Inventory |  | U+E05B | ![](/assets/images/concepts/emojis/touch/smallinventory.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ----------------- | --------------------- | ------- | ----------------------------------------------------------- | +| 跳跃 |  | U+E084 | ![](/assets/images/concepts/emojis/touch/jump.png) | +| 蹲下 |  | U+E085 | ![](/assets/images/concepts/emojis/touch/crouch.png) | +| 上升 |  | U+E086 | ![](/assets/images/concepts/emojis/touch/fly_up.png) | +| 下降 |  | U+E087 | ![](/assets/images/concepts/emojis/touch/fly_down.png) | +| 停止飞行 |  | U+E088 | ![](/assets/images/concepts/emojis/touch/stop_flying.png) | +| 左箭头 |  | U+E081 | ![](/assets/images/concepts/emojis/touch/left_arrow.png) | +| 右箭头 |  | U+E083 | ![](/assets/images/concepts/emojis/touch/right_arrow.png) | +| 上箭头 |  | U+E080 | ![](/assets/images/concepts/emojis/touch/up_arrow.png) | +| 下箭头 |  | U+E082 | ![](/assets/images/concepts/emojis/touch/down_arrow.png) | +| 小跳跃 |  | U+E059 | ![](/assets/images/concepts/emojis/touch/smalljump.png) | +| 小蹲下 |  | U+E05A | ![](/assets/images/concepts/emojis/touch/smallcrouch.png) | +| 小上升 |  | U+E05C | ![](/assets/images/concepts/emojis/touch/smallflyup.png) | +| 小下降 |  | U+E05D | ![](/assets/images/concepts/emojis/touch/smallflydown.png) | +| 小左箭头 |  | U+E056 | ![](/assets/images/concepts/emojis/touch/smallleftarrow.png) | +| 小右箭头 |  | U+E058 | ![](/assets/images/concepts/emojis/touch/smallrightarrow.png) | +| 小上箭头 |  | U+E055 | ![](/assets/images/concepts/emojis/touch/smalluparrow.png) | +| 小下箭头 |  | U+E057 | ![](/assets/images/concepts/emojis/touch/smalldownarrow.png) | +| 小物品栏 |  | U+E05B | ![](/assets/images/concepts/emojis/touch/smallinventory.png) | -### Keyboard & Mouse +### 键鼠操作 -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ------------------ | ------------------------ | ------- | ------------------------------------------------------------------- | -| Left Click |  | U+E060 | ![](/assets/images/concepts/emojis/keyboard/left_click.png) | -| Right Click |  | U+E061 | ![](/assets/images/concepts/emojis/keyboard/right_click.png) | -| Middle Click |  | U+E062 | ![](/assets/images/concepts/emojis/keyboard/middle_click.png) | -| Small Left Click |  | U+E070 | ![](/assets/images/concepts/emojis/keyboard/small_left_click.png) | -| Small Right Click |  | U+E071 | ![](/assets/images/concepts/emojis/keyboard/small_right_click.png) | -| Small Middle Click |  | U+E072 | ![](/assets/images/concepts/emojis/keyboard/small_middle_click.png) | -| Small Mouse |  | U+E073 | ![](/assets/images/concepts/emojis/keyboard/small_mouse.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ------------------ | --------------------- | ------- | ----------------------------------------------------------------- | +| 左键点击 |  | U+E060 | ![](/assets/images/concepts/emojis/keyboard/left_click.png) | +| 右键点击 |  | U+E061 | ![](/assets/images/concepts/emojis/keyboard/right_click.png) | +| 中键点击 |  | U+E062 | ![](/assets/images/concepts/emojis/keyboard/middle_click.png) | +| 小左键点击 |  | U+E070 | ![](/assets/images/concepts/emojis/keyboard/small_left_click.png) | +| 小右键点击 |  | U+E071 | ![](/assets/images/concepts/emojis/keyboard/small_right_click.png) | +| 小中键点击 |  | U+E072 | ![](/assets/images/concepts/emojis/keyboard/small_middle_click.png) | +| 小鼠标图标 |  | U+E073 | ![](/assets/images/concepts/emojis/keyboard/small_mouse.png) | -### Xbox +### Xbox手柄 -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ------------------ | ------------------------ | ------- | ---------------------------------------------------------- | -| Y |  | U+E003 | ![](/assets/images/concepts/emojis/xbox/y_button.png) | -| B |  | U+E001 | ![](/assets/images/concepts/emojis/xbox/b_button.png) | -| A |  | U+E000 | ![](/assets/images/concepts/emojis/xbox/a_button.png) | -| X |  | U+E002 | ![](/assets/images/concepts/emojis/xbox/x_button.png) | -| Back |  | U+E008 | ![](/assets/images/concepts/emojis/xbox/back.png) | -| Start |  | U+E009 | ![](/assets/images/concepts/emojis/xbox/start.png) | -| LB (Left Bumper) |  | U+E004 | ![](/assets/images/concepts/emojis/xbox/left_bumper.png) | -| RB (Right Bumper) |  | U+E005 | ![](/assets/images/concepts/emojis/xbox/right_bumper.png) | -| LT (Left Trigger) |  | U+E006 | ![](/assets/images/concepts/emojis/xbox/left_trigger.png) | -| RT (Right Trigger) |  | U+E007 | ![](/assets/images/concepts/emojis/xbox/right_trigger.png) | -| LS (Left Stick) |  | U+E00A | ![](/assets/images/concepts/emojis/xbox/left_stick.png) | -| RS (Right Stick) |  | U+E00B | ![](/assets/images/concepts/emojis/xbox/right_stick.png) | -| D-pad Up |  | U+E00C | ![](/assets/images/concepts/emojis/xbox/dpad_up.png) | -| D-pad Right |  | U+E00F | ![](/assets/images/concepts/emojis/xbox/dpad_right.png) | -| D-pad Down |  | U+E00E | ![](/assets/images/concepts/emojis/xbox/dpad_down.png) | -| D-pad Left |  | U+E00D | ![](/assets/images/concepts/emojis/xbox/dpad_left.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ------------------ | --------------------- | ------- | -------------------------------------------------------- | +| Y键 |  | U+E003 | ![](/assets/images/concepts/emojis/xbox/y_button.png) | +| B键 |  | U+E001 | ![](/assets/images/concepts/emojis/xbox/b_button.png) | +| A键 |  | U+E000 | ![](/assets/images/concepts/emojis/xbox/a_button.png) | +| X键 |  | U+E002 | ![](/assets/images/concepts/emojis/xbox/x_button.png) | +| 返回键 |  | U+E008 | ![](/assets/images/concepts/emojis/xbox/back.png) | +| 开始键 |  | U+E009 | ![](/assets/images/concepts/emojis/xbox/start.png) | +| LB(左肩键) |  | U+E004 | ![](/assets/images/concepts/emojis/xbox/left_bumper.png) | +| RB(右肩键) |  | U+E005 | ![](/assets/images/concepts/emojis/xbox/right_bumper.png) | +| LT(左扳机键) |  | U+E006 | ![](/assets/images/concepts/emojis/xbox/left_trigger.png) | +| RT(右扳机键) |  | U+E007 | ![](/assets/images/concepts/emojis/xbox/right_trigger.png) | +| LS(左摇杆) |  | U+E00A | ![](/assets/images/concepts/emojis/xbox/left_stick.png) | +| RS(右摇杆) |  | U+E00B | ![](/assets/images/concepts/emojis/xbox/right_stick.png) | +| 方向键上 |  | U+E00C | ![](/assets/images/concepts/emojis/xbox/dpad_up.png) | +| 方向键右 |  | U+E00F | ![](/assets/images/concepts/emojis/xbox/dpad_right.png) | +| 方向键下 |  | U+E00E | ![](/assets/images/concepts/emojis/xbox/dpad_down.png) | +| 方向键左 |  | U+E00D | ![](/assets/images/concepts/emojis/xbox/dpad_left.png) | -### Nintendo Switch +### 任天堂Switch -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ------------------ | ------------------------ | ------- | ------------------------------------------------------------ | -| X |  | U+E042 | ![](/assets/images/concepts/emojis/switch/x_button.png) | -| A |  | U+E040 | ![](/assets/images/concepts/emojis/switch/a_button.png) | -| B |  | U+E041 | ![](/assets/images/concepts/emojis/switch/b_button.png) | -| Y |  | U+E043 | ![](/assets/images/concepts/emojis/switch/y_button.png) | -| + |  | U+E049 | ![](/assets/images/concepts/emojis/switch/plus.png) | -| - |  | U+E048 | ![](/assets/images/concepts/emojis/switch/minus.png) | -| L (Left Bumper) |  | U+E044 | ![](/assets/images/concepts/emojis/switch/left_bumper.png) | -| R (Right Bumper) |  | U+E045 | ![](/assets/images/concepts/emojis/switch/right_bumper.png) | -| ZL (Left Trigger) |  | U+E046 | ![](/assets/images/concepts/emojis/switch/left_trigger.png) | -| RL (Right Trigger) |  | U+E047 | ![](/assets/images/concepts/emojis/switch/right_trigger.png) | -| L (Left Stick) |  | U+E04A | ![](/assets/images/concepts/emojis/switch/left_stick.png) | -| R (Right Stick) |  | U+E04B | ![](/assets/images/concepts/emojis/switch/right_stick.png) | -| D-pad Up |  | U+E04C | ![](/assets/images/concepts/emojis/switch/dpad_up.png) | -| D-pad Right |  | U+E04F | ![](/assets/images/concepts/emojis/switch/dpad_right.png) | -| D-pad Down |  | U+E04E | ![](/assets/images/concepts/emojis/switch/dpad_down.png) | -| D-pad Left |  | U+E04D | ![](/assets/images/concepts/emojis/switch/dpad_left.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ------------------ | --------------------- | ------- | ---------------------------------------------------------- | +| X键 |  | U+E042 | ![](/assets/images/concepts/emojis/switch/x_button.png) | +| A键 |  | U+E040 | ![](/assets/images/concepts/emojis/switch/a_button.png) | +| B键 |  | U+E041 | ![](/assets/images/concepts/emojis/switch/b_button.png) | +| Y键 |  | U+E043 | ![](/assets/images/concepts/emojis/switch/y_button.png) | +| +键 |  | U+E049 | ![](/assets/images/concepts/emojis/switch/plus.png) | +| -键 |  | U+E048 | ![](/assets/images/concepts/emojis/switch/minus.png) | +| L(左肩键) |  | U+E044 | ![](/assets/images/concepts/emojis/switch/left_bumper.png) | +| R(右肩键) |  | U+E045 | ![](/assets/images/concepts/emojis/switch/right_bumper.png) | +| ZL(左扳机键) |  | U+E046 | ![](/assets/images/concepts/emojis/switch/left_trigger.png) | +| RL(右扳机键) |  | U+E047 | ![](/assets/images/concepts/emojis/switch/right_trigger.png) | +| L(左摇杆) |  | U+E04A | ![](/assets/images/concepts/emojis/switch/left_stick.png) | +| R(右摇杆) |  | U+E04B | ![](/assets/images/concepts/emojis/switch/right_stick.png) | +| 方向键上 |  | U+E04C | ![](/assets/images/concepts/emojis/switch/dpad_up.png) | +| 方向键右 |  | U+E04F | ![](/assets/images/concepts/emojis/switch/dpad_right.png) | +| 方向键下 |  | U+E04E | ![](/assets/images/concepts/emojis/switch/dpad_down.png) | +| 方向键左 |  | U+E04D | ![](/assets/images/concepts/emojis/switch/dpad_left.png) | ### PlayStation (4/5) -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ------------------ | ------------------------ | ------- | ----------------------------------------------------------------- | -| Triangle |  | U+E023 | ![](/assets/images/concepts/emojis/playstation/triangle.png) | -| Circle |  | U+E021 | ![](/assets/images/concepts/emojis/playstation/circle.png) | -| Cross |  | U+E020 | ![](/assets/images/concepts/emojis/playstation/cross.png) | -| Square |  | U+E022 | ![](/assets/images/concepts/emojis/playstation/square.png) | -| Options/Share |  | U+E029 | ![](/assets/images/concepts/emojis/playstation/options_share.png) | -| Touch Pad |  | U+E028 | ![](/assets/images/concepts/emojis/playstation/touch_pad.png) | -| L1 (Left Bumper) |  | U+E024 | ![](/assets/images/concepts/emojis/playstation/left_bumper.png) | -| R1 (Right Bumper) |  | U+E025 | ![](/assets/images/concepts/emojis/playstation/right_bumper.png) | -| L2 (Left Trigger) |  | U+E026 | ![](/assets/images/concepts/emojis/playstation/left_trigger.png) | -| R2 (Right Trigger) |  | U+E027 | ![](/assets/images/concepts/emojis/playstation/right_trigger.png) | -| L3 (Left Stick) |  | U+E02A | ![](/assets/images/concepts/emojis/playstation/left_stick.png) | -| R3 (Right Stick) |  | U+E02B | ![](/assets/images/concepts/emojis/playstation/right_stick.png) | -| D-pad Up |  | U+E02C | ![](/assets/images/concepts/emojis/playstation/dpad_up.png) | -| D-pad Right |  | U+E02F | ![](/assets/images/concepts/emojis/playstation/dpad_right.png) | -| D-pad Down |  | U+E02E | ![](/assets/images/concepts/emojis/playstation/dpad_down.png) | -| D-pad Left |  | U+E02D | ![](/assets/images/concepts/emojis/playstation/dpad_left.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ------------------ | --------------------- | ------- | --------------------------------------------------------------- | +| 三角键 |  | U+E023 | ![](/assets/images/concepts/emojis/playstation/triangle.png) | +| 圆圈键 |  | U+E021 | ![](/assets/images/concepts/emojis/playstation/circle.png) | +| 叉键 |  | U+E020 | ![](/assets/images/concepts/emojis/playstation/cross.png) | +| 方框键 |  | U+E022 | ![](/assets/images/concepts/emojis/playstation/square.png) | +| 选项/分享键 |  | U+E029 | ![](/assets/images/concepts/emojis/playstation/options_share.png) | +| 触摸板 |  | U+E028 | ![](/assets/images/concepts/emojis/playstation/touch_pad.png) | +| L1(左肩键) |  | U+E024 | ![](/assets/images/concepts/emojis/playstation/left_bumper.png) | +| R1(右肩键) |  | U+E025 | ![](/assets/images/concepts/emojis/playstation/right_bumper.png) | +| L2(左扳机键) |  | U+E026 | ![](/assets/images/concepts/emojis/playstation/left_trigger.png) | +| R2(右扳机键) |  | U+E027 | ![](/assets/images/concepts/emojis/playstation/right_trigger.png) | +| L3(左摇杆) |  | U+E02A | ![](/assets/images/concepts/emojis/playstation/left_stick.png) | +| R3(右摇杆) |  | U+E02B | ![](/assets/images/concepts/emojis/playstation/right_stick.png) | +| 方向键上 |  | U+E02C | ![](/assets/images/concepts/emojis/playstation/dpad_up.png) | +| 方向键右 |  | U+E02F | ![](/assets/images/concepts/emojis/playstation/dpad_right.png) | +| 方向键下 |  | U+E02E | ![](/assets/images/concepts/emojis/playstation/dpad_down.png) | +| 方向键左 |  | U+E02D | ![](/assets/images/concepts/emojis/playstation/dpad_left.png) | ### Oculus (Rift/Rift S) -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ------------------ | ------------------------ | ------- | ------------------------------------------------------------ | -| 0 |  | U+E0E0 | ![](/assets/images/concepts/emojis/oculus/0_button.png) | -| B |  | U+E0E2 | ![](/assets/images/concepts/emojis/oculus/b_button.png) | -| A |  | U+E0E1 | ![](/assets/images/concepts/emojis/oculus/a_button.png) | -| Y |  | U+E0EA | ![](/assets/images/concepts/emojis/oculus/y_button.png) | -| X |  | U+E0E9 | ![](/assets/images/concepts/emojis/oculus/x_button.png) | -| LG (Left Grip) |  | U+E0E3 | ![](/assets/images/concepts/emojis/oculus/left_grip.png) | -| RG (Right Grip) |  | U+E0E4 | ![](/assets/images/concepts/emojis/oculus/right_grip.png) | -| LT (Left Trigger) |  | U+E0E7 | ![](/assets/images/concepts/emojis/oculus/left_trigger.png) | -| RT (Right Trigger) |  | U+E0E8 | ![](/assets/images/concepts/emojis/oculus/right_trigger.png) | -| LS (Left Stick) |  | U+E0E5 | ![](/assets/images/concepts/emojis/oculus/left_stick.png) | -| RS (Right Stick) |  | U+E0E6 | ![](/assets/images/concepts/emojis/oculus/right_stick.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ------------------ | --------------------- | ------- | ---------------------------------------------------------- | +| 0键 |  | U+E0E0 | ![](/assets/images/concepts/emojis/oculus/0_button.png) | +| B键 |  | U+E0E2 | ![](/assets/images/concepts/emojis/oculus/b_button.png) | +| A键 |  | U+E0E1 | ![](/assets/images/concepts/emojis/oculus/a_button.png) | +| Y键 |  | U+E0EA | ![](/assets/images/concepts/emojis/oculus/y_button.png) | +| X键 |  | U+E0E9 | ![](/assets/images/concepts/emojis/oculus/x_button.png) | +| LG(左握柄) |  | U+E0E3 | ![](/assets/images/concepts/emojis/oculus/left_grip.png) | +| RG(右握柄) |  | U+E0E4 | ![](/assets/images/concepts/emojis/oculus/right_grip.png) | +| LT(左扳机键) |  | U+E0E7 | ![](/assets/images/concepts/emojis/oculus/left_trigger.png) | +| RT(右扳机键) |  | U+E0E8 | ![](/assets/images/concepts/emojis/oculus/right_trigger.png) | +| LS(左摇杆) |  | U+E0E5 | ![](/assets/images/concepts/emojis/oculus/left_stick.png) | +| RS(右摇杆) |  | U+E0E6 | ![](/assets/images/concepts/emojis/oculus/right_stick.png) | -### Windows MR (Mixed Reality) +### Windows MR(混合现实) -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ------------------------- | ------------------------ | ------- | --------------------------------------------------------------------------- | -| Menu |  | U+E0C2 | ![](/assets/images/concepts/emojis/windowsMR/menu.png) | -| Windows |  | U+E0CD | ![](/assets/images/concepts/emojis/windowsMR/windows.png) | -| Left Touchpad |  | U+E0C5 | ![](/assets/images/concepts/emojis/windowsMR/left_touchpad.png) | -| Left Horizontal Touchpad |  | U+E0C6 | ![](/assets/images/concepts/emojis/windowsMR/left_touchpad_horizontal.png) | -| Left Vertical Touchpad |  | U+E0C7 | ![](/assets/images/concepts/emojis/windowsMR/left_touchpad_vertical.png) | -| Right Touchpad |  | U+E0C8 | ![](/assets/images/concepts/emojis/windowsMR/right_touchpad.png) | -| Right Horizontal Touchpad |  | U+E0C9 | ![](/assets/images/concepts/emojis/windowsMR/right_touchpad_horizontal.png) | -| Right Vertical Touchpad |  | U+E0CA | ![](/assets/images/concepts/emojis/windowsMR/right_touchpad_vertical.png) | -| LT (Left Trigger) |  | U+E0CB | ![](/assets/images/concepts/emojis/windowsMR/left_trigger.png) | -| RT (Right Trigger) |  | U+E0CC | ![](/assets/images/concepts/emojis/windowsMR/right_trigger.png) | -| LG (Left Grab) |  | U+E0C0 | ![](/assets/images/concepts/emojis/windowsMR/left_grab.png) | -| RG (Right Grab) |  | U+E0C1 | ![](/assets/images/concepts/emojis/windowsMR/right_grab.png) | -| LS (Left Stick) |  | U+E0C3 | ![](/assets/images/concepts/emojis/windowsMR/left_stick.png) | -| RS (Right Stick) |  | U+E0C4 | ![](/assets/images/concepts/emojis/windowsMR/right_stick.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ------------------------- | --------------------- | ------- | ------------------------------------------------------------------------- | +| 菜单键 |  | U+E0C2 | ![](/assets/images/concepts/emojis/windowsMR/menu.png) | +| Windows键 |  | U+E0CD | ![](/assets/images/concepts/emojis/windowsMR/windows.png) | +| 左触摸板 |  | U+E0C5 | ![](/assets/images/concepts/emojis/windowsMR/left_touchpad.png) | +| 左水平触摸板 |  | U+E0C6 | ![](/assets/images/concepts/emojis/windowsMR/left_touchpad_horizontal.png) | +| 左垂直触摸板 |  | U+E0C7 | ![](/assets/images/concepts/emojis/windowsMR/left_touchpad_vertical.png) | +| 右触摸板 |  | U+E0C8 | ![](/assets/images/concepts/emojis/windowsMR/right_touchpad.png) | +| 右水平触摸板 |  | U+E0C9 | ![](/assets/images/concepts/emojis/windowsMR/right_touchpad_horizontal.png) | +| 右垂直触摸板 |  | U+E0CA | ![](/assets/images/concepts/emojis/windowsMR/right_touchpad_vertical.png) | +| LT(左扳机键) |  | U+E0CB | ![](/assets/images/concepts/emojis/windowsMR/left_trigger.png) | +| RT(右扳机键) |  | U+E0CC | ![](/assets/images/concepts/emojis/windowsMR/right_trigger.png) | +| LG(左抓握键) |  | U+E0C0 | ![](/assets/images/concepts/emojis/windowsMR/left_grab.png) | +| RG(右抓握键) |  | U+E0C1 | ![](/assets/images/concepts/emojis/windowsMR/right_grab.png) | +| LS(左摇杆) |  | U+E0C3 | ![](/assets/images/concepts/emojis/windowsMR/left_stick.png) | +| RS(右摇杆) |  | U+E0C4 | ![](/assets/images/concepts/emojis/windowsMR/right_stick.png) | -### Other +### 其他 -| Name | Letter (Copy/Paste This) | Unicode | Image | -| ---------------- | ------------------------ | ------- | -------------------------------------------------------------- | -| Crosshair |  | U+E017 | ![](/assets/images/concepts/emojis/other/crosshair.png) | -| Agent |  | U+E103 | ![](/assets/images/concepts/emojis/other/agent.png) | -| Immersive Reader |  | U+E104 | ![](/assets/images/concepts/emojis/other/immersive_reader.png) | -| Hollow Star |  | U+E106 | ![](/assets/images/concepts/emojis/other/hollow_star.png) | -| Solid Star |  | U+E107 | ![](/assets/images/concepts/emojis/other/solid_star.png) | +| 名称 | 字符(复制/粘贴此处) | Unicode | 图片 | +| ---------------- | --------------------- | ------- | ------------------------------------------------------------- | +| 准星 |  | U+E017 | ![](/assets/images/concepts/emojis/other/crosshair.png) | +| 助手 |  | U+E103 | ![](/assets/images/concepts/emojis/other/agent.png) | +| 沉浸式阅读器 |  | U+E104 | ![](/assets/images/concepts/emojis/other/immersive_reader.png) | +| 空心星 |  | U+E106 | ![](/assets/images/concepts/emojis/other/hollow_star.png) | +| 实心星 |  | U+E107 | ![](/assets/images/concepts/emojis/other/solid_star.png) | -## Custom Emoji +## 自定义表情符号 -::: warning -This method is not officially supported. Use with caution on the Marketplace! +:::warning +此方法并非官方支持功能。在市场中请谨慎使用! ::: -To make a custom emoji, we use a very similar method to the pre-built emoji, except instead of using the Microsoft sprite-sheets, we overwrite them with our own! Some _character-slots_ are already used up with the emoji above, but there are blank slots we can use. +要创建自定义表情符号,我们使用与原版表情符号类似的方法,不过需要用自己的材质覆盖微软的精灵图!虽然上文中部分字符位已被占用,但仍存在可用空白位。 -Please note that the following files have been annotated with slot information: If you use them directly, existing Emoji will have numbers added on top of them. If you need the original sprite-sheets, you can get them from the Vanilla Resources on your system (not included in the Vanilla Resource Pack downloads). +请注意以下文件已添加槽位注释:如果直接使用这些文件,现有表情符号上会出现数字叠加。如需原始精灵图,请从系统内的原版资源中提取(原版资源包下载中不包含)。 -To get started, you should download the sprite-sheets, and move them into the fonts folder. - -Two sprite-sheets are provided for each glyph-target: One that accurately reflects vanilla, and a second version which has been annotated with hex information, for easily finding the correct character. +首先需要下载精灵图文件,并将其移动到字体目录中: ### RP/font/glyph_E0.png @@ -251,7 +252,7 @@ Two sprite-sheets are provided for each glyph-target: One that accurately reflec ![](/assets/images/concepts/emojis/custom/annotated/glyph_E1.png) ![](/assets/images/concepts/emojis/custom/glyph_E1.png) -Your filepath should look like this: +文件结构应如下所示: -### Finding the correct hex. +### 获取正确十六进制编码 -Once you have emojis inside the `glyph_E0.png` or `glyph_E1.png` you need to find your character "code" so it can be converted. +在`glyph_E0.png`或`glyph_E1.png`中添加表情符号后,需要找到对应的字符"编码"以进行转换。 -The first two characters are always `0x`. +前两位固定为`0x`。 -The next two characters are either `E0` or `E1`, depending on which file you added emojis to. +第三、四位根据文件选择`E0`或`E1`。 -The next two characters are the position inside the image like ``, where each character is a number in hexadecimal numeral system. You can find this number by referencing the images above. For example, the top-right square in `E0` is `0F`, and the bottom right is `FF`. +最后两位表示图像中的行列位置(十六进制)。例如,`E0`的右上角方格为`0F`,右下角为`FF`。 -So after you are done, it might look like `0xE102` (`0x` + `E1` + `02`). +最终编码可能形如`0xE102`(`0x` + `E1` + `02`)。 -Copy this code into the following field, and press Convert. The symbol on the right-hand side can be copy/pasted into MC. +将编码输入下方字段并点击转换按钮,右侧生成的符号即可复制到MC中使用。
- - -Convert + + +转换
-### Glyph Separation Space +### 字形间隔问题 -Sometimes, it appears that if you put 2 glyphs near to each other, there will be a couple of empty pixels between them. The only fix for it is to scale the glyph itself. +当两个相邻符号间出现多余空白时,可通过缩放字形本身来解决。 \ No newline at end of file diff --git a/docs/wiki/concepts/index.md b/docs/wiki/concepts/index.md index ec28707f..0a5da50e 100644 --- a/docs/wiki/concepts/index.md +++ b/docs/wiki/concepts/index.md @@ -1,3 +1,3 @@ --- -title: Concepts +title: 概念 Concepts --- diff --git a/docs/wiki/concepts/molang.md b/docs/wiki/concepts/molang.md index d41fee76..8d62877c 100644 --- a/docs/wiki/concepts/molang.md +++ b/docs/wiki/concepts/molang.md @@ -1,7 +1,7 @@ --- title: Molang tags: - - intermediate + - 中级 mentions: - yanasakana - TheDoctor15 @@ -11,37 +11,56 @@ mentions: - TheItsNameless --- -## Introduction -Pretty much everything evaluates to a number; if something doesn't evaluate to a number, you can use an `operator` to make it into one. You can basically just think of Molang as one big math equation. +# Molang -An equation evaluates to `true` when any number except `0` is returned. When I reference `returning`, I'm talking about the output of an equation. There is also a `return` statement, but I don't usually use it, and will therefore not be talking about it. + -## Accessing Values -There are three main ways to access and use values in Molang (queries, variables and temp variables) +## 简介 +几乎所有的表达式都会求值为一个数字。如果某个表达式的结果不是数字,可以使用`operator`运算符将其转换为数字。你可以将Molang简单理解为一个大型数学方程式。 -- **Queries** are read only values returned by the game. You cannot set these values, only read them. (`query.example_query` | `q.example_query`) +当方程式返回除`0`以外的任何数字时,都会被判定为`true`(真)。本文中提到的"返回"指的是方程式的输出结果。虽然存在`return`语句,但通常不推荐使用,因此不做详细讨论。 -- **Variables** are read and write values that you can manipulate, these can be set and read through Molang. (`variable.example_variable` | `v.example_variable`) - - There are also hard-coded variables which act practically the same way as queries, but can only be used in certain situations. +## 值访问方式 +在Molang中主要有三种访问值的方式(查询语句、变量和临时变量): -- **Temp. Variables** are practically the same as variables, except they only exist in the current scope. (`temp.example_temp` | `t.example_temp`) - - A "scope" can refer to the current `for_each` or `loop` *or* just the current expression, if it's not used within either +- **查询语句** 是从游戏获取的只读值,不可修改只能读取(语法:`query.example_query` 或简写为 `q.example_query`) -## Handling values +- **变量** 是可读写的值,可以通过Molang进行修改(语法:`variable.example_variable` 或简写为 `v.example_variable`) + - 部分硬编码变量的行为与查询语句类似,但仅在特定情境下可用 -- **Logical Operators** can be used to convert non-numbers into 1s or 0s. These include: `==`, `!=`, `<`, `>`, `<=`, `>=`. - - Example.) "`q.get_equipped_item_name == 'stick'`" Will evaluate to `1`/`true` when holding a stick +- **临时变量** 的功能与普通变量相同,但仅在当前作用域内有效(语法:`temp.example_temp` 或简写为 `t.example_temp`) + - "作用域"指当前的`for_each`循环、`loop`循环,若未在循环中使用则指当前表达式 - - There is also a *second* set of *Logical Operators* which can be used to 'group' values into `and/or` statements, often used in cases where you need *multiple* things to evaluate to `true` or just *one out of many*. `&&` represents an `and` statement, and `||` represents an `or` statement. - - Example.) "`q.is_sneaking && q.is_using_item`" Will evaluate to `1`/`true` when sneaking *and* using an item - - Example.) "`q.is_sneaking || q.is_jumping`" // Evaluates to `1`/`true` when either jumping *or* sneaking +## 值处理 -- **Parentheses**, `( )`, are also a major help when grouping values or performing math operations. - - Example.) "`q.is_sneaking && (q.get_equipped_item_name == "stick" || q.get_equipped_item_name == "diamond")`" Will evaluate to `1`/`true` when sneaking *and* holding either a stick *or* a diamond +- **逻辑运算符** 可以将非数字值转换为1或0,包括:`==`, `!=`, `<`, `>`, `<=`, `>=` + - 示例:`q.get_equipped_item_name == 'stick'` 当手持木棍时求值为`1`/`true` -- **Conditional Operators** can be used as `if/else` statements. - - A *binary* conditional operator refers to just using `?`. When this is used, it'll output your value or `0` depending on whether the given input value is `true`. - - Example.) "`q.is_sneaking ? 5`" Will output a `5` when sneaking, otherwise returning a `0` - - A *trinary* conditional operator refers to using `?` and `:`. When this is used, it'll output one of the two given values depending on whether your given input value is `true`. - - Example.) "`q.is_sneaking ? 10 : 3`" Will output a `10` when sneaking, otherwise returning a `3` + - **复合逻辑运算符** 用于构建"与/或"逻辑关系: + - `&&` 表示"与",`||` 表示"或" + - 示例:`q.is_sneaking && q.is_using_item` 潜行且使用物品时返回`1`/`true` + - 示例:`q.is_sneaking || q.is_jumping` 潜行或跳跃时返回`1`/`true` +- **圆括号** `( )` 在组合值或进行数学运算时非常实用 + - 示例:`q.is_sneaking && (q.get_equipped_item_name == "stick" || q.get_equipped_item_name == "diamond")` 潜行时手持木棍或钻石返回`1`/`true` + +- **条件运算符** 可实现类似`if/else`的逻辑: + - **二元条件运算符** `?` 根据输入值返回指定值或0 + - 示例:`q.is_sneaking ? 5` 潜行时返回`5`,否则返回`0` + - **三元条件运算符** `? :` 根据条件返回两个指定值之一 + - 示例:`q.is_sneaking ? 10 : 3` 潜行时返回`10`,否则返回`3` + +::: code-group +```json [示例] +{ + "format_version": "1.16.100", + "minecraft:entity": { + "components": { + "minecraft:movement": { + "value": "q.is_jumping ? 0.1 : 0.05" // 跳跃时移动速度变为0.1,否则0.05 + } + } + } +} +``` +::: \ No newline at end of file diff --git a/docs/wiki/concepts/namespaces.md b/docs/wiki/concepts/namespaces.md index f2b7ac92..03f17853 100644 --- a/docs/wiki/concepts/namespaces.md +++ b/docs/wiki/concepts/namespaces.md @@ -1,51 +1,48 @@ --- -title: Namespaces +title: 命名空间 mentions: - SirLich - MedicalJewel105 --- -Namespaces are identifiers that mark content ownership. You can think of them as folders. Namespaces are helpful because they keep naming conflicts from happening. +# 命名空间 -Namespaces in addon creation can essentially be thought of as "the part to the left of the colon". For example, `minecraft` is the namespace of `minecraft:zombie`. The general form is `namespace:name`. + -As a concrete example of why namespaces are helpful, let's imagine you create a new Mob. You name it `minecraft:shark`, not aware that you should create your own namespace for custom content. Next year, Mojang decides to add sharks into the game! Now there is a naming conflict since there are two definitions of `minecraft:shark`. Your addon will break. +命名空间是用于标识内容归属的标识符。你可以将它们理解为文件夹。命名空间有助于避免命名冲突的产生。 -If you had instead used `your_namespace:shark`, the naming conflict wouldn't have happened. +在附加包创作中,命名空间本质上可以看作是"冒号左侧的部分"。例如在`minecraft:zombie`中,`minecraft`就是命名空间。其通用格式为`命名空间:名称`。 -## Picking a namespace +举个具体例子说明命名空间的重要性:假设你创建了一个新生物并命名为`minecraft:shark`,却不知道应该为自定义内容使用自己的命名空间。一年后Mojang决定在游戏中加入鲨鱼!此时就会出现两个`minecraft:shark`的定义,导致命名冲突,你的附加包将无法正常运行。 -A suitable namespace is unique to you. Something like `mob` or `cars` or `content` or `custom` would be a **bad** namespace since another developer might come up with the same namespace as you. +如果你当初使用`你的命名空间:shark`,就不会发生这种冲突。 -A suitable namespace is short. You will be writing your namespace a **LOT**, so the shorter, the better. `george_carlin_the_comedian` would be a lousy namespace for this reason. +## 如何选择命名空间 -For personal projects, I recommend a convenient version of your player name, and for commercial projects, I recommend a suitable version of the company name. +合适的命名空间应当具有个人独特性。类似`mob`、`cars`、`content`或`custom`这样的通用词是**糟糕的**命名空间选择,因为其他开发者可能会使用相同的名称。 -Some good examples: +合适的命名空间应当简短。你将会**频繁使用**你的命名空间,因此越简短越好。类似`george_carlin_the_comedian`这样的长命名空间就不太合适。 -- `gcarlin` -- `sirlich` -- `cubeworld` -- `bworks` +对于个人项目,建议使用玩家ID的简化版本;商业项目则建议使用公司名称的合适变体。 -**DO NOT USE** `minecraft` or `minecon` as a namespace unless editing a vanilla file. Not only is it a terrible idea, but Minecraft reserves these, and it won't even work. +优秀示例: +- `gcarlin` +- `sirlich` +- `cubeworld` +- `bworks` -## Where to use namespaces? +**切勿使用**`minecraft`或`minecon`作为命名空间(除非修改原版文件)。这不仅是个糟糕的主意,而且Minecraft保留了这些命名空间的使用权,实际也无法生效。 -In short, you should use namespaces as often as you can. +## 命名空间的使用场景 -For starters, you should use a namespace when adding custom entities to the game. +简而言之,应当尽可能多地使用命名空间。 -`sirlich:shark` is much better than `shark`. +基础原则:为游戏添加自定义实体时必须使用命名空间。`sirlich:shark`的命名方式远优于`shark`。 -It would be best if you also used namespaces for components and events. Just like Mojang uses `minecraft:pig_saddled` you should use `namespace:my_mob_event`, and `namespace:my_component_group`. +在组件和事件的命名中也应使用命名空间。就像Mojang使用`minecraft:pig_saddled`那样,你应该使用`命名空间:我的生物事件`和`命名空间:我的组件组`的格式。 -It would be best if you also used namespaces in animation controllers, render controllers, and animations. +在动画控制器、渲染控制器和动画的命名中也推荐使用命名空间。例如:`controller.animation.命名空间.实体名称.动作`的格式优于`controller.animation.我的动作`。 -For example: `controller.animation.namespace.entity_name.action` is better than `controller.animation.my_action`. +## 无需使用命名空间的场景 -## Where NOT to use namespaces. - -The actual file structure does not need namespaces. - -`animations/namespace/my_entity/animation` is more confusing than `animations/my_entity/animation`. +实际文件结构不需要包含命名空间。`animations/命名空间/我的实体/animation`的路径结构反而会比`animations/我的实体/animation`更易造成混淆。 \ No newline at end of file diff --git a/docs/wiki/concepts/overwriting-assets.md b/docs/wiki/concepts/overwriting-assets.md index 2ce034fd..45a95dd0 100644 --- a/docs/wiki/concepts/overwriting-assets.md +++ b/docs/wiki/concepts/overwriting-assets.md @@ -1,7 +1,7 @@ --- -title: Overwriting Assets +title: 资源覆盖机制 tags: - - intermediate + - 中级 mentions: - SirLich - MedicalJewel105 @@ -9,76 +9,80 @@ mentions: - SmokeyStack --- -## Addon Layering +# 资源覆盖机制 -The addon system is built layer by layer, where each pack is added _on top_ of the ones before it. Even if you only have a single pack added, there is an implicit _vanilla_ pack which is always added. When you add custom content, this content will have full access to all vanilla files. + -### Accessing Vanilla Files +## 附加包层级系统 -This layered structure is very useful, because it allows us to access the files inside of vanilla, without copy/pasting them into our addon. For example you can access `blocks/stone.png` without moving it into your addon! Just set it as the texture for your custom entity - it will work out of the box. This is particularly useful for things like models, or render controllers, or sounds. +附加包系统采用分层架构,每个资源包/行为包都会叠加在先前加载的包之上。即使你只添加了一个自定义包,系统也会默认加载隐式的原版包。当创建自定义内容时,这些内容将完全继承原版文件的所有权限。 -If the vanilla assets change, for example if [JAPPA](https://twitter.com/JasperBoerstra?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor) updates the stone texture, your addon will also receive the update, since you are relying on the actual dynamic, vanilla resources. +### 访问原版文件 -You should try to use this system of layering as often as you can. If you don't *need* to copy/paste something into your addon, don't. +这种分层结构非常实用,它允许我们无需将原版文件复制到附加包中即可直接调用。例如你可以直接调用`blocks/stone.png`作为自定义实体的纹理,无需复制文件即可直接生效。这种特性在模型、渲染控制器、音效等资源的调用中尤为便利。 + +若原版资源发生更新(例如[JAPPA](https://twitter.com/JasperBoerstra?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor)更新了石头纹理),你的附加包也会同步获得更新,因为你的资源始终动态关联着原版资源。 + +请尽可能使用这种分层调用机制。如果不需要复制粘贴原版资源,就不要进行冗余操作。 :::warning -It is never OK to make an addon inside of a copy of the vanilla resource/behavior pack. This will make the download for your addon incredibly huge, and will reduce performance. Always begin with a blank addon, then copy/paste the files you want to overwrite. +绝对禁止直接复制原版资源包/行为包进行修改。这会导致附加包体积异常臃肿,并严重影响运行性能。正确做法是新建空白附加包,仅复制需要覆盖的特定文件。 ::: -## Overwriting Assets +## 资源覆盖方式 -Pack Layering also allows us to overwrite vanilla assets, by _overwriting_ them with a file that shares the same path, or the same identifier. Our new file will replace the one being used in vanilla, allowing us to change textures, sounds, entity behavior, etc. +通过包层级系统,我们可以通过创建相同路径或相同标识符的文件来覆盖原版资源。新的文件将完全替代原版文件,从而实现纹理替换、音效修改、实体行为调整等功能。 :::warning -Different resources have different methods of overwriting, so be careful to use the right method for each type! +不同类型的资源需要采用不同的覆盖方式,请仔细确认每种资源的覆盖机制! ::: -### Overwriting by Path +### 路径覆盖法 -Assets that are referenced by _path_, and do _not have an identifier_ can be overwritten by simply placing a new asset into the same path. The following can be overwritten in this way: +对于通过路径引用且没有标识符的资源,只需在相同路径下创建新文件即可覆盖。以下资源类型适用此方式: -- Functions -- Loot tables -- Textures -- Sounds -- Trade Tables +- 游戏指令 +- 战利品表 +- 纹理贴图 +- 音效文件 +- 交易表 -When you overwrite these files, the overwriting is absolute: The new asset will fully replace the old asset. +此方式会完全替换原文件内容。 :::tip -**Example**: If you would like to replace the redstone ore texture, simply place a new file at `textures/blocks/redstone_ore.png`. +**示例**:要替换红石矿石纹理,只需在`textures/blocks/redstone_ore.png`路径放置新纹理文件即可。 ::: -### Overwriting by Identifier +### 标识符覆盖法 -Many assets are defined not by their name, but by their identifier! To overwrite these assets, simply create a new file that shares the same identifier, regardless of file-path. The following can be overwritten in this way: +对于通过标识符定义的资源,只需创建具有相同标识符的文件(无论路径如何)即可覆盖。以下资源类型适用此方式: -- BP Entities -- RP Entities -- Animations -- Models -- Animation Controllers -- Spawn Rules -- Recipes -- Particles -- Render Controllers +- 行为包实体 +- 资源包实体 +- 动画 +- 模型 +- 动画控制器 +- 生成规则 +- 合成配方 +- 粒子效果 +- 渲染控制器 -When you overwrite these files, the overwriting is absolute: The new asset will fully replace the old asset. +此方式会完全替换原文件内容。 :::tip -**Example**: If you would like to make Ghasts have higher health, simply create a new BP entity with the `minecraft:ghast` identifier, and all the behaviors required to make the ghast function. +**示例**:要提升恶魂生命值,需要创建包含`minecraft:ghast`标识符的新实体行为文件,并完整定义恶魂的所有行为组件。 -Remember, entity files do not merge together, so you will first need to copy/paste the entire BP Ghast file, and _then_ edit the health. Simply creating a `minecraft:ghast` with a high health component inside will not work. +注意:实体文件不会自动合并,必须首先完整复制原版恶魂行为文件,再进行生命值修改。仅创建包含高生命值组件的`minecraft:ghast`文件会导致功能异常。 ::: -### Overwriting via Reference File +### 注册表覆盖法 -Many assets can also be registered into some kind of "registration system" file. These files are interesting, because unlike the other asset types, they are _merged together_ instead of _overwritten_. This means that when you define these files, you do not need to copy from the vanilla resources. You can simply start with a blank file, and then overwrite the specific definitions you want. +部分资源通过注册表文件进行管理,这类文件具有合并特性而非完全覆盖。这意味着你无需复制原版内容,只需创建新的定义即可覆盖特定条目。 -The following files work in this way: +以下注册表文件支持此方式: -- All UI files -- [All language files](/concepts/text-and-translations) +- 所有UI文件 +- [所有语言文件](/wiki/concepts/text-and-translations) - `item_textures.json` - `flipbook_textures.json` - `terrain_textures.json` @@ -87,11 +91,10 @@ The following files work in this way: - `sound_definitions.json` :::tip -**Example:** Lets say you want to override the `sugar` texture, using the reference files. You can do so by creating a new `item_textures.json`, with the following contents: +**示例**:通过注册表覆盖法修改糖的纹理,只需新建`item_textures.json`并添加以下内容: - - -```json +::: code-group +```json [item_textures.json] { "resource_pack_name": "vanilla", "texture_data": { @@ -101,20 +104,23 @@ The following files work in this way: } } ``` - -This _definition_ will be merged with the vanilla `item_textures.json`, and will override the short-name `sugar`. When the vanilla item accesses this short-name, it will get a reference to your custom texture path, instead of the actual texture path to sugar. ::: -## Overwriting Dangers +该定义会与原版`item_textures.json`合并,覆盖`sugar`的纹理路径指向。当原版物品调用此简称时,将自动引用你的自定义纹理。 +::: -Since addons mostly _overwrite_ each other rather than _merge_, it can be very difficult to get two incompatible addons to work together. For example, if you try to combine two addons that overwrite the creeper behavior (for example, one makes them very fast, and one makes them very large) the addon you have applied _second_ will overwrite the first. +## 覆盖风险提示 -This is mostly a problem with `player.json` (in either the RP or the BP), since this file is often used for gameplay purposes. +由于附加包采用覆盖机制而非合并机制,不同附加包之间可能存在兼容性问题。例如同时安装两个修改爬行者行为的附加包(一个提升速度,一个增大体型),后加载的包会完全覆盖前者的修改。 -## Things that Cannot be Overwritten +这个问题在`player.json`(资源包或行为包中的)中尤为突出,因为该文件常被用于核心玩法修改。 -Not everything can be overwritten, the following is a list of things that cannot be overwritten using any of the described methods: +## 不可覆盖内容列表 -- Vanilla items (Not all) -- Vanilla blocks -- Vanilla fogs (create a fog with another namespace and change it everywhere it is used) +以下内容无法通过上述任何方式覆盖: + +- 原版物品(部分不可覆盖) +- 原版方块 +- 原版雾效(需新建命名空间的雾效并全局替换引用) + +(注:保留英文术语以保持开发概念准确性) \ No newline at end of file diff --git a/docs/wiki/concepts/shaders.md b/docs/wiki/concepts/shaders.md index d60322e1..a42e1b38 100644 --- a/docs/wiki/concepts/shaders.md +++ b/docs/wiki/concepts/shaders.md @@ -1,5 +1,5 @@ --- -title: Shaders +title: 着色器(光影) mentions: - SirLich - Dreamedc2015 @@ -8,46 +8,42 @@ mentions: - SIsilicon --- +# 着色器(光影)Shader + + + :::warning -The shaders on this page are incompatible with [Render Dragon](https://help.minecraft.net/hc/en-us/articles/360052771272-About-the-1-16-200-Update-for-Windows-10-). That means that they will not work on Windows and Console devices past 1.16.200, nor other devices past 1.18.30! +本页所述的着色器与[Render Dragon](https://help.minecraft.net/hc/en-us/articles/360052771272-About-the-1-16-200-Update-for-Windows-10-)渲染引擎不兼容。这意味着在1.16.200版本后的Windows和主机设备,以及1.18.30版本后的其他设备上无法使用! ::: -## Overview +## 概述 -Shaders are divided into 2 folders: `glsl` and `hlsl`. For shaders to work on every device, -you need to code shaders in both languages. For testing on Windows, `hlsl` is enough. -When rewriting shaders from one language to another, there are few things to change, -like HLSL `float3` is `vec3` in GLSL. Mapping between those languages can be found [here](https://anteru.net/blog/2016/mapping-between-HLSL-and-GLSL/) +着色器分为`glsl`和`hlsl`两个文件夹。要使着色器在所有设备上生效,需要同时用两种语言编写代码。在Windows平台测试时,使用`hlsl`即可。在两种语言间转换时需要注意语法差异,例如HLSL中的`float3`对应GLSL中的`vec3`。[此处](https://anteru.net/blog/2016/mapping-between-HLSL-and-GLSL/)可查看两种语言的对照表。 -## Materials +## 材质 -Vertex, fragments, and sometimes geometry shaders are combined with some options -as materials and are required for custom shaders. To create new material, -you need to create a file, which matches the name of the .material file in the vanilla resource pack. -For example: `materials/particles.material`. Materials support inheritance by adding parent -material after a colon. For example: `entity_alpha:entity_base` +顶点着色器、片段着色器和几何着色器(可选)通过材质配置文件组合使用。创建新材质时,需要参照原版资源包中的`.material`文件命名。例如:`materials/particles.material`。材质支持继承机制,使用冒号语法:`entity_alpha:entity_base` -### Common material definition fields +### 通用材质定义字段 -| **Field name** | **Description** | **Example value** | **Notes** | -| ---------------- | --------------------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `vertexShader` | Path to the shader relative to hlsl/glsl folder | | For HLSL shader, `.hlsl` suffix is added. | -| `fragmentShader` | Path to the shader relative to hlsl/glsl folder | | For HLSL shader, `.hlsl` suffix is added. | -| `vertexFields` | An array of fields passed to vertex shader | | It's better to copy this field from vanilla material. | -| `variants` | An array of objects, which define variants of the material | | It's better to copy this field from vanilla material. | -| `+defines` | An array of `#define` directives to add to the shader source | | Useful for reusing shader, but changing some minor setting. | -| `+states` | An array of states to enable | `["Blending", "DisableAlphaWrite", "DisableDepthWrite"]` | For OpenGL implementation, this is equivalent to [glEnable](https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glEnable.xml) call. | -| `-defines` | An array of `#defines` directives to remove from inherited `+defines` | | | -| `+samplerStates` | An array of objects, defining how texture at certain index is treated | `{ "samplerIndex": 0, "textureFilter": "Point" }` | `textureFilter` specifies how to sample the texture and `textureWrap` specifies the behavior, when accessing outside of the texture dimensions. | -| `msaaSupport` | Multisample anti-aliasing support | `Both` | | -| `blendSrc` | Specifies how the color source blending factors are computed | `One` | For OpenGL implementation, this is equivalent to [glBlendFunc](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBlendFunc.xhtml) call. | -| `blendDst` | Specifies how the color destination blending factors are computed | `One` | For OpenGL implementation, this is equivalent to [glBlendFunc](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBlendFunc.xhtml) call. | +| **字段名称** | **描述** | **示例值** | **注意事项** | +| ------------------ | ----------------------------------------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `vertexShader` | 顶点着色器路径(相对于hlsl/glsl文件夹) | | HLSL着色器会自动添加`.hlsl`后缀 | +| `fragmentShader` | 片段着色器路径(相对于hlsl/glsl文件夹) | | HLSL着色器会自动添加`.hlsl`后缀 | +| `vertexFields` | 传递给顶点着色器的字段数组 | | 建议从原版材质中复制此字段 | +| `variants` | 定义材质变体的对象数组 | | 建议从原版材质中复制此字段 | +| `+defines` | 添加到着色器源码的`#define`指令数组 | | 适用于复用着色器时调整细节参数 | +| `+states` | 启用的渲染状态数组 | `["Blending", "DisableAlphaWrite", "DisableDepthWrite"]` | OpenGL实现中对应[glEnable](https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glEnable.xml)调用 | +| `-defines` | 从继承的`+defines`中移除的指令数组 | | | +| `+samplerStates` | 定义纹理采样方式的对象数组 | `{ "samplerIndex": 0, "textureFilter": "Point" }` | `textureFilter`指定采样方式,`textureWrap`定义纹理边界外访问行为 | +| `msaaSupport` | 多重采样抗锯齿支持 | `Both` | | +| `blendSrc` | 颜色源混合因子计算方式 | `One` | OpenGL实现中对应[glBlendFunc](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBlendFunc.xhtml)调用 | +| `blendDst` | 颜色目标混合因子计算方式 | `One` | OpenGL实现中对应[glBlendFunc](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBlendFunc.xhtml)调用 | -Example: +示例: - - -```json +::: code-group +```json [材质示例] { "materials": { "version": "1.0.0", @@ -73,89 +69,80 @@ Example: } } ``` +::: -For all the details about material files and possible field values, check [material file JSON schema](https://github.com/stirante/bedrock-shader-schema/blob/master/materials.schema.json). +完整材质文件规范请参考[材质文件JSON模式](https://github.com/stirante/bedrock-shader-schema/blob/master/materials.schema.json)。 -## Troubleshooting +## 疑难解答 -### Shader doesn’t change +### 着色器未生效 -Every time there is a change in the shader, you need to restart Minecraft to recompile the shader completely. +每次修改着色器后,必须重启Minecraft才能完全重新编译着色器。 -### Compilation error +### 编译错误 -When there is a shader compilation error, a line number is usually specified where the error occurred. You need to check a few lines above the one set in error because Minecraft adds `#define` directives before compilation. +出现编译错误时,错误信息中的行号可能需要检查前几行的代码,因为Minecraft会在编译前自动添加`#define`指令。 -### Couldn’t find constant buffer named: $Globals +### 找不到名为$Globals的常量缓冲区 -I couldn’t accurately find the actual cause of this error, but it seems to be somehow connected to global variables. Removing them (initializing them in the `main` function or changing them to `#define` directives) seems to fix the problem. +此错误可能与全局变量相关。尝试通过以下方式解决: +- 在`main`函数中初始化变量 +- 改用`#define`指令定义常量 -## Tips and tricks +## 实用技巧 -### Passing variables to the shader +### 向着色器传递变量 -You can pass variables to the shader from a particle or an entity by changing entity color. -Input color is clamped to `<0.0, 1.0>`. To pass more significant values, you need to divide by max value (or at least some considerable number). +通过修改实体颜色可将数据传入着色器。输入值会被限制在`<0.0, 1.0>`范围内。传递较大数值时建议先进行归一化处理。 -### Using time in shader +### 使用时间变量 -`TIME` variable is a number of seconds as `float` and is global for all shaders. For time-based on particle lifetime, you need to pass this: +全局`TIME`变量存储以秒为单位的浮点时间值。要获取基于粒子生命周期的计时器: - - -```json +::: code-group +```json [粒子计时器配置] "minecraft:particle_appearance_tinting": { "color": ["variable.particle_age/variable.particle_lifetime", 0, 0, 1] } ``` +::: -Then in the shader, use `PSInput.color.r` as time, where `0.0` is particle birth and `1.0` is particle death. +在着色器中使用`PSInput.color.r`获取时间值,其中`0.0`表示粒子生成,`1.0`表示粒子消亡。 -### Camera direction towards the entity +### 相机朝向控制 -For entity shaders, you can make the shader dependent on the camera direction towards the entity. - -- Add to `PS_Input` in vertex and fragment shader new field - - +在实体着色器中实现相机方向相关效果: +1. 在顶点/片段着色器的`PS_Input`结构体添加: ``` float3 viewDir: POSITION; ``` -- After that, add to vertex shader this line - - - +2. 在顶点着色器中添加: ``` PSInput.viewDir = normalize((mul(WORLD, mul(BONES[VSInput.boneId], float4(VSInput.position, 1)))).xyz); ``` -- In the fragment shader, use `PSInput.viewDir` to make changes depending on camera rotation +3. 在片段着色器中使用`PSInput.viewDir`控制渲染逻辑 -### Debugging values +### 调试技巧 -The easiest way to debug a value is to turn it into color and render it like this. +将调试值转换为颜色输出是最直观的方式: - - -``` +::: code-group +```hlsl [颜色调试] PSOutput.color = float4(PSInput.uv, 0., 1.); ``` +::: -This should create a red-green gradient, showing that the values of `uv` are between `<0, 0>` and `<1, 1>`. - -You can use the debug shader I wrote [based on this shader](http://mew.cx/drawtext/drawtext). -Right now, this shader will display values of the color passed to the shader. To display another value, change line 70 in hlsl shader to - - +这会生成红绿渐变,显示UV坐标范围。推荐使用[调试着色器](http://files.stirante.com/debugShader.zip),修改HLSL第70行代码可显示不同变量: +::: code-group +```hlsl [调试代码] +int ascii = getFloatCharacter( cellIndex, <需要显示的向量> ); ``` -int ascii = getFloatCharacter( cellIndex, ); -``` +::: -GLSL version of debugging shader may crash Minecraft, use only for debugging. +注意:GLSL版调试着色器可能导致崩溃,建议仅用于调试。 -[Download debug shader](http://files.stirante.com/debugShader.zip) - -![](/assets/images/knowledge/shaders/debugShader.gif) +![调试着色器演示](/assets/images/knowledge/shaders/debugShader.gif) \ No newline at end of file diff --git a/docs/wiki/concepts/sounds.md b/docs/wiki/concepts/sounds.md index 90c7711f..6d8a954e 100644 --- a/docs/wiki/concepts/sounds.md +++ b/docs/wiki/concepts/sounds.md @@ -1,7 +1,7 @@ --- -title: Sounds +title: 声音系统 tags: - - intermediate + - 中级 mentions: - SirLich - solvedDev @@ -14,17 +14,21 @@ mentions: - ThomasOrs --- -In bedrock, we can add custom sounds without overwriting any vanilla sounds. This is done by adding files to the resource pack. +# 声音系统 + + + +在基岩版中,我们可以通过资源包添加自定义声音而无需覆盖原版音效。以下是实现方法: :::tip -The best way to learn about sounds is by downloading and playing around with the default resource pack. +学习声音系统的最佳方式是下载并研究默认资源包的结构。 ::: -### Folder Structure +### 文件夹结构 -There are two main files that we edit when we want to add sounds. Note how `sound_definition` is nested inside `sounds`. +添加声音时主要需要修改两个文件。注意`sound_definition`文件需要放置在`sounds`文件夹内。 -Sound files themselves are added inside of the `sounds` folder, and can be any of the following formats. +声音文件本身存放在`sounds`文件夹中,支持以下格式: ` limits the sound's audible range. -The axis `distance` is the distance of the sound listener (player) to the sound source. The corresponding `volume` axis' value is the factor for the playsound volume capped to 1, multiplied by the sound definition's volume to get the final volume of the sound you hear. As an expression this could be written as: `final_volume = min(playsound_volume, 1) * graph_volume * sound_definition_volume`. +上图展示了**当playsound音量参数≥1时**的衰减曲线。注意``参数会影响声音的可听范围。 -**Note:** Attenuation by distance of the hearable sound's volume is not affected by the volume parameter given in the command. +公式表达为:`final_volume = min(playsound_volume, 1) * graph_volume * sound_definition_volume` -For example, `mob.ghast.affectionate_scream` sets `"min_distance": 100.0`, but can only be heard from at most 16 blocks away when using `/playsound` with volume 1 to play it. Specifying a greater volume value increases the audible range. When using a large enough volume to hear the sound farther away, the sound will get quieter only after a distance of more than 100.0. +**注意:** 距离衰减曲线不受命令中音量参数影响。 -To make a sound which can be heard far away but also drops in volume continuously over distance, one can add e.g. `"volume": 0.01`and use large `` values in the playsound command. The high value for the `/playsound` volume will produce a large audible range (e.g. a volume of 4 is 64 blocks as calculated above), while the low volume will prevent the played sound from capping at 1.0 too soon. +例如:`mob.ghast.affectionate_scream`设置了`"min_distance": 100.0`,但使用`/playsound`音量1时最大可听距离仍为16格。若需增大范围,可通过设置更高的音量参数。 -### Top Level Keys +要实现远距离可听且线性衰减的效果,可在定义中设置`"volume": 0.01`,并在命令中使用大音量值(如4对应64格范围)。 -In the example above, I showed two `top-level` fields: `category` and `sounds`. Sounds will be discussed in further detail below, but the other `top-level` keys will be discussed here: +### 顶级参数 -#### Categories +#### 类别(Categories) -Categories are used internally by the engine to decide how each sound is played. We can utilize different channels to get other effects. +控制声音播放方式的核心参数: -| Category | Note | -| -------- | ----------------------------------------------- | -| weather | | -| block | | -| bucket | | -| bottle | | -| ui | Sounds in this category will ignore range limit | -| player | | -| hostile | | -| music | | -| record | | -| neutral | | +| 类别 | 说明 | +|----------|--------------------------| +| weather | 天气音效 | +| block | 方块交互音效 | +| bucket | 桶类音效 | +| bottle | 玻璃瓶音效 | +| ui | 界面音效(无视距离限制)| +| player | 玩家相关音效 | +| hostile | 敌对生物音效 | +| music | 背景音乐 | +| record | 唱片机音效 | +| neutral | 中立生物音效 | #### min_distance -The distance from the sound source after which sound volume is attenuated. Default value: 0.0. It must be a float (eg. 1.0), or the property will be ignored. +声音开始衰减的最小距离(浮点数),默认0.0 #### max_distance -The distance from the sound source after which the sound volume is the quietest (if in range). It must be a float (eg. 1.0), or the property will be ignored. +声音衰减至最弱的最大距离(浮点数) -### Sound definitions +### 声音定义进阶 -In the example above, I showed `sounds` as simply a list with a single path. This is good for simple sounds but does not have much power. For starts, I can add multiple sounds to the list. These sounds will be randomized when played: +可通过数组定义多个随机音效: -RP/sounds/sound_definitions.json - -```json +::: code-group +```json [RP/sounds/sound_definitions.json] { "format_version": "1.14.0", "sound_definitions": { @@ -128,49 +130,25 @@ In the example above, I showed `sounds` as simply a list with a single path. Thi } } ``` +::: -Additionally, we can define each sound as an object instead of a string. This allows us finer control and unlocks some new settings. The string/object style can be mixed and matched. +#### 对象式定义参数 -#### name +| 参数 | 说明 | +|-------------------|----------------------------------------------------------------------| +| name | 文件路径(例:"sounds/music/game/creative/creative1") | +| stream | 启用流式加载(降低内存占用) | +| volume | 音量(0.0-1.0,可超过1.0) | +| load_on_low_memory| 已弃用(1.16.0+) | +| pitch | 音高倍数(例:2.3=2.3倍速播放) | +| is3D | 是否启用3D音效(音乐/UI类自动禁用) | +| interruptible | 是否可被中断(默认true) | +| weight | 随机权重(例:权重10的选中概率是权重2的5倍) | -The path to the file, such as: `"sounds/music/game/creative/creative1"` +### 完整示例 -#### stream - -Limits the sound only to be played a limited number of instances at a time. Will cause the game to not load the entire sound data into memory while playing, but rather in smaller parts while playing, thus using less memory. Good for improving performance on sound heavy worlds. - -#### volume - -How loud the sound should play, from `0.0` to `1.0`. Sounds cannot be made more audible than initially encoded. Set to `1.0` by default. -Sounds in custom resource packs can have working values greater than 1.0. - -#### load_on_low_memory - -Forces the loading of the sound even when nearing low memory. "load_on_low_memory" is now deprecated as of 1.16.0 - -#### pitch - -The pitch of the sound (how low/high it sounds). Should be a positive value. For example, `2.3` will let the sound play 2.3 times as quickly and thus at higher pitch. Set to `1.0` by default. - -#### is3D - -`true` makes the sound directional. Set to `true` for all sounds by default. Ignored for `music` and `ui` sounds. Only sounds with `false` will play stereo sound. - -#### interruptible - -Set to `true` by default. - -### weight - -If there is more than one sound in the list, the sound to be played is chosen randomly. `"weight"` (integer value like 5) will give the relative chance that this sound is chosen from the list. For example, if there are two sounds in the list, one with `"weight": 10` and the other with `"weight": 2`, the first will be played approximately 5 times more likely than the second (accurately: `10 / (10 + 2) = 83.3%` chance vs. `2 / (10 + 2) = 16.7%` chance) . Set to `1` by default. - -### Example - -Here is a more realistic example containing these options: - -RP/sounds/sound_definitions.json#sound_definitions - -```json +::: code-group +```json [RP/sounds/sound_definitions.json#sound_definitions] "block.beehive.drip": { "category": "block", "max_distance": 8, @@ -185,63 +163,39 @@ Here is a more realistic example containing these options: ] } ``` +::: ## sounds.json -If we want our sounds to run automatically, we can add them into the `sounds.json` file. This will tie the sound definitions directly to game events and cause them to play without needing to trigger with `/playsound`. +此文件用于绑定自动播放的音效: -Sounds can be added into various categories: +| 分类 | 说明 | +|------------------------|----------------------| +| individual_event_sounds| 独立事件音效(如信标激活)| +| block_sounds | 方块交互音效 | +| entity_sounds | 实体音效(含自定义实体)| +| interactive_sounds | 交互音效(开发中) | -| Category | Note | -| ----------------------- | -------------------------------------------------------------------------------- | -| individual_event_sounds | Contains sounds like beacon activation, chest-close, or explode | -| block_sounds | Contains hit, step, and break sounds for blocks | -| entity_sounds | Contains death, ambient, hurt, etc. sounds for entities (Including custom ones!) | -| interactive_sounds | WIP | +### 实体音效事件 -### Adding Entity Sounds +常见生命周期事件: -I assume that sounds can be added in other categories, but I personally only have experience adding sounds into the `entities` category. Entity sounds are automatically played at various points in the entities life-cycle. +| 事件 | 触发时机 | +|---------------|------------------------| +| ambient | 随机播放(如生物低鸣)| +| hurt | 受伤时 | +| death | 死亡时 | +| step | 移动时 | +| fall.big | 高空坠落 | +| fall.small | 低处跌落 | +| splash | 溅水 | +| attack | 近战攻击 | +| shoot | 远程射击 | -Common events: +### 实体音效示例 -| Events | Note | -| ---------- | -------------------------------------------------------- | -| ambient | Played randomly, such as grunts, clucks, or ghast noises | -| hurt | Played when damaged | -| death | Played when it dies | -| step | Played when the entity moves along the ground | -| fall.big | For hitting the ground from a high height | -| fall.small | For hitting the ground from a low height | -| splash | For splashing in the water | -| attack | For melee attacking | -| shoot | For shooting projectiles | - -There are also many sound events, which _most likely_ trigger automatically, but which I don't have details for, such as: - -| Unknown Categories | -| ------------------ | -| breathe | -| splash | -| swim | -| ambient.in.water | -| death.in.water | -| jump | -| eat | -| hurt.in.water | -| mad | -| stare | -| sniff | -| sleep | -| spit | -| warn | -| scream | - -### Example - -RP/sounds.json - -```json +::: code-group +```json [RP/sounds.json] { "entity_sounds": { "entities": { @@ -265,48 +219,44 @@ There are also many sound events, which _most likely_ trigger automatically, but } } ``` +::: -## Adding sounds to Animations +## 动画音效绑定 -Sounds played in animations function based off of `short-name` definitions in the RP entity file. +通过RP实体文件中的`sound_effects`实现动画同步: -This example shows playing a wing-flap sound, synced with an animation. - -RP/entities/dragon.json#minecraft:client_entity/description - -```json +::: code-group +```json [RP/entities/dragon.json#minecraft:client_entity/description] "sound_effects": { - "wing_flap": "wiki.dragon.wing_flap" //where wiki.dragon.roar is a sound defined in sound_definitions + "wing_flap": "wiki.dragon.wing_flap" // wiki.dragon.wing_flap需在sound_definitions中定义 } ``` +::: -RP/animations/dragon.json#animations/animation.dragon.flying - -```json +::: code-group +```json [RP/animations/dragon.json#animations/animation.dragon.flying] "sound_effects": { "3.16": { "effect": "wing_flap" } } ``` +::: -## Adding sounds to Animation Controllers +## 动画控制器音效 -You can play sounds within animation controllers in a similar way that animations can be. +动画控制器中的音效触发方式类似: -This example shows playing an explosion sound, synced using an animation controller. - -RP/entities/custom_tnt.json#minecraft:client_entity/description - -```json +::: code-group +```json [RP/entities/custom_tnt.json#minecraft:client_entity/description] "sound_effects": { - "explosion": "wiki.custom_tnt.explosion" //where wiki.custom_tnt.explosion is a sound defined in sound_definitions just like animation sounds. + "explosion": "wiki.custom_tnt.explosion" // 需在sound_definitions中定义 } ``` +::: -RP/animation_controllers/custom_tnt.animation_controllers.json#controller.animation.custom_tnt - -```json +::: code-group +```json [RP/animation_controllers/custom_tnt.animation_controllers.json#controller.animation.custom_tnt] "states":{ "default":{ "transitions":[ @@ -329,3 +279,4 @@ This example shows playing an explosion sound, synced using an animation control } } ``` +::: \ No newline at end of file diff --git a/docs/wiki/concepts/subpacks.md b/docs/wiki/concepts/subpacks.md index 9cbd3d73..e802f9cd 100644 --- a/docs/wiki/concepts/subpacks.md +++ b/docs/wiki/concepts/subpacks.md @@ -1,5 +1,5 @@ --- -title: Subpacks +title: 子Packs mentions: - SirLich - solvedDev @@ -10,32 +10,36 @@ mentions: - TheItsNameless --- -## What are Subpacks? +# 子Packs -Subpacks allow you to select between different addon 'configurations'. + -They are intended for texture resolutions to load on different memory capacities, but can also be used to create file variations in behavior and resource packs. These variations can be selected by clicking the gear icon and adjusting the slider. +## 什么是子包? -## How do Subpacks work? +子包功能允许玩家在不同的附加包"配置"之间进行选择。 -Files placed in you subpack folder will override files placed in your main addon folder, if the subpack is selected. For example, if your addon contains both `RP/textures/entities/ghost.png` and `RP/subpacks/pack_1/textures/ghost.png`, the second image file will replace the first, if subpack `pack_1` is selected. +该功能最初设计用于根据设备内存容量加载不同分辨率的材质包,但也可用于创建行为包和资源包的多种文件变体。玩家可以通过点击齿轮图标并调整滑块来选择不同的子包配置。 -For more information about how files override each other, please see our page on [overriding vanilla assets](/concepts/overwriting-assets). +## 子包工作原理 -## Creating Subpacks +当子包被选中时,放置在子包文件夹中的文件将覆盖主附加包文件夹中的同名文件。例如,若附加包同时包含 `RP/textures/entities/ghost.png` 和 `RP/subpacks/pack_1/textures/ghost.png`,当选择 `pack_1` 子包时,第二个图片文件将取代第一个文件。 -- To start adding a subpack you need to create a `subpacks` folder inside the root of your `BP`/`RP`. -- Then inside the `subpacks` folder add a folder for each subpack you want to have - e.g. +关于文件覆盖机制的更多信息,请参阅我们的[覆盖原版资源](/wiki/concepts/overwriting-assets)说明文档。 + +## 创建子包 + +- 首先需要在行为包或资源包的根目录下创建 `subpacks` 文件夹 +- 在 `subpacks` 文件夹内为每个子包创建独立文件夹 + 例如: -- Inside each of these folders you can add the content of each subpack. - This can be anything that normally goes in your behavior or resource pack. - e.g. +- 在每个子包文件夹中添加该子包的特定内容 + 这些内容可以是常规附加包中的任意资源 + 例如: -## Manifest Part +## 清单文件配置 -To register the subpacks in the manifest you need to add `subpacks` and this contains an array of subpacks. +需要在清单文件(manifest.json)中注册子包信息,在 `subpacks` 字段下以数组形式声明各个子包。 -Example: +示例配置: -RP/manifest.json - -```json +::: code-group +```json [RP/manifest.json] { "format_version": 2, "header": { - "name": "Pack Name", - "description": "Pack Description", + "name": "资源包名称", + "description": "资源包描述", "uuid": "2fc2dd6f-86cb-4370-af70-21490a1ae471", "version": [1, 0, 0], "min_engine_version": [1, 13, 0] @@ -72,24 +75,23 @@ Example: "subpacks": [ { "folder_name": "subpack_1", - "name": "First Subpack", + "name": "初级材质", "memory_tier": 0 }, { "folder_name": "subpack_2", - "name": "Second Subpack", + "name": "高清材质", "memory_tier": 1 } ] } ``` +::: -- `name` - name that will show when selecting subpacks. +- `name` - 在子包选择界面显示的名称 +- `memory_tier`- 设备运行所需内存配置(1个内存等级 = 0.25 GB) +- `folder_name` - 对应子包文件夹名称,例如示例中的 `subpack_1` 或 `subpack_2` -- `memory_tier`- amount of RAM that device must have to enable this subpack. 1 memory tier = 0.25 GB. +## 注意事项 -- `folder_name` - name of the folder to be used for this subpack, for example in the examples above this would be `subpack_1` or `subpack_2`. - -## Known Things - -If you add only one subpack, there will be 2 options at the subpacks selection section, however second resolution (no subpack actually) does **not** make content in the root folder override subpacks. +当仅添加一个子包时,选择界面会显示两个选项,但第二个"无子包"选项实际上**不会**用根目录内容覆盖子包内容。 \ No newline at end of file diff --git a/docs/wiki/concepts/text-and-translations.md b/docs/wiki/concepts/text-and-translations.md index 1e905453..76a6e2f5 100644 --- a/docs/wiki/concepts/text-and-translations.md +++ b/docs/wiki/concepts/text-and-translations.md @@ -1,5 +1,5 @@ --- -title: Text and Localization +title: 文本与本地化 mentions: - ThijsHankelMC - SirLich @@ -14,13 +14,17 @@ mentions: - Sprunkles --- -Minecraft is a game with fully localized text in languages all over the world. To achieve this, Minecraft employs a system where internal **translation keys** are assigned values on a per-language basis. Minecraft will generate translation keys for custom entities, items, and blocks, and it is up to us to assign them a localized name in our resource pack. +# 文本与本地化 -## Language Files + -### File Location +Minecraft 是一款支持全球多语言本地化的游戏。为实现这一特性,游戏采用了基于语言代码的**翻译键值系统**。对于自定义实体(Entity)、物品(Item)和方块(Block),Minecraft 会自动生成翻译键值,而我们需要通过资源包为其提供本地化文本。 -Language files typically go within the resource pack in the "texts" folder as files with the `.lang` file extension. These files can be placed in the behavior pack, but the only translatable text it can change is the pack manifest's name and description. +## 语言文件 + +### 文件位置 + +语言文件通常位于资源包的 `texts` 文件夹中,使用 `.lang` 扩展名。虽然也可以放置在行为包中,但行为包仅能修改资源包清单(manifest)的名称和描述。 -Minecraft supports 29 languages currently, as described in [§ Vanilla Languages](/concepts/text-and-translations#vanilla-languages). +Minecraft 目前支持 29 种语言,详见 [§ 原版支持语言](/wiki/concepts/text-and-translations#vanilla-languages)。 -### Format +### 格式规范 -The format for a language file is rather straightforward. Translations are supplied as key-value pairs separated by an equals sign (`=`), the key being a translation key and the value being a string. Values cannot contain newline characters. +语言文件采用键值对格式,使用等号(`=`)分隔。键为翻译键值,值为字符串(不支持换行符)。 ```toml -wiki.example_translation.line_1=The first line! -wiki.example_translation.line_2=Some more information following the first line. +wiki.example_translation.line_1=第一行内容! +wiki.example_translation.line_2=这里是第一行之后的其他信息。 ``` -Comments may be added with two pound signs (`##`), either as line comments or in-line comments. All text after the pound signs are a comment until the next line. +可通过双井号(`##`)添加注释,支持行尾注释和整行注释(注释内容持续到行尾)。 :::warning -Trailing spaces are not trimmed for in-line comments. If you want to indent a comment, use the Tab character. +行尾注释前的空格不会被自动删除。如需缩进注释,请使用制表符(Tab)。 ::: ```toml -## Translator note: I thought this would be funny to put here. -item.flint_and_steel.name=Flint and Steve ##[sic] +## 译者注:这个翻译可能有点幽默成分 +item.flint_and_steel.name=燧石与史蒂夫 ##[原文如此] ``` -A translation can contain substitutions in place of text. Substitutions can either be ordered (`%1`, `%2`, etc.) or not ordered (`%s`). Vanilla translations have their values filled in by the game, while players can manually set the substitutions' values with commands that use the raw JSON text format, like with [`/tellraw`](/commands/tellraw). +翻译文本支持占位符替换,可使用有序占位符(`%1`、`%2`)或无序占位符(`%s`)。原版占位符由游戏自动填充,而通过原始JSON文本命令(如 [`/tellraw`](/wiki/commands/tellraw))可手动指定替换值。 ```toml -commands.op.success=Opped: %s -immersive_reader.book_page_header=Page %1 of %2 +commands.op.success=已授予管理员权限:%s +immersive_reader.book_page_header=第 %1 页 / 共 %2 页 ``` -### Usage +### 应用场景 -Localization can be done just about anywhere text can be used, including (but not limited to): +本地化文本可用于以下场景(包括但不限于): -- Pack name and description -- Entity, item, or block names -- Pages in a book -- Lines on a sign -- `/tellraw` and `/titleraw` commands -- Text in dialogue +- 资源包/行为包名称与描述 +- 实体、物品或方块的名称 +- 书页内容 +- 告示牌文字 +- `/tellraw` 和 `/titleraw` 命令 +- 对话系统中的文本 -Some text cannot be translated however, such as for an item renamed in an anvil. +但某些文本(如铁砧重命名的物品)不支持本地化。 -## Localization +## 本地化实践 :::tip -It is good practice create a copy of your language file for each major language your pack supports. For example, to support full English one should create both an `en_US.lang` and an `en_GB.lang` file, to cover English in both the United States and Great Britain countries, respectively. +最佳实践是为每个主要支持语言创建独立语言文件。例如要完整支持英语,应同时创建 `en_US.lang`(美式英语)和 `en_GB.lang`(英式英语)文件。 ::: -When editing language files one must also add a `languages.json` file in the `texts` folder containing an array with each of the languages you plan to change. This lets Minecraft know that it should apply localization for these languages. +编辑语言文件时,需在 `texts` 文件夹中添加 `languages.json` 文件,声明需要修改的语言列表。这会告知 Minecraft 应用对应的本地化配置。 -RP/texts/languages.json - -```json +::: code-group +```json [原始CodeHeader的值] [ "en_US", "en_GB", "fr_FR" ] ``` +::: -### Custom Languages +### 自定义语言 -With a global resource pack, custom languages may be introduced through the `languages.json` and `language_names.json` files. Once the pack is applied globally the language can be changed in the "Language" tab of the in-game settings. +通过全局资源包,可使用 `languages.json` 和 `language_names.json` 添加自定义语言。应用全局资源包后,即可在游戏设置的"语言"选项中选择新语言。 -For the following examples, lets assume that we have 2 fully functional language files, one named `xx_XX.lang`, and another named `yy_YY.lang`. +假设我们有两个功能完善的语言文件:`xx_XX.lang` 和 `yy_YY.lang`。 -RP/texts/languages.json - -```json +::: code-group +```json [原始CodeHeader的值] [ "xx_XX", "yy_YY" ] ``` - -`language_names.json` is an array as well, but this time to define the names to display for the languages. - -RP/texts/language_names.json - -```json -[ - [ "xx_XX", "New Language (Custom Language #1)" ], - [ "yy_YY", "Wiki-Speak (Custom Language #2)" ] -] -``` - -:::warning - Whenever using a custom language, make sure to unequip the language before you disable the Resource Pack which it is stored in, or else Minecraft will crash. ::: -### Vanilla Languages +`language_names.json` 用于定义语言在选项菜单中的显示名称: -The following is a table of the 29 languages Minecraft supports by default. +::: code-group +```json [原始CodeHeader的值] +[ + [ "xx_XX", "新语言(自定义语言 #1)" ], + [ "yy_YY", "维基语(自定义语言 #2)" ] +] +``` +::: -| File ID | Language | Country | -| ---------- | --------------------- | -------------- | -| id_ID | Indonesian | Indonesia | -| da_DK | Danish | Denmark | -| de_DE | German | Germany | -| en_GB | English | Great Britain | -| en_US | English | North America | -| es_ES | Spanish | Spain | -| es_MX | Mexican Spanish | Mexico | -| fr_CA | Canadian French | Canada | -| fr_FR | French | France | -| it_IT | Italian | Italy | -| hu_HU | Hungarian | Hungary | -| nl_NL | Dutch | Netherlands | -| nb_NO | Bokmål | Norway | -| pl_PL | Polish | Poland | -| pt_BR | Brazilian Portuguese | Brazil | -| pt_PT | Portuguese | Portugal | -| sk_SK | Slovak | Slovakia | -| fi_FI | Finnish | Finland | -| sv_SE | Swedish | Sweden | -| tr_TR | Turkish | Turkey | -| cs_CZ | Czech | Czech Republic | -| el_GR | Greek | Greece | -| bg_BG | Bulgarian | Bulgaria | -| ru_RU | Russian | Russia | -| uk_UA | Ukrainian | Ukraine | -| ja_JP | Japanese | Japan | -| zh_CN | Chinese (Simplified) | China | -| zh_TW | Chinese (Traditional) | Taiwan | -| ko_KR | Korean | Korea | +:::warning +使用自定义语言时,在禁用其所属资源包前请先切换回其他语言,否则可能导致游戏崩溃。 +::: + +### 原版支持语言 + +下表列出了 Minecraft 默认支持的 29 种语言: + +| 文件ID | 语言 | 国家/地区 | +| ---------- | ------------------- | --------------- | +| id_ID | 印度尼西亚语 | 印度尼西亚 | +| da_DK | 丹麦语 | 丹麦 | +| de_DE | 德语 | 德国 | +| en_GB | 英语 | 英国 | +| en_US | 英语 | 北美 | +| es_ES | 西班牙语 | 西班牙 | +| es_MX | 墨西哥西班牙语 | 墨西哥 | +| fr_CA | 加拿大法语 | 加拿大 | +| fr_FR | 法语 | 法国 | +| it_IT | 意大利语 | 意大利 | +| hu_HU | 匈牙利语 | 匈牙利 | +| nl_NL | 荷兰语 | 荷兰 | +| nb_NO | 书面挪威语 | 挪威 | +| pl_PL | 波兰语 | 波兰 | +| pt_BR | 巴西葡萄牙语 | 巴西 | +| pt_PT | 葡萄牙语 | 葡萄牙 | +| sk_SK | 斯洛伐克语 | 斯洛伐克 | +| fi_FI | 芬兰语 | 芬兰 | +| sv_SE | 瑞典语 | 瑞典 | +| tr_TR | 土耳其语 | 土耳其 | +| cs_CZ | 捷克语 | 捷克共和国 | +| el_GR | 希腊语 | 希腊 | +| bg_BG | 保加利亚语 | 保加利亚 | +| ru_RU | 俄语 | 俄罗斯 | +| uk_UA | 乌克兰语 | 乌克兰 | +| ja_JP | 日语 | 日本 | +| zh_CN | 简体中文 | 中国 | +| zh_TW | 繁体中文 | 台湾地区 | +| ko_KR | 韩语 | 韩国 | \ No newline at end of file diff --git a/docs/wiki/concepts/textures-list.md b/docs/wiki/concepts/textures-list.md index a726a03c..aa8098f6 100644 --- a/docs/wiki/concepts/textures-list.md +++ b/docs/wiki/concepts/textures-list.md @@ -8,21 +8,24 @@ mentions: - TheItsNameless --- -## General Overview +# textures_list.json -The `textures_list` file is Minecraft's way of *caching* each texture so that it can retrieve it faster than looking through each image in your textures folder. This is especially important when you have an abundance of textures, where Minecraft could potentially mess up and swap textures or even not load them at all. Minecraft tends to throw a content log _warning_ if you don't have the textures listed in the file. You can ignore it if you have a small amount, but it is recommended that you list the textures anyway. + -## What textures can be used in the file? +## 概述 -Any texture! Any textures can and _should_ be used in the textures_list.json file for best practice and performance. +`textures_list` 文件是 Minecraft 用来*缓存*所有纹理的机制,相比从纹理文件夹中逐张查找,这种方式能更快地检索纹理。当您拥有大量纹理时这一点尤为重要,因为 Minecraft 可能会因纹理过多而出现错误交换纹理甚至无法加载的情况。如果您未在文件中列出纹理,Minecraft 通常会在内容日志中抛出_警告_。纹理数量较少时可以忽略该警告,但仍建议您将所有纹理列入清单。 -## File Structure +## 可使用的纹理类型 -The structure is simple. The file itself is in `RP/textures` and is named `textures_list.json`. The file includes the file path to every texture you want in the file: +所有纹理!最佳实践表明,任何纹理都可以且_应该_被列入 textures_list.json 文件中以优化性能。 -RP/textures/textures_list.json +## 文件结构 -```json +结构非常简单。该文件位于 `RP/textures` 目录下,命名为 `textures_list.json`。文件包含您需要缓存的所有纹理文件路径: + +::: code-group +```json [RP/textures/textures_list.json] [ "textures/blocks/foo", "textures/blocks/bar", @@ -37,7 +40,8 @@ The structure is simple. The file itself is in `RP/textures` and is named `textu "textures/entity/bar" ] ``` +::: -## Automating +## 自动化处理 -If you have a lot of textures, this could obviously be tedious to go and list all the texture paths. In this case you can start to use [Regolith](https://bedrock-oss.github.io/regolith/) with its wonderful filters. +当您需要处理大量纹理时,手动列出所有纹理路径显然非常繁琐。此时可以使用集成强大过滤器的 [Regolith](https://bedrock-oss.github.io/regolith/) 工具来实现自动化处理。 \ No newline at end of file diff --git a/docs/wiki/documentation/advanced-molang.md b/docs/wiki/documentation/advanced-molang.md index e67b0187..7389df55 100644 --- a/docs/wiki/documentation/advanced-molang.md +++ b/docs/wiki/documentation/advanced-molang.md @@ -1,70 +1,74 @@ --- -title: Advanced Molang +title: 进阶Molang toc_max_level: 2 mentions: - Ciosciaa - TheItsNameless --- -## Values +# 进阶Molang -- All expressions in Molang return a value for the sake of checks against equality. Most expressions return `0`. Notably, assignments return the value assigned and loops return the resolved value of the looping statements, if one would exist. -- All values in Molang are effectively single-precision floats. -- `this` is used to refer to the field's current value as it accumulated during evaluation. It is only observed to be usable in animations, but it may be usable elsewhere. As an example, if the accumulated transformations on the `x` `scale` of a bone would yield `62`, a final animation with a `x` `scale` of `-this` would resolve to `-62`, unsetting the prior transformations. This is used in vanilla animations in a number of places. Outside of animation contexts, `this` appears to always resolve to `0`. + -### Booleans +## 值类型 -- Booleans are usable in Molang. `true` resolves to `1`, and `false` resolves to `0`. +- 所有Molang表达式都会返回一个值以便进行相等性检查。大多数表达式返回`0`。特别地,赋值表达式会返回被赋予的值,循环语句会返回循环体内最后一个解析的值(如果存在)。 +- Molang中的所有值本质上都是单精度浮点数。 +- `this`用于指代当前字段在运算过程中累积的当前值。目前仅在动画系统中被观察到可用,但可能在其他场景也有用途。例如,如果骨骼在`x`轴上的缩放变换累积结果为`62`,那么最终动画中`x`轴的`scale`设置为`-this`时,结果将为`-62`,这会抵消之前的变换效果。这一特性在大量原版动画中都有应用。在非动画上下文中,`this`似乎始终解析为`0`。 -### Numbers +### 布尔值 -- You can use leading `0`s in front of numbers, for example, to line them up better in your code. -- Numbers can use exponential notation, such as `2.5e2`, which would be equal to 250. `e` can be suffixed with `+` or `-` to direct the power. -- Numbers may be suffixed with a single `f`, often used to denote a floating point value. This can be found across vanilla code, but it is not believed to have any functionality. +- 布尔值可在Molang中使用。`true`解析为`1`,`false`解析为`0`。 -### Strings +### 数值 -- Strings use `\` (`\\` in escaped JSON) as some sort of escape or perhaps something else. It is unknown what functionality this has. It is known that the subsequent 2 characters are handed off to their own sub-parser, which does not exit correctly on a closing `'`; this means the Molang string `"v.type = '\\x';"` is invalid. `'`, which is normally disallowed on its own as it would represent the end of the string, is allowed in the 2 characters following a `\`. -- String values are (mostly) incremental as they are represented against floats. It is possible to compare 2 individual character strings using equality or comparison operators or even to effectively "adjust" the contents of a single-character string. Multi-character behavior of such is unknown. +- 可以在数值前添加前导零(例如`0012`),以便在代码中对齐。 +- 数值支持科学计数法(如`2.5e2`等价于250)。指数部分可使用`+`或`-`符号。 +- 数值可以后缀单个`f`(常见于原版代码中用于标记浮点数),但目前未发现该符号具有实际功能影响。 -## Operators +### 字符串 -The complete precedence list, from first to last evaluated: +- 字符串使用`\`(JSON转义后为`\\`)作为某种转义符或其他功能。其具体功能尚不明确。已知后续两个字符会被传递给独立子解析器,但该子解析器遇到结束单引号`'`时无法正确退出。例如Molang字符串`"v.type = '\\x';"`是无效的。而单独存在的`'`通常会被视为字符串结束符,但在`\`后的两个字符中出现时会被允许。 +- 字符串值(多数情况下)以浮点数形式进行增量表示。可以通过等式或比较运算符对单字符字符串进行比较,甚至可对单字符字符串内容进行"调整"。多字符字符串在此类操作中的行为尚不明确。 -1. `()` and `[]` +## 运算符 + +运算符优先级列表(从高到低): + +1. `()` 和 `[]` 2. `->` -3. `!` and `-` (unary negation) -4. `*` and `/` -5. `+` and `-` (binary subtraction) -6. `<`, `<=`, `>`, and `>=` -7. `==` and `!=` +3. `!` 和 `-`(一元取反) +4. `*` 和 `/` +5. `+` 和 `-`(二元减法) +6. `<`, `<=`, `>` 和 `>=` +7. `==` 和 `!=` 8. `&&` 9. `||` -10. `?` and `? :` +10. `?` 和 `? :` 11. `??` 12. `=` 13. `return` -- Operators are considered from left to right for all operators except the conditionals. -- Multiple `->` cannot be used in the same statement. -- Logical operators short-circuit. +- 除条件运算符外,所有运算符均按从左到右顺序执行。 +- 同一语句中不可重复使用`->`运算符。 +- 逻辑运算符具有短路特性。 -## Statements +## 语句 -- Assignments return the value assigned. You can therefore chain assignments if you need separate variables to work with from a single value, such as with `v.iterator_x = (v.iterator_z = math.random_integer(16, 32));`. -- The last statement inside a brace scope does not need to end with a `;`. -- Brace scopes can be used anywhere an expression can be used. `v.spawn_point ?? {v.target = false;};`, for example, would set `v.target` to `false` if `v.spawn_point` were not defined. +- 赋值语句会返回被赋予的值。因此可以进行链式赋值(例如`v.iterator_x = (v.iterator_z = math.random_integer(16, 32));`)。 +- 大括号作用域内的最后一条语句无需以`;`结尾。 +- 大括号作用域可以在任何表达式可用的位置使用。例如`v.spawn_point ?? {v.target = false;};`会在`v.spawn_point`未定义时将`v.target`设为`false`。 -## Collections +## 集合类型 -- Entity iterables (such as the result of `q.get_nearby_entities`) are their own "type". They are not compatible with subscripts. -- Arrays, likewise, are not compatible with entity iterable operations, such as `q.count`. -- The result of array subscripts cannot directly be an argument to `+`, `-`, `*`, or `/` but may still be used directly as function parameters (even math functions) or with other operators. +- 实体可迭代对象(如`q.get_nearby_entities`的结果)属于独立"类型",不可与下标运算符兼容使用。 +- 数组类型同样无法与实体可迭代操作(如`q.count`)兼容使用。 +- 数组下标结果不可直接作为`+`, `-`, `*`, `/`的操作数,但可作为函数参数(包括数学函数)或与其他运算符配合使用。 -## Evaluation +## 表达式求值 -- `initialize` and `pre_animation` are lazily concatenated. Molang strings in these arrays must be syntactically valid independently, but the basic concatenation of all independent strings must also be a valid Molang input. +- `initialize`和`pre_animation`数组中的语句采用延迟连接方式。这些数组中的每个Molang字符串必须独立语法有效,同时所有字符串连接后也需构成有效的Molang输入。 -## Limits +## 限制条件 -- Molang showed no reasonable limits to any language functionality, aside from numeric size. Loop counts, string lengths, Molang input length, collection size, etc., were observed to hold in very unreasonable situations. \ No newline at end of file +- 除数值大小外,未发现Molang存在合理的功能限制。在极端场景下仍可观察到循环计数、字符串长度、输入长度、集合大小等参数的正常运行。 \ No newline at end of file diff --git a/docs/wiki/documentation/creative-categories.md b/docs/wiki/documentation/creative-categories.md index e95c0d8e..0d90b336 100644 --- a/docs/wiki/documentation/creative-categories.md +++ b/docs/wiki/documentation/creative-categories.md @@ -1,5 +1,5 @@ --- -title: Menu Categories +title: 菜单分类 mentions: - Warhead51707 - yanasakana @@ -13,37 +13,39 @@ mentions: - QuazChick --- -Menu categories determine where items and blocks appear inside of the creative inventory and recipe book. +# 菜单分类 -- A `category` can be defined to place the item under a tab (such as construction). Click [here](#list-of-categories) for a list of valid categories. + -- A `group` specifies which expandable group the item is placed into. If you use a custom value, a new expandable group won't be created, however items with the group will be placed next to each other in the creative inventory. Click [here](#list-of-groups) for a list of expandable groups. +菜单分类决定了物品和方块在创造模式物品栏和配方书中的显示位置。 -- You can also set `is_hidden_in_commands` to true to remove this block/item from commands, such as `/give` and `/setblock`. +- 通过定义`category`可将物品放置于特定标签页下(如"construction"建筑类)。点击[此处](#分类列表)查看有效分类列表。 -If `menu_category` is omitted, the item will only be accessible through commands and won't appear in the creative inventory or recipe book. +- `group`参数用于指定物品所在的可展开分组。使用自定义值时不会创建新分组,但相同分组的物品会在创造模式物品栏中相邻排列。点击[此处](#分组列表)查看可展开分组列表。 -**NOTE:** The menu category of custom spawn eggs cannot be modified. You must instead create a custom item with the `minecraft:entity_placer` component. +- 设置`is_hidden_in_commands`为true可让该物品/方块无法通过`/give`和`/setblock`等命令获取。 - +若省略`menu_category`参数,物品将只能通过命令获取,且不会出现在创造模式物品栏或配方书中。 -```json +**注意:** 自定义刷怪蛋的菜单分类不可修改,需使用`minecraft:entity_placer`组件创建自定义物品实现类似功能。 + +::: code-group +```json [菜单分类配置] "menu_category": { - "category": "construction", // Tab the item is placed under - "group": "itemGroup.name.door", // Optional - Group the item is placed into - "is_hidden_in_commands": false // Optional - default is false (item is usable in commands) + "category": "construction", // 物品所在的标签页 + "group": "itemGroup.name.door", // 可选 - 物品所在的展开分组 + "is_hidden_in_commands": false // 可选 - 默认为false(可通过命令使用) } ``` -:::danger HIDDEN ITEMS INACCESSIBLE IN COMMANDS ([MCPE-177866](https://bugs.mojang.com/browse/MCPE-177866)) -Currently, setting the category to "none" in a custom item (not block) prevents the item from being used in commands, overriding the "is_hidden_in_commands" option. This issue doesn't affect blocks. +:::danger 命令中隐藏物品不可访问的问题 ([MCPE-177866](https://bugs.mojang.com/browse/MCPE-177866)) +当前版本中,将自定义物品(非方块)的category设为"none"会覆盖"is_hidden_in_commands"设置,导致无法通过命令使用该物品。此问题不影响方块类物品。 ::: -## Block Example +## 方块示例 -BP/blocks/balsa_wood.json - -```json +::: code-group +```json [BP/blocks/balsa_wood.json] { "format_version": "1.20.50", "minecraft:block": { @@ -51,18 +53,18 @@ Currently, setting the category to "none" in a custom item (not block) prevents "identifier": "wiki:balsa_wood", "menu_category": { "category": "nature", - "group": "itemGroup.name.wood" // Placed into an expandable group + "group": "itemGroup.name.wood" // 归入可展开分组 } } } } ``` +::: -## Item Example +## 物品示例 -BP/items/dagger.json - -```json +::: code-group +```json [BP/items/dagger.json] { "format_version": "1.20.50", "minecraft:item": { @@ -70,111 +72,112 @@ Currently, setting the category to "none" in a custom item (not block) prevents "identifier": "wiki:dagger", "menu_category": { "category": "equipment", - "is_hidden_in_commands": true // Item cannot be used in commands + "is_hidden_in_commands": true // 无法通过命令使用 } } } } ``` +::: -## List of Categories +## 分类列表 -_For use with `menu_category` parameter, `category`._ +_用于`menu_category`参数中的`category`属性_ -| Category | Description | -| ------------ | -------------------------------------------------------- | -| construction | Added to the "Contruction" tab. | -| equipment | Added to the "Equipment" tab. | -| items | Added to the "Items" tab. | -| nature | Added to the "Nature" tab. | -| none | Not added to a tab and only accessible through commands. | +| 分类名称 | 描述 | +| ------------ | ----------------------------------------- | +| construction | 显示在"建筑"标签页 | +| equipment | 显示在"装备"标签页 | +| items | 显示在"物品"标签页 | +| nature | 显示在"自然"标签页 | +| none | 不显示在任何标签页,只能通过命令获取 | -## List of Groups +## 分组列表 -_For use with the `menu_category` parameter, `group`._ +_用于`menu_category`参数中的`group`属性_ -| Creative Categories: | -| --------------------------------- | -| itemGroup.name.anvil | -| itemGroup.name.arrow | -| itemGroup.name.axe | -| itemGroup.name.banner | -| itemGroup.name.banner_pattern | -| itemGroup.name.bed | -| itemGroup.name.boat | -| itemGroup.name.boots | -| itemGroup.name.buttons | -| itemGroup.name.candles | -| itemGroup.name.chalkboard | -| itemGroup.name.chest | -| itemGroup.name.chestboat | -| itemGroup.name.chestplate | -| itemGroup.name.concrete | -| itemGroup.name.concretePowder | -| itemGroup.name.cookedFood | -| itemGroup.name.copper | -| itemGroup.name.coral | -| itemGroup.name.coral_decorations | -| itemGroup.name.crop | -| itemGroup.name.door | -| itemGroup.name.dye | -| itemGroup.name.enchantedBook | -| itemGroup.name.fence | -| itemGroup.name.fenceGate | -| itemGroup.name.firework | -| itemGroup.name.fireworkStars | -| itemGroup.name.flower | -| itemGroup.name.glass | -| itemGroup.name.glassPane | -| itemGroup.name.glazedTerracotta | -| itemGroup.name.goatHorn | -| itemGroup.name.grass | -| itemGroup.name.hanging_sign | -| itemGroup.name.helmet | -| itemGroup.name.hoe | -| itemGroup.name.horseArmor | -| itemGroup.name.leaves | -| itemGroup.name.leggings | -| itemGroup.name.lingeringPotion | -| itemGroup.name.log | -| itemGroup.name.minecart | -| itemGroup.name.miscFood | -| itemGroup.name.mobEgg | -| itemGroup.name.monsterStoneEgg | -| itemGroup.name.mushroom | -| itemGroup.name.netherWartBlock | -| itemGroup.name.ore | -| itemGroup.name.permission | -| itemGroup.name.pickaxe | -| itemGroup.name.planks | -| itemGroup.name.potion | -| itemGroup.name.potterySherds | -| itemGroup.name.pressurePlate | -| itemGroup.name.rail | -| itemGroup.name.rawFood | -| itemGroup.name.record | -| itemGroup.name.sandstone | -| itemGroup.name.sapling | -| itemGroup.name.sculk | -| itemGroup.name.seed | -| itemGroup.name.shovel | -| itemGroup.name.shulkerBox | -| itemGroup.name.sign | -| itemGroup.name.skull | -| itemGroup.name.slab | +| 创造模式分组: | +| ----------------------------- | +| itemGroup.name.anvil | +| itemGroup.name.arrow | +| itemGroup.name.axe | +| itemGroup.name.banner | +| itemGroup.name.banner_pattern | +| itemGroup.name.bed | +| itemGroup.name.boat | +| itemGroup.name.boots | +| itemGroup.name.buttons | +| itemGroup.name.candles | +| itemGroup.name.chalkboard | +| itemGroup.name.chest | +| itemGroup.name.chestboat | +| itemGroup.name.chestplate | +| itemGroup.name.concrete | +| itemGroup.name.concretePowder | +| itemGroup.name.cookedFood | +| itemGroup.name.copper | +| itemGroup.name.coral | +| itemGroup.name.coral_decorations | +| itemGroup.name.crop | +| itemGroup.name.door | +| itemGroup.name.dye | +| itemGroup.name.enchantedBook | +| itemGroup.name.fence | +| itemGroup.name.fenceGate | +| itemGroup.name.firework | +| itemGroup.name.fireworkStars | +| itemGroup.name.flower | +| itemGroup.name.glass | +| itemGroup.name.glassPane | +| itemGroup.name.glazedTerracotta | +| itemGroup.name.goatHorn | +| itemGroup.name.grass | +| itemGroup.name.hanging_sign | +| itemGroup.name.helmet | +| itemGroup.name.hoe | +| itemGroup.name.horseArmor | +| itemGroup.name.leaves | +| itemGroup.name.leggings | +| itemGroup.name.lingeringPotion| +| itemGroup.name.log | +| itemGroup.name.minecart | +| itemGroup.name.miscFood | +| itemGroup.name.mobEgg | +| itemGroup.name.monsterStoneEgg| +| itemGroup.name.mushroom | +| itemGroup.name.netherWartBlock| +| itemGroup.name.ore | +| itemGroup.name.permission | +| itemGroup.name.pickaxe | +| itemGroup.name.planks | +| itemGroup.name.potion | +| itemGroup.name.potterySherds | +| itemGroup.name.pressurePlate | +| itemGroup.name.rail | +| itemGroup.name.rawFood | +| itemGroup.name.record | +| itemGroup.name.sandstone | +| itemGroup.name.sapling | +| itemGroup.name.sculk | +| itemGroup.name.seed | +| itemGroup.name.shovel | +| itemGroup.name.shulkerBox | +| itemGroup.name.sign | +| itemGroup.name.skull | +| itemGroup.name.slab | | itemGroup.name.smithing_templates | -| itemGroup.name.splashPotion | -| itemGroup.name.stainedClay | -| itemGroup.name.stairs | -| itemGroup.name.stone | -| itemGroup.name.stoneBrick | -| itemGroup.name.sword | -| itemGroup.name.trapdoor | -| itemGroup.name.walls | -| itemGroup.name.wood | -| itemGroup.name.wool | -| itemGroup.name.woolCarpet | +| itemGroup.name.splashPotion | +| itemGroup.name.stainedClay | +| itemGroup.name.stairs | +| itemGroup.name.stone | +| itemGroup.name.stoneBrick | +| itemGroup.name.sword | +| itemGroup.name.trapdoor | +| itemGroup.name.walls | +| itemGroup.name.wood | +| itemGroup.name.wool | +| itemGroup.name.woolCarpet | -*Last updated for 1.20.10* - +*最后更新版本:1.20.10* + \ No newline at end of file diff --git a/docs/wiki/documentation/file-types.md b/docs/wiki/documentation/file-types.md index 0e465bdb..aa97962c 100644 --- a/docs/wiki/documentation/file-types.md +++ b/docs/wiki/documentation/file-types.md @@ -1,106 +1,113 @@ --- -title: File Types +title: 文件类型 max_toc_level : 3 mentions: - Ciosciaa - SirLich --- -A number of file types exist for *Minecraft*, all for importing content. All *Minecraft* files are ZIP archives renamed to use a `mc…` extension. These archives can currently be divided into three sets: +# 文件类型 -- **Levels (`mcworld` and `mcproject`)**: level data and associated resources for worlds and projects -- **Assets (`mcpack` and `mctemplate`)**: cosmetics or supporting assets for worlds -- **Composites (`mcaddon` and `mceditoraddon)`**: used to import up to one world or project and any number of asset types + -All file types for Minecraft can be opened as any file, launching Minecraft and importing the content. When packages are imported, they are automatically unpacked into their constituent files and directories. If it was not already open, most file types will launch Minecraft in normal mode; `mcproject` and `mceditoraddon` will instead launch Minecraft into Editor mode. +*Minecraft* 存在多种文件类型,均用于导入内容。所有 *Minecraft* 文件本质上都是 ZIP 压缩包,通过重命名使用 `mc...` 扩展名。这些压缩包目前可分为三大类: -# Levels -Levels represent save data and resources for regular worlds and Editor projects. All levels, regardless of mode, are imported to `minecraftWorlds` in the `com.mojang` directory. +- **世界文件(`mcworld` 与 `mcproject`)**:包含世界或项目的关卡数据及相关资源 +- **资源文件(`mcpack` 与 `mctemplate`)**:包含世界的装饰性素材或支持性资源 +- **复合文件(`mcaddon` 与 `mceditoraddon`)**:可同时包含最多一个世界/项目文件及任意数量的资源文件 -Importing an exact duplicate of an existing saved level will create a duplicate saved level. Composite archives will only import one level if multiple are included, including across nested composite archives. +所有 *Minecraft* 文件类型均可通过常规文件打开方式启动游戏并导入内容。当资源包被导入时,会自动解压到对应的文件目录结构中。若游戏未处于运行状态,多数文件类型会以普通模式启动游戏;而 `mcproject` 和 `mceditoraddon` 则会直接进入编辑器模式。 -## Worlds +# 世界文件 +世界文件代表普通世界与编辑器项目的存档数据及资源。所有世界文件无论模式,都会被导入到 `com.mojang` 目录下的 `minecraftWorlds` 文件夹中。 + +若导入与已有存档完全相同的世界文件,会生成重复存档。复合文件包中若包含多个世界文件(包括嵌套的复合文件),只会导入其中一个世界。 + +## 普通世界 `mcworld` -Archive encapsulating an individual world +单个世界的压缩存档包 -World archives can be created a few different ways: -- Zipping the *contents* of a world directory and renaming the extension from `zip` to `mcworld` -- Using the "Export World" button on the Game settings screen for a world -- In Editor mode, exporting the world from the File → Export as → Playable world menu option. The world will be saved to the `projectbackups` directory in the `com.mojang` folder. -- In Editor mode, running the `/project export world` command. The world will be saved to the `projectbackups` directory in the `com.mojang` folder. +创建世界存档的几种方式: +- 将世界目录的**全部内容**打包为 ZIP 文件后,将扩展名改为 `mcworld` +- 在游戏设置界面点击"导出世界"按钮 +- 在编辑器模式中,通过 文件 → 导出为 → 可游玩世界 菜单选项导出。存档将保存在 `com.mojang` 文件夹的 `projectbackups` 目录中 +- 在编辑器模式中运行 `/project export world` 命令。存档将保存在 `com.mojang` 文件夹的 `projectbackups` 目录中 -Importing a world package while *Minecraft* is launched in Editor mode will import the world as a project. The imported world will then be inaccessible outside Editor mode and will need to be re-exported as a world for playing. Editor extension packs bundled in a world archive will be retained on import outside Editor mode. +在编辑器模式下导入世界文件会将其作为项目导入。此时该世界将无法在编辑器模式之外访问,需重新导出为普通世界才能游玩。世界文件中包含的编辑器扩展包在非编辑器模式导入时会被保留。 -## Projects +## 项目文件 `mcproject` -Archive encapsulating an individual Editor project +单个编辑器项目的压缩存档包 -Project archives can be created two different ways: -- Zipping the *contents* of a project directory and renaming the extension from `zip` to `mcproject`. -- Using the "Export Project" button on the Game settings screen for a world -- In Editor mode, running the `/project export project` command. The world will be saved to the `projectbackups` directory in the `com.mojang` folder. +创建项目存档的两种方式: +- 将项目目录的**全部内容**打包为 ZIP 文件后,将扩展名改为 `mcproject` +- 在编辑器模式中运行 `/project export project` 命令。存档将保存在 `com.mojang` 文件夹的 `projectbackups` 目录中 -If *Minecraft* is not open, launching a `mcproject` file will open Editor mode. Importing a `mcproject` will fail if *Minecraft* is open but not in Editor mode. +若游戏未运行,打开 `mcproject` 文件会直接进入编辑器模式。若游戏已运行但未处于编辑器模式,导入 `mcproject` 文件会失败。 -# Assets -Asset archives represent a singular instance of a number of non-level contents: +# 资源文件 +资源文件代表各种非世界类内容的独立实例: +- 行为包 +- 资源包 +- 皮肤包 +- 世界模板 -- Behavior packs -- Resource packs -- Skin packs -- World templates +所有资源文件都包含描述其内容的清单文件(manifest)。若资源清单的 UUID 和版本号与同类型现有资源完全一致,导入将会失败。注意行为包和资源包共享相同的 UUID/版本号命名空间。内置于世界、项目或模板中的行为包/资源包不会被视为重复资源。 -All asset archives include a manifest describing their contents. An asset archive will fail to import if its manifest UUID and version exactly matches an existing asset archive of the same type. Note that behavior and resource packs share the same UUID/version space. Behavior and resource packs self-contained within a world, project, or template will not count as duplicates for the sake of importing. +虽然 `mcpack` 和 `mctemplate` 功能相同,但建议遵循以下规范: +- 使用 `mcpack` 作为行为包、资源包、皮肤包 +- 使用 `mctemplate` 作为世界模板 +以便用户更直观地识别内容类型。复合文件中可包含任意数量的资源文件。 -Both asset extensions, `mcpack` and `mctemplate`, appear to functionally behave the same. It's best practice to use `mcpack` for behavior, resource, and skin packs and `mctemplate` for world templates to make it more clear what's being installed. Any number of asset archives may be included in a composite archive. - -## Packs +## 资源包 `mcpack` -Package representing an individual behavior pack, resource pack, skin pack, or world template. It's recommended only to use `mctemplate` for behavior packs, resource packs, or skin packs. +代表单个行为包、资源包、皮肤包或世界模板的压缩包。建议仅将 `mctemplate` 用于世界模板。 -Packs are only created manually, by zipping the contents of a behavior pack, resource pack, or skin pack directory and renaming the extension from `zip` to `mcpack`. Behavior and resource packs are installed globally and do not conflict with matching behavior or resource packs installed in worlds, projects, or templates. +手动创建方式: +- 将行为包、资源包或皮肤包目录的全部内容打包为 ZIP 文件后,将扩展名改为 `mcpack` +行为包与资源包会全局安装,不会与世界/项目/模板中安装的同名资源冲突。 -### Behavior Packs -Behavior packs are attached to servers to change or extend gameplay. Behavior packs are installed to the `behavior_packs` directory in the `com.mojang` folder. +### 行为包 +行为包用于修改或扩展游戏玩法,安装在 `com.mojang` 目录下的 `behavior_packs` 文件夹中。 -Development behavior packs must be placed in the `development_behavior_packs` directory under `com.mojang` manually. +开发中的行为包需手动放置到 `com.mojang` 下的 `development_behavior_packs` 目录。 -### Resource Packs -Resource packs are attached to clients to affect sounds, visuals, etc. Resource packs are installed to the `resource_packs` directory in the `com.mojang` folder. +### 资源包 +资源包用于修改客户端音效、视觉效果等,安装在 `com.mojang` 目录下的 `resource_packs` 文件夹中。 -Development resource packs must be placed in the `development_resource_packs` directory under `com.mojang` manually. +开发中的资源包需手动放置到 `com.mojang` 下的 `development_resource_packs` 目录。 -### Skin Packs -Skin packs are client-only packs for custom skins. Skin packs are installed to the `skin_packs` directory in the `com.mojang` folder. +### 皮肤包 +皮肤包是仅限客户端的自定义皮肤资源,安装在 `com.mojang` 目录下的 `skin_packs` 文件夹中。 -Development skin packs must be placed in the `development_skin_packs` directory under `com.mojang` manually, but this feature appears non-functional. +开发中的皮肤包需手动放置到 `com.mojang` 下的 `development_skin_packs` 目录,但此功能目前似乎不可用。 -## World Templates +## 世界模板 `mctemplate` -Package representing an individual behavior pack, resource pack, skin pack, or world template. It's recommended only to use `mctemplate` for world templates. +代表单个行为包、资源包、皮肤包或世界模板的压缩包。建议仅将 `mctemplate` 用于世界模板。 -World templates are installed to the `world_templates` directory under `com.mojang`. World templates can be constructed in a few different ways: -- Zipping the *contents* of a world directory, adding a world template manifest, and renaming the extension from `zip` to `mctemplate` -- In Editor mode, using the "Export Template" button on the Game settings screen for a world -- In Editor mode, running the `/project export template` command. The world will be saved to the `projectbackups` directory in the `com.mojang` folder. +世界模板安装在 `com.mojang` 目录下的 `world_templates` 文件夹中。创建方式: +- 将世界目录的**全部内容**打包为 ZIP 文件,添加模板清单文件后,将扩展名改为 `mctemplate` +- 在编辑器模式中点击游戏设置界面的"导出模板"按钮 +- 在编辑器模式中运行 `/project export template` 命令。存档将保存在 `com.mojang` 文件夹的 `projectbackups` 目录中 -# Composites -Composite archives are used to import up to *one* level archive and any number or combination of asset archives in a single import action. In general, contents to a composite must be packaged. Directories can also be given *on the top level* of a composite archive for importing asset types (behavior packs, resource packs, skin packs, and world templates) without needing to pre-package them. Nested sub-directories for organization may not be used. +# 复合文件 +复合文件用于在一次导入操作中同时导入**最多一个**世界文件及任意数量的资源文件。通常复合文件中的内容需要预先打包,但资源类型(行为包/资源包/皮肤包/世界模板)的原始目录也可直接放在复合文件顶层(不可使用嵌套子目录)。 -Composite contents are treated as usual. For example, importing a `mcaddon` contianing a `mcworld` while in Editor mode will import the world as a project. +复合文件的内容按常规方式处理。例如在编辑器模式导入包含 `mcworld` 的 `mcaddon` 时,世界文件会作为项目导入。 -Composite archives may also contain any number or nesting of other composite archives, even across *Minecraft* modes. Nested composite archives cannot be used to get around the singular world import restriction. +复合文件可包含任意数量或层级的其他复合文件(跨模式也可)。但嵌套复合文件不能突破单世界导入限制。 -Composites can only be constructed manually by zipping archives and asset types. +复合文件只能通过手动打包现有文件/目录创建。 -## Add-Ons +## 附加包 `mcaddon` -Generic composite content archive +通用复合内容存档 -Importing a `mcaddon` package while *Minecraft* is launched in Editor mode will import any contained world as a project. The imported world will then be inaccessible outside Editor mode and will need to be re-exported as a world for playing. Asset types are imported as usual. +在编辑器模式导入 `mcaddon` 时,包含的世界文件会作为项目导入。此时该世界将无法在编辑器模式之外访问,需重新导出为普通世界才能游玩。其他资源类型会正常导入。 -## Editor Add-Ons +## 编辑器附加包 `mceditoraddon` -Composite content archive for Editor mode +专用于编辑器模式的复合内容存档 -If *Minecraft* is not open, launching a `mcproject` file will open Editor mode. Importing a `mcproject` will fail if *Minecraft* is open but not in Editor mode. +若游戏未运行,打开 `mcproject` 文件会直接进入编辑器模式。若游戏已运行但未处于编辑器模式,导入 `mcproject` 文件会失败。 \ No newline at end of file diff --git a/docs/wiki/documentation/fog-ids.md b/docs/wiki/documentation/fog-ids.md index 9a0e3eb4..3864f220 100644 --- a/docs/wiki/documentation/fog-ids.md +++ b/docs/wiki/documentation/fog-ids.md @@ -1,92 +1,95 @@ --- -title: Fog IDs +title: 雾效ID mentions: - SirLich - MedicalJewel105 - TheItsNameless --- -## By Element X +# 雾效ID -| ID | Note | + + +## 按元素X分类 + +| ID | 说明 | | ---------------------------------------------- | -------------------------------------------------------------------------------- | -| minecraft:fog_bamboo_jungle | Fog used in the bamboo jungle. | -| minecraft:fog_bamboo_jungle_hills | Fog used in the bamboo jungle hills. | -| minecraft:fog_basalt_deltas | Fog used in the basalt deltas. Adds a gray-red tint to the edge of the sky | -| minecraft:fog_beach | Fog used in the beach biome. | -| minecraft:fog_birch_forest | Fog used in the birch forest | -| minecraft:fog_birch_forest_hills | Fog used in the birch forest hills biome. | -| minecraft:fog_cold_beach | Fog used in the cold beach biome. | -| minecraft:fog_cold_ocean | Fog used in the cold ocean biome. | -| minecraft:fog_cold_taiga | Fog used in the cold taiga biome. | -| minecraft:fog_cold_taiga_hills | Fog used in the cold taiga hills biome. | -| minecraft:fog_cold_taiga_mutated | Fog used in the mutated cold taiga biome. | -| minecraft:fog_crimson_forest | Fog used in the crimson forest biome. Adds a red tint to the edge of the sky | -| minecraft:fog_deep_cold_ocean | Fog used in the deep cold ocean biome. | -| minecraft:fog_deep_frozen_ocean | Fog used in the deep frozen ocean biome. | -| minecraft:fog_deep_lukewarm_ocean | Fog used in the deep lukewarm ocean biome. | -| minecraft:fog_deep_ocean | Fog used in the deep ocean biome. | -| minecraft:fog_deep_warm_ocean | Fog used in the deep warm ocean biome. | -| minecraft:fog_default | Default fog used in the game. | -| minecraft:fog_desert | Fog used in the desert biome. | -| minecraft:fog_desert_hills | Fog used in the desert hills biome. | -| minecraft:fog_extreme_hills | Fog used in the extreme hills biome. | -| minecraft:fog_extreme_hills_edge | Fog used in the extreme hills edge biome. | -| minecraft:fog_extreme_hills_mutated | Fog used in the mutated extreme hills biome. | -| minecraft:fog_extreme_hills_plus_trees | Fog used in the extreme hills with trees biome. | -| minecraft:fog_extreme_hills_plus_trees_mutated | Fog used in the mutated extreme hills with trees biome. | -| minecraft:fog_flower_forest | Fog used in the flower forest biome. | -| minecraft:fog_forest | Fog used in the forest biome. | -| minecraft:fog_forest_hills | Fog used in the forest hills biome. | -| minecraft:fog_frozen_ocean | Fog used in the frozen ocean biome. | -| minecraft:fog_frozen_river | Fog used in the frozen river biome. | -| minecraft:fog_hell | Fog used in the nether wastes biome. Adds a red tint to the edge of the sky | -| minecraft:fog_ice_mountains | Fog used in the ice mountains biome. | -| minecraft:fog_ice_plains | Fog used in the ice plains biome. | -| minecraft:fog_ice_plains_spikes | Fog used in the ice spikes biome. | -| minecraft:fog_jungle | Fog used in the jungle biome. | -| minecraft:fog_jungle_edge | Fog used in the jungle edge biome. | -| minecraft:fog_jungle_hills | Fog used in the jungle hills biome. | -| minecraft:fog_jungle_mutated | Fog used in the mutated jungle biome. | -| minecraft:fog_lukewarm_ocean | Fog used in the lukewarm ocean biome. | -| minecraft:fog_mega_spruce_taiga | Fog used in the mega spruce taiga biome. | -| minecraft:fog_mega_spruce_taiga_mutated | Fog used in the mega spruce mutated taiga biome. | -| minecraft:fog_mega_taiga | Fog used in the mega taiga biome. | -| minecraft:fog_mega_taiga_hills | Fog used in the mega taiga hills biome. | -| minecraft:fog_mega_taiga_mutated | Fog used in the mega mutated taiga biome. | -| minecraft:fog_mesa | Fog used in the mesa biome. | -| minecraft:fog_mesa_bryce | Fog used in the mesa bryce biome. | -| minecraft:fog_mesa_mutated | Fog used in the mutated mesa biome. | -| minecraft:fog_mesa_plateau | Fog used in the mesa plateau biome. | -| minecraft:fog_mesa_plateau_stone | Fog used in the stone mesa plateau biome. | -| minecraft:fog_mushroom_island | Fog used in the mushroom island biome. | -| minecraft:fog_mushroom_island_shore | Fog used in the mushroom island shore biome. | -| minecraft:fog_ocean | Fog used in the ocean biome. | -| minecraft:fog_plains | Fog used in the plains biome. | -| minecraft:fog_river | Fog used in the river biome. | -| minecraft:fog_roofed_forest | Fog used in the roofed forest biome. | -| minecraft:fog_savanna | Fog used in the savanna biome. | -| minecraft:fog_savanna_mutated | Fog used in the mutated savanna biome. | -| minecraft:fog_savanna_plateau | Fog used in the savanna plateau biome. | -| minecraft:fog_soulsand_valley | Fog used in the soulsand valley biome. Adds a dark green tint to the sky | -| minecraft:fog_stone_beach | Fog used in the stone beach biome. | -| minecraft:fog_sunflower_plains | Fog used in the sunflower plains biome. | -| minecraft:fog_swampland | Fog used in the swamp biome. | -| minecraft:fog_swampland_mutated | Fog used in the mutated swamp biome. | -| minecraft:fog_taiga | Fog used in the taiga biome. | -| minecraft:fog_taiga_hills | Fog used in the taiga hills biome. | -| minecraft:fog_taiga_mutated | Fog used in the mutated taiga hills biome. | -| minecraft:fog_the_end | Fog used in the end biome. Adds a black tint to the edge of the sky | -| minecraft:fog_warm_ocean | Fog used in the warm ocean biome. | -| minecraft:fog_warped_forest | Fog used in the warped forest biome. Adds a dark red tint to the edge of the sky | +| minecraft:fog_bamboo_jungle | 竹林生物群系使用的雾效 | +| minecraft:fog_bamboo_jungle_hills | 竹林丘陵生物群系使用的雾效 | +| minecraft:fog_basalt_deltas | 玄武岩三角洲生物群系使用的雾效,为天空边缘添加灰红色调 | +| minecraft:fog_beach | 沙滩生物群系使用的雾效 | +| minecraft:fog_birch_forest | 桦木林生物群系使用的雾效 | +| minecraft:fog_birch_forest_hills | 桦木林丘陵生物群系使用的雾效 | +| minecraft:fog_cold_beach | 寒冷沙滩生物群系使用的雾效 | +| minecraft:fog_cold_ocean | 寒冷海洋生物群系使用的雾效 | +| minecraft:fog_cold_taiga | 寒冷针叶林生物群系使用的雾效 | +| minecraft:fog_cold_taiga_hills | 寒冷针叶林丘陵生物群系使用的雾效 | +| minecraft:fog_cold_taiga_mutated | 突变寒冷针叶林生物群系使用的雾效 | +| minecraft:fog_crimson_forest | 绯红森林生物群系使用的雾效,为天空边缘添加红色调 | +| minecraft:fog_deep_cold_ocean | 深层寒冷海洋生物群系使用的雾效 | +| minecraft:fog_deep_frozen_ocean | 深层冰冻海洋生物群系使用的雾效 | +| minecraft:fog_deep_lukewarm_ocean | 深层温水海洋生物群系使用的雾效 | +| minecraft:fog_deep_ocean | 深层海洋生物群系使用的雾效 | +| minecraft:fog_deep_warm_ocean | 深层温暖海洋生物群系使用的雾效 | +| minecraft:fog_default | 游戏默认雾效 | +| minecraft:fog_desert | 沙漠生物群系使用的雾效 | +| minecraft:fog_desert_hills | 沙漠丘陵生物群系使用的雾效 | +| minecraft:fog_extreme_hills | 峭壁生物群系使用的雾效 | +| minecraft:fog_extreme_hills_edge | 峭壁边缘生物群系使用的雾效 | +| minecraft:fog_extreme_hills_mutated | 突变峭壁生物群系使用的雾效 | +| minecraft:fog_extreme_hills_plus_trees | 带树林的峭壁生物群系使用的雾效 | +| minecraft:fog_extreme_hills_plus_trees_mutated | 突变带树林的峭壁生物群系使用的雾效 | +| minecraft:fog_flower_forest | 繁花森林生物群系使用的雾效 | +| minecraft:fog_forest | 森林生物群系使用的雾效 | +| minecraft:fog_forest_hills | 森林丘陵生物群系使用的雾效 | +| minecraft:fog_frozen_ocean | 冰冻海洋生物群系使用的雾效 | +| minecraft:fog_frozen_river | 冰冻河流生物群系使用的雾效 | +| minecraft:fog_hell | 下界荒地生物群系使用的雾效,为天空边缘添加红色调 | +| minecraft:fog_ice_mountains | 冰封山脉生物群系使用的雾效 | +| minecraft:fog_ice_plains | 冰原生物群系使用的雾效 | +| minecraft:fog_ice_plains_spikes | 冰刺平原生物群系使用的雾效 | +| minecraft:fog_jungle | 丛林生物群系使用的雾效 | +| minecraft:fog_jungle_edge | 丛林边缘生物群系使用的雾效 | +| minecraft:fog_jungle_hills | 丛林丘陵生物群系使用的雾效 | +| minecraft:fog_jungle_mutated | 突变丛林生物群系使用的雾效 | +| minecraft:fog_lukewarm_ocean | 温水海洋生物群系使用的雾效 | +| minecraft:fog_mega_spruce_taiga | 巨型云杉针叶林生物群系使用的雾效 | +| minecraft:fog_mega_spruce_taiga_mutated | 突变巨型云杉针叶林生物群系使用的雾效 | +| minecraft:fog_mega_taiga | 巨型针叶林生物群系使用的雾效 | +| minecraft:fog_mega_taiga_hills | 巨型针叶林丘陵生物群系使用的雾效 | +| minecraft:fog_mega_taiga_mutated | 突变巨型针叶林生物群系使用的雾效 | +| minecraft:fog_mesa | 平顶山生物群系使用的雾效 | +| minecraft:fog_mesa_bryce | 布莱斯平顶山生物群系使用的雾效 | +| minecraft:fog_mesa_mutated | 突变平顶山生物群系使用的雾效 | +| minecraft:fog_mesa_plateau | 平顶山高原生物群系使用的雾效 | +| minecraft:fog_mesa_plateau_stone | 石质平顶山高原生物群系使用的雾效 | +| minecraft:fog_mushroom_island | 蘑菇岛生物群系使用的雾效 | +| minecraft:fog_mushroom_island_shore | 蘑菇岛海岸生物群系使用的雾效 | +| minecraft:fog_ocean | 海洋生物群系使用的雾效 | +| minecraft:fog_plains | 平原生物群系使用的雾效 | +| minecraft:fog_river | 河流生物群系使用的雾效 | +| minecraft:fog_roofed_forest | 黑森林生物群系使用的雾效 | +| minecraft:fog_savanna | 热带草原生物群系使用的雾效 | +| minecraft:fog_savanna_mutated | 突变热带草原生物群系使用的雾效 | +| minecraft:fog_savanna_plateau | 热带高原生物群系使用的雾效 | +| minecraft:fog_soulsand_valley | 灵魂沙峡谷生物群系使用的雾效,为天空边缘添加深绿色调 | +| minecraft:fog_stone_beach | 石滩生物群系使用的雾效 | +| minecraft:fog_sunflower_plains | 向日葵平原生物群系使用的雾效 | +| minecraft:fog_swampland | 沼泽生物群系使用的雾效 | +| minecraft:fog_swampland_mutated | 突变沼泽生物群系使用的雾效 | +| minecraft:fog_taiga | 针叶林生物群系使用的雾效 | +| minecraft:fog_taiga_hills | 针叶林丘陵生物群系使用的雾效 | +| minecraft:fog_taiga_mutated | 突变针叶林丘陵生物群系使用的雾效 | +| minecraft:fog_the_end | 末地生物群系使用的雾效,为天空边缘添加黑色调 | +| minecraft:fog_warm_ocean | 温暖海洋生物群系使用的雾效 | +| minecraft:fog_warped_forest | 诡异森林生物群系使用的雾效,为天空边缘添加深红色调 | -[Original Credit](https://www.youtube.com/watch?time_continue=52&v=SA79ulIgypg&feature=emb_logo) +[原始来源](https://www.youtube.com/watch?time_continue=52&v=SA79ulIgypg&feature=emb_logo) - -## Auto-generated +## 自动生成列表 -| ID | Biome used in | +| ID | 适用的生物群系 | | ---------------------------------------------- | -------------------------------- | | minecraft:fog_bamboo_jungle | bamboo_jungle | | minecraft:fog_bamboo_jungle_hills | bamboo_jungle_hills | @@ -159,5 +162,5 @@ mentions: | minecraft:fog_the_end | the_end | | minecraft:fog_warm_ocean | warm_ocean | | minecraft:fog_warped_forest | warped_forest | -*Last updated for 1.20.10* - +*最后更新于1.20.10版本* + \ No newline at end of file diff --git a/docs/wiki/documentation/index.md b/docs/wiki/documentation/index.md index 05e96e29..e31ea1ae 100644 --- a/docs/wiki/documentation/index.md +++ b/docs/wiki/documentation/index.md @@ -1,3 +1,3 @@ --- -title: Documentation +title: 文档 --- diff --git a/docs/wiki/documentation/materials.md b/docs/wiki/documentation/materials.md index 677355c0..7bf22ab5 100644 --- a/docs/wiki/documentation/materials.md +++ b/docs/wiki/documentation/materials.md @@ -1,8 +1,8 @@ --- -title: Vanilla Materials +title: 原版材质 show_toc: false tags: - - expert + - 专家 mentions: - SirLich - Luthorius @@ -11,15 +11,19 @@ mentions: - ThomasOrs --- +# 原版材质 + + + :::warning -Materials are not for the faint of heart. Be prepared for potential crashes, content log errors, and long loading times. +材质系统不适合心理承受能力较弱者。请做好应对潜在崩溃、内容日志错误和漫长加载时间的准备。 ::: -Materials are extremely useful for making entities more unique. You can make new ones for your addons, or use pre-existing vanilla materials. +材质在使实体更具独特性方面极为有用。您既可以为附加包创建新材质,也可以使用现有的原版材质。 -You can learn more about creating materials [here](/visuals/materials). +您可以通过[此链接](/wiki/visuals/materials)了解更多关于材质创建的内容。 -## List of Vanilla Materials +## 原版材质列表 | Vanilla_Material | | --------------------------------------------------------------------------------------- | @@ -81,339 +85,264 @@ You can learn more about creating materials [here](/visuals/materials). | [opaque_block_color](#opaque-block-color) | | [opaque_block_color_uv2](#opaque-block-color-uv2) | -## Properties +## 材质属性 -Materials can have a range of different properties which affect their appearance, including: +材质可具备多种影响外观的属性,包括: -### Backface-Culling +### 背面剔除(Backface-Culling) +使模型的内表面不被渲染。 -This makes the inside faces of models **not** render. +### Alpha通道 +启用半透明效果,使用纹理的Alpha通道。 -### Alpha Channel +### 自发光(Emissive) +使纹理不受暗光影响,呈现发光效果。若使用Alpha通道,每个像素的发光强度与其透明度成正比。 -Enables analogue translucency, usage of the alpha channel of textures. +### 固定透明度(Set Translucency) +无论其他属性如何,始终以预设透明度完全渲染。 -### Emissive +### 纹理混合(Texture Blending) +当存在多个纹理时,可根据纹理通过某种滤镜改变实体外观。 -Causes the texture to not be affected by dim lighting, and appear to glow. If there is usage of the alpha channel, the emissivity is in direct proportion to how transparent each individual pixel is. +## 材质细节说明 -### Set Translucency - -Regardless of other properties, is always completely rendered at a pre-determined translucency. - -### Texture Blending - -When multiple textures are present, may use a filter of sorts to change the entities appearance, based on the textures. - -## Details on the Materials - -The following is a last of each material, along with general known properties. The names are vague pointers to what each will do, some may act rather unpredictably, or have undocumented usages, so this only is what's certain for each: +以下是各材质的具体说明及已知属性。材质名称仅作功能提示,部分材质可能表现不稳定或存在未记录的用法,以下信息仅包含已验证内容: :::warning -The following section has currently **only** been tested for with single textures. Take it all with a pinch of salt. It is highly recommended to experiment with the materials yourself. +以下内容目前**仅针对单纹理**进行过测试,请谨慎参考。强烈建议自行实验材质效果。 ::: ### alpha_block - -- Backface-culling -- Completely Opaque +- 背面剔除 +- 完全不透明 ### alpha_block_color - -- Backface-Culling -- Translucencies as Transparent +- 背面剔除 +- 透明度处理为半透明 ### banner - -Inconsistently renders objects with transparency behind. - -- N/A +在透明物体后方渲染时表现不稳定 +- 无特殊属性 ### banner_pole - -Inconsistently renders objects with transparency behind. - -- Backface-Culling -- Transparency +在透明物体后方渲染时表现不稳定 +- 背面剔除 +- 透明效果 ### beacon_beam - -- Completely Opaque +- 完全不透明 ### beacon_beam_transparent - -This one is rather different. Particles that are behind it are rendered in front, and it appears to have "Frontface-Culling". - -- Alpha Channel +特性特殊:后方粒子会渲染在前方,呈现"正面剔除"效果 +- Alpha通道 ### charged_creeper - -Inconsistently renders objects with transparency behind. - -- Emissive -- Set Translucency +在透明物体后方渲染时表现不稳定 +- 自发光 +- 固定透明度 ### conduit_wind - -- Transparency -- Translucency as Transparency +- 透明效果 +- 透明度处理为半透明 ### entity - -- Completely Opaque -- Backface Culling +- 完全不透明 +- 背面剔除 ### entity_alphablend - -Inconsistently renders objects with transparency behind. - -- Backface-Culling -- Alpha Channel +在透明物体后方渲染时表现不稳定 +- 背面剔除 +- Alpha通道 ### entity_alphablend_nocolorentity_static - -- Unknown -- Potential Crash +- 未知属性 +- 可能导致崩溃 ### entity_alphatest - -- Transparency -- Translucency as Transparency +- 透明效果 +- 透明度处理为半透明 ### entity_alphatest_change_color - -- Transparency -- Translucency as Opaque +- 透明效果 +- 透明度处理为不透明 ### entity_alphatest_change_color_glint - -- Unknown +- 未知属性 ### entity_alphatest_glint - -- Unknown +- 未知属性 ### entity_alphatest_glint_item - -- Unknown +- 未知属性 ### entity_alphatest_multicolor_tint - -- Greyscale -- Backface-Culling -- Transparency -- Translucency as Opaque +- 灰度处理 +- 背面剔除 +- 透明效果 +- 透明度处理为不透明 ### entity_beam - -- Transparency -- Translucency as Transparency +- 透明效果 +- 透明度处理为半透明 ### entity_beam_additive - -Particles always render on top - -- Transparency -- Emissive -- Backface-Culling -- Set Translucency +粒子始终渲染在最上层 +- 透明效果 +- 自发光 +- 背面剔除 +- 固定透明度 ### entity_change_color - -- Completely Opaque +- 完全不透明 ### entity_change_color_glint - -- Unknown +- 未知属性 ### entity_custom - -Inconsistently renders objects with transparency behind. - -- Backface-Culling -- Alpha Channel +在透明物体后方渲染时表现不稳定 +- 背面剔除 +- Alpha通道 ### entity_dissolve_layer0 - -Inconsistently renders objects with transparency behind. - -- Unknown +在透明物体后方渲染时表现不稳定 +- 未知属性 ### entity_dissolve_layer1 - -- Unknown +- 未知属性 ### entity_emissive - -- Emissive -- Completely Opaque -- Backface-Culling +- 自发光 +- 完全不透明 +- 背面剔除 ### entity_emissive_alpha - -- Emissive -- Alpha Channel -- Transparency +- 自发光 +- Alpha通道 +- 透明效果 ### entity_emissive_alpha_one_sided - -- Emissive -- Alpha Channel -- Transparency -- Backface-Culling +- 自发光 +- Alpha通道 +- 透明效果 +- 背面剔除 ### entity_flat_color_line - -- Backface-Culling -- Completely Opaque +- 背面剔除 +- 完全不透明 ### entity_glint - -- Unknown +- 未知属性 ### entity_lead_base - -Inconsistently renders objects with transparency behind. - -- Alpha Channel +在透明物体后方渲染时表现不稳定 +- Alpha通道 ### entity_loyalty_rope - -- Unknown +- 未知属性 ### entity_multitexture - -- Unknown +- 未知属性 ### entity_multitexture_alpha_test - -- Unknown +- 未知属性 ### entity_multitexture_alpha_test_color_mask - -- Unknown +- 未知属性 ### entity_multitexture_color_mask - -- Unknown +- 未知属性 ### entity_multitexture_masked - -- Unknown +- 未知属性 ### entity_multitexture_multiplicative_blend - -- Unknown +- 未知属性 ### entity_nocull - -- Completely Opaque +- 完全不透明 ### guardian_ghost - -Inconsistently renders objects with transparency behind. - -- Backface-Culling -- Alpha Channel +在透明物体后方渲染时表现不稳定 +- 背面剔除 +- Alpha通道 ### item_in_hand - -- Completely Opaque -- Backface-Culling +- 完全不透明 +- 背面剔除 ### item_in_hand_entity_alphatest - -- Transparency -- Translucency into either Opaque or Transparent depends on level. +- 透明效果 +- 根据透明度等级决定是否透明 ### item_in_hand_entity_alphatest_color - -- Transparency -- Translucency into either Opaque or Transparent depends on level. +- 透明效果 +- 根据透明度等级决定是否透明 ### item_in_hand_glint - -- Unknown +- 未知属性 ### item_in_hand_multicolor_tint - -- Greyscale -- Completely Opaque -- Backface-Culling +- 灰度处理 +- 完全不透明 +- 背面剔除 ### map - -- Transparency -- Translucency into either Opaque or Transparent depends on level. +- 透明效果 +- 根据透明度等级决定是否透明 ### map_decoration - -- Backface-Culling -- Transparency -- Translucency into either Opaque or Transparent depends on level. +- 背面剔除 +- 透明效果 +- 根据透明度等级决定是否透明 ### map_marker - -- Backface-Culling -- Transparency -- Translucency into either Opaque or Transparent depends on level. -- Potential Crash +- 背面剔除 +- 透明效果 +- 根据透明度等级决定是否透明 +- 可能导致崩溃 ### moving_block - -- Completely Opaque -- Backface-Culling +- 完全不透明 +- 背面剔除 ### moving_block_alpha - -- Backface-Culling -- Transparency -- Translucency into either Opaque or Transparent depends on level. +- 背面剔除 +- 透明效果 +- 根据透明度等级决定是否透明 ### moving_block_alpha_seasons - -- Translucency into either Opaque or Transparent depends on level. -- Transparency +- 根据透明度等级决定是否透明 +- 透明效果 ### moving_block_alpha_single_side - -- Backface-Culling -- Transparency -- Translucency into either Opaque or Transparent depends on level. +- 背面剔除 +- 透明效果 +- 根据透明度等级决定是否透明 ### moving_block_blend - -Inconsistently renders objects with transparency behind. - -- Backface-Culling -- Alpha Channel +在透明物体后方渲染时表现不稳定 +- 背面剔除 +- Alpha通道 ### moving_block_double_side - -- Completely Opaque +- 完全不透明 ### moving_block_seasons - -- Completely Opaque -- Backface-Culling +- 完全不透明 +- 背面剔除 ### opaque_block - -- Completely Opaque -- Backface-Culling +- 完全不透明 +- 背面剔除 ### opaque_block_color - -- Completely Opaque -- Backface-Culling +- 完全不透明 +- 背面剔除 ### opaque_block_color_uv2 - -- Completely Opaque -- Backface-Culling - +- 完全不透明 +- 背面剔除 :::warning -Please note, that these have also only been tested using a RenderDragon platform. Non-RenderDragon visuals may differ. -::: - +请注意,以上测试结果均基于RenderDragon渲染平台。非RenderDragon的视觉效果可能存在差异。 +::: \ No newline at end of file diff --git a/docs/wiki/documentation/pack-structure.md b/docs/wiki/documentation/pack-structure.md index 6e12ff78..e7b70056 100644 --- a/docs/wiki/documentation/pack-structure.md +++ b/docs/wiki/documentation/pack-structure.md @@ -1,5 +1,5 @@ --- -title: Pack Folder Structure +title: 包文件夹结构 show_toc: false mentions: - SirLich @@ -12,6 +12,10 @@ mentions: - SmokeyStack --- +# 包文件夹结构 + + + + 'RP/ui/*.json' +]"> \ No newline at end of file diff --git a/docs/wiki/documentation/projectiles.md b/docs/wiki/documentation/projectiles.md index 20a82b8c..65f5a49f 100644 --- a/docs/wiki/documentation/projectiles.md +++ b/docs/wiki/documentation/projectiles.md @@ -1,5 +1,5 @@ --- -title: Projectiles +title: 投射物 mentions: - SirLich - stirante @@ -9,248 +9,250 @@ mentions: - ThomasOrs --- -## Overview +# 投射物 -This page intends to document all different fields you can use inside `minecraft:projectile` entity behavior component. + + +## 概述 + +本文档旨在记录`minecraft:projectile`实体行为组件中可使用的所有字段。 :::warning -_Disclaimer: this component has been mostly documented based on projectiles found in the game or reverse engineering the game._ -_This information was last tested on **1.18.2**._ +_免责声明:该组件的文档主要基于游戏中存在的投射物或通过逆向工程获得。_ +_最后测试版本为 **1.18.2**。_ ::: -| Name | Type | Default Value | Description | -| ------------------------- | ---------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| anchor | Integer | | | -| angle_offset | Decimal | 0 | Determines the angle at which the projectile is thrown | -| catch_fire | Boolean | false | If true, the entity hit will be set on fire | -| crit_particle_on_hurt | Boolean | false | If true, the projectile will produce critical hit particles when it happens | -| destroy_on_hurt | Boolean | false | If true, this entity will be destroyed when hit | -| filter | String | | Entity Definitions defined here can't be hurt by the projectile | -| fire_affected_by_griefing | Boolean | false | If true, whether the projectile causes fire is affected by the mob griefing game rule | -| gravity | Decimal | 0.05 | The gravity applied to this entity when thrown. The higher the value, the faster the entity falls | -| hit_ground_sound | String | | The sound that plays when the projectile hits ground | -| hit_sound | String | | The sound that plays when the projectile hits an entity | -| homing | Boolean | false | If true, the projectile homes in to the nearest. **Does not work on 1.18.2** entity | -| inertia | Decimal | 0.99 | The fraction of the projectile's speed maintained every frame while traveling in air | -| is_dangerous | Boolean | false | If true, the projectile will be treated as dangerous to the players | -| knockback | Boolean | true | If true, the projectile will knock back the entity it hits | -| lightning | Boolean | false | If true, the entity hit will be struck by lightning | -| liquid_inertia | Decimal | 0.6 | The fraction of the projectile's speed maintained every frame while traveling in water | -| multiple_targets | Boolean | true | If true, the projectile can hit multiple entities per flight | -| offset | Vector [a, b, c] | [0, 0.5, 0] | The offset from the entity's anchor where the projectile will spawn | -| on_fire_time | Decimal | 5 | Time in seconds that the entity hit will be on fire for | -| on_hit | Object | | Projectile's behavior on hit. More info [below](#on_hit) | -| particle | String | iconcrack | Particle to use upon collision | -| potion_effect | Integer | -1 | Defines the effect the arrow will apply to the entity it hits | -| power | Decimal | 1.3 | Determines the velocity of the projectile | -| reflect_on_hurt | Boolean | false | If true, this entity will be reflected back when hit | -| semi_random_diff_damage | Boolean | false | If true, damage will be randomized based on damage and speed | -| shoot_sound | String | | The sound that plays when the projectile is shot | -| shoot_target | Boolean | true | If true, the projectile will be shot towards the target of the entity firing it | -| should_bounce | Boolean | false | If true, the projectile will bounce upon hit | -| splash_potion | Boolean | false | If true, the projectile will be treated like a splash potion | -| splash_range | Decimal | 4 | Radius in blocks of the 'splash' effect | -| stop_on_hurt | Boolean | | | -| uncertainty_base | Decimal | 0 | The base accuracy. Accuracy is determined by the formula uncertaintyBase - difficultyLevel \* uncertaintyMultiplier | -| uncertainty_multiplier | Decimal | 0 | Determines how much difficulty affects accuracy. Accuracy is determined by the formula uncertaintyBase - difficultyLevel \* uncertaintyMultiplier | -| hit_water | Boolean | false | If true, liquid blocks will be treated as solid. **Requires "Education Edition" toggle active** | +| 字段名称 | 类型 | 默认值 | 描述 | +| ------------------------- | ----------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| anchor | 整数 | | | +| angle_offset | 小数 | 0 | 决定投射物被抛射时的角度 | +| catch_fire | 布尔值 | false | 若为true,被击中的实体将被点燃 | +| crit_particle_on_hurt | 布尔值 | false | 若为true,投射物在造成暴击时会产生特殊粒子效果 | +| destroy_on_hurt | 布尔值 | false | 若为true,投射物在击中时会被销毁 | +| filter | 字符串 | | 此处定义的实体类型不会被投射物伤害 | +| fire_affected_by_griefing | 布尔值 | false | 若为true,投射物的引燃效果受游戏规则"mobGriefing"影响 | +| gravity | 小数 | 0.05 | 投射物抛射时应用的引力值。数值越大下坠越快 | +| hit_ground_sound | 字符串 | | 投射物击中地面时播放的音效 | +| hit_sound | 字符串 | | 投射物击中实体时播放的音效 | +| homing | 布尔值 | false | 若为true,投射物会自动追踪最近目标。**在1.18.2版本中不可用** | +| inertia | 小数 | 0.99 | 投射物在空气中飞行时每帧保留的速度比例 | +| is_dangerous | 布尔值 | false | 若为true,投射物将被视为对玩家具有威胁性 | +| knockback | 布尔值 | true | 若为true,投射物会击退被击中的实体 | +| lightning | 布尔值 | false | 若为true,被击中的实体将遭受雷击 | +| liquid_inertia | 小数 | 0.6 | 投射物在水中飞行时每帧保留的速度比例 | +| multiple_targets | 布尔值 | true | 若为true,投射物在飞行过程中可以击中多个实体 | +| offset | 三维向量 [a,b,c] | [0, 0.5, 0] | 投射物生成时相对于实体锚点的偏移量 | +| on_fire_time | 小数 | 5 | 被击中实体持续燃烧的时间(秒) | +| on_hit | 对象 | | 投射物击中时的行为。详见[下方说明](#on_hit) | +| particle | 字符串 | iconcrack | 碰撞时使用的粒子效果 | +| potion_effect | 整数 | -1 | 定义箭矢击中实体时施加的药水效果 | +| power | 小数 | 1.3 | 决定投射物的初速度 | +| reflect_on_hurt | 布尔值 | false | 若为true,投射物被击中时会反弹 | +| semi_random_diff_damage | 布尔值 | false | 若为true,伤害值将基于基础伤害和速度进行随机计算 | +| shoot_sound | 字符串 | | 投射物发射时播放的音效 | +| shoot_target | 布尔值 | true | 若为true,投射物将朝向发射者的目标方向射出 | +| should_bounce | 布尔值 | false | 若为true,投射物击中时会反弹 | +| splash_potion | 布尔值 | false | 若为true,投射物将被视为喷溅药水 | +| splash_range | 小数 | 4 | '溅射'效果的半径(方块) | +| stop_on_hurt | 布尔值 | | | +| uncertainty_base | 小数 | 0 | 基础精准度。实际精准度计算公式为:uncertaintyBase - difficultyLevel \* uncertaintyMultiplier | +| uncertainty_multiplier | 小数 | 0 | 难度对精准度的影响系数。实际精准度计算公式为:uncertaintyBase - difficultyLevel \* uncertaintyMultiplier | +| hit_water | 布尔值 | false | 若为true,液态方块将被视为固体。**需要启用"教育版"功能** | ## on_hit -This object contains all behaviors, that can be executed, when projectile hits something. +该对象包含投射物击中目标时可执行的所有行为。 ### arrow_effect -_Exact behavior unknown_ +_具体作用未知_ ### teleport_owner -Teleports shooter to the hit location. +将发射者传送到击中位置。 ### catch_fire -_Exact behavior unknown_ - -Sets target on fire +_具体作用未知_ +点燃目标 ### ignite -_Exact behavior unknown_ - -Sets target on fire +_具体作用未知_ +点燃目标 ### remove_on_hit -Removes the projectile when it hits something. +击中目标后移除投射物。 ### douse_fire -_Exact behavior unknown_ +_具体作用未知_ ### impact_damage -Deals damage on hit. +造成碰撞伤害。 -| Name | Type | Description | -| ------------------------------ | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| damage | Integer/Integer Array [min, max] | Damage dealt to entity on hit | -| semi_random_diff_damage | Boolean | | -| max_critical_damage | Decimal | | -| min_critical_damage | Decimal | | -| power_multiplier | Decimal | | -| channeling | Boolean | | -| set_last_hurt_requires_damage | Boolean | | -| destroy_on_hit_requires_damage | Boolean | | -| filter | String | Entity to affect. Much more primitive than filters used elsewhere, as it cannot "test" for anything other than an identifier | -| destroy_on_hit | Boolean | | -| knockback | Boolean | | -| catch_fire | Boolean | Dictates wether or not targets will be engulfed in flames | +| 字段名称 | 类型 | 描述 | +| ------------------------------ | --------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| damage | 整数/整数数组 [min, max] | 对实体造成的伤害值 | +| semi_random_diff_damage | 布尔值 | | +| max_critical_damage | 小数 | | +| min_critical_damage | 小数 | | +| power_multiplier | 小数 | | +| channeling | 布尔值 | | +| set_last_hurt_requires_damage | 布尔值 | | +| destroy_on_hit_requires_damage | 布尔值 | | +| filter | 字符串 | 受影响的实体类型。此过滤器较为基础,只能通过标识符进行匹配 | +| destroy_on_hit | 布尔值 | | +| knockback | 布尔值 | | +| catch_fire | 布尔值 | 控制是否点燃目标 | ### definition_event -Calls an event on hit. +触发击中事件。 -| Name | Type | Description | -| ------------------ | ------- | --------------------------------------------------- | -| affect_projectile | Boolean | Event will be triggered for projectile entity | -| affect_shooter | Boolean | Event will be triggered for shooter entity | -| affect_target | Boolean | Event will be triggered for hit entity | -| affect_splash_area | Boolean | Event will be triggered for all entities in an area | -| splash_area | Decimal | Area of entities | -| event_trigger | Object | Event to trigger. Structure below. | +| 字段名称 | 类型 | 描述 | +| ---------------------- | -------- | ------------------------------------------- | +| affect_projectile | 布尔值 | 为投射物实体触发事件 | +| affect_shooter | 布尔值 | 为发射者实体触发事件 | +| affect_target | 布尔值 | 为被击中实体触发事件 | +| affect_splash_area | 布尔值 | 为区域内所有实体触发事件 | +| splash_area | 小数 | 实体作用范围半径 | +| event_trigger | 对象 | 要触发的事件。结构如下: | -| Name | Type | Description | -| ------- | ------ | ------------------------------------- | -| event | String | Event to trigger | -| target | String | Target of the event | -| filters | Object | Criteria required in order to trigger | +| 字段名称 | 类型 | 描述 | +| ----------- | -------- | ----------------------------- | +| event | 字符串 | 要触发的事件名称 | +| target | 字符串 | 事件目标 | +| filters | 对象 | 触发事件所需的过滤条件 | ### stick_in_ground -Sticks the projectile into the ground. +将投射物插入地面。 -| Name | Type | Description | -| ---------- | ------- | ----------- | -| shake_time | Decimal | | +| 字段名称 | 类型 | 描述 | +| -------------- | -------- | ---- | +| shake_time | 小数 | | ### spawn_aoe_cloud -Spawns an area of effect cloud of potion effect. +生成药水效果的区域云。 -| Name | Type | Description | -| ------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| radius | Decimal | Radius of the cloud | -| radius_on_use | Decimal | | -| potion | Integer | Lingering Potion ID | -| particle | String | [Vanilla Particles](/particles/vanilla-particles) emitter of the cloud. Only accepts Vanilla Particles. **dragonbreath** enables the usage of Bottles to obtain Dragon's Breath. | -| duration | Integer | Duration of the cloud in seconds | -| color | Integer array [r, g, b] | Color of the particles | -| affect_owner | Boolean | Is potion effect affecting the shooter. Does not appear to apply to the player | -| reapplication_delay | Integer | Delay in ticks between application of the potion effect | +| 字段名称 | 类型 | 描述 | +| ----------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| radius | 小数 | 云效果半径 | +| radius_on_use | 小数 | | +| potion | 整数 | 滞留药水ID | +| particle | 字符串 | 区域云的[原版粒子效果](/wiki/particles/vanilla-particles)。仅接受原版粒子。**dragonbreath**允许使用瓶子收集龙息 | +| duration | 整数 | 云效果持续时间(秒) | +| color | 整数数组 [r, g, b] | 粒子颜色 | +| affect_owner | 布尔值 | 药水效果是否影响发射者(对玩家无效) | +| reapplication_delay | 整数 | 药水效果重复施加的时间间隔(刻) | -#### Potion IDs +#### 药水ID -| Potion | Regular | Extended | Enhanced (Level II) | -| ------------------------- | ------- | -------- | ------------------- | -| Water Bottle | 0 | | | -| Mundane Potion | 1 | 2 | | -| Thick Potion | 3 | | | -| Awkward Potion | 4 | | | -| Potion of Night Vision | 5 | 6 | | -| Potion of Invisibility | 7 | 8 | | -| Potion of Leaping | 9 | 10 | 11 | -| Potion of Fire Resistance | 12 | 13 | | -| Potion of Swiftness | 14 | 15 | 16 | -| Potion of Slowness | 17 | 18 | | -| Potion of Water Breathing | 19 | 20 | | -| Potion of Healing | 21 | | 22 | -| Potion of Harming | 23 | | 24 | -| Potion of Poison | 25 | 26 | 27 | -| Potion of Regeneration | 28 | 29 | 30 | -| Potion of Strength | 31 | 32 | 33 | -| Potion of Weakness | 34 | 35 | | -| Potion of Decay | 36 | | | -| Potion of Turtle Master | 37 | 38 | 39 | -| Potion of Slow Falling | 40 | 41 | | -| Potion of Slowness IV | 42 | | | -| Potion of Crashing | 43+ | | | +| 药水名称 | 普通 | 延长版 | 强化版(II级) | +| ------------------------ | ------- | ------- | ------------- | +| 水瓶 | 0 | | | +| 平凡药水 | 1 | 2 | | +| 浓稠药水 | 3 | | | +| 粗制药水 | 4 | | | +| 夜视药水 | 5 | 6 | | +| 隐身药水 | 7 | 8 | | +| 跳跃药水 | 9 | 10 | 11 | +| 抗火药水 | 12 | 13 | | +| 迅捷药水 | 14 | 15 | 16 | +| 迟缓药水 | 17 | 18 | | +| 水肺药水 | 19 | 20 | | +| 治疗药水 | 21 | | 22 | +| 伤害药水 | 23 | | 24 | +| 剧毒药水 | 25 | 26 | 27 | +| 再生药水 | 28 | 29 | 30 | +| 力量药水 | 31 | 32 | 33 | +| 虚弱药水 | 34 | 35 | | +| 衰变药水 | 36 | | | +| 神龟药水 | 37 | 38 | 39 | +| 缓降药水 | 40 | 41 | | +| 迟缓IV药水 | 42 | | | +| 跳跃提升IV药水 | 43+ | | | ### spawn_chance -Spawns an entity on hit. +击中时生成实体。 -| Name | Type | Description | -| --------------------------- | ------- | ------------------------------------------- | -| first_spawn_percent_chance | Decimal | | -| second_spawn_percent_chance | Decimal | | -| first_spawn_count | Integer | | -| second_spawn_count | Integer | | -| spawn_definition | String | ID of the entity to spawn | -| spawn_baby | Boolean | Whether the spawned entity should be a baby | +| 字段名称 | 类型 | 描述 | +| ------------------------------- | -------- | ------------------------------- | +| first_spawn_percent_chance | 小数 | | +| second_spawn_percent_chance | 小数 | | +| first_spawn_count | 整数 | | +| second_spawn_count | 整数 | | +| spawn_definition | 字符串 | 要生成的实体ID | +| spawn_baby | 布尔值 | 生成的实体是否为幼体 | ### particle_on_hit -Spawns particles on hit. - -| Name | Type | Description | -| ------------- | ------- | -------------------------------------------------------- | -| particle_type | String | [Vanilla Particles](/particles/vanilla-particles) to use | -| num_particles | Integer | Number of particles | -| on_entity_hit | Boolean | Whether it should spawn particles on entity hit | -| on_other_hit | Boolean | Whether it should spawn particles on other hit | +击中时生成粒子效果。 +| 字段名称 | 类型 | 描述 | +| ----------------- | -------- | ----------------------------------------------- | +| particle_type | 字符串 | 使用的[原版粒子效果](/wiki/particles/vanilla-particles) | +| num_particles | 整数 | 粒子数量 | +| on_entity_hit | 布尔值 | 是否在击中实体时生成粒子 | +| on_other_hit | 布尔值 | 是否在其他碰撞时生成粒子 | ### mob_effect -Applies a mob effect to the target. +对目标施加生物状态效果。 -| Name | Type | Description | -| -------------- | ------- | ------------------------------------------- | -| effect | String | Effect | -| duration | Integer | Duration of the effect | -| durationeasy | Integer | Duration of the effect on easy difficulty | -| durationnormal | Integer | Duration of the effect on normal difficulty | -| durationhard | Integer | Duration of the effect on hard difficulty | -| amplifier | Integer | Effect amplifier | -| ambient | Boolean | | -| visible | Boolean | | +| 字段名称 | 类型 | 描述 | +| ------------------ | -------- | ------------------------------- | +| effect | 字符串 | 效果类型 | +| duration | 整数 | 效果持续时间 | +| durationeasy | 整数 | 简单难度下的持续时间 | +| durationnormal | 整数 | 普通难度下的持续时间 | +| durationhard | 整数 | 困难难度下的持续时间 | +| amplifier | 整数 | 效果等级 | +| ambient | 布尔值 | | +| visible | 布尔值 | | ### grant_xp -Despite the name, this actually spawns a number of experience orbs, being worth the amount stated. +尽管名称如此,该行为实际上是生成指定数量的经验球。 -| Name | Type | Description | -| ----- | ------- | ----------------------------------------------------------------------------------------------- | -| minXP | Integer | Minimum amount of experience to give | -| maxXP | Integer | Maximum amount of experience to give | -| xp | Integer | Constant amount of experience to give. When set, it will be used instead of min and max values. | +| 字段名称 | 类型 | 描述 | +| --------- | -------- | ------------------------------------------- | +| minXP | 整数 | 给予的最小经验值 | +| maxXP | 整数 | 给予的最大经验值 | +| xp | 整数 | 固定经验值。设置后将覆盖min和max值 | ### freeze_on_hit -_Exact behavior unknown_ +_具体作用未知_ -_Requires Education Edition toggle to be enabled._ -Freezes water on hit. +_需要启用教育版功能_ +冻结命中点周围的水。 -| Name | Type | Description | -| ------------- | ------- | ----------------------------- | -| shape | String | "sphere" or "cube" | -| snap_to_block | Boolean | | -| size | Integer | The size of the freeze effect | +| 字段名称 | 类型 | 描述 | +| ----------------- | -------- | --------------------- | +| shape | 字符串 | "sphere" 或 "cube" | +| snap_to_block | 布尔值 | | +| size | 整数 | 冻结效果的范围大小 | ### hurt_owner -_Exact behavior unknown. Right now it crashes minecraft probably because of wrong parameters_ +_具体作用未知。当前版本可能导致游戏崩溃(可能参数错误)_ -| Name | Type | Description | -| ------------ | ------- | ----------- | -| owner_damage | Integer | | -| knockback | Boolean | | -| ignite | Boolean | | +| 字段名称 | 类型 | 描述 | +| ---------------- | -------- | ---- | +| owner_damage | 整数 | | +| knockback | 布尔值 | | +| ignite | 布尔值 | | ### thrown_potion_effect -_Exact behavior unknown. Right now it crashes minecraft probably because it's only valid for thrown potions_ +_具体作用未知。当前版本可能导致游戏崩溃(可能仅适用于投掷药水)_ -## Additional Information -When it comes to creating a custom projectile, such as an arrow or trident variant, or something entirely your own, you may want to consider defining a [runtime identifier](/entities/runtime-identifier) to ensure that it acts as intended. Not doing so may result in unintended behaviour, from odd visuals to incorrect knockback direction and arrows that you can kill with your bare hands. \ No newline at end of file +## 补充说明 + +在创建自定义投射物(如箭矢变体或全新物品)时,建议定义[运行时标识符](/wiki/entities/runtime-identifier)来确保预期行为。未正确设置可能导致异常表现,包括显示错误、击退方向异常,甚至出现可用徒手摧毁的箭矢等问题。 \ No newline at end of file diff --git a/docs/wiki/documentation/queries.md b/docs/wiki/documentation/queries.md index 51185518..caf5fca9 100644 --- a/docs/wiki/documentation/queries.md +++ b/docs/wiki/documentation/queries.md @@ -1,5 +1,5 @@ --- -title: Molang Queries +title: Molang 查询 toc_max_level: 2 mentions: - SirLich @@ -17,142 +17,142 @@ mentions: - ThomasOrs --- -The bedrock documentation for Molang is notoriously bad. This page will attempt to remedy this by providing additional details for individual queries, _where possible_. This page is intended to be searched, not read in full. Use the side-bar, or use `ctrl-f` to navigate. +# Molang 查询 + + + +基岩版官方Molang文档存在诸多不足。本页面旨在通过为各个查询提供额外详细信息(在可能的情况下)改善这一现状。建议通过侧边栏导航或使用`Ctrl+F`进行搜索查阅,无需全文通读。 :::tip -This page is not an exhaustive list list! It only contains queries we've written extra information for. The full list of queries can be found [here](https://bedrock.dev/docs/stable/Molang#List%20of%20Entity%20Queries)! +本页面并非完整列表!仅包含我们补充了额外信息的查询。完整查询列表可访问[此处](https://bedrock.dev/docs/stable/Molang#List%20of%20Entity%20Queries)查看! ::: ## query.armor_texture_slot -Formatted like: `query.armor_texture_slot(x) = y`. +语法格式:`query.armor_texture_slot(x) = y` -Where `x` and `y` are both integer arguments, from the following table: +其中`x`和`y`均为整型参数,对应以下表格: -### X +### X 参数 -| Argument | Slot | -| -------- | ---------- | -| 0 | Helmet | -| 1 | Chestplace | -| 2 | Leggings | -| 3 | Boots | +| 参数值 | 装备槽位 | +| ------ | ---------- | +| 0 | 头盔 | +| 1 | 胸甲 | +| 2 | 护腿 | +| 3 | 靴子 | -### Y +### Y 参数(常规) -| Argument | Type | -| -------- | --------------------- | -| -1 | none | -| 0 | Leather armor piece | -| 1 | Chain armor piece | -| 2 | Iron armor piece | -| 3 | Diamond armor piece | -| 4 | Gold armor piece | -| 5 | Elytra | -| 6 | Turtle helmet | -| 7 | Netherite armor piece | +| 参数值 | 材质类型 | +| ------ | ------------------ | +| -1 | 无装备 | +| 0 | 皮革护甲 | +| 1 | 锁链护甲 | +| 2 | 铁护甲 | +| 3 | 钻石护甲 | +| 4 | 金护甲 | +| 5 | 鞘翅 | +| 6 | 海龟壳头盔 | +| 7 | 下界合金护甲 | -### Y for horses +### Y 参数(马匹) -| Argument | Type | -| -------- | --------------------- | -| 1 | Leather armor piece | -| 2 | Iron armor piece | -| 3 | Gold armor piece | -| 4 | Diamond armor piece | +| 参数值 | 材质类型 | +| ------ | ------------------ | +| 1 | 皮革马铠 | +| 2 | 铁马铠 | +| 3 | 金马铠 | +| 4 | 钻石马铠 | -### Example +### 示例 -`query.armor_texture_slot(3) == 1`: queries for Iron Boots. +`query.armor_texture_slot(3) == 1`:检测是否穿着铁靴子 ## query.armor_material_slot -Formatted like: `query.armor_material_slot(x) = y`. +语法格式:`query.armor_material_slot(x) = y` -Where `x` and `y` are both integer arguments, from the following table: +其中`x`和`y`均为整型参数,对应以下表格: -### X +### X 参数 -| Argument | Slot | -| -------- | ---------- | -| 0 | Helmet | -| 1 | Chestplace | -| 2 | Leggings | -| 3 | Boots | +| 参数值 | 装备槽位 | +| ------ | ---------- | +| 0 | 头盔 | +| 1 | 胸甲 | +| 2 | 护腿 | +| 3 | 靴子 | -### Y +### Y 参数(推测值) -Unknown, possibly: - -| Argument | Slot | -| -------- | -------------------------- | -| 0 | Default armor material | -| 1 | Enchanted armor material | -| 2 | Leather armor material | -| 3 | Leather enchanted material | +| 参数值 | 材质类型 | +| ------ | ---------------------- | +| 0 | 默认护甲材质 | +| 1 | 附魔护甲材质 | +| 2 | 皮革护甲材质 | +| 3 | 附魔皮革护甲材质 | ## query.armor_color_slot -_Notice: As of version `1.16.100.51`, this query is crashing minecraft. It might be fixed in later versions._ +*注意:截至版本`1.16.100.51`,此查询会导致游戏崩溃,可能在后续版本修复* -Formatted like: `color = query.armor_color_slot(slot, channel)`. +语法格式:`color = query.armor_color_slot(slot, channel)` -Where `slot` and `channel` are both integer arguments, from the following tables: +其中`slot`和`channel`均为整型参数,对应以下表格: -### Slot +### Slot 参数 -| Argument | Slot | -| -------- | ---------- | -| 0 | Helmet | -| 1 | Chestplace | -| 2 | Leggings | -| 3 | Boots | +| 参数值 | 装备槽位 | +| ------ | ---------- | +| 0 | 头盔 | +| 1 | 胸甲 | +| 2 | 护腿 | +| 3 | 靴子 | -### Channel +### Channel 参数 -| Argument | Slot | -| -------- | ------------- | -| 0 | Red channel | -| 1 | Green channel | -| 2 | Blue channel | -| 3 | Alpha channel | +| 参数值 | 颜色通道 | +| ------ | -------------- | +| 0 | 红色通道 | +| 1 | 绿色通道 | +| 2 | 蓝色通道 | +| 3 | 透明度通道 | -### Color +### 返回值 -Query returns color value in specified channel. +返回指定通道的颜色值(0-1范围) ## query.get_equipped_item_name :::warning -**DEPRECATED QUERY:** It is recommended to use the new query (`query.is_item_name_any`) if possible as it is more of an updated version of this query. However, this query will still continue to work in the future for backwards compatibility. +**已弃用查询**:建议优先使用新查询`query.is_item_name_any`,此查询未来仍会保留以兼容旧版本 ::: -Formatted like: `query.get_equipped_item_name('main_hand') = 'item_name'` +语法格式:`query.get_equipped_item_name('main_hand') = 'item_name'` -Takes one optional hand slot as a parameter (0 or 'main_hand' for main hand, 1 or 'off_hand' for off hand), and a second parameter (0=default) if you would like the equipped item or any non-zero number for the currently rendered item, and returns the name of the item in the requested slot (defaulting to the main hand if no parameter is supplied) if there is one, otherwise returns ''. +接受一个可选的手部槽位参数(0或'main_hand'表示主手,1或'off_hand'表示副手),第二个参数(0=默认)用于选择装备物品或当前渲染物品,返回对应槽位的物品名称(无参数时默认主手),无物品时返回空字符串。 -Where `item_name` is the item you want to test for. No namespace, and please notice the quotes. +`item_name`需使用不带命名空间的物品ID,注意保留引号 -Example: `"query.get_equipped_item_name == 'diamond'"` +示例:`"query.get_equipped_item_name == 'diamond'"` -**Can you test for items in the inventory? Yes! Using the new query `query.is_item_name_any`.** +**如何检测背包物品?可以使用新查询`query.is_item_name_any`!** ## query.get_name :::warning -**DEPRECATED QUERY:** It is recommended to use the new query (`query.is_name_any`) if possible as it is more of an updated version of this query. However, this query will still continue to work in the future for backwards compatibility. +**已弃用查询**:建议优先使用新查询`query.is_name_any`,此查询未来仍会保留以兼容旧版本 ::: -Formatted like: `query.get_name == 'Name'` +语法格式:`query.get_name == '名称'` -Turns true if actual in-game displayed name matches name (use OnixClient to see names in third view). -Needs to be used in special conditions. +当实体显示名称匹配时返回true(需使用OnixClient等工具查看第三方视角名称),需在特定条件下使用 - + -animation_controllers/ac.json - -```json +::: code-group +```json [animation_controllers/ac.json] { "format_version": "1.10.0", "animation_controllers": { @@ -174,7 +174,7 @@ Needs to be used in special conditions. ], "animations": [ { - "anim": "query.get_name == '...'" // You can use it only here! + "anim": "query.get_name == '...'" // 只能在此处使用! } ] } @@ -183,21 +183,20 @@ Needs to be used in special conditions. } } ``` +::: ## query.is_name_any -Formatted like: `query.get_name('Name1', 'Name2')`. -Takes one or more arguments. -Turns true if actual in-game displayed name matches one of the given names. -Needs to be used in special conditions. +语法格式:`query.is_name_any('名称1', '名称2')` - +接受一个或多个参数,当实体显示名称匹配任一参数时返回true,需在特定条件下使用 -animation_controllers/ac.json + -```json +::: code-group +```json [animation_controllers/ac.json] { "format_version": "1.10.0", "animation_controllers": { @@ -219,7 +218,7 @@ Needs to be used in special conditions. ], "animations": [ { - "anim": "query.is_name_any(...)" // You can use it only here! + "anim": "query.is_name_any(...)" // 只能在此处使用! } ] } @@ -228,340 +227,249 @@ Needs to be used in special conditions. } } ``` +::: ## query.is_item_name_any -Formatted like: `query.is_item_name_any('slot.weapon.mainhand', 0, 'namespace:item_name')` +语法格式:`query.is_item_name_any('slot.weapon.mainhand', 0, '命名空间:物品名称')` -Takes the equipment slot name first, followed by the slot index value, and then the list of item names with namespaces after it. +参数顺序:装备槽名称 → 槽位索引 → 带命名空间的物品名称列表 -Possible equipment slot are as follows: -| Slot Name | Slot Counts | Description | -| ---------------------- | ----------- | ----------------------------------------------------------------------------------- | -| `slot.weapon.mainhand` | 0 | Usually any held items are in here | -| `slot.weapon.offhand` | 0 | Offhand slot for things like `Shield`, `Totem of Undying` or a `Map` | -| `slot.armor.head` | 0 | Head armor piece | -| `slot.armor.chest` | 0 | Chestplate armor piece | -| `slot.armor.legs` | 0 | Leggings armor piece | -| `slot.armor.feet` | 0 | Boots armor piece | -| `slot.armor` | 0 | Horse armor | -| `slot.saddle` | 0 | Saddle slot | -| `slot.hotbar` | 0 to 8 | Player hotbar slots | -| `slot.inventory` | 0+ (varies) | Entities that has an inventory, like the player, minecart with chests, donkey, etc. | -| `slot.enderchest` | 0 to 26 | Ender chest inventory for players only | +可用槽位列表: +| 槽位名称 | 槽位数 | 说明 | +| -------------------- | ------ | ----------------------------- | +| `slot.weapon.mainhand` | 0 | 主手持握物品 | +| `slot.weapon.offhand` | 0 | 副手(盾牌、地图等) | +| `slot.armor.head` | 0 | 头部护甲 | +| `slot.armor.chest` | 0 | 胸甲 | +| `slot.armor.legs` | 0 | 护腿 | +| `slot.armor.feet` | 0 | 靴子 | +| `slot.armor` | 0 | 马铠 | +| `slot.saddle` | 0 | 鞍具 | +| `slot.hotbar` | 0-8 | 玩家快捷栏 | +| `slot.inventory` | 可变 | 实体库存(箱子矿车、驴等) | +| `slot.enderchest` | 0-26 | 末影箱(仅玩家) | -### Test for items within the player's inventory +### 检测玩家背包物品 -Formatted like: `t.val = 0; t.i = 0; loop(27, {t.val = q.is_item_name_any('slot.inventory', t.i, 'namespace:item_name'); t.val ? {return t.val;}; t.i = t.i+1;});` - -Replace `namespace:item_name` with any item you wish to check for. This simply loops through all 27 slots of the inventory and returns `1.0` if it has found any slot that has the specified item provided. Note that the hotbar is in a different slot from the main inventory slot so you will have to check that separately. +示例代码: +```molang +t.val = 0; +t.i = 0; +loop(27, { + t.val = q.is_item_name_any('slot.inventory', t.i, '命名空间:物品名称'); + t.val ? {return t.val;}; + t.i = t.i+1; +}); +``` +替换`命名空间:物品名称`为目标物品,此代码会遍历27个背包槽位,检测到目标物品时返回1.0。注意快捷栏与主背包槽位独立,需分开检测。 ## query.is_enchanted -Formatted like: `is_enchanted = query.is_enchanted`. +语法格式:`is_enchanted = query.is_enchanted` -Return 1.0 or 0.0 based on whether the entity is enchanted. +返回1.0(已附魔)或0.0(未附魔) -_Currently, can be only used in materials._ +*目前仅能在材质中使用* ## query.is_eating -This query tracks when certain entities are 'eating'. It's not used for the player. To trigger, use one of the following components: - - `minecraft:behavior.eat_carried_item` - - `minecraft:behavior.snacking` +检测实体是否处于"进食"状态(不适用于玩家)。需配合以下组件使用: +- `minecraft:behavior.eat_carried_item` +- `minecraft:behavior.snacking` ## query.is_ghost -Formatted like: `is_ghost = query.is_ghost`. +语法格式:`is_ghost = query.is_ghost` -Return 1.0 or 0.0 based on whether the entity is a ghost. +返回1.0(幽灵实体)或0.0 -_Currently, only returns 1.0 for a guardian ghost and is used by its renderer._ +*当前仅对守护者幽灵有效,用于渲染控制* ## query.is_grazing -Formatted like: `is_grazing = query.is_grazing`. +语法格式:`is_grazing = query.is_grazing` -Return 1.0 or 0.0 based on whether the entity is eating a block. +检测实体是否在啃食方块(如绵羊吃草) -_Currently, only returns 1.0 for a sheep and entities using runtime identifier of a sheep._ +*目前仅对绵羊及使用绵羊运行ID的实体有效* ## query.is_jumping -Formatted like: `is_jumping = query.is_jumping`. +语法格式:`is_jumping = query.is_jumping` -Return 1.0 or 0.0 based on whether the entity is jumping. +返回1.0(跳跃中)或0.0 -For the player, conditions for its activation are: - -- the jump button is pressed (includes being in water and climbing a scaffolding) -- OR auto-jump is triggered -- OR swimming with auto-jump -- OR charging the jump of a ridable entity +玩家触发条件: +- 按下跳跃键(包含水中跳跃、攀爬脚手架) +- 自动跳跃触发 +- 游泳时自动跳跃 +- 骑乘实体蓄力跳跃 ## query.modified_move_speed -Formatted like: `modified_move_speed = query.modified_move_speed`. +语法格式:`modified_move_speed = query.modified_move_speed` -Returns the current walk speed of the entity modified by status flags such as is_baby or on_fire +返回实体当前移动速度(受幼体、着火等状态影响) -Value example: - -- Player is walking: around 0.86 -- Player is sprinting: 1.0 -- Player is sprinting and jumping: 0.35 -- Player is walking on fire: 1.0 -- Player is sprinting on fire: 1.0 -- Player is sprinting and jumping on fire: 0.525 +参考值: +- 行走:约0.86 +- 疾跑:1.0 +- 疾跑跳跃:0.35 +- 着火行走:1.0 +- 着火疾跑:1.0 +- 着火疾跑跳跃:0.525 ## query.log -Content log is NOT debug log, they're different files. `query.log` outputs to the debug log only. +将日志输出到调试日志(注意:content log与debug log不同) ## query.on_fire_time -Formatted like: `on_fire_time = query.on_fire_time`. +语法格式:`on_fire_time = query.on_fire_time` -Returns the time in ticks since the entity started or stopped being on fire, else it returns 0.0 +返回实体着火/灭火后的持续时间(刻),未着火时返回0.0 -Value example: - -- Entity is summoned: value is 0 -- Entity is ignited: value is 0 and starts counting up 1 every tick -- Entity is on fire for 2 seconds already: value is 40 and still counts up 1 every tick -- Entity stops being on fire: value resets to 0 and continues to count up 1 every tick despite not being on fire -- Entity is ignited second time: value resets to 0 and continues counting up 1 every tick -- Entity stops being on fire the second time: value resets to 0 and continues to count up 1 every tick despite not being on fire - -Basically it's tick timer that starts after entity is first ignited and resets every time it changes from/to being on fire. +计时规则: +- 实体生成:0 +- 点燃:开始递增(1刻/次) +- 灭火:重置0并继续递增 +- 重复点燃/灭火:每次状态变化重置计时 ## query.scoreboard -Formatted like: `query.scoreboard('objective_name') > 0` +语法格式:`query.scoreboard('计分项名称') > 数值` -Returns 1.0 or 0.0 if the queried value is within the specified range provided. Or based on score count, molang operator and number. +根据计分板值返回1.0或0.0 -Note that sometimes it might not work because of unknown reasons. One of which is that this cannot query scoreboard objective names with uppercase letters. In this case, for example, objective `testfoo` will work but **not** `testFoo`. +注意: +- 无法检测含大写字母的计分项(如`testFoo`无效,需使用`testfoo`) +- 部分情况可能异常 ## query.structural_integrity -Formatted like: `structural_integrity = query.structural_integrity`. +语法格式:`structural_integrity = query.structural_integrity` -Used by boats and minecarts for destroying it. It will decrease when attacking the entity and will recover with time. -Probably unusable by anything other than boats and minecarts. +用于船和矿车的耐久系统(受攻击减少,随时间恢复) + +*可能无法用于其他实体* ## variable.attack_time -### Explanation +### 说明 -This variable is setup as IF it was a query. In other words, it can be used on any entity, both on the client and server, regardless of whether you setup/define the variable correctly. +该变量作为查询使用,可在任意实体(客户端/服务端)生效,无需预先定义 -### For entities +### 实体行为 -The variable tracks when the entity is swinging to attack. When not attacking, it will return 0.0, when attacking it will range from 0.0 to the total attack time, which may be around 0.3 or something similar. For players, this value ranges from 0.0 to 1.0. The variable returns a percentage, in the form of a decimal, for how far into the attack the entity is. For example, if an entity is halfway into its attack swing, then the variable will return 0.5. It increments linearly. +追踪实体攻击动作进度: +- 未攻击:0.0 +- 攻击中:0.0~总攻击时间(约0.3) +- 玩家:0.0~1.0(线性增长) -### For the Player +### 玩家行为 -For the player, the variable will track whenever the arm bones are swinging, this includes: - -- placing blocks -- placing entities -- interacting (when swing is enabled) -- melee attack +追踪手臂摆动动作(包含以下情况): +- 放置方块 +- 放置实体 +- 交互动作(当启用摆动时) +- 近战攻击 ## query.is_roaring -Evaluates to true when a `knockback_roar` attack is happening. +当实体执行`knockback_roar`攻击时返回true ## query.head_x_rotation -Formatted like: `query.head_x_rotation(x)` +语法格式:`query.head_x_rotation(x)` -Where `x` specifies the head of the entity. It is not really relevant for any entity but the wither. +`x`参数指定头部编号(主要用于凋灵) -Returns head pitch. looking up returns `-89.9`, looking all the way down returns `89.9`. +返回值: +- 仰角(向上-89.9,向下89.9) ## query.head_y_rotation -Formatted like: `query.head_y_rotation(x)` +语法格式:`query.head_y_rotation(x)` -Where `x` specifies the head of the entity. It is not really relevant for any entity but the wither. +`x`参数指定头部编号(主要用于凋灵) -Returns yaw of the head from `-179.9` to `179.9`. the values wrap around so like if you are at `-179.9` and you turn just a little bit, it instantly goes to `179.9`. +返回值: +- 偏航角(-179.9~179.9,循环变化) -## query.target_x_rotation and query.target_y_rotation +## query.target_x_rotation 与 query.target_y_rotation -Identical to the respective `query.head_*_rotation`, however has no optional argument for selecting head. +功能同`query.head_*_rotation`,但无需指定头部参数 ## query.time_of_day -Returns the time of day (midnight=0.0, sunrise=0.25, noon=0.5, sunset=0.75) of the dimension the entity is in. -Day time is calculated via this formula: +返回维度时间(午夜=0.0,日出=0.25,正午=0.5,日落=0.75) -`f(x) = (x*0.25/2400)mod 1` +计算公式:`(当前刻数*0.25/2400) mod 1` -query.time_of_day - day time table +时间对应表: - + -| `query.time_of_day` | Day Time | -| ------------------- | -------- | -| 0.00 | 18000 | -| 0.01 | 18240 | -| 0.02 | 18480 | -| 0.03 | 18720 | -| 0.04 | 18960 | -| 0.05 | 19200 | -| 0.06 | 19440 | -| 0.07 | 19680 | -| 0.08 | 19920 | -| 0.09 | 20162 | -| 0.10 | 20400 | -| 0.11 | 20640 | -| 0.12 | 20880 | -| 0.13 | 21120 | -| 0.14 | 21360 | -| 0.15 | 21602 | -| 0.16 | 21840 | -| 0.17 | 22080 | -| 0.18 | 22322 | -| 0.19 | 22560 | -| 0.20 | 22800 | -| 0.21 | 23040 | -| 0.22 | 23280 | -| 0.23 | 23520 | -| 0.24 | 23760 | -| 0.25 | 0 | -| 0.26 | 240 | -| 0.27 | 480 | -| 0.28 | 720 | -| 0.29 | 960 | -| 0.30 | 1202 | -| 0.31 | 1440 | -| 0.32 | 1680 | -| 0.33 | 1922 | -| 0.34 | 2160 | -| 0.35 | 2400 | -| 0.36 | 2642 | -| 0.37 | 2880 | -| 0.38 | 3120 | -| 0.39 | 3360 | -| 0.40 | 3600 | -| 0.41 | 3840 | -| 0.42 | 4080 | -| 0.43 | 4320 | -| 0.44 | 4560 | -| 0.45 | 4800 | -| 0.46 | 5040 | -| 0.47 | 5280 | -| 0.48 | 5520 | -| 0.49 | 5760 | -| 0.50 | 6000 | -| 0.51 | 6240 | -| 0.52 | 6480 | -| 0.53 | 6720 | -| 0.54 | 6960 | -| 0.55 | 7200 | -| 0.56 | 7440 | -| 0.57 | 7680 | -| 0.58 | 7920 | -| 0.59 | 8160 | -| 0.60 | 8402 | -| 0.61 | 8640 | -| 0.62 | 8880 | -| 0.63 | 9120 | -| 0.64 | 9360 | -| 0.65 | 9600 | -| 0.66 | 9842 | -| 0.67 | 10080 | -| 0.68 | 10320 | -| 0.69 | 10560 | -| 0.70 | 10800 | -| 0.71 | 11040 | -| 0.72 | 11282 | -| 0.73 | 11520 | -| 0.74 | 11760 | -| 0.75 | 12000 | -| 0.76 | 12240 | -| 0.77 | 12480 | -| 0.78 | 12720 | -| 0.79 | 12962 | -| 0.80 | 13200 | -| 0.81 | 13440 | -| 0.82 | 13680 | -| 0.83 | 13920 | -| 0.84 | 14160 | -| 0.85 | 14402 | -| 0.86 | 14640 | -| 0.87 | 14880 | -| 0.88 | 15120 | -| 0.89 | 15360 | -| 0.90 | 15600 | -| 0.91 | 15842 | -| 0.92 | 16080 | -| 0.93 | 16320 | -| 0.94 | 16560 | -| 0.95 | 16800 | -| 0.96 | 17040 | -| 0.97 | 17282 | -| 0.98 | 17520 | -| 0.99 | 17760 | -| 1.00 | 18000 | +| query.time_of_day | 游戏刻数 | +| ----------------- | -------- | +| 0.00 | 18000 | +| 0.25 | 0 | +| 0.50 | 6000 | +| 0.75 | 12000 | +| ... | ... | -Credit: [Analysis of query.time_of_day](https://gist.github.com/DoubleF3lix/a03afde0a979dfa41e8525ee92f12ca5) +*完整表格详见原文档* -## query.eye_target_x_rotation and query.eye_target_y_rotation +## query.eye_target_x_rotation 与 query.eye_target_y_rotation -Not valid for player. not really sure what its good for. +不适用于玩家,具体用途待验证 ## variable.short_arm_offset_right -Returns the offset factor for the player's rightarm bone compared to the default skin geometry. Slim-armed (3 pixel wide) skins will return `0.5` when equipped on the player. Normal (4 pixel wide) skins will return `0.0` when equipped on the player. Note: the player must go into 1st person perspective at least once for this variable to be initialized and usable elsewhere on the entity. +返回玩家右臂骨骼偏移因子: +- 细臂皮肤(3像素宽):0.5 +- 常规皮肤(4像素宽):0.0 + +*注意:需进入第一人称视角初始化变量* ## variable.short_arm_offset_left -Identical behavior to `variable.short_arm_offset_right` except it references the player leftarm bone. +功能同`variable.short_arm_offset_right`,对应左臂骨骼 ## query.movement_direction -Returns one of the 3 components from the normalized vector of the entity movement meaning the magnitude/modulus/length of the vector is between 0 and 1. +返回实体移动方向向量的归一化分量(模长0~1) -**Note**: As of writing the documentation, the value returned from any of the axis will change depending on the speed of the entity (If the entity is on the ground the value will be less than the value of the entity if it were in the air even if it is moving in the same direction). +注意:实际值受移动速度影响(地面移动值小于空中相同方向) -To get the actual normalized velocity vector of the entity movement you will have to normalize the values. Here is the Molang setup: - -``` -variable.mag = math.sqrt( math.pow( query.movement_direction(0), 2 ) + math.pow( query.movement_direction(1), 2) + math.pow( query.movement_direction(2), 2)); -variable.xNorm = query.movement_direction(0) / variable.mag; -variable.yNorm = query.movement_direction(1) / variable.mag; -variable.zNorm = query.movement_direction(2) / variable.mag; +归一化处理示例: +```molang +variable.mag = math.sqrt(math.pow(query.movement_direction(0),2) + ...); +variable.xNorm = query.movement_direction(0)/variable.mag; +// y/z同理 ``` -For more information on normalized vectors you can play around with this Desmos graph +| 参数 | 轴向 | +| ---- | ---- | +| 0 | X轴 | +| 1 | Y轴 | +| 2 | Z轴 | -| Argument | Axis | -| -------- | ---- | -| 0 | X | -| 1 | Y | -| 2 | Z | +## query.block_neighbor_has_any_tag 与 query.relative_block_has_any_tag -## query.block_neighbor_has_any_tag and query.relative_block_has_any_tag +*需启用`Experimental Molang Features`* -Requires `Experimental Molang Features` to use. From the docs `Takes a relative position and one or more tag names, and returns either 0 or 1 based on if the block at that position has any of the tags provided`. This is useful for using connecting blocks or detecting entities. +语法: +- `q.block_neighbor_has_any_tag(x,y,z,'标签')` +- `q.relative_block_has_any_tag(x,y,z,'标签')` -`query.block_neighbor_has_any_tag` - Takes block position -`query.relative_block_has_any_tag` - Takes entity position +示例: +- `q.relative_block_has_any_tag(0,-1,0,'grass')`:检测实体下方草方块 +- 支持多标签检测:`q.query(0,-1,0,'grass','plant')` -The syntax for it is `q.block_neighbor_has_any_tag(x,y,z,'tag_name')` and `q.relative_block_has_any_tag(x,y,z,'tag_name')`. - -Example: -- `q.relative_block_has_any_tag(0,-1,0,'grass')` would try to detect a block with the grass tag one block under the entity. -- `q.block_neighbor_has_any_tag(0,-1,0,'grass')` would try to detect a block with the grass tag one block under the block. - -To do multiple tags you would use `q.correct_query(0,-1,0,'grass', 'plant')` with `correct_query` being replaced by the right query. - -Note that this can also detect custom tags and [vanilla tags](/blocks/block-tags) +可检测原版与[自定义方块标签](/wiki/blocks/block-tags) \ No newline at end of file diff --git a/docs/wiki/documentation/shared-constructs.md b/docs/wiki/documentation/shared-constructs.md index d06437f0..03e81ec5 100644 --- a/docs/wiki/documentation/shared-constructs.md +++ b/docs/wiki/documentation/shared-constructs.md @@ -1,5 +1,5 @@ --- -title: Shared Constructs +title: 共享结构体 nav_order: 1 tags: - Stable @@ -9,32 +9,34 @@ mentions: - ThomasOrs --- -A few JSON constructs are expressible in multiple locations in the add-ons system. +# 共享结构体 -## Range Objects -Range objects define a spread between two numbers. + -Range Object Example +在附加包系统中,部分JSON结构体可以在多个模块中通用。 -```json +## 范围对象 +范围对象用于定义两个数值之间的区间。 + +::: code-group +```json [范围对象示例] { "min": 2, "max": 4 } ``` -When provided, a random value will be selected inclusively between the minimum and maximum. Rolls are not retained; a new random value will be rolled each instance the range object would be used. The maximum must not be less than the minimum, but they may be equal to affix rolls to a specific value. +当使用该对象时,系统会在最小值(含)和最大值(含)之间随机选取一个数值。每次调用范围对象都会重新进行随机取值。最大值不可小于最小值,但允许两者相等以实现固定取值。 -## Fraction Objects -Fraction objects define a fraction using a numerator and denominator. +## 分数对象 +分数对象通过分子和分母定义分数关系。 -Fraction Object Example - -```json +::: code-group +```json [分数对象示例] { "numerator": 3, "denominator": 5 } ``` -The value used in place of the object will be the computed division, `numerator` ÷ `denominator`. Both the numerator and denominator must be at least `1`, and the denominator cannot be equal to the numerator. \ No newline at end of file +该对象在计算时将使用分子除以分母的商值(即 `分子` ÷ `分母`)。分子和分母的数值必须大于等于 `1`,且分母不能等于分子(即不能形成值为1的分数)。 \ No newline at end of file diff --git a/docs/wiki/3-实体/2-巧思案例/boat-entities.md b/docs/wiki/entities/boat-entities.md similarity index 94% rename from docs/wiki/3-实体/2-巧思案例/boat-entities.md rename to docs/wiki/entities/boat-entities.md index 6f1afc17..a77216b7 100644 --- a/docs/wiki/3-实体/2-巧思案例/boat-entities.md +++ b/docs/wiki/entities/boat-entities.md @@ -1,6 +1,6 @@ --- title: 创建船只 -category: 教程 +category: 巧思案例 tags: - 配方 - 进阶 @@ -24,7 +24,7 @@ mentions: ## 使用运行时标识符 -详细内容请参阅[运行时标识符指南](/entities/runtime-identifier)。使用运行时标识符可以实现船只的大部分硬编码行为,但会导致船只无法随玩家转向且始终面向北方。 +详细内容请参阅[运行时标识符指南](/wiki/entities/runtime-identifier)。使用运行时标识符可以实现船只的大部分硬编码行为,但会导致船只无法随玩家转向且始终面向北方。 ## 利用组件系统实现 diff --git a/docs/wiki/3-实体/2-巧思案例/detecting-other-entities.md b/docs/wiki/entities/detecting-other-entities.md similarity index 96% rename from docs/wiki/3-实体/2-巧思案例/detecting-other-entities.md rename to docs/wiki/entities/detecting-other-entities.md index a24d37dd..396e9b18 100644 --- a/docs/wiki/3-实体/2-巧思案例/detecting-other-entities.md +++ b/docs/wiki/entities/detecting-other-entities.md @@ -1,6 +1,6 @@ --- title: 侦测其他实体 -category: 教程 +category: 巧思案例 tags: - 中级 mentions: @@ -72,7 +72,7 @@ mentions: ``` ::: -首个动画用于检测实体存在,第二个检测实体离开。可通过`/event`命令添加[虚拟组件](/entities/dummy-components)或更新[实体属性](https://learn.microsoft.com/zh-cn/minecraft/creator/documents/introductiontoentityproperties)。 +首个动画用于检测实体存在,第二个检测实体离开。可通过`/event`命令添加[虚拟组件](/wiki/entities/dummy-components)或更新[实体属性](https://learn.microsoft.com/zh-cn/minecraft/creator/documents/introductiontoentityproperties)。 ::: code-group ```json [BP/animation_controllers/pig_animation_controllers.json] diff --git a/docs/wiki/3-实体/2-巧思案例/disabling-team-damage.md b/docs/wiki/entities/disabling-team-damage.md similarity index 99% rename from docs/wiki/3-实体/2-巧思案例/disabling-team-damage.md rename to docs/wiki/entities/disabling-team-damage.md index 85cdb3aa..18b96c8e 100644 --- a/docs/wiki/3-实体/2-巧思案例/disabling-team-damage.md +++ b/docs/wiki/entities/disabling-team-damage.md @@ -1,6 +1,6 @@ --- title: 禁用团队伤害 -category: 教程 +category: 巧思案例 tags: - 中级 mentions: diff --git a/docs/wiki/3-实体/3-文档/dummy-components.md b/docs/wiki/entities/dummy-components.md similarity index 100% rename from docs/wiki/3-实体/3-文档/dummy-components.md rename to docs/wiki/entities/dummy-components.md diff --git a/docs/wiki/3-实体/2-巧思案例/dummy-entities.md b/docs/wiki/entities/dummy-entities.md similarity index 99% rename from docs/wiki/3-实体/2-巧思案例/dummy-entities.md rename to docs/wiki/entities/dummy-entities.md index bdd9e598..32474d5e 100644 --- a/docs/wiki/3-实体/2-巧思案例/dummy-entities.md +++ b/docs/wiki/entities/dummy-entities.md @@ -1,6 +1,6 @@ --- title: 虚拟实体 -category: 教程 +category: 巧思案例 tags: - 初学者 mentions: diff --git a/docs/wiki/3-实体/2-巧思案例/entity-attack.md b/docs/wiki/entities/entity-attack.md similarity index 97% rename from docs/wiki/3-实体/2-巧思案例/entity-attack.md rename to docs/wiki/entities/entity-attack.md index 37fee515..165ded19 100644 --- a/docs/wiki/3-实体/2-巧思案例/entity-attack.md +++ b/docs/wiki/entities/entity-attack.md @@ -1,6 +1,6 @@ --- title: 实体攻击机制 -category: 教程 +category: 巧思案例 mentions: - Luthorius - TheDoctor15 @@ -27,7 +27,7 @@ tags: ### 移动机制 -生物发起攻击前需要搭载多种[移动组件](/entities/entity-movement)。 +生物发起攻击前需要搭载多种[移动组件](/wiki/entities/entity-movement)。 在开始配置攻击行为前,请确保实体具备基础移动和路径规划能力。 @@ -234,7 +234,7 @@ tags: ### 远程攻击 -按设定间隔发射指定[弹射物](/documentation/projectiles)。 +按设定间隔发射指定[弹射物](/wiki/documentation/projectiles)。 ::: code-group ```json [原始CodeHeader的值] @@ -391,7 +391,7 @@ tags: ### 模式切换系统 -通过[事件系统](/entities/entity-events)和组件组实现攻击模式切换。常用传感器组件: +通过[事件系统](/wiki/entities/entity-events)和组件组实现攻击模式切换。常用传感器组件: | 传感器类型 | 说明 | | ---------------------- | ----------------------- | @@ -499,7 +499,7 @@ tags: ### 动画资源 -建议使用[Blockbench](/guide/blockbench)制作动画,需在资源包中包含: +建议使用[Blockbench](/wiki/guide/blockbench)制作动画,需在资源包中包含: - animations文件夹(实体动画定义) - animation_controllers文件夹(动画控制器) diff --git a/docs/wiki/3-实体/1-基础/entity-events.md b/docs/wiki/entities/entity-events.md similarity index 99% rename from docs/wiki/3-实体/1-基础/entity-events.md rename to docs/wiki/entities/entity-events.md index f1e34da2..8eee12ed 100644 --- a/docs/wiki/3-实体/1-基础/entity-events.md +++ b/docs/wiki/entities/entity-events.md @@ -1,6 +1,6 @@ --- title: 实体事件 -category: 综合 +category: 基础 mentions: - ChibiMango - SirLich diff --git a/docs/wiki/3-实体/2-巧思案例/entity-holds-item.md b/docs/wiki/entities/entity-holds-item.md similarity index 98% rename from docs/wiki/3-实体/2-巧思案例/entity-holds-item.md rename to docs/wiki/entities/entity-holds-item.md index b113add8..843778d3 100644 --- a/docs/wiki/3-实体/2-巧思案例/entity-holds-item.md +++ b/docs/wiki/entities/entity-holds-item.md @@ -1,6 +1,6 @@ --- title: 实体手持物品 -category: 教程 +category: 巧思案例 tags: - 中等难度 mentions: diff --git a/docs/wiki/3-实体/1-基础/entity-intro-bp.md b/docs/wiki/entities/entity-intro-bp.md similarity index 97% rename from docs/wiki/3-实体/1-基础/entity-intro-bp.md rename to docs/wiki/entities/entity-intro-bp.md index 5178f2f4..302e41f0 100644 --- a/docs/wiki/3-实体/1-基础/entity-intro-bp.md +++ b/docs/wiki/entities/entity-intro-bp.md @@ -1,6 +1,6 @@ --- title: 实体行为包入门指南 -category: 基础知识 +category: 基础 nav_order: 1 tags: - 指南 @@ -90,7 +90,7 @@ _无法_创建自定义组件。所有组件列表由微软硬编码实现并对 所有组件组均为自定义创建,不可直接引用其他实体的组件组。 -在原版Minecraft实体中,组件组使用`minecraft:`前缀命名(如示例中的`minecraft:cat_persian`)。但需特别注意这些_并非_组件。开发者可自由使用任意命名规则,例如上文中的`wiki:example_group`。更多命名空间信息请参阅[此文档](/concepts/namespaces)。 +在原版Minecraft实体中,组件组使用`minecraft:`前缀命名(如示例中的`minecraft:cat_persian`)。但需特别注意这些_并非_组件。开发者可自由使用任意命名规则,例如上文中的`wiki:example_group`。更多命名空间信息请参阅[此文档](/wiki/concepts/namespaces)。 放在组件组中的组件不会自动生效,必须通过事件激活才能影响实体行为。多个组件组可同时生效。 @@ -163,7 +163,7 @@ _仅能对组件组进行添加/移除操作_,无法直接操作单个组件 当玩家与该实体交互时,将触发`"wiki:on_interact"`事件,添加`"wiki:interacted"`组件组,从而激活缩放效果。 -想深入了解事件的更多用法,请参阅[实体事件](/entities/entity-events)页面。 +想深入了解事件的更多用法,请参阅[实体事件](/wiki/entities/entity-events)页面。 实体事件详解 diff --git a/docs/wiki/3-实体/1-基础/entity-intro-rp.md b/docs/wiki/entities/entity-intro-rp.md similarity index 93% rename from docs/wiki/3-实体/1-基础/entity-intro-rp.md rename to docs/wiki/entities/entity-intro-rp.md index 395ef62e..3e3f0b36 100644 --- a/docs/wiki/3-实体/1-基础/entity-intro-rp.md +++ b/docs/wiki/entities/entity-intro-rp.md @@ -1,6 +1,6 @@ --- title: 实体资源包入门指南 -category: 基础指南 +category: 基础 nav_order: 2 tags: - 新手教程 @@ -22,7 +22,7 @@ mentions: 资源包中的实体文件定义了构成实体视觉效果的各种资源引用,同时包含了如何渲染这些视觉元素的详细逻辑。 -本文将分解实体文件的每个组成部分并进行详细说明。如需创建自定义实体的完整指引,请参考我们的[新手教程](/guide/custom-entity)。 +本文将分解实体文件的每个组成部分并进行详细说明。如需创建自定义实体的完整指引,请参考我们的[新手教程](/wiki/guide/custom-entity)。 ## 文件大纲 @@ -69,7 +69,7 @@ mentions: 这里的`default`和`invisible`是简称,分别指向`spider`和`spider_invisible`材质。需要注意的是单纯的简称定义并不会告知实体何时使用不同材质。 -[预置材质列表](/documentation/materials)可供参考。[自定义材质教程](/visuals/materials)适合进阶开发者。 +[预置材质列表](/wiki/documentation/materials)可供参考。[自定义材质教程](/wiki/visuals/materials)适合进阶开发者。 ## 纹理配置 纹理(Textures)是映射到模型表面的图像文件。此部分同样使用简称定义系统: @@ -85,7 +85,7 @@ mentions: ``` ::: -支持定义多状态纹理(如蜜蜂的不同状态),也可叠加纹理层(参考村民的生物群系基底+职业层组合)。详细应用技巧参见[渲染控制器章节](/entities/render-controllers)。 +支持定义多状态纹理(如蜜蜂的不同状态),也可叠加纹理层(参考村民的生物群系基底+职业层组合)。详细应用技巧参见[渲染控制器章节](/wiki/entities/render-controllers)。 ## 几何体格式 几何体(Geometry)由Blockbench等建模工具生成的骨骼模型文件构成: @@ -123,7 +123,7 @@ mentions: ``` ::: -该示例始终使用"default"标识的各类资源。进阶用法可支持动态切换纹理与隐藏模型部件,详情参阅[渲染控制器指南](/entities/render-controllers)。 +该示例始终使用"default"标识的各类资源。进阶用法可支持动态切换纹理与隐藏模型部件,详情参阅[渲染控制器指南](/wiki/entities/render-controllers)。 在实体文件中通过标识符指定渲染控制器: @@ -246,7 +246,7 @@ mentions: ``` ::: -[自定义粒子教程](/particles/particles) | [动画效果应用](/visuals/animation-effects) +[自定义粒子教程](/wiki/particles/particles) | [动画效果应用](/wiki/visuals/animation-effects) ## 生成蛋设置 生成蛋(Spawn Egg)支持纯色或自定义纹理两种风格: diff --git a/docs/wiki/3-实体/2-巧思案例/entity-movement.md b/docs/wiki/entities/entity-movement.md similarity index 95% rename from docs/wiki/3-实体/2-巧思案例/entity-movement.md rename to docs/wiki/entities/entity-movement.md index bf4afe6d..7e81777b 100644 --- a/docs/wiki/3-实体/2-巧思案例/entity-movement.md +++ b/docs/wiki/entities/entity-movement.md @@ -1,6 +1,6 @@ --- title: 实体移动 -category: 教程 +category: 巧思案例 mentions: - SirLich - sermah @@ -33,9 +33,9 @@ mentions: | 组件 | 说明 | | ---------------------------------------------------------------------------------------------------- | ----------------------------- | -| [minecraft:movement](/entities/vanilla-usage-components#movement) | 设置基础移动速度(必需组件) | -| [minecraft:underwater_movement](/entities/vanilla-usage-components#underwater-movement) | 设置水下移动速度 | -| [minecraft:flying_speed](/entities/vanilla-usage-components#flying-speed) | 设置空中飞行速度 | +| [minecraft:movement](/wiki/entities/vanilla-usage-components#movement) | 设置基础移动速度(必需组件) | +| [minecraft:underwater_movement](/wiki/entities/vanilla-usage-components#underwater-movement) | 设置水下移动速度 | +| [minecraft:flying_speed](/wiki/entities/vanilla-usage-components#flying-speed) | 设置空中飞行速度 | 所有实体必须包含`minecraft:movement`组件。其他两个组件按需添加。 @@ -116,7 +116,7 @@ mentions: ### 路径规划 -实现实体自动寻路是常用需求。推荐使用通过"诱饵实体"(Marker)进行引导的方案。若需要创建诱饵实体,请参考[虚拟实体教程](/entities/dummy-entities)。 +实现实体自动寻路是常用需求。推荐使用通过"诱饵实体"(Marker)进行引导的方案。若需要创建诱饵实体,请参考[虚拟实体教程](/wiki/entities/dummy-entities)。 #### 实现思路 diff --git a/docs/wiki/3-实体/1-基础/entity-properties.md b/docs/wiki/entities/entity-properties.md similarity index 99% rename from docs/wiki/3-实体/1-基础/entity-properties.md rename to docs/wiki/entities/entity-properties.md index 556546a7..4e14f509 100644 --- a/docs/wiki/3-实体/1-基础/entity-properties.md +++ b/docs/wiki/entities/entity-properties.md @@ -1,6 +1,6 @@ --- title: 实体属性 -category: 常规 +category: 基础 tags: - 实验性 mentions: diff --git a/docs/wiki/3-实体/2-巧思案例/flying-entities.md b/docs/wiki/entities/flying-entities.md similarity index 99% rename from docs/wiki/3-实体/2-巧思案例/flying-entities.md rename to docs/wiki/entities/flying-entities.md index 1758e081..bbc132fa 100644 --- a/docs/wiki/3-实体/2-巧思案例/flying-entities.md +++ b/docs/wiki/entities/flying-entities.md @@ -1,6 +1,6 @@ --- title: 飞行实体的控制方法 -category: 教程 +category: 巧思案例 tags: - 配方 - 中级 diff --git a/docs/wiki/entities/index.md b/docs/wiki/entities/index.md new file mode 100644 index 00000000..1cfc92a4 --- /dev/null +++ b/docs/wiki/entities/index.md @@ -0,0 +1,10 @@ +--- +title: 实体 Entities +categories: + - title: 基础 + color: blue + - title: 巧思案例 + color: green + - title: 文档 + color: red +--- diff --git a/docs/wiki/3-实体/2-巧思案例/introduction-to-aec.md b/docs/wiki/entities/introduction-to-aec.md similarity index 91% rename from docs/wiki/3-实体/2-巧思案例/introduction-to-aec.md rename to docs/wiki/entities/introduction-to-aec.md index 4ea965a5..cee2c9dd 100644 --- a/docs/wiki/3-实体/2-巧思案例/introduction-to-aec.md +++ b/docs/wiki/entities/introduction-to-aec.md @@ -1,6 +1,6 @@ --- title: AOE云区域效果介绍 -category: 教程 +category: 巧思案例 tags: - 中阶 mentions: @@ -18,7 +18,7 @@ mentions: 区域效果云具备以下可被利用的特性: -- 作为[虚拟实体](/entities/dummy-entities),它们在性能表现优异,几乎不影响帧率,且完全静态且不与世界发生碰撞。这使其非常适用于需要围绕玩家或精确定位的场景。 +- 作为[虚拟实体](/wiki/entities/dummy-entities),它们在性能表现优异,几乎不影响帧率,且完全静态且不与世界发生碰撞。这使其非常适用于需要围绕玩家或精确定位的场景。 - 不会向客户端发送更新。生成后视觉上会定格在初始位置直至消失,但仍可通过指令自由移动。 - 能以高度可配置的方式施加任何药水效果(精准到游戏刻的持续时间设定,调节环境效果、屏幕提示显示、粒子发射等属性)。 - 具有运行时标识符`minecraft:area_effect_cloud`的实体将继承相同属性。 @@ -27,7 +27,7 @@ mentions: 投射物组件支持在命中时生成区域效果云。Minecraft正是通过此机制实现投掷滞留药水生成AOE云。 -[投射物组件文档](/documentation/projectiles#spawn-aoe-cloud) +[投射物组件文档](/wiki/documentation/projectiles#spawn-aoe-cloud) ## 方法二:NBT编辑 @@ -49,7 +49,7 @@ mentions: ``` ::: -结构文件编辑指南请参考:[.mcstructure文件解析](/nbt/mcstructure) +结构文件编辑指南请参考:[.mcstructure文件解析](/wiki/nbt/mcstructure) ### NBT数据格式 diff --git a/docs/wiki/3-实体/2-巧思案例/invulnerable-entities.md b/docs/wiki/entities/invulnerable-entities.md similarity index 99% rename from docs/wiki/3-实体/2-巧思案例/invulnerable-entities.md rename to docs/wiki/entities/invulnerable-entities.md index a0dd5545..cdb0c009 100644 --- a/docs/wiki/3-实体/2-巧思案例/invulnerable-entities.md +++ b/docs/wiki/entities/invulnerable-entities.md @@ -1,6 +1,6 @@ --- title: 无敌实体 -category: 教程 +category: 巧思案例 tags: - beginner mentions: diff --git a/docs/wiki/3-实体/2-巧思案例/look-at-entity.md b/docs/wiki/entities/look-at-entity.md similarity index 98% rename from docs/wiki/3-实体/2-巧思案例/look-at-entity.md rename to docs/wiki/entities/look-at-entity.md index f1db47f2..a8a11f46 100644 --- a/docs/wiki/3-实体/2-巧思案例/look-at-entity.md +++ b/docs/wiki/entities/look-at-entity.md @@ -1,6 +1,6 @@ --- title: 看向实体 -category: 教程 +category: 巧思案例 tags: - 中级 mentions: diff --git a/docs/wiki/3-实体/3-文档/non-mob-runtime-identifiers.md b/docs/wiki/entities/non-mob-runtime-identifiers.md similarity index 100% rename from docs/wiki/3-实体/3-文档/non-mob-runtime-identifiers.md rename to docs/wiki/entities/non-mob-runtime-identifiers.md diff --git a/docs/wiki/3-实体/1-基础/npc-dialogs.md b/docs/wiki/entities/npc-dialogs.md similarity index 99% rename from docs/wiki/3-实体/1-基础/npc-dialogs.md rename to docs/wiki/entities/npc-dialogs.md index 2feafb32..99b85807 100644 --- a/docs/wiki/3-实体/1-基础/npc-dialogs.md +++ b/docs/wiki/entities/npc-dialogs.md @@ -1,6 +1,6 @@ --- title: NPC 对话框 -category: 通用 +category: 基础 tags: - 中级 参与贡献: diff --git a/docs/wiki/3-实体/1-基础/render-controllers.md b/docs/wiki/entities/render-controllers.md similarity index 98% rename from docs/wiki/3-实体/1-基础/render-controllers.md rename to docs/wiki/entities/render-controllers.md index a2b8f84b..712ff5eb 100644 --- a/docs/wiki/3-实体/1-基础/render-controllers.md +++ b/docs/wiki/entities/render-controllers.md @@ -1,6 +1,6 @@ --- title: 渲染控制器 -category: 常规 +category: 基础 tags: - beginner mentions: @@ -222,7 +222,7 @@ mentions: #### 动态分层进阶 -通过添加更多纹理数组和使用虚拟组件(dummy components)作为索引,可实现更复杂的动态分层效果。关于虚拟组件的详细信息请参阅[此文档](/entities/dummy-components)。 +通过添加更多纹理数组和使用虚拟组件(dummy components)作为索引,可实现更复杂的动态分层效果。关于虚拟组件的详细信息请参阅[此文档](/wiki/entities/dummy-components)。 ### 动态几何体切换 diff --git a/docs/wiki/3-实体/3-文档/runtime-identifier.md b/docs/wiki/entities/runtime-identifier.md similarity index 100% rename from docs/wiki/3-实体/3-文档/runtime-identifier.md rename to docs/wiki/entities/runtime-identifier.md diff --git a/docs/wiki/3-实体/2-巧思案例/sleeping-entities.md b/docs/wiki/entities/sleeping-entities.md similarity index 98% rename from docs/wiki/3-实体/2-巧思案例/sleeping-entities.md rename to docs/wiki/entities/sleeping-entities.md index 0b3c8efb..0e33d627 100644 --- a/docs/wiki/3-实体/2-巧思案例/sleeping-entities.md +++ b/docs/wiki/entities/sleeping-entities.md @@ -1,6 +1,6 @@ --- title: 睡眠实体 -category: 教程 +category: 巧思案例 tags: - 中级 mentions: @@ -388,4 +388,4 @@ mentions: ``` ::> -最后需要为实体创建并注册睡眠动画,若存在制作难题可参考[BlockBench动画教程](/guide/blockbench.html#animating)。 \ No newline at end of file +最后需要为实体创建并注册睡眠动画,若存在制作难题可参考[BlockBench动画教程](/wiki/guide/blockbench.html#animating)。 \ No newline at end of file diff --git a/docs/wiki/3-实体/2-巧思案例/solid-entities.md b/docs/wiki/entities/solid-entities.md similarity index 89% rename from docs/wiki/3-实体/2-巧思案例/solid-entities.md rename to docs/wiki/entities/solid-entities.md index 5d24e406..926db7e1 100644 --- a/docs/wiki/3-实体/2-巧思案例/solid-entities.md +++ b/docs/wiki/entities/solid-entities.md @@ -1,6 +1,6 @@ --- title: 实体碰撞体 -category: 教程 +category: 巧思案例 tags: - 配方指南 - 中级 @@ -25,7 +25,7 @@ mentions: ## 运行时标识符 -通过[运行时标识符](/entities/runtime-identifier)可以实现实体碰撞效果。但目前仅支持两种预设形态,每种形态具有特定的碰撞箱及副作用。且两种模型的碰撞形状均不可调节或缩放。 +通过[运行时标识符](/wiki/entities/runtime-identifier)可以实现实体碰撞效果。但目前仅支持两种预设形态,每种形态具有特定的碰撞箱及副作用。且两种模型的碰撞形状均不可调节或缩放。 ### 船型实体 diff --git a/docs/wiki/3-实体/1-基础/spawn-rules.md b/docs/wiki/entities/spawn-rules.md similarity index 99% rename from docs/wiki/3-实体/1-基础/spawn-rules.md rename to docs/wiki/entities/spawn-rules.md index e2f7f312..ba176ea4 100644 --- a/docs/wiki/3-实体/1-基础/spawn-rules.md +++ b/docs/wiki/entities/spawn-rules.md @@ -1,6 +1,6 @@ --- title: 实体生成规则 -category: 常规 +category: 基础 mentions: - SirLich - solvedDev diff --git a/docs/wiki/3-实体/3-文档/spawning-tamed-entities.md b/docs/wiki/entities/spawning-tamed-entities.md similarity index 97% rename from docs/wiki/3-实体/3-文档/spawning-tamed-entities.md rename to docs/wiki/entities/spawning-tamed-entities.md index 016957ba..f39fed5d 100644 --- a/docs/wiki/3-实体/3-文档/spawning-tamed-entities.md +++ b/docs/wiki/entities/spawning-tamed-entities.md @@ -1,6 +1,6 @@ --- title: 生成已驯服的实体 -category: 教程 +category: 巧思案例 tags: - 中级 mentions: @@ -112,7 +112,7 @@ mentions: ## 集成物品抛射物(替代方法) -利用 [1.16 实验性物品特性](/items/item-components) 中的 `shoot` 事件属性,可制作碰撞时转换为已驯服实体的弹射物。 +利用 [1.16 实验性物品特性](/wiki/items/item-components) 中的 `shoot` 事件属性,可制作碰撞时转换为已驯服实体的弹射物。 ::: code-group ```json [BP/items/throwable_pretamed_wolf.json] diff --git a/docs/wiki/3-实体/2-巧思案例/timers.md b/docs/wiki/entities/timers.md similarity index 98% rename from docs/wiki/3-实体/2-巧思案例/timers.md rename to docs/wiki/entities/timers.md index f10de473..85f5de22 100644 --- a/docs/wiki/3-实体/2-巧思案例/timers.md +++ b/docs/wiki/entities/timers.md @@ -1,6 +1,6 @@ --- title: 实体计时器 -category: 教程 +category: 巧思案例 tags: - 中级 mentions: @@ -19,7 +19,7 @@ mentions: 基于时间的交互是地图制作的超实用工具。本文旨在提供一份详尽的指南,详解多种创建计时器的方法。为方便阅读,本页将分为两大部分:组件计时器和动画计时器。每种方式都有其独特优劣,我们将在对应章节详细探讨。 -你可能也会对[计分板计时器](/commands/scoreboard-timers)感兴趣。 +你可能也会对[计分板计时器](/wiki/commands/scoreboard-timers)感兴趣。 ## 基于组件的计时器 diff --git a/docs/wiki/3-实体/1-基础/troubleshooting-entities.md b/docs/wiki/entities/troubleshooting-entities.md similarity index 98% rename from docs/wiki/3-实体/1-基础/troubleshooting-entities.md rename to docs/wiki/entities/troubleshooting-entities.md index 5c274fa0..bd2d5e22 100644 --- a/docs/wiki/3-实体/1-基础/troubleshooting-entities.md +++ b/docs/wiki/entities/troubleshooting-entities.md @@ -1,6 +1,6 @@ --- title: 实体问题排查指南 -category: 常规 +category: 基础 nav_order: 3 tags: - help @@ -19,7 +19,7 @@ mentions: :::tip -本页面包含关于_实体_的疑难解答信息。在继续阅读前,请务必先查阅[全局问题排查指南](/guide/troubleshooting)。 +本页面包含关于_实体_的疑难解答信息。在继续阅读前,请务必先查阅[全局问题排查指南](/wiki/guide/troubleshooting)。 ::: :::warning diff --git a/docs/wiki/3-实体/3-文档/vanilla-usage-components.md b/docs/wiki/entities/vanilla-usage-components.md similarity index 99% rename from docs/wiki/3-实体/3-文档/vanilla-usage-components.md rename to docs/wiki/entities/vanilla-usage-components.md index 58b613d4..efa6265d 100644 --- a/docs/wiki/3-实体/3-文档/vanilla-usage-components.md +++ b/docs/wiki/entities/vanilla-usage-components.md @@ -1,6 +1,6 @@ --- title: 所有可用 Components -category: Documentation +category: 文档 mentions: - MedicalJewel105 --- diff --git a/docs/wiki/3-实体/3-文档/vanilla-usage-spawn-rules.md b/docs/wiki/entities/vanilla-usage-spawn-rules.md similarity index 99% rename from docs/wiki/3-实体/3-文档/vanilla-usage-spawn-rules.md rename to docs/wiki/entities/vanilla-usage-spawn-rules.md index ab431d09..7774d88d 100644 --- a/docs/wiki/3-实体/3-文档/vanilla-usage-spawn-rules.md +++ b/docs/wiki/entities/vanilla-usage-spawn-rules.md @@ -1,6 +1,6 @@ --- title: 所有可用生成规则(Spawn Rules) -category: Documentation +category: 文档 mentions: - MedicalJewel105 --- diff --git a/docs/wiki/3-实体/2-巧思案例/village-mechanic.md b/docs/wiki/entities/village-mechanic.md similarity index 98% rename from docs/wiki/3-实体/2-巧思案例/village-mechanic.md rename to docs/wiki/entities/village-mechanic.md index 08bdd95f..f81dc575 100644 --- a/docs/wiki/3-实体/2-巧思案例/village-mechanic.md +++ b/docs/wiki/entities/village-mechanic.md @@ -1,6 +1,6 @@ --- title: 村庄机制 -category: 教程 +category: 巧思案例 mentions: - AeroForta - MedicalJewel105 @@ -172,7 +172,7 @@ meeting_area // 聚集点 ### 睡眠行为 -可参考[睡眠实体指南](/entities/sleeping-entities)实现实体睡眠 +可参考[睡眠实体指南](/wiki/entities/sleeping-entities)实现实体睡眠 ### 工作行为 diff --git a/docs/wiki/3-实体/3-文档/vuc-full.md b/docs/wiki/entities/vuc-full.md similarity index 99% rename from docs/wiki/3-实体/3-文档/vuc-full.md rename to docs/wiki/entities/vuc-full.md index fef775df..48675006 100644 --- a/docs/wiki/3-实体/3-文档/vuc-full.md +++ b/docs/wiki/entities/vuc-full.md @@ -1,6 +1,6 @@ --- title: 所有可用 Components - 完整 -category: Documentation +category: 文档 mentions: - MedicalJewel105 hidden: true diff --git a/docs/wiki/3-实体/3-文档/vusr-full.md b/docs/wiki/entities/vusr-full.md similarity index 99% rename from docs/wiki/3-实体/3-文档/vusr-full.md rename to docs/wiki/entities/vusr-full.md index d946fca6..004fd240 100644 --- a/docs/wiki/3-实体/3-文档/vusr-full.md +++ b/docs/wiki/entities/vusr-full.md @@ -1,6 +1,6 @@ --- title: 所有可用 Spawn Rules - 完整 -category: Documentation +category: 文档 mentions: - MedicalJewel105 hidden: true diff --git a/docs/wiki/guide/addons.md b/docs/wiki/guide/addons.md index 794220aa..951a50f9 100644 --- a/docs/wiki/guide/addons.md +++ b/docs/wiki/guide/addons.md @@ -1,7 +1,7 @@ --- -title: Addons Explained -category: Guide -description: The basics of Addons +title: Addons详解 +category: 指南 +description: 附加包的基础知识 nav_order: 2 prefix: '2. ' mentions: @@ -18,55 +18,86 @@ mentions: - SmokeyStack --- -## What are addons? +# Addons 详解 -Addons allow us to modify the contents of our Minecraft Experience by _modifying_ or _removing_ existing content and _adding_ our own. Addons are very powerful and allow us to create custom entities, items, and blocks, as well as things like custom loot tables and crafting recipes. Your imagination is the limit! + -Addons are primarily written in [json](/guide/understanding-json), which is a structured data-format. An addon is essentially a collection of json files, images, and sounds, which modify or add to the game in some way. +## 什么是附加包(Adddons)? -## What's the difference between a Behavior Pack & a Resource Pack? +附加包允许我们通过 _修改_ 或 _移除_ 现有内容以及_添加_自定义内容来改变Minecraft的游戏体验。它们功能强大,可以创建自定义实体、物品、方块,以及自定义战利品表和合成配方等。你的想象力就是唯一的限制! -Addons are split into two pack types: Resource Packs, and Behavior Packs. Both can function independently, but they are most commonly used together. When you have both a Resource Pack and Behavior Pack, this is referred to as an _addon_. +附加包主要使用结构化数据格式[JSON](/wiki/guide/understanding-json)编写。本质上,附加包是一系列JSON文件、图像和声音文件的集合,通过这些文件以某种方式修改或增强游戏内容。 -### Resource Pack +## 行为包与资源包的区别? -The Resource Pack, also known as the _client_, or RP, is responsible for the _visuals_ and _sounds_ in your addon. This includes things like: +附加包分为两种类型:资源包(Resource Pack)和行为包(Behavior Pack)。两者可以独立运行,但通常配合使用。当同时使用资源包和行为包时,就组成了一个_附加包_。 -- Textures -- Sounds -- Geometry -- Animations -- Particles +### 资源包 -### Behavior Pack +资源包(Resource Pack),也称为 _客户端_ 或RP,负责附加包的 _视觉效果_ 和 _声音_ 。主要包括: -The Behavior Pack, also known as the _server_, or BP, is responsible for the _logic_ of your addon. This can include things like: +- 材质贴图 +- 音效 +- 几何模型 +- 动画 +- 粒子效果 -- How your entity acts -- Crafting recipes -- Loot tables -- Custom functions +### 行为包 -### Communication between packs +行为包(Behavior Pack),也称为 _服务端_ 或BP,负责附加包的 _逻辑功能_ 。主要包括: -In most cases, you will have both a RP and a BP together. These packs can communicate with or will require each other for them to function properly, in the sense that assets defined in one can be accessed in the other. For example, when creating a custom entity, you need two files: +- 实体行为 +- 合成配方 +- 战利品表 +- 自定义函数 -- An RP entity definition, which describes how your entity will _look_ -- A BP entity definition, which describes how your entity will _act_ +### 包间通信 -## What you have learned +大多数情况下需要同时使用RP和BP。这两个包之间会进行通信或相互依赖才能正常运行,即在一个包中定义的资源可以被另一个包访问。例如创建自定义实体时需要两个文件: + +- RP实体定义文件(描述实体 _外观_) +- BP实体定义文件(描述实体 _行为_) + +## 知识总结 :::tip -- Addons modify Minecraft content or add their own -- Addons are written in json -- An addon is split into the **Resource Pack** and the **Behavior Pack**: - Resource Packs contain Textures, Sounds, ... and control how the game looks - Behavior Packs contain entity-files, crafting recipes, ... and control the logic of your game +- 附加包可以修改Minecraft内容或添加新内容 +- 附加包使用JSON语言编写 +- 附加包分为**资源包**和**行为包**: + - 资源包包含材质、音效等内容,控制游戏外观 + - 行为包包含实体文件、合成配方等内容,控制游戏逻辑 ::: -## What to do now? +## 下一步建议 Check out software and preparation page! +>查看软件准备指南! +::: code-group +```json [示例RP实体定义] +// 自定义苦力怕的材质路径 +"minecraft:client_entity": { + "description": { + "textures": { + "default": "textures/entity/custom_creeper" + } + } +} +``` +::: + +::: code-group +```json [示例BP实体定义] +// 设置自定义苦力怕的爆炸行为 +"minecraft:entity": { + "components": { + "minecraft:explode": { + "fuseLength": 2.5 + } + } +} +``` +::: \ No newline at end of file diff --git a/docs/wiki/guide/advancedmanifest.md b/docs/wiki/guide/advancedmanifest.md index 02900c1a..07a52510 100644 --- a/docs/wiki/guide/advancedmanifest.md +++ b/docs/wiki/guide/advancedmanifest.md @@ -1,7 +1,7 @@ --- -title: Advanced Manifest -category: Extra -description: How to work with manifests - a more detailed guide [UNDER CONSTRUCTION] +title: 进阶manifest配置 +category: 扩展内容 +description: 如何操作清单文件 - 更详细的指南 [施工中] nav_order: 4 prefix: 'd.' mentions: @@ -13,35 +13,39 @@ mentions: - QuazChick --- +# 进阶 manifest 配置 + + + ::: tip -This is an appendix page. You can start the guide from the beginning [here](/guide/index). +本页为附录章节。您可以从[这里](/wiki/guide/index)开始完整阅读指南。 ::: -This page is desgined to go into more detail about the manifest.json file, here we will cover what UUIDs are in more detail and how to add them. We will explain the use of dependencies, the different format versions, and how to include meta-data. +本文旨在深入解析 manifest.json 文件,我们将详细讲解UUID的定义及添加方式,阐述依赖项的使用方法,不同格式版本的区别,以及如何包含元数据。 -We will also go over the version differences between Behaviour packs, Resource packs, and Skin packs. +同时我们也会比较行为包、资源包和皮肤包之间的版本差异。 -## UUIDs +## UUID详解 -UUID is an abbreviation for Universal Unique Identifier, there are 5 UUID versions plus one common unofficial version, A UUID is a 36 character string containing numbers, letters, and dashes. +UUID是通用唯一识别码(Universal Unique Identifier)的缩写,共有5个官方版本和1个常见非官方版本。UUID是由数字、字母和连字符组成的36位字符串。 -Minecraft uses Version 4: Variant 1, which is completely random. This is what creates your pack's unique identity in Minecraft. +Minecraft使用完全随机生成的版本4变体1。这是构成您资源包在游戏中唯一身份标识的核心要素。 -### How to Generate the correct UUID +### 如何生成正确的UUID -You can use online sites such as [UUID Generator](https://www.uuidgenerator.net/version4/) and [UUID Tools](https://www.uuidtools.com/generate/v4) to generate the correct version required for Minecraft. +您可以使用在线工具如[UUID生成器](https://www.uuidgenerator.net/version4/)和[UUID工具](https://www.uuidtools.com/generate/v4)来生成符合Minecraft要求的正确版本。 ## -### UUID FAQ +### UUID常见问题 -- **Are UUIDs Case-sensitive?** +- **UUID是否区分大小写?** - - _No, UUIDs are written in base 16 which uses numbers 0-9 and characters a-f. There is no distinction between upper and lowercase letters._ + - _不区分,UUID使用16进制表示(包含数字0-9和字母a-f),大小写字母在系统中被视为等同。_ -- **Can I use the same UUID for the header and the modules UUID?** - - _No, the UUID for the header and the module needs to be different._ +- **能否在文件头和模块中使用相同UUID?** + - _不可行,文件头UUID与模块UUID必须使用不同标识符。_ :::warning -This page is under construction! -::: +本页面内容尚在完善中! +::: \ No newline at end of file diff --git a/docs/wiki/guide/blockbench.md b/docs/wiki/guide/blockbench.md index 26b3235f..712407a4 100644 --- a/docs/wiki/guide/blockbench.md +++ b/docs/wiki/guide/blockbench.md @@ -1,7 +1,7 @@ --- -title: 'Blockbench: Modeling, Texturing and Animating' -category: Guide -description: A first peek into Blockbench +title: 'Blockbench建模、纹理与动画' +category: 指南 +description: 初探Blockbench建模工具 prefix: '7. ' nav_order: 7 mentions: @@ -18,74 +18,82 @@ mentions: - smell-of-curry --- -Blockbench is a free software designed to make Minecraft modeling, texturing, and animating possible. It is available for mobile browsers, Windows 10, and macOS. Please install it at [blockbench.net](https://blockbench.net/). +# Blockbench建模、纹理与动画 -Let's get started. + -1. Open Blockbench. -2. Choose _File>New>Bedrock Model_. This is important because Minecraft Bedrock will not be able to read Java models. -3. A screen like this will have popped up. +Blockbench是一款专为Minecraft设计的免费建模、纹理绘制和动画制作软件,支持移动端浏览器、Windows 10和macOS。请访问[blockbench.net](https://blockbench.net/)下载安装。 + +## 快速入门 + +1. 打开Blockbench +2. 选择 _文件 > 新建 > 基岩版模型_(注意:基岩版无法读取Java版模型) +3. 将出现以下界面 ![](/assets/images/guide/create_entity_project_menu.png) - - `"File name:"` is self-explanatory. My file will generate as "skele_yaklin.geo.json". - - `"Model Identifier:"` is the model identifier (namespace not required), a short name for this ID will be defined later. - - `"Box UV"` has to be checked on for automatic UV editing and unwrapping for texturing. - - `"Texture Height"` and `"Texture Width"` define the resolution of the model's textures. + - `"文件名:"` 即保存名称(示例将生成"skele_yaklin.geo.json") + - `"模型标识符:"` 是模型的命名空间标识(可省略命名空间前缀) + - **必须勾选** `"方框UV映射"` 以实现自动UV编辑和纹理展开 + - `"纹理高度"` 和 `"纹理宽度"` 决定贴图分辨率 -4. Press confirm. You'll see a screen like this: +4. 点击确认后进入工作区: ![](/assets/images/guide/create_entity_workspace.png) - - You can see many tools here: move, resize, rotate, etc. - - You can add bones and cubes in the menu on the right-bottom corner. Cubes can rotate on their own; the bones will carry everything in them along; + - 工具栏提供移动、缩放、旋转等基础操作 + - 右下角菜单可添加骨骼和立方体(立方体可独立旋转,骨骼将带动其下所有子元素) -5. Now, you are ready to create your model! For more in-depth tutorials on modeling, please check out the videos by Everbloom Studio below. +5. 现在可以开始建模!如需深入学习,推荐观看下方Everbloom Studio的教学视频 -## Texturing +## 纹理绘制 -Now that you have your model in place let's start texturing! +完成模型后,开始制作纹理: -1. On the left-bottom panel, click "Create Texture" -1. Write down your image file name under "Name:". Mine will export as `ghost.png`. Check "Template:" to make a template texture - it'll be easier to work with. +1. 在左下方面板点击"创建纹理" +2. 在"名称:"处输入贴图文件名(示例将导出为`ghost.png`),勾选"模板:"可生成带辅助线的纹理模板 ![](/assets/images/guide/create_entity_texture_1.png) -1. Check everything and change your resolution to the one you set in the very first step. +3. 确认分辨率与初始设置一致 ![](/assets/images/guide/create_entity_texture_2.png) -1. Go to "Paint" in the upper right corner and paint your texture. +4. 切换右上角至"绘制"模式进行纹理创作 -## Animating +## 动画制作 -Once your model and texture are done, you can start animating. Go to "Animate" in the upper right corner. +完成模型与纹理后,切换至右上角"动画"模式开始制作动画。 -You might want to adjust one of the toolbars by adding "Export Animations" and "Import Animations" like this: +建议通过工具栏设置添加"导出动画"和"导入动画"按钮: ![](/assets/images/guide/create_entity_animation_1.png) -1. Click "Add Animation" [the plus icon on the top right side] and name it `animation.{yourEntityName}.move`. - Create the first frame of your walking animation under 0 on the timeline by moving the legs. +1. 点击"添加动画"(右上角+号图标),命名为`animation.{实体名称}.move` + 在时间轴0帧处调整腿部位置创建第一关键帧 ![](/assets/images/guide/create_entity_animation_2.png) -1. Create the second frame under 0.5 on the timeline. +2. 在时间轴0.5帧处创建第二关键帧 ![](/assets/images/guide/create_entity_animation_3.png) -1. Finally, copy the first frame to the third frame by placing your timeline cursor on 1.0 and selecting the first frame, then ctrl+c, ctrl+v. -1. Right-click the animation and tick "Loop" for the animation to loop. +3. 将时间轴移至1.0帧,复制第一帧完成循环(Ctrl+C → Ctrl+V) +4. 右键动画选择"循环"使动画持续播放 ![](/assets/images/guide/create_entity_animation_4.png) -## Saving your work +## 保存作品 -Now that our model, texture, and walk animation are complete, you can save your work. +完成模型、纹理和行走动画后: -Go to _File > Save Model_ or _File > Export Bedrock Geometry_. Save the model in `RP/models/entity`, the texture in `RP/textures/entity/` and the animation in `RP/animations`. Congratulations! You've successfully created your first entity's visuals! You can see the file examples below. +- 通过 _文件 > 保存模型_ 或 _文件 > 导出基岩版模型_ 保存 +- 模型保存至 `RP/models/entity` +- 纹理保存至 `RP/textures/entity/` +- 动画保存至 `RP/animations` -_Meanwhile, why not upgrade the visuals of your own unique entities' or create another one?_ +恭喜完成首个实体视觉创作!下方提供完整文件示例参考。 - +_不妨尝试为你的独特实体升级视觉效果,或创作全新角色?_ -RP/models/entity/ghost.geo.json + -```json +::: code-group +```json [RP/models/entity/ghost.geo.json] { "format_version": "1.12.0", "minecraft:geometry": [ @@ -154,9 +162,7 @@ _Meanwhile, why not upgrade the visuals of your own unique entities' or create a } ``` -RP/animations/ghost.a.animations.json - -```json +```json [RP/animations/ghost.a.animations.json] { "format_version": "1.8.0", "animations": { @@ -269,15 +275,15 @@ _Meanwhile, why not upgrade the visuals of your own unique entities' or create a } } ``` +::: -## What you have learned +## 学习总结 -- [x] How to create an entity in Blockbench -- [x] How to use Blockbench to model, texture, and animate your entity - - +- [x] 掌握Blockbench实体创建流程 +- [x] 学会使用Blockbench进行建模、纹理绘制与动画制作 + \ No newline at end of file diff --git a/docs/wiki/guide/custom-entity.md b/docs/wiki/guide/custom-entity.md index 647a3d65..9251c6c0 100644 --- a/docs/wiki/guide/custom-entity.md +++ b/docs/wiki/guide/custom-entity.md @@ -44,7 +44,7 @@ First, we will cover how to create an entity & define its behavior. Next, we wil Like with items, we need a file to tell our entity how to behave which points an identifier to certain components which define behavior. This file will be very similar to our item behavior file except with a lot more components. -We define our server file in our BP, under the `BP/entities/` folder. We will call this file `ghost.se.json`. Here the `.se` stands for _server entity_. This is for clarity and is recommend in the [Style Guide](/meta/style-guide). +We define our server file in our BP, under the `BP/entities/` folder. We will call this file `ghost.se.json`. Here the `.se` stands for _server entity_. This is for clarity and is recommend in the [Style Guide](/wiki/meta/style-guide). This is a basic overview of the file: @@ -88,7 +88,7 @@ We recommend leaving the settings as they are here as any changes will make it h An entity has a lot more behaviors than just an item, so we need to define more components for it. We will break down the types of components will use into categories and then look at them closer. -For more information on components in entities, you can check out our page [here](/entities/entity-intro-bp). +For more information on components in entities, you can check out our page [here](/wiki/entities/entity-intro-bp). ### Stat Components @@ -347,7 +347,7 @@ In general, important behaviors will have a priority of `0` or `1`. With that we have completed our entity behavior file. -More complex entities can also have different _states_, where they will behave differently depending on what state they are in. For example, a wild wolf will walk around freely, but once it is tamed it will follow the player. An _event_ (being tamed) caused the wolf to change _states_. This feature allows us to create dynamic entities which can perform different actions when different events occurs. You can learn more about this in our guide [here](/entities/entity-intro-bp). +More complex entities can also have different _states_, where they will behave differently depending on what state they are in. For example, a wild wolf will walk around freely, but once it is tamed it will follow the player. An _event_ (being tamed) caused the wolf to change _states_. This feature allows us to create dynamic entities which can perform different actions when different events occurs. You can learn more about this in our guide [here](/wiki/entities/entity-intro-bp). If you open your world and try to summon in your entity using `/summon wiki:ghost`, it should behave like we expect but there will only be a shadow on the ground. You might also see its name as a translation key, similar to how it happened with our item. @@ -772,7 +772,7 @@ To begin, we need to define the visuals of our entity in our file so we know whi In order to display our entity it needs to be _rendered_. For this to happen, it needs a material, texture and geometry. We have already made a texture and geometry. A material defines how our texture will be displayed. For example, a skeleton uses a material to allow for transparency and an enderman uses a material to allow its eyes to glow. -Since our ghost has some transparency, we need a material which will render this correctly. Luckily, Minecraft has many pre-built materials for us to use such as `entity_alphatest` which will allow us to do this. You can create your own materials but be warned it is very advanced. If you are interested though, you can begin [here](/documentation/materials). +Since our ghost has some transparency, we need a material which will render this correctly. Luckily, Minecraft has many pre-built materials for us to use such as `entity_alphatest` which will allow us to do this. You can create your own materials but be warned it is very advanced. If you are interested though, you can begin [here](/wiki/documentation/materials). For us to now use these resources, we need to define a reference to them with a shortname. This is similar to how we did for items within the `item_texture.json` file, except here we do it in the entity client file. Here is the layout. @@ -825,7 +825,7 @@ The file is called `ghost.rc.json` and is under `RP/render_controllers/`: ``` This follows a similar structure to the animation controller and animation file, with our render controller identifier being `controller.render.ghost`. -This tells the game that the resource rendered should be the resource with shortname `default`. Render controllers can also allow you to display different textures or apply different materials to different parts of our model. Under `materials`, we use `"*"` to mean that we apply this material to all _bones_ in our model (i.e. each cube in our model.) For more information on render controllers, you can check our page [here](/entities/render-controllers). +This tells the game that the resource rendered should be the resource with shortname `default`. Render controllers can also allow you to display different textures or apply different materials to different parts of our model. Under `materials`, we use `"*"` to mean that we apply this material to all _bones_ in our model (i.e. each cube in our model.) For more information on render controllers, you can check our page [here](/wiki/entities/render-controllers). :::tip If you keep your shortnames consistent, you can actually reference the same render controller for multiple entities. diff --git a/docs/wiki/guide/custom-item.md b/docs/wiki/guide/custom-item.md index 0246141c..6143206f 100644 --- a/docs/wiki/guide/custom-item.md +++ b/docs/wiki/guide/custom-item.md @@ -1,11 +1,11 @@ --- -title: 'Create a custom Item' -category: Guide -description: How to create your first custom Item +title: '创建自定义物品' +category: 指南 +description: 如何创建你的第一个自定义物品 nav_order: 5 prefix: '5. ' mentions: - - KaiFireborn + - KaiFireBorn - SirLich - cda94581 - TheItsNameless @@ -19,80 +19,73 @@ mentions: - davedavis --- -In Minecraft, we can create custom items, which can be dropped, traded, crafted, and otherwise used like a normal item. There is a lot of power in the system, including the ability to make food, fuel, and tools. +# 创建自定义物品 -In this tutorial we are going to learn how to create a simple "ectoplasm" item, which we will later use as a loot-table drop for our ghost entity. + + +在Minecraft中,我们可以创建自定义物品,这些物品可以像普通物品一样被丢弃、交易、合成和使用。该系统具有强大的功能,包括制作食物、燃料和工具的能力。 + +在本教程中,我们将学习如何创建一个简单的"灵质"(ectoplasm)物品,后续将作为幽灵实体的战利品掉落。


-Conceptually, items are made up of two parts: +概念上,物品由两部分组成: -- The visuals (texture, name) -- The behaviors (how the item should behave) +- 视觉元素(纹理、名称) +- 行为特性(物品的行为方式) -First, we will learn how to create a new simple item & define its behaviors. In the next section we will assign a texture to this item, so you can see it in game. +首先我们将学习如何创建新物品并定义其行为,下一章节会为这个物品添加纹理使其在游戏中可见。 :::warning -This guide requires experimental features toggled on. +本指南需要开启实验性功能 ::: -## Item Behavior +## 物品行为 -To make an item we will need a way to identify it and define how we want it to behave. To do this we will be making a file which tell Minecraft to apply certain behaviors to a specific item of our choice. +创建物品需要定义标识符和行为特性。我们将通过创建文件告诉Minecraft如何为指定物品应用特定行为。 -At the end of this section we will have fully defined the behavior of our item. +本节结束时我们将完整定义物品的行为特性。 -### Components +### 组件 -Different items behave differently; you can eat a porkchop, enchanted items glow & eggs can only stack to 16. These are all examples of how the item behaves. -We are able to define how our custom item will behave by using behavior components. +不同物品具有不同行为:可以食用猪肉、附魔物品发光、鸡蛋最多堆叠16个。这些都是通过行为组件实现的。 - + -BP/items/example.json/components/ - -```json -"minecraft:food": +::: code-group +```json [示例组件] +"minecraft:food": {...}, "minecraft:foil": true, "minecraft:max_stack_size": 16 ``` +::: -Components contain information which tells the game what our item should do. For example the component `"minecraft:foil"` determines whether the item should have an enchanted foil to it, so setting it to `true` will apply it. -All components have a `value` attached to it which we can edit to get the behaviour we want. +组件包含决定物品行为的信息。例如`"minecraft:foil"`组件控制物品是否显示附魔光效,设为`true`即可启用。 -For our ectoplasm, we will set it to have a stack size of 16, similar to eggs. To do this we use the component `"minecraft:max_stack_size"` and set its value to `16`. +对于灵质物品,我们设置类似鸡蛋的堆叠上限16,使用`"minecraft:max_stack_size"`组件并设值为`16`。 -### Identifier +### 标识符 -In order for the game to apply the correct components to the correct item, we need to be able to tell the game which item is ours. We do this by defining an identifier for our item. +为了让游戏正确应用组件,我们需要为物品定义唯一标识符。原版鸡蛋的标识符是`minecraft:egg`,包含两部分: -An identifier is a name unique to this item. For a vanilla minecraft egg it's identifier is `minecraft:egg`. An identifier is made of two parts, +- 命名空间(`minecraft`) +- 物品ID(`egg`) -- The namespace (`minecraft`) -- The id (`egg`) +命名空间用于避免不同附加包之间的冲突。建议使用个人独特标识(如作者缩写或项目简称)。本教程使用`wiki`作为命名空间,更多命名空间信息请参考[此页面](/wiki/concepts/namespaces)。 -The namespace is unique to your addon and you will use it throughout the project. This is to reduce issues if someone adds two packs to your game which both add an ectoplasm item; the namespace reduces the chance of the identifier being the same. -The namespace that Minecraft use is `minecraft`. Your namespace should be unique to you, for example the authors initials or an abbreviation of the pack name. We will use the namespace `wiki` in our example; for more information on making a namespace check out our page [here](/concepts/namespaces). +物品ID是简短描述性名称,这里使用`ectoplasm`。最终标识符为`wiki:ectoplasm`(使用冒号分隔命名空间和ID),后续可通过`/give`命令引用。 -The id is an informative shorthand name for your item. Here we will use `ectoplasm`. +### 物品文件 -Together our custom identifier becomes `wiki:ectoplasm`. Note that we use a colon, `:`, to spilt the namespace and id. When we want to reference our item we will use this identifier, for example using the `/give` command. +在行为包中创建物品定义文件`BP/items/ectoplasm.json`,基本结构如下: -### Item File - -Now that we have our components and identifier, we can now start defining our item. We define an item by creating an item definition file in our behavior pack. This is where all our information will go. - -All item definitions go in `BP/items/`. The name of your file doesn't affect anything, but for ease of navigation it's recommend to name it after your id. -We will create a file `BP/items/ectoplasm.json`. Here is the the basic layout of the file: - -BP/items/ectoplasm.json - -```json +::: code-group +```json [物品文件结构] { "format_version": "1.16.100", "minecraft:item": { @@ -101,42 +94,39 @@ We will create a file `BP/items/ectoplasm.json`. Here is the the basic layout of } } ``` +::: -Most files in your pack will have 2 top level definitions, `"format_version"` and `"minecraft:"`. -The format version defines which version of the Addon system Minecraft will use to read this file. For our item, we will be using `1.16.100` to allow us to use the experimental features. For more information on format version you can check [here](/guide/format-version). +文件包含两个顶层字段: +- `format_version`:定义使用的附加包系统版本(本教程使用1.16.100启用实验性功能) +- `minecraft:item`:包含物品描述和组件 -The second definitions defines what kind of file this is. In our case, as this is an item definition, it is `minecraft:item`. Under this is where we will put all our information. This will always contain a `description` key. +描述部分定义标识符和分类: -Let us look closer at the `"description"`: - -ectoplasm.json/minecraft:item/ - -```json +::: code-group +```json [描述部分] "description": { "identifier": "wiki:ectoplasm", "category": "Items" }, ``` +::: -The description key contains the `identifier` and any other information required. The `identifier` allows the file to know which item to apply the components to. -The `category` key defines which tab of the creative inventory the item would show up in. There are four tabs to choose from: `"Nature"`, `"Equipment"`, `"Construction"` and `"Items"`. If this key is not included, then the item will not show in the creative inventory, but you can still get the item by using `/give`. +分类决定物品在创造模式库存中的位置,可选值:`"Nature"`(自然)、`"Equipment"`(装备)、`"Construction"`(建筑)、`"Items"`(物品)。不设置则不会出现在创造菜单,但仍可通过命令获取。 -Now we can actually define the behavior of our item, under `components`. Here we simply place any components we want our item to have. -This will be our `"minecraft:max_stack_size"` component. For other components you can use, check out our more in depth guide on Items [here](/items/item-components). +组件部分定义行为特性: -ectoplasm.json/minecraft:item/ - -```json +::: code-group +```json [组件部分] "components": { "minecraft:max_stack_size": 16 } ``` +::: -With that, we have now fully defined our item's behavior. This is what your file should currently look like. +完整物品文件应如下所示: -BP/items/ectoplasm.json - -```json +::: code-group +```json [完整物品文件] { "format_version": "1.16.100", "minecraft:item": { @@ -150,30 +140,15 @@ With that, we have now fully defined our item's behavior. This is what your file } } ``` +::: -If you open a world with your addon, your item should be in the correct menu but invisible and have a strange name. +此时物品已具备功能,但缺少纹理和名称。下一章节将完善视觉元素。 -This is because we haven't defined the visuals yet. However, you should see that it does stack as expected. In the next section, we will define the items texture and assign it to our item. +## 物品视觉 -## Item Visuals +### 纹理准备 -Now that we have an item that works, we want to add a texture and name to it. - -Textures are stored in the resource pack under `RP/textures` as images. In order for Minecraft to know which texture to use where, we need to assign a shortname to it, so we can access it. - -### Texture - -To start we need a texture for our item. For our ectoplasm, we will be using this image. - -![ectoplasm.png](https://raw.githubusercontent.com/Bedrock-OSS/wiki-addon/86b0380310d3d5748a43a4be1f93d4c59668e4bf/guide/guide_RP/textures/items/ectoplasm.png) - -Download texture here - -All item textures are stored in `RP/textures/items/`. From here, you can create any subdirectories you wish. -It's best to name your texture image files with the items' _id_, in our case it will be `ectoplasm.png`. -It is recommended to have your images in `.png` format and be of size `16x16`, though Minecraft will accept other formats such as `.jpg` or `.tga`. - -Your folder layout should look like this: +将纹理图片保存至资源包`RP/textures/items/`目录,建议使用物品ID命名(如`ectoplasm.png`),推荐16x16像素PNG格式。 -### Shortname +### 纹理短名 -A shortname is essentially a name that is assigned to the folder path of the texture, so whenever we want to use a texture somewhere, we will use its shortname instead of its folder path. +在`RP/textures/item_texture.json`中定义纹理短名: -All item shortnames are stored in one file called `item_texture.json` which is in `RP/textures`. This contains a list of shortnames and its assigned textures. - -RP/textures/item_texture.json - -```json +::: code-group +```json [纹理定义] { "resource_pack_name": "Ghostly Guide", "texture_name": "atlas.items", - "texture_data": {...} + "texture_data": { + "wiki.ectoplasm": { + "textures": "textures/items/ectoplasm" + } + } } ``` +::: -Here we have 3 top level definitions, `texture_data` is where we will define our shortnames, the other two define the type of file this is. -The `resource_pack_name` is simply our resource pack's name and `texture_name` is what kind of texture file this is. Since this is for _items_, this will always be set to `atlas.items`. +短名`wiki.ectoplasm`将关联到纹理路径(无需扩展名)。 -Under `texture_data` will our list of item shortname definitions. An example definition looks like this: +### 应用纹理 -RP/textures/item_texture.json/texture_data +在物品组件中添加`minecraft:icon`: -```json -"wiki.ectoplasm": { - "textures": "textures/items/ectoplasm" -} -``` - -Here `wiki.ectoplasm` is our shortname and under `textures` we have the path to our item. Notice that this is relative to the resource pack, and does not include the file extension. Your shortname should be short and unique. We recommend setting it as the namespace and id for the item we are assigning it to. - -Now whenever we want to refer our image, we will use the shortname `wiki.ectoplasm`. - -### Icon - -To finally apply our texture to our item, we add the `minecraft:icon` component to our item definition and set its value to our shortname. - -ectoplasm.json/minecraft:item/ - -```json +::: code-group +```json [图标组件] "components":{ "minecraft:max_stack_size": 16, "minecraft:icon" : { @@ -228,28 +189,21 @@ To finally apply our texture to our item, we add the `minecraft:icon` component } } ``` +::: -Now your texture should appear on your item. +### 本地化名称 -### Item Name - -The last thing to add is a nice name to your item. Currently it will look like `item.wiki:ectoplasm`. This is the translation key for your item name, and it is used to allow for [localization](/concepts/text-and-translations). To set it, we just have to define it in our language files. - -We already created these files when making our `RP` and `BP`, so we just need to add to them. - -RP/texts/en_US.lang +在语言文件中添加翻译: +::: code-group +```text [语言文件] +item.wiki:ectoplasm=灵质 ``` -item.wiki:ectoplasm=Ectoplasm -``` +::: -Now when you enter your world, your item should have a name. +## 最终成果 -## Overview - -Now your first custom item, Ectoplasm, is complete! If everything has been done correctly, the item should now be obtainable through the `/give` command in-game, as well as appearing in your creative inventory. - -Your folder structure should look like this: +完成后的物品应可通过`/give`命令获取,并在创造菜单显示。完整文件结构: - -BP/items/ectoplasm.json - -```json + +::: code-group +```json [完整物品文件] { "format_version": "1.16.100", "minecraft:item": { @@ -285,13 +238,12 @@ Your folder structure should look like this: } } ``` - +::: - -RP/textures/item_texture.json - -```json + +::: code-group +```json [完整纹理文件] { "resource_pack_name": "Ghostly Guide", "texture_name": "atlas.items", @@ -302,21 +254,21 @@ Your folder structure should look like this: } } ``` - +::: -If you're having some trouble, check the [Troubleshooting page](/items/troubleshooting-items). If that doesn't help, compare your results with the [example files](https://github.com/Bedrock-OSS/wiki-addon/tree/main/guide). +如遇问题,请参考[故障排除页面](/wiki/items/troubleshooting-items)或对比[示例文件](https://github.com/Bedrock-OSS/wiki-addon/tree/main/guide)。 -## Your progress so far +## 进度追踪 -- [x] Setup your pack -- [x] Create a custom item -- [x] How to format the behavior and resource files for an item -- [x] What components are and how to use them -- [x] How to set an items texture -- [ ] Create a custom entity -- [ ] Create the entity's loot, spawn rules, and a custom recipe +- [x] 创建附加包框架 +- [x] 创建自定义物品 +- [x] 理解物品行为和资源文件格式 +- [x] 掌握组件使用方法 +- [x] 设置物品纹理 +- [ ] 创建自定义实体 +- [ ] 实现实体战利品、生成规则和合成配方 - + \ No newline at end of file diff --git a/docs/wiki/guide/download-packs.md b/docs/wiki/guide/download-packs.md index d7f6243e..0de62cd8 100644 --- a/docs/wiki/guide/download-packs.md +++ b/docs/wiki/guide/download-packs.md @@ -1,7 +1,7 @@ --- -title: Download Example Packs -category: Extra -description: Appendix for downloading example Packs +title: 下载示例包 +category: 扩展内容 +description: 下载示例包的参考指南 prefix: 'b. ' nav_order: 2 show_toc: false @@ -17,17 +17,35 @@ mentions: - TheItsNameless --- +# 下载示例包 + + + ::: tip -This is an appendix page. You can start the guide from the beginning [here](/guide/index). +这是附录页面。你可以从[这里](/wiki/guide/index)重新开始本指南。 ::: -To get the most out of the guide, you should always attempt all guide-exercises yourself! However if you get very stuck, the example packs should give you some valuable reference material. +为了获得最佳学习效果,建议始终先自行尝试完成教程中的所有练习!如果遇到实在无法解决的问题,示例包将为你提供有价值的参考材料。 -Download here: +下载地址: Download Add-On +>下载附加包 -To install, simply unzip the behavior pack into the Minecraft folder: `com.mojang\development_behavior_packs` or `com.mojang\development_*_packs`, depending on which pack you downloaded. +安装时,只需将行为包解压到Minecraft的以下目录:`com.mojang\development_behavior_packs` 或 `com.mojang\development_*_packs`(具体路径取决于你下载的包类型)。 + +::: code-group +```text [安装说明] +// 注意:此处路径根据实际安装平台可能有所不同 +// Windows 10/11 默认路径: +%localappdata%\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang +``` +::: + +注意事项: +1. 确保已启用"测试版 API" 功能 +2. 首次安装后需要重启游戏 +3. 在创建世界时选择对应的行为包/资源包 +4. 示例包包含完整的组件(Component)和实体(Entity)实现参考 \ No newline at end of file diff --git a/docs/wiki/guide/format-version.md b/docs/wiki/guide/format-version.md index 52005aec..1127ae15 100644 --- a/docs/wiki/guide/format-version.md +++ b/docs/wiki/guide/format-version.md @@ -1,7 +1,7 @@ --- -title: Format Versions -category: Extra -description: How to work with Format Versions +title: 格式版本 +category: 扩展内容 +description: 如何正确使用格式版本 prefix: 'e. ' nav_order: 5 mentions: @@ -11,100 +11,104 @@ mentions: - Xterionix --- -Format versions are an important part of Minecraft: Bedrock Edition's Addon System. They appear at the top of most files, formatted like this: `"format_version": "1.16.100"`. You can think of this as the "version number" of the file, and the number you select here is really important! The format version you select will define which syntax and features are available to you, in that particular file. +# 格式版本 format_version + + + +格式版本是Minecraft基岩版附加包系统的重要组成部分。它们通常以`"format_version": "1.16.100"`的形式出现在文件头部。你可以将其视为文件的"版本号",所选用的数值至关重要!格式版本决定了该文件可用的语法和功能特性。 :::tip -Selecting the wrong format version is a common source of errors. When troubleshooting, people may ask you questions like 'what format version is your item'. Ensure that you know how to answer that question. +选择错误的格式版本是常见错误来源。排查问题时,人们可能会询问"你的物品使用什么格式版本"。请确保你知晓如何回答这类问题。 ::: -## Why do format versions exist? +## 格式版本存在的意义 -Format versions exist to *version* the Addon system, and allow Minecraft to introduce new features into the addon system, without breaking old Addons. For example, a `1.8.0` format version RP Entity file has very different syntax than a `1.10.0` format version RP Entity file. By using the 'format_version' key in the json *you* can decide which version you want to use. +格式版本用于为附加包系统建立**版本控制机制**,使Minecraft能够在引入新功能的同时保持旧版附加包的兼容性。例如,使用`1.8.0`格式版本的RP实体文件与`1.10.0`格式版本的RP实体文件在语法结构上有显著差异。通过在JSON中使用`format_version`字段,**你可以自主选择**要使用的版本。 -By using format versions *per file*, Minecraft gives you a lot of control over how your addon will be interpreted by the game. It is completely possible and expected to mix different format versions in your addon. +通过**按文件**指定格式版本,Minecraft赋予你对附加包运行方式的精细控制。在一个附加包中混合使用不同格式版本是完全可行且常见的做法。 -## Experimental Format Versions +## 实验性格式版本 -Format versions are also used for the purpose of versioning experimental features. Since Minecraft releases bedrock experiments directly into stable, some format versions will be 'locked' under experimental, unless you toggle the correct experiment. +格式版本也用于管理实验性功能的版本控制。由于Minecraft基岩版会将实验性功能直接发布到稳定版中,某些格式版本需要开启对应实验性选项才能启用。 -A well known example is the item/blocks system, where `1.16.100` denotes experimental, and `1.10.0` denotes stable. If you want to make an item, it's important to select a format version early, as it will effect everything else you add to the files. If you are going with an experimental format version for your item/block you may want to go higher than `1.16.100` because some experimental features won't work properly in that format version, for example if you are making a custom spawn egg and you want it to be able to set the entity type of a monster spawner, then you need to the format version to `1.19.80` or higher. +典型案例是物品/方块系统:`1.16.100`代表实验性版本,`1.10.0`代表稳定版本。在制作物品时,建议尽早确定格式版本,因为这会影响文件后续的所有内容。如果选用实验性格式版本,可能需要使用高于`1.16.100`的版本——例如制作自定义刷怪蛋时,若需要设置怪物刷怪箱的实体类型,则必须使用`1.19.80`或更高版本。 -## Format Version is not Game Version +## 格式版本 ≠ 游戏版本 -It is really important to understand that format version is *per subsystem*, and is generally not equal to the base game version. This simply means that every type of file (item, rp entity, bp entity, recipe) will use a different versioning system. +需要重点理解的是:格式版本是**按子系统独立管理**的,通常与基础游戏版本号无关。这意味着每种文件类型(物品、RP实体、BP实体、配方等)都使用独立的版本体系。 -For example: `"format_version": "1.8.0"` in an RP entity file means "use version `1.8.0` of the *item system*". It does *not* mean "use version `1.8.0` of the *addon system*". +例如:RP实体文件中的`"format_version": "1.8.0"`表示"使用物品系统的`1.8.0`版本",而非"使用附加包系统的`1.8.0`版本"。 -For this reason, some file types will have very "old" format versions. Do not be tempted to replace this version with the latest game version, such as `1.17.0`. +因此某些文件类型可能使用看似"陈旧"的格式版本。切忌将其替换为最新游戏版本(如`1.17.0`)。 -## Format Version Fixing +## 格式版本自动修正 -Minecraft has a system that will "fix" your format version if you've written it wrong. This system isn't well understood, isn't enabled for all systems, and shouldn't be relied upon. But it's important to note that an incorrect format version will often "regress" downwards until it hits a valid format version. For example a `1.11.0` RP entity file will simply be interpreted as `1.10.0`, and cause no errors. +Minecraft具备自动修正错误格式版本的机制。该机制尚未被完全掌握,也未在所有系统中启用,不建议依赖此功能。但需注意:错误的格式版本通常会被"降级"到最近的合法版本。例如`1.11.0`的RP实体文件会被识别为`1.10.0`且不会报错。 -This system is useful, as it means you are less likely to generate a broken file, by selecting the wrong format version. +此机制可有效降低因格式版本错误导致文件损坏的概率。 -## Picking a Format Version +## 如何选择格式版本 -Generally speaking, there is a cool tricky to pick the correct format version, for any file type. +通常可采用以下技巧确定正确的格式版本: -For example, imagine you are creating a Recipe file: +以配方文件为例: - 1) Install the [Vanilla Packs](/guide/download-packs). - 2) Look at some recipe files, to judge which format version is most used, or the most recent - 3) Use this format version in your file +1. 安装[原版资源包](/wiki/guide/download-packs) +2. 参考原版配方文件,确定最常用或最新的格式版本 +3. 在你的文件中使用相同版本 -This simple trick will help you select a valid format version for your file. +此方法可帮助你为文件选择有效的格式版本。 -## Format Versions per Asset Type +## 各资源类型的格式版本 -This section will list the format versions used in the vanilla game, alongside how many times it appears. +本节列出原版游戏中使用的格式版本及其出现频率: - - The '⭐' is the recommended *stable* version. - - The '🚀' is the recommended *experimental* version, where applicable. + - '⭐' 代表推荐使用的**稳定**版本 + - '🚀' 代表推荐使用的**实验性**版本(如适用) -### Resource Pack +### 资源包 -| Resource Pack | Version | Count | -|----------------------|----------|-------| -| Entity | 1.10.0 ⭐ | 82 | -| Entity | 1.8.0 | 74 | -| Animation Controller | 1.10.0 ⭐ | 56 | -| Animation | 1.8.0 | 120 | -| Animation | 1.10.0 ⭐ | 6 | -| Attachables | 1.10.0 ⭐ | 29 | -| Attachables | 1.8.0 | 25 | -| Attachables | 1.10 | 1 | -| Models | 1.8.0 | 92 | -| Models | 1.12.0 | 19 | -| Models | 1.10.0 | 4 | -| Models | 1.16.0 | 7 | -| Particles | 1.10.0 ⭐ | 131 | -| Render Controllers | 1.10.0 ⭐ | 83 | +| 资源类型 | 版本 | 数量 | +|---------------------|------------|------| +| 实体 | 1.10.0 ⭐ | 82 | +| 实体 | 1.8.0 | 74 | +| 动画控制器 | 1.10.0 ⭐ | 56 | +| 动画 | 1.8.0 | 120 | +| 动画 | 1.10.0 ⭐ | 6 | +| 可附着物 | 1.10.0 ⭐ | 29 | +| 可附着物 | 1.8.0 | 25 | +| 可附着物 | 1.10 | 1 | +| 模型 | 1.8.0 | 92 | +| 模型 | 1.12.0 | 19 | +| 模型 | 1.10.0 | 4 | +| 模型 | 1.16.0 | 7 | +| 粒子效果 | 1.10.0 ⭐ | 131 | +| 渲染控制器 | 1.10.0 ⭐ | 83 | -### Behavior Pack +### 行为包 -| Category | Version | Count | -|-------------|------------|-------| -| Entities | 1.8.0 | 2 | -| Entities | 1.16.210 | 1 | -| Entities | 1.13.0 | 7 | -| Entities | 1.16.0 ⭐ | 58 | -| Entities | 1.16.100 | 3 | -| Entities | 1.12.0 | 21 | -| Entities | 1.17.20 | 7 | -| Entities | 1.17.10 | 4 | -| Entities | 1.10.0 | 1 | -| Entities | 1.14.0 | 1 | -| Items | 1.10 ⭐ | 44 | -| Items | 1.16.0 | 1 | -| Items | 1.16 | 1 | -| Items | 1.14 | 1 | -| Items | 1.16.100 🚀 | 0 | -| Items | 1.19.80 | 0 | -| Items | 1.20.40 | 0 | -| Recipes | 1.12 | 991 | -| Recipes | 1.16 ⭐ | 194 | -| Recipes | 1.14 | 2 | -| Spawn Rules | 1.8.0 ⭐ | 48 | -| Spawn Rules | 1.17.0 | 1 | -| Spawn Rules | 1.11.0 | 1 | +| 类别 | 版本 | 数量 | +|--------------|--------------|------| +| 实体 | 1.8.0 | 2 | +| 实体 | 1.16.210 | 1 | +| 实体 | 1.13.0 | 7 | +| 实体 | 1.16.0 ⭐ | 58 | +| 实体 | 1.16.100 | 3 | +| 实体 | 1.12.0 | 21 | +| 实体 | 1.17.20 | 7 | +| 实体 | 1.17.10 | 4 | +| 实体 | 1.10.0 | 1 | +| 实体 | 1.14.0 | 1 | +| 物品 | 1.10 ⭐ | 44 | +| 物品 | 1.16.0 | 1 | +| 物品 | 1.16 | 1 | +| 物品 | 1.14 | 1 | +| 物品 | 1.16.100 🚀 | 0 | +| 物品 | 1.19.80 | 0 | +| 物品 | 1.20.40 | 0 | +| 配方 | 1.12 | 991 | +| 配方 | 1.16 ⭐ | 194 | +| 配方 | 1.14 | 2 | +| 生成规则 | 1.8.0 ⭐ | 48 | +| 生成规则 | 1.17.0 | 1 | +| 生成规则 | 1.11.0 | 1 | \ No newline at end of file diff --git a/docs/wiki/guide/index.md b/docs/wiki/guide/index.md index c357f89e..09ea6757 100644 --- a/docs/wiki/guide/index.md +++ b/docs/wiki/guide/index.md @@ -1,10 +1,10 @@ --- -title: Beginners Guide +title: 新手指南 nav_order: 1 categories: - - title: Guide + - title: 指南 color: green - - title: Extra + - title: 扩展内容 color: blue --- diff --git a/docs/wiki/guide/introduction.md b/docs/wiki/guide/introduction.md index 817c6852..2e03452f 100644 --- a/docs/wiki/guide/introduction.md +++ b/docs/wiki/guide/introduction.md @@ -1,9 +1,9 @@ --- -title: Introduction -category: Guide -description: Introduction to our "Getting Started" Guide +title: 入门指南 +category: 指南 +description: 《我的世界》附加包开发入门指南 tags: - - guide + - 指南 nav_order: 1 prefix: '1. ' mentions: @@ -19,42 +19,46 @@ mentions: - retr0cube --- -## What are Addons? +# 入门指南 -An "Addon" is the Minecraft Bedrock Edition (_Windows 10, iOS, Android, Consoles_) equivalent to Java mods. However, in contrast to Java, the Bedrock Edition API is officially maintained by Mojang instead of the community. + -In general, you can think of _mods_ as _modifying_ the game, and _addons_ as _adding onto_ the game, following the development opportunities provided by Microsoft. +## 什么是附加包? -## What is this guide? +"附加包"(Addon)是《我的世界》基岩版(_Windows 10/iOS/Android/主机平台_)中与Java版模组(Mod)相对应的内容扩展形式。与Java版不同的是,基岩版的API由Mojang官方维护而非社区驱动。 -This guide is a beginner tutorial, intended to walk you through the first stages of addon-creation. You will create your very own fully-functional Ghost entity, as well as an Ectoplasm item, and some other associated files. +简单来说,_模组_(Mod)侧重于修改游戏本身,而_附加包_(Addon)则遵循微软提供的开发规范,通过添加新内容来扩展游戏。 -By the end of this guide, you will have created an entire addon all by yourself, which you can play with and modify! +## 本指南的定位 -In this guide you will find boxes like these: +本指南是面向新手的入门教程,将手把手带你完成附加包开发的初阶内容。你将亲手创建一个功能完整的幽灵实体、灵质物品以及其他相关文件。 + +完成本指南后,你将独立制作出完整的附加包,并可以自由体验和修改! + +本指南中你会看到以下形式的提示框: :::tip -Some very helpful information! +这是非常有用的提示信息! ::: :::warning -Attention! Watch out for these common mistakes. +注意!请特别留意这些常见错误 ::: -Watch out for these boxes! They contain very important information that could help you with problems. +请仔细阅读这些提示框!它们包含可能帮助你解决问题的重要信息。 -## Is the guide up to date? +## 指南时效性说明 -This guide is written for the most recent _stable_ release of Minecraft Bedrock Edition. Many things won't work in previous versions, and some will be changed in later ones. We will keep the guide as up-to-date as possible, so no need to worry. +本指南基于《我的世界》基岩版最新稳定版编写。部分内容在旧版本中可能无法使用,未来版本也可能会有改动。我们将持续更新指南内容以保持时效性,请放心使用。 -## Appendix Pages +## 附录文档 -Alongside the step-by-step guide, we have a few other files here, which may be interesting to you: +除了分步教程,我们还准备了以下扩展阅读材料: -- [Understanding JSON](/guide/understanding-json) -- [Downloading Example Packs](/guide/download-packs) -- [Troubleshooting](/guide/troubleshooting) +- [理解JSON](/wiki/guide/understanding-json) +- [下载示例资源包](/wiki/guide/download-packs) +- [故障排查](/wiki/guide/troubleshooting) -## What to do after finishing the Guide +## 完成指南后的进阶建议 -At the end of the guide section, your first addon will be done! To further expand your knowledge, consider doing these: +完成本指南的学习后,你的第一个附加包就诞生了!想要进一步提升技能,可以参考以下建议: -- Start your project! -- To dive into the other aspects of adding onto MCBE (Minecraft Bedrock Edition), you can use the different sections' sub guides listed in the Appendix. This includes but is not limited just to custom Blocks, Biomes, advanced Items, Animation Controllers, and even JS scripts. Some sections provide more technical in-depth tutorials and documents for each relevant topic. +- 立即开启你的新项目! +- 通过附录中列出的各类子指南,深入探索MCBE(Minecraft基岩版)的其他扩展领域。包含但不限于自定义方块、生物群系、高级物品、动画控制器甚至JS脚本开发。部分章节还提供了相关主题的深度技术文档。 diff --git a/docs/wiki/guide/loot-table.md b/docs/wiki/guide/loot-table.md index 7585f6fe..0a3db0f4 100644 --- a/docs/wiki/guide/loot-table.md +++ b/docs/wiki/guide/loot-table.md @@ -1,11 +1,11 @@ --- -title: 'Adding a Loot Table, a Spawn rule and a crafting recipe' -category: Guide -description: How to add your first Loot Table, Spawn Rule and Crafting Recipe +title: '添加战利品表、生成规则与合成配方' +category: 指南 +description: 如何添加你的第一个战利品表、生成规则和合成配方 nav_order: 8 prefix: '8. ' mentions: - - KaiFireborn + - KaiFireBorn - SirLich - sermah - cda94581 @@ -17,15 +17,18 @@ mentions: - FrankyRay --- -Next, we'll enhance the custom Ghost entity by adding some more basic mechanics to it: +# 添加战利品表、生成规则与合成配方 -## Loot tables + -First, we'll make the ghost drop Ectoplasm upon death: create the following file: +接下来我们将为自定义的幽灵实体添加更多基础机制: -BP/loot_tables/entities/ghost.json +## 战利品表 -```json +首先让幽灵死亡时掉落灵质,创建以下文件: + +::: code-group +```json [BP/loot_tables/entities/ghost.json] { "pools": [ { @@ -50,24 +53,24 @@ First, we'll make the ghost drop Ectoplasm upon death: create the following file ] } ``` +::: -- Loot Tables consist of `"pools"`. Each pool defines a different loot. A pool consists of 3 parts, `"rolls"`, `"entries"` and `"conditions"`. The `"conditions"` are optional and won't be covered in this guide. To learn more about conditions, look at [Loot Tables](/loot/loot-tables). -- The `"rolls"` section defines how many times a random entry will be chosen from the following `"entries"`object. -- The `"entries"` part defines the items, from which the loot table can choose. Each roll a new item will be chosen. -- `"type"` defines what will be chosen. You can set it to `"item"` or `"loot_table"` to either chose an item or an different loot table. -- `"name"` will be set to an item identifier with its namespace. It defines which item will be selected. -- `"weight"` is optional and defines how likely it is, that this item will be selected. If there is more than one item in the `"entries"` section, the `"weight"` attribute can be used to make the probability of one item more or less likely. If it isn't set, it defaults to 1. -- `"functions"` provide a powerful way of customizing the item that will be returned. They can add enchantments to an item, setting an items' name or simply setting the number of items that will be dropped. To define the number of items, we use `"set_count"`. It takes the `"count"` attribute, which sets the maximum and minimum amount of items that will be dropped. +- 战利品表由`"pools"`(池)组成,每个池定义不同的战利品。每个池包含三部分:`"rolls"`(随机次数)、`"entries"`(条目)和可选的`"conditions"`(条件)。关于条件的详细信息请参阅[战利品表](/wiki/loot/loot-tables) +- `"rolls"`定义从`"entries"`中随机选择物品的次数 +- `"entries"`定义可供选择的物品列表,每次roll会从中选取一个新物品 +- `"type"`决定选取类型,可设置为`"item"`(物品)或`"loot_table"`(其他战利品表) +- `"name"`使用命名空间格式指定具体物品 +- `"weight"`(权重)决定物品被选中的概率,默认值为1 +- `"functions"`提供强大的物品自定义功能,可通过`"set_count"`设置掉落数量范围 -For more information on loot tables, see our extended guide: [Loot Tables](/loot/loot-tables)! +更多战利品表知识请参阅进阶指南:[战利品表](/wiki/loot/loot-tables) -## Spawn rules +## 生成规则 -Next, we'll make the ghost spawn in deserts at night: +接下来配置幽灵在沙漠生物群系的夜间生成规则: -BP/spawn_rules/ghost.json - -```json +::: code-group +```json [BP/spawn_rules/ghost.json] { "format_version": "1.8.0", "minecraft:spawn_rules": { @@ -104,27 +107,27 @@ Next, we'll make the ghost spawn in deserts at night: } } ``` +::: -- You already know what `"format_version"`does. -- Inside the `"minecraft:spawn_rules"` part we define our spawn rules. -- The `"description"` defines the basic properties of the file. The `"identifier"` is used to define on which entity this spawn rule applies on. `"population_control"` is used to limit the amount of entities that will be spawned. Once the pool that is defined inside of `"population_control"` is full, no more entities will be spawned. -- With `"conditions"` we can define rules that limit the spawning of this entity to special cases. We will shortly describe each condition used here, but you can learn more conditions and how to use them [here](/entities/vanilla-usage-spawn-rules). - - `"spawns_on_surface"` allows the mob to only spawn on surfaces. - - `"minecraft:brightness_filter"` limits the spawning to areas with a lighting level thats between the defined values. If `"adjust_for_weather"` is `true`, the light level decrease during rain and storms will be ignored. - - `"minecraft:difficulty_filter"` defines the difficulty level needed to spawn the entity. - - `"weight"` defines how often this entity will spawn. The higher this value, the more often the mob will spawn. - - `"minecraft:herd"`defines how many entities will be spawned at once. - - With `"minecraft:biome_filter"` we define the biomes in which the entity is able to spawn. +- `"description"`定义基础属性: + - `"identifier"`指定应用此规则的实体 + - `"population_control"`控制实体生成数量上限 +- `"conditions"`包含生成条件: + - `"spawns_on_surface"`限制地表生成 + - `"brightness_filter"`设置光照范围(0-7),`"adjust_for_weather"`忽略天气影响 + - `"difficulty_filter"`设置生效难度范围 + - `"weight"`控制生成频率(数值越高越常见) + - `"herd"`设置单次生成数量 + - `"biome_filter"`限定沙漠生物群系 -To learn more about spawn rules, take a look on our guide on [Vanilla spawn rules](/entities/vanilla-usage-spawn-rules). +详细生成规则请参考:[原版生成规则](/wiki/entities/vanilla-usage-spawn-rules) -## Crafting recipes +## 合成配方 -And finally, as an introduction to recipes, we'll make the Ectoplasm craftable into Slime Blocks: +最后实现将灵质合成史莱姆方块的功能: -BP/recipes/ectoplasm_slime_blocks.json - -```json +::: code-group +```json [BP/recipes/ectoplasm_slime_blocks.json] { "format_version": "1.12.0", "minecraft:recipe_shaped": { @@ -144,36 +147,34 @@ And finally, as an introduction to recipes, we'll make the Ectoplasm craftable i } } ``` - -- `"format_version"` is already known. -- With `"recipe_shaped"` we define, that each ingredient has a set place in the crafting grid. There are some other types that can be used, you can find more information [here](/loot/recipes). -- Inside `"description"` we define the `"identifier"` of this recipe, which is the name of the recipe. -- `"tags"` is a list of benches (crafting table, furnace, etc) that are able to use this recipe. After version b1.16.100 it was possible to use custom benches, created by an addon. -- `"pattern"` defines the arrangement of the items inside the crafting grid. Each `#` represents the item that is set under `"key"`. In this case, the whole 3x3 grid has to be filled with `"wiki:ectoplasm"`, our own item. It is possible to define more items, just add an entry to `"key"` and set the key to a character, that you can use inside `"pattern"`. -- `"result"` contains an `"item"`, which is set to the item that will be the output of this recipe. - -For more information on this topic, visit our page about [recipes](/loot/recipes)! - -## What you have learned - -:::tip What you have learned: - -- How to create a loot table and define which items a mob is able to drop -- How to set the rules for a mob to spawn -- How to create new crafting recipes ::: -## Your progress so far +- `"recipe_shaped"`表示有序合成配方 +- `"tags"`指定适用的工作台类型 +- `"pattern"`定义3x3网格布局,`#`符号对应`"key"`中指定的灵质 +- `"result"`设置输出为原版史莱姆方块 -**What you've done:** +完整配方教程请查看:[合成配方](/wiki/loot/recipes) + +## 知识总结 + +:::tip 学习要点 +- 创建战利品表配置生物掉落 +- 设置生物生成规则 +- 制作合成配方 +::: + +## 当前进度 + +**已完成内容:** -- [x] Setup your pack -- [x] Create a custom item -- [x] Create a custom entity -- [x] Create the entity's loot, spawn rules, and a custom recipe +- [x] 资源包初始化 +- [x] 创建自定义物品 +- [x] 创建自定义实体 +- [x] 添加实体掉落、生成规则与合成配方 -Congratulations! you have finished the Guide and created your first Add-on. 🎉 +恭喜!你已完成全部教程并创建了第一个附加包 🎉 \ No newline at end of file diff --git a/docs/wiki/guide/project-setup-android.md b/docs/wiki/guide/project-setup-android.md index c64dcc90..cd7dd2c0 100644 --- a/docs/wiki/guide/project-setup-android.md +++ b/docs/wiki/guide/project-setup-android.md @@ -1,7 +1,7 @@ --- -title: Project Setup Android -category: Guide -description: How to setup your project on Android +title: Android项目设置 +category: 指南 +description: 如何在Android平台上设置项目 mentions: - Etanarvazac - MedicalJewel105 @@ -10,74 +10,83 @@ mentions: hidden: true --- -## Tools +# Android项目设置 -It is not easy to find good apps to make add-ons for android platform, but we tried our best and collected Google Play apps for you. -For development on Android, you'll need a combination of 3 applications. + -1. A file manager that can create ZIP archives if your device is running Android 12 or newer. -2. A code editor (any text editor will work, but only code editors will show syntax highlights). -3. An image editor (no device comes with a editor that can go down to the pixels). +## 工具选择 -### File Managers +为Android平台寻找合适的附加包开发工具并非易事,但我们已尽力为您收集了Google Play上的优质应用。Android开发需要以下三类工具组合使用: -These file managers are known to have ZIP archiving and view-only access to the `Android/data` folder: +1. **文件管理器**:若设备运行Android 12或更高版本,需支持创建ZIP压缩包 +2. **代码编辑器**:任意文本编辑器均可,但专业编辑器能提供语法高亮 +3. **图像编辑器**:需要支持像素级编辑(系统自带编辑器通常无法满足) -1. [**X-Plore**](https://play.google.com/store/apps/details?id=com.lonelycatgames.Xplore) - a powerful file manager with dual-pane tree view, a built-in text editor (not code), several file compression formats (ZIP, 7zip, RAR, etc.), and more. On rooted devices, X-Plore has edit access to `Android/data` and root directories. -2. [**Total Commander**](https://play.google.com/store/apps/details?id=com.ghisler.android.TotalCommander) - not as powerful out of the box compared to X-Plore, but contains some of the same features including dual pane, ZIP and RAR archives, and view-only access to `Android/data`. Total Commander has list view instead of tree and many other features that require plugins (apps from Google Play) to use. +### 文件管理器推荐 -### Code Editors +以下管理器支持ZIP压缩包操作及`Android/data`目录只读访问: -1. **Acode:** [Free version](https://play.google.com/store/apps/details?id=com.foxdebug.acodefree) comes with ads that can be toggled off without paying. Supports GitHub integration using a Personal Access Token, FTP/SFTP, syntax highlighting for over 100+ languages including JSON, tab-view for multi-file editing, dozens of themes, and more. This app is open source and does have a [paid version](https://play.google.com/store/apps/details?id=com.foxdebug.acode) that allows a much deeper theme customization. +1. [**X-Plore**](https://play.google.com/store/apps/details?id=com.lonelycatgames.Xplore) - 双面板树形视图,内置文本编辑器(非代码专用),支持ZIP/7zip/RAR等格式。Root设备可编辑`Android/data`及系统目录 +2. [**Total Commander**](https://play.google.com/store/apps/details?id=com.ghisler.android.TotalCommander) - 双面板界面,支持ZIP/RAR压缩包,列表视图展示文件,部分功能需插件扩展 + +### 代码编辑器推荐 + +1. **Acode**: + - [免费版](https://play.google.com/store/apps/details?id=com.foxdebug.acodefree) 含可关闭的广告 + - 支持GitHub集成(需个人访问令牌)、FTP/SFTP协议 + - 提供100+语言语法高亮(含JSON)、多标签编辑、丰富主题 + - 开源项目,另有[付费版](https://play.google.com/store/apps/details?id=com.foxdebug.acode)支持深度主题定制 :::info -Acode is the only powerful code editor actively being developed on Android at this time. Other editors are very limited or have been abandoned long enough to vanish from the Google Play store. If you know of a code application, you can contribute to this guide. +Acode是当前Android平台唯一持续更新的专业代码编辑器。其他编辑器功能有限或已停止维护。若您有其他推荐,欢迎贡献至本指南。 ::: -### Image Editors +### 图像编辑器推荐 -1. [**Pocket Paint**](https://play.google.com/store/apps/details?id=org.catrobat.paintroid) - lightweight editor with the bare minimum features needed for any add-on creation. This app is easy to use and allows importing other images over others. Saves in JPG (compressed), PNG (lossless, with transparency), and ORA (multi-layer images). This app is open source. -2. [**Pixly**](https://play.google.com/store/apps/details?id=com.meltinglogic.pixly&hl=en) - very lightweight, no ads or in app purchases. Plentiful tools and customizable brushes, ability to save palettes internally or externally. -3. [**Pixel Art editor**](https://play.google.com/store/apps/details?id=net.spc.app.pixelarteditor&hl=en) - a simple lightweight app. Would be the best if you need just to draw some texture-placeholder. +1. [**Pocket Paint**](https://play.google.com/store/apps/details?id=org.catrobat.paintroid) - 轻量级基础编辑器,支持JPG/PNG/ORA格式,开源项目 +2. [**Pixly**](https://play.google.com/store/apps/details?id=com.meltinglogic.pixly&hl=en) - 无广告内购,提供丰富笔刷工具和调色板管理 +3. [**Pixel Art editor**](https://play.google.com/store/apps/details?id=net.spc.app.pixelarteditor&hl=en) - 极简像素画工具,适合制作纹理占位图 -## Your Workspace +## 工作区搭建 :::tip -In this version of the guide, "BP" refers to your behaviour pack folder and "RP" refers to your resource pack folder in your workspace. For locations in files or directories, `../` indicates "From last location" followed by the added space (e.g.: `/one/two/three/file.txt` would be shortened to `../three/file.txt`) +本文中: +- "BP"指行为包目录 +- "RP"指资源包目录 +- 路径表示`../<当前位置>`指代上级路径(如`/one/two/three/file.txt`简写为`../three/file.txt`) -If your device is rooted, you can follow the main project setup using the `/Android/data/com.mojang.minecraftpe/files/games/com.mojang` development behaviour and resource pack folders directly. Otherwise, follow the steps below. +若设备已Root,可直接使用`/Android/data/com.mojang.minecraftpe/files/games/com.mojang`开发目录。未Root设备请按以下步骤操作。 ::: -Before we begin, you need a workspace. Using your file manager, navigate to your Internal Storage (In most cases, it's `/`. In others, the full path (e.g.: `/storage/emulated/0/`) is displayed. Both are acceptable.) and create a folder that will contain your packs. For this example, our full directory is `/Minecraft Packs/MyFirstAddon`. From there, you'll need one folder for both your behaviour and resource packs (e.g.: `../MyFirstAddon/addonBP` and `../MyFirstAddon/addonRP`). +1. 使用文件管理器进入内部存储(通常为根目录`/`或`/storage/emulated/0/`) +2. 创建项目总目录(示例:`/Minecraft附加包/我的首个附加包`) +3. 在总目录下分别建立行为包和资源包子目录(示例:`../我的首个附加包/addonBP`和`../我的首个附加包/addonRP`) -Now that you have the workplace setup, code editors should have a way for you to open a folder as a workplace. In this guide, we'll be walking through Acode. +以Acode为例配置工作区: -1. Open Acode. -2. Tap the file browser button (3 bars in the top-left), followed by "Open folder" -3. Tap "Add a storage", followed by "select folder" -4. This should have opened your device's file browser. Navigate to the _main_ folder for your projects (for us, `/Minecraft Packs`) then tap "Use this folder". If your device asked you to allow Acode access, tap "Allow". -5. You should be back in Acode now. Tap "OK" and your folder should now be in the list. Tap on it and then "Select Folder" on the bottom of the screen. -6. Now when you open the file browser (3 bars in top-left), you should see your folder in the list. You now have quick access to your addon's behaviour and resource pack folders. The file browser uses tree view to display your active workspace. +1. 打开Acode点击左上角文件浏览器图标 +2. 选择"打开文件夹" → "添加存储" → "选择文件夹" +3. 导航至项目总目录(如`/Minecraft附加包`)并授权访问 +4. 完成配置后即可在侧边栏快速访问项目文件 :::tip -You can create new files and folders inside your packs from the file browser by tapping and holding on the folder you want to create the item in. +长按目录可快速新建文件/文件夹,建议保持整洁的项目结构。 ::: -## BP & RP Manifests +## 清单文件配置 :::warning -From here on out, all files and folders have very specific names unless otherwise noted. Wrongly named files and/or folders are a common reason of an error. Please ensure you're checking your work carefully in accordance to the examples provided. If a file or folder mentioned has not yet been created, please create it in it's appropriate directory. - -When creating a new file in a file manager or some text or code applications, the `.txt` extension is added automatically to the end of the file name. To ensure our files work as intended, be sure to remove `.txt`. Like names, the wrong file extension is also a common reason of an error. If you're using Acode, you'll notice `untitled.txt` is completely highlighted instead of just `untitled`. This is a common practice for naming programming language files. +注意: +- 所有文件/文件夹名称需严格匹配示例 +- 错误命名是常见报错原因 +- 新建文件时注意移除自动添加的`.txt`扩展名 +- Acode中`untitled.txt`会全选文件名,便于修改扩展名 ::: -The manifest file is the file Minecraft uses to identify your packs. Every pack has one (and only one) manifest. A folder with a correctly formatted manifest will show up in Minecraft. Before we begin adding content, we will ensure our "minimal" pack is visible. Manifests are written in the `JSON` programming language. If you're unfamiliar with JSON, you can learn more about it [here](/guide/understanding-json). +每个附加包都需要唯一的`manifest.json`清单文件。以下是基本配置模板: -Create a new text file in your addon's behaviour pack folder called `manifest.json`. To begin, copy and paste the following code into the `manifest.json` file. A full breakdown of the manifest file is provided after creating these files. - -BP/manifest.json - -```json +::: code-group +```json [BP/manifest.json] { "format_version": 2, "header": { @@ -97,14 +106,10 @@ Create a new text file in your addon's behaviour pack folder called `manifest.js } ``` -Now create another `manifest.json` file in your addon's resource pack folder. Again, copy and paste the following code inside the new file. - -RP/manifest.json - -```json +```json [RP/manifest.json] { "format_version": 2, - "header" { + "header": { "name": "pack.name", "description": "pack.description", "uuid": "...", @@ -120,110 +125,99 @@ Now create another `manifest.json` file in your addon's resource pack folder. Ag ] } ``` +::: -## Manifest Breakdown +### 清单参数说明 -- `format_version` defines the version the syntax your manifest is written in. Version 2 is the most recent stable version. Always use this version. -- `name` is name of your pack. We will be defining the this in "code form" later so they can easily be translated into other languages, should you create a pack with multiple languages. -- `description` is a short description about your pack that will show up under the `name` in-game. This will also be defined later in "code form". -- `uuid` is required to help identify your pack from other packs and will have a breakdown of it's own below. Once explained, you'll need to replace all of the `...` with them. -- `version` is literally the version of your addon. Upon completing your addon, you can always change this to `[1, 0, 0]`. However, it'll be easier to use the hotfix spot while making your changes on mobile. -- `min_engine_version` tells Minecraft what the minimum version it needs to be in order for your pack to work. For example, if your pack has a crafting recipe that involves concrete, your pack can't run on Minecraft 1.5 because concrete doesn't exist in that version. -- Under `modules`, you have the `type` field. This tells Minecraft what your pack is. So `data` in your BP tells the game that pack is a behaviour pack and `resources` in your RP tells the game that pack is a resource pack. +| 参数 | 说明 | +|----------------------|----------------------------------------------------------------------| +| `format_version` | 清单语法版本(推荐使用2) | +| `name` | 包名称(后续通过语言文件定义) | +| `description` | 包描述(显示在游戏内名称下方) | +| `uuid` | 唯一标识符(需使用UUIDv4生成) | +| `version` | 附加包版本号(格式[主,次,修订]) | +| `min_engine_version` | 最低兼容游戏版本 | +| `modules.type` | 包类型:`data`=行为包,`resources`=资源包 | -## UUID Breakdown +### UUID生成指南 -A UUID, or **U**niversally **U**nique **ID**entifier, both identifies your pack for other programs (Minecraft, for example) and separates your pack from someone else's pack for the program it's for. A version 4 UUID (UUID-4) is usually in the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` and made of a random string of letters and numbers. For example: `5c830391-0937-44d6-9774-406de66b6984`. +UUID(通用唯一识别码)格式为`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,需使用[在线生成工具](https://www.uuidgenerator.net/version4)创建版本4的随机UUID。每个清单文件需要两个不同的UUID,共需生成4个唯一值。 -You should **NEVER** use the same UUID twice! Use the [Online UUID Generator Tool](https://www.uuidgenerator.net/version4) to generate the UUID's needed for your manifest files. Every manifest file uses two different UUID's. So to ensure your packs will work correctly, get 4 different UUID's to replace all of the `...` in both manifests. When finished, each UUID entry should look similar like this: `"uuid": "5c830391-0937-44d6-9774-406de66b6984` +## 包图标配置 -## Pack Icon +为附加包添加识别图标(建议64x64 PNG格式),将图片命名为`pack_icon.png`并放置于两个包的根目录: -Notice how other packs have a icon? It's a image file which can quickly identify how your addon will appear in-game. Got a low-resolution square image as a PNG? You can use it! Otherwise, you can use this example icon. - - + Download Image +>下载示例图标 -You must place a copy of your desired image in both the behaviour and resource packs. In order for the image to be read correctly, the name must be `pack_icon.png`. +## 多语言配置 -## Language Files +在以下路径创建语言文件,使用`§`符号实现文字格式化(格式代码参考[Minecraft颜色代码](https://htmlcolorcodes.com/minecraft-color-codes/)): -Remember when we said we'll define the pack name and description in code form earlier? Now is that time as it's the last thing we need to do to setup your addon. You will need to create 4 new files and 2 new folders (2 files and 1 folder for each pack). You can You can learn more about how Minecraft handles localization [here](/concepts/text-and-translations). You can also format your definitions using the `§` symbol. You can view a list of colors and formats [here](https://htmlcolorcodes.com/minecraft-color-codes/). If you use any formatting, make sure you `§r`eset when changing formats: `§kl My pack l` will render "My pack" unreadable whereas `§kl §rMy pack §kl` can be read properly. - -BP/texts/en_US.lang - -``` -pack.name=§2My §lFIRST §r§2Addon's Behaviour Pack! -pack.description=This addon is made by a Wiki Contributor! +::: code-group +```txt [BP/texts/en_US.lang] +pack.name=§2我的§l首个§r§2行为包! +pack.description=本附加包由Wiki贡献者制作! ``` -BP/texts/languages.json - -```json +```json [BP/texts/languages.json] ["en_US"] ``` -RP/texts/en_US.lang - -``` -pack.name=§2My §lFIRST §r§2Addon's Resource Pack! -pack.description=This addon is made by a Wiki Contributor! +```txt [RP/texts/en_US.lang] +pack.name=§2我的§l首个§r§2资源包! +pack.description=本附加包由Wiki贡献者制作! ``` -RP/texts/languages.json - -```json +```json [RP/texts/languages.json] ["en_US"] ``` +::: -## Importing Your Addon +## 导入附加包 -Now that your addon has all of the required content, we need to import it to Minecraft. To do this, we need to create a file with the extension `.mcaddon`. +1. 选中行为包和资源包目录 +2. 创建ZIP压缩包 +3. 重命名文件扩展名为`.mcaddon` +4. 点击生成的文件自动导入游戏 -1. Open your preferred file manager and navigate to the folder containing your behaviour and resource packs. -2. Using multi-select, select both packs and create a ZIP file. -3. When asked for the name of the file, ensure that `.zip` is changed to `.mcaddon`. - ![](/assets/images/guide/project-setup-android/zip-addon.png) -4. When your file manager finishes, it should be a `MCADDON` file with Minecraft as it's icon. Tapping on this file should launch Minecraft. +![](/assets/images/guide/project-setup-android/zip-addon.png) -If done correctly, Minecraft will display a banner for both packs. First is `Importing...`. After should be `Successfully imported ""`. You can also go to `Settings > Storage` if you don't see the import messages to verify your packs were imported. If you do not see either pack, check out our [troubleshooting guide](/guide/troubleshooting). +导入成功后游戏会显示提示横幅,或在`设置 > 存储`中确认包状态。若导入失败请参考[问题排查指南](/wiki/guide/troubleshooting)。 -## Turn on Content Log +## 开启内容日志 :::warning -Content log is the most useful tool you have for debugging your addons. Please do not skip this step. +内容日志是调试附加包的重要工具,请务必开启 ::: ![](/assets/images/guide/content_log.png) -Content Log is an extremely important debugging tool, which you should always have on. +1. 进入`设置 > 创作者` +2. 启用两个内容日志选项 +3. 游戏中按`Ctrl+H`可打开日志界面 -Turn on both content log settings in `settings > creator`. This will show you any errors in your add-on when you enter a world with it applied. You can also open the content log GUI in-game by pressing `ctrl+h`. Learn more about the content log [here](/guide/troubleshooting). +## 创建测试世界 -## Creating your testing world +1. 点击**创建新世界** +2. 确保以下设置: + - 实验性玩法:全部开启 + - 默认游戏模式:创造模式 + - 世界权限:仅邀请(单人游戏不影响) + + ![](/assets/images/guide/project-setup/settings_1.png) + ![](/assets/images/guide/project-setup/settings_2.png) -Now we create a world to test your new add-on! +3. 激活行为包与资源包 +4. 点击**创建** -1. Click "**Create new world**"; +## 最终项目结构 -2. Ensure that the following settings are set. - - ![](/assets/images/guide/project-setup/settings_1.png) - ![](/assets/images/guide/project-setup/settings_2.png) - -3. Now activate your behavior pack, and your resource pack. You can do this by selecting the packs, and clicking 'apply'. - -4. Now click '**Create**'! - -## Final Notes - -**Here is how your project should look, after completing this page:** - -Remember that in future, we will represent `com.mojang/development_behavior_packs/guide_RP/` as `RP`, and `com.mojang/development_behavior_packs/guide_BP/` as `BP`. +完成配置后项目应包含以下文件: -## What you have learned +## 学习总结 -:::tip What you have learned: +:::tip 已掌握内容: -- What and where your `com.mojang` folder is and what it contains -- How to setup your mobile workspace -- What a `manifest.json` file is -- What are UUID's and how to use them -- How to create icons for your addons -- What a `.lang` file is +- `com.mojang`目录结构解析 +- 移动端工作区配置方法 +- 清单文件的作用与配置 +- UUID的生成与应用 +- 包图标的制作规范 +- 语言文件的配置原理 ::: -## Your progress so far +## 进度追踪 -- [x] Setup your pack -- [ ] Create a custom item -- [ ] Create a custom entity -- [ ] Create a custom block +- [x] 完成项目基础配置 +- [ ] 创建自定义物品 +- [ ] 创建自定义实体 +- [ ] 创建自定义方块 - + \ No newline at end of file diff --git a/docs/wiki/guide/project-setup.md b/docs/wiki/guide/project-setup.md index f90ff437..5891a51b 100644 --- a/docs/wiki/guide/project-setup.md +++ b/docs/wiki/guide/project-setup.md @@ -1,7 +1,7 @@ --- -title: Project Setup -category: Guide -description: How to setup your project +title: 项目设置 +category: 指南 +description: 如何设置您的项目 nav_order: 4 prefix: '4. ' mentions: @@ -24,91 +24,94 @@ mentions: - lescx --- -## The com.mojang folder +# 项目设置 -The `com.mojang` folder is a special folder where Minecraft stores data (Addons, Worlds, Player info...). Minecraft understands this location, and all files we access or create will be placed somewhere in this folder! + -You should create a shortcut to the `com.mojang` folder on your Desktop or on your mobile device, so you can easily access it at any time. The exact location of the `com.mojang` folder will depend on your device OS. +## com.mojang 文件夹 + +`com.mojang` 文件夹是Minecraft存储数据(附加包、世界、玩家信息等)的特殊位置。Minecraft能够识别这个路径,所有我们访问或创建的文件都将存放在这个文件夹中! + +建议您在桌面或移动设备上创建`com.mojang`文件夹的快捷方式以便快速访问。该文件夹的具体位置因设备操作系统而异。 ### Windows -_Tip: You can type %appdata% into the searchbar to jump directly into the 'C:\Users\USERNAME\AppData\' folder._ +_提示:在搜索栏输入%appdata%可直接跳转至'C:\Users\用户名\AppData\'目录_ `C:\Users\USERNAME\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang` ### Android -Android 11 or older: `Phone > games > com.mojang` +Android 11及更早版本:`手机存储 > games > com.mojang` -Android 12 and newer: `Phone > Android > data > com.mojang.minecraftpe > files > games > com.mojang` +Android 12及更新版本:`手机存储 > Android > data > com.mojang.minecraftpe > files > games > com.mojang` ### ChromeOS -Before you can see the `com.mojang` in your files, make sure to change the `File Storage Location` to `External` in your Minecraft Settings: +在访问`com.mojang`文件夹前,需先在Minecraft设置中将`文件存储位置`更改为`外部`: -- Go to `Minecraft Settings`. -- Navigate to `Settings > General > Storage`. -- Change the `File Storage Location` to `External`. +1. 进入`Minecraft设置` +2. 导航至`设置 > 通用 > 存储` +3. 将`文件存储位置`改为`外部` -After that you can access the `com.mojang` folder in your Android Subsystem: - -`My Files > Play Files > Android > data > com.mojang.minecraftpe > files > games > com.mojang` +设置完成后可通过以下路径访问: +`我的文件 > Play文件 > Android > data > com.mojang.minecraftpe > files > games > com.mojang` ### iOS -`My iDevice > Minecraft > games > com.mojang` +`我的设备 > Minecraft > games > com.mojang` -### Development Packs +### 开发包 -We will develop our addon in `development_behavior_packs` and `development_resource_packs`. When you make changes within these folders, you can _exit and re-enter a world with the packs applied_, to automatically reload the content. This allows you to quickly test your addon without reloading Minecraft. +我们将在`development_behavior_packs`和`development_resource_packs`中开发附加包。在这些文件夹中修改内容后,只需_退出并重新进入已应用该包的世界_即可自动重载内容,无需重启Minecraft即可快速测试修改。 -`resource_packs` and `behavior_packs` on the other hand contain stable addons, including those imported via `.mcpack`. We can ignore these folders for now. +`resource_packs`和`behavior_packs`文件夹用于存放稳定版附加包(包括通过`.mcpack`导入的包),开发时可暂时忽略这些目录。 -## Your Workspace +## 您的工作区 :::tip -Project setup is different for android and other platforms. Consider looking into our guide for android platforms. +Android平台的项目设置与其他平台有所不同,建议参考我们的Android专用指南。 ::: Android guide +>Android指南 :::tip -In this guide, BP refers to the folder you created in `development_behavior_packs` ("the behavior pack"), and RP refers to the folder you created in `development_resource_packs` ("the resource pack") +本指南中: +- BP指在`development_behavior_packs`中创建的文件夹(行为包) +- RP指在`development_resource_packs`中创建的文件夹(资源包) ::: -First of all, you will need to create the proper folders in suitable locations and set up your workspace. -_The remainder of this guide assumes you are using VSCode. You may also follow along with other editors._ +首先需要在适当位置创建文件夹并建立工作区。_本指南后续步骤默认使用VSCode,您也可以使用其他编辑器。_ -Let's create your first add-on workspace in Visual Studio Code now. +现在让我们在VSCode中创建第一个附加包工作区: -1. Open VSCode (_Visual Studio Code, the code editor_) -2. Create a folder named "`your_pack_name_RP`" in `development_resource_packs`. **I'll refer to this folder as `RP`** -3. Create a folder "`your_pack_name_BP`" in `development_behavior_packs`. **I'll refer to this folder as `BP`**. -4. Go to `File > Add folder to workspace...` and choose `BP`. Do the same with `RP`. -5. Press `File > Save Workspace as...` to save the workspace file to your Desktop. Whenever you're working on your addon, all you have to do is open the workspace by double-clicking, and you will get quick access to both BP and RP folders. +1. 打开VSCode(Visual Studio Code代码编辑器) +2. 在`development_resource_packs`中创建名为"`your_pack_name_RP`"的文件夹(以下简称`RP`) +3. 在`development_behavior_packs`中创建名为"`your_pack_name_BP`"的文件夹(以下简称`BP`) +4. 通过`文件 > 将文件夹添加到工作区...`依次添加`BP`和`RP` +5. 使用`文件 > 将工作区另存为...`将工作区文件保存到桌面。后续开发时只需双击打开该工作区文件,即可快速访问BP和RP文件夹 -## BP Manifest +## BP清单文件 :::tip -In this guide, you will often be instructed to create files with specific names, placed in specific folders. If the folder doesn't exist yet, please create it! +本指南中会频繁要求您在特定路径创建指定文件。如果目标文件夹不存在,请先创建! ::: :::warning -Wrongly named files/folders is a common source of errors. Please check your work carefully against the examples. +文件名/文件夹名错误是常见问题来源,请仔细核对示例。 ::: -The manifest is a file that identifies your pack to Minecraft. Every pack has one manifest. A folder with a correctly formatted manifest will show up in Minecraft, and we consider this the "minimal" pack before we can add additional content. +清单文件(manifest)是Minecraft识别附加包的核心文件。每个包都必须包含一个格式正确的清单文件,这是附加包能被识别的最低要求。 -Manifest files are written in `json`. If this isn't familiar to you, you can learn more about json [here](/understanding-json). +清单文件使用`json`格式编写。如需了解json格式,请参考[此文档](/understanding-json)。 -First, create a new file in your BP folder by right-clicking on the folder and selecting `New File`. Call the file `manifest.json`. To begin, you can copy paste the following code into the file. +在BP文件夹中右键新建文件,命名为`manifest.json`。初始内容可复制以下代码: -BP/manifest.json - -```json +::: code-group +```json [BP/manifest.json] { "format_version": 2, "header": { @@ -127,40 +130,36 @@ First, create a new file in your BP folder by right-clicking on the folder and s ] } ``` +::: -### Manifest Explained +### 清单文件解析 -- "`format_version`" defines what version of manifest syntax you are using. Version 2 is the most recent stable version; use it. +- `format_version` 指定清单语法版本,推荐使用最新稳定版2 +- `name` 定义行为包名称,`description` 为游戏内显示的描述。使用"代码形式"定义以便后续本地化,详见[文本与翻译](/wiki/concepts/text-and-translations) +- `UUID` 字段至关重要,下文将详细说明 +- `version` 控制附加包版本号。当设备上已安装旧版本时,新版会自动覆盖旧版。若仅在`development_*_packs`中使用且用于私人世界,可不更新版本号 +- `min_engine_version` 指定兼容的最低Minecraft客户端版本 +- `modules` 中`type`设为`data`表明这是行为包 -- "`name`" is the name of your behavior pack. "`description`" will show up under it in-game. We are defining these files in "code form" so we can translate them later into other languages. For more information about localization, look [here](/concepts/text-and-translations). +### UUID详解 -- The "`UUID`" field is **essential**, and will be discussed in more detail below. +UUID(通用唯一识别码)是Minecraft识别附加包的核心标识,格式示例:`5c830391-0937-44d6-9774-406de66b6984` -- "`version`" defines the version of your add-on. When you import an add-on with a newer version on a device with an older version installed, the more recent version will overwrite the older one. You don't need to change the version if you have the add-on in `development_*_packs` folders and only use them on private worlds. +**禁止重复使用相同UUID**。您可以通过以下方式生成: +- [在线生成器](https://www.uuidgenerator.net/version4) +- VSCode用户可安装[此扩展](https://marketplace.visualstudio.com/items?itemName=netcorext.uuid-generator) +- 专业工具如_bridge._会自动生成 -- "`min_engine_version`" defines the minimum Minecraft client version that'll be able to read your add-on. - -- In "`modules`", the "`type`" is defined to be "`data`". This makes your pack a _Behavior Pack_. - -### UUID Explained - -A UUID (_Universally Unique Identifier_) identifies your pack for other programs (in this case, Minecraft) to read. It looks something like this: `5c830391-0937-44d6-9774-406de66b6984` - -**NEVER USE THE SAME UUID TWICE.** You can generate your own UUIDs [here](https://www.uuidgenerator.net/version4) or, if you use VSCode, you can install [this](https://marketplace.visualstudio.com/items?itemName=netcorext.uuid-generator) extension. Many other tools like _bridge._ generate UUIDS automatically. Every manifest file uses two different UUIDs. - -To ensure that your add-on will work correctly you should generate two new UUID's which you will paste into the BP `manifest.json` file, at each `"..."`. When you are finished, it should look something like this: +每个清单文件需要两个不同的UUID,分别填入`header.uuid`和`modules[0].uuid`。正确示例如下: `"uuid": "5c830391-0937-44d6-9774-406de66b6984"` -## RP Manifest +## RP清单文件 -The next step is to create the `manifest.json` for the RP. The format for a resource-pack manifest is nearly identical to a BP manifests except that the `type` is `resources`, which marks the pack as a _Resource Pack_. +资源包清单文件格式与行为包相似,主要区别在于`type`需设为`resources`: -Copy the following code into your newly created `RP/manifest.json` and insert your own UUIDs. - -RP/manifest.json - -```json +::: code-group +```json [RP/manifest.json] { "format_version": 2, "header": { @@ -179,90 +178,93 @@ Copy the following code into your newly created `RP/manifest.json` and insert yo ] } ``` +::: -## Pack Icon +## 包图标 -The pack icon is an image file which identifies how your addon will look in-game. If you have a low-resolution square image, you can use it. Otherwise, download and use this example icon: +包图标是附加包在游戏内的展示图片。建议使用低分辨率正方形图片,或下载以下示例图标: - + Download Image +>下载图片 -You should place a copy of your desired image into both the RP and the BP. The image needs to be named `pack_icon.png` +将图片文件分别放入RP和BP文件夹,并命名为`pack_icon.png` -## Language Files +## 语言文件 -The last thing to do is setup language support for your addon. You will need to create a language file for both the RP and the BP. You can learn more about how Minecraft handles localization [here](/concepts/text-and-translations). +最后需要为附加包设置语言支持。需为RP和BP分别创建语言文件,详见[本地化系统](/wiki/concepts/text-and-translations)。 -RP/texts/en_US.lang - -```json -pack.name=Wiki Resource Pack -pack.description=A Ghostly Guide +::: code-group +```json [RP/texts/en_US.lang] +pack.name=Wiki资源包 +pack.description=幽灵指南 ``` +::: -BP/texts/en_US.lang - -```json -pack.name=Wiki Behavior Pack -pack.description=A Ghostly Guide +::: code-group +```json [BP/texts/en_US.lang] +pack.name=Wiki行为包 +pack.description=幽灵指南 ``` +::: -RP/texts/languages.json - -```json +::: code-group +```json [RP/texts/languages.json] ["en_US"] ``` +::: -BP/texts/languages.json - -```json +::: code-group +```json [BP/texts/languages.json] ["en_US"] ``` +::: -## Checking your Work +## 验证成果 -If you have done everything correctly, your packs should show up in Minecraft now! If you don't see your pack, you should follow the [troubleshooting guide.](/troubleshooting) +完成上述步骤后,您的附加包应已出现在游戏中!如果未显示,请参考[问题排查指南](/troubleshooting)。 ![](/assets/images/guide/project-setup/active_pack.png) -## Turn on Content Log +## 启用内容日志 :::warning -Content log is the most useful tool you have for debugging your addons. Please do not skip this step. +内容日志是调试附加包最重要的工具,请务必启用。 ::: ![](/assets/images/guide/content_log.png) -Content Log is an extremely important debugging tool, which you should always have on. +内容日志是至关重要的调试工具,建议始终保持开启: -Turn on both content log settings in `settings > creator`. This will show you any errors in your add-on when you enter a world with it applied. You can open the content log GUI in-game by pressing `ctrl+h` or by pressing `Content Log History` in the creator settings panel. Learn more about the content log [here](/guide/troubleshooting). +1. 在`设置 > 创作者`中启用全部内容日志选项 +2. 应用附加包进入世界后,任何错误都会显示在日志中 +3. 游戏内按`ctrl+h`或通过创作者设置面板打开日志界面 -## Creating your testing world +了解更多内容日志信息请访问[问题排查指南](/wiki/guide/troubleshooting)。 -Now we create a world to test your new add-on! +## 创建测试世界 -1. Click "**Create new world**"; - -2. Ensure that the following settings are set. +现在让我们创建测试世界: +1. 点击"**创建新世界**" +2. 确保以下设置: ![](/assets/images/guide/project-setup/settings_1.png) ![](/assets/images/guide/project-setup/settings_2.png) - -3. Now activate your behavior pack, and your resource pack. You can do this by selecting the packs, and clicking 'apply'. - -4. Now click '**Create**'! +3. 激活行为包和资源包(选中后点击'应用') +4. 点击"**创建**"! --- -## Your progress so far +## 当前进度 -**Here is how your project should look, after completing this page:** +**完成本页面后的项目结构:** -Remember that in future, we will represent `com.mojang/development_behavior_packs/guide_RP/` as `RP`, and `com.mojang/development_behavior_packs/guide_BP/` as `BP`. +后续指南中将使用简写: +- `com.mojang/development_behavior_packs/guide_RP/` 简写为 `RP` +- `com.mojang/development_behavior_packs/guide_BP/` 简写为 `BP` -## What you have learned +## 知识总结 -:::tip What you have learned: +:::tip 已掌握内容: -- What the com.mojang folder is, where it is and what folders it contains -- How to setup your workspace -- What a `manifest.json` file is -- How to use UUIDs -- How to create an icon for your addon -- What a `.lang` file is +- com.mojang文件夹的作用与位置 +- 工作区设置方法 +- manifest.json文件的作用 +- UUID的使用规范 +- 附加包图标创建 +- .lang文件的作用 ::: -## Your progress so far +## 进度追踪 -- [x] Setup your pack -- [ ] Create a custom item -- [ ] Create a custom entity -- [ ] Create the entity's loot, spawn rules and a custom recipe +- [x] 完成基础设置 +- [ ] 创建自定义物品 +- [ ] 创建自定义实体 +- [ ] 配置实体战利品、生成规则与合成配方 - + \ No newline at end of file diff --git a/docs/wiki/guide/software-preparation.md b/docs/wiki/guide/software-preparation.md index 75ab1a1f..c8ecee90 100644 --- a/docs/wiki/guide/software-preparation.md +++ b/docs/wiki/guide/software-preparation.md @@ -1,7 +1,7 @@ --- -title: Software and preparation -category: Guide -description: How to setup your developement environment +title: 软件与准备工作 +category: 指南 +description: 如何配置开发环境 nav_order: 3 prefix: '3. ' mentions: @@ -21,56 +21,64 @@ mentions: - ThomasOrs --- -Before you can start creating addons, you first have to install the required tools and applications. While development will be easiest on Windows 10, we have provided mobile alternatives for both Android and iOS, where applicable. +# 软件与准备工作 -## Download Minecraft Bedrock Edition + + +在开始制作附加包之前,您需要先安装必要的工具和软件。虽然在 Windows 10 上进行开发最为便捷,我们也为 Android 和 iOS 用户提供了适用的移动端替代方案。 + +## 下载 Minecraft 基岩版 - [Windows 10](https://www.microsoft.com/en-us/p/minecraft-for-windows-10/9nblggh2jhxj?activetab=pivot:overviewtab) - [Android](https://play.google.com/store/apps/details?id=com.mojang.minecraftpe&hl=en) - [iOS](https://apps.apple.com/us/app/minecraft/id479516143) -- [Run MC on Linux](https://discord.gg/VJTZ3KaTx6) +- [在 Linux 上运行 MC](https://discord.gg/VJTZ3KaTx6) -## Picking an Editor +## 选择编辑器 -Addons can be created using any text editor, however it's much more comfortable to work in a dedicated editor. A good editor can give you code-completion, error-detection, and in-editor documentation. +虽然任何文本编辑器都可以创建附加包,但使用专用编辑器会更加高效。优秀的编辑器能提供代码补全、错误检测和内置文档支持。 -There are strong opinions about the best editor for beginners, but generally speaking you cannot go wrong selecting either VSCode, or bridge. If you are mobile, you will need to use a mobile alternative. +对于初学者而言,VSCode 和 bridge. 都是不错的选择。移动端用户需要使用对应的移动版编辑器。 ### VSCode -VSCode is a general purpose text-editor and IDE. With VSCode, you will be able to edit your addons in plain-text, guided along by a powerful array of extensions and addons. VSCode is a great option for programmers and advanced users. +VSCode 是一款通用文本编辑器兼 IDE。通过丰富的扩展支持,您可以在纯文本环境下高效开发附加包。适合程序员和高级用户使用。 -[⚙️Install VSCode](https://code.visualstudio.com/) +[⚙️安装 VSCode](https://code.visualstudio.com/) - + -Many packages exist for VSCode that make editing addons easier: +以下扩展能显著提升附加包开发体验: -- [Blockception's Minecraft Bedrock Development](https://marketplace.visualstudio.com/items?itemName=BlockceptionLtd.blockceptionvscodeminecraftbedrockdevelopmentextension) -- [.mcfunction support](https://marketplace.visualstudio.com/items?itemName=arcensoth.language-mcfunction) -- [.lang support](https://marketplace.visualstudio.com/items?itemName=zz5840.minecraft-lang-colorizer) -- [Bedrock Definitions](https://marketplace.visualstudio.com/items?itemName=destruc7i0n.vscode-bedrock-definitions) -- [Prettify-json](https://marketplace.visualstudio.com/items?itemName=mohsen1.prettify-json) -- [Spell Checker (for writing wiki)](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) -- [Snowstorm Particle Editor](https://marketplace.visualstudio.com/items?itemName=JannisX11.snowstorm) -- [UUID Generator](https://marketplace.visualstudio.com/items?itemName=netcorext.uuid-generator) +- [Blockception 的 Minecraft 基岩版开发扩展](https://marketplace.visualstudio.com/items?itemName=BlockceptionLtd.blockceptionvscodeminecraftbedrockdevelopmentextension) +- [.mcfunction 支持](https://marketplace.visualstudio.com/items?itemName=arcensoth.language-mcfunction) +- [.lang 支持](https://marketplace.visualstudio.com/items?itemName=zz5840.minecraft-lang-colorizer) +- [基岩版定义库](https://marketplace.visualstudio.com/items?itemName=destruc7i0n.vscode-bedrock-definitions) +- [JSON 美化工具](https://marketplace.visualstudio.com/items?itemName=mohsen1.prettify-json) +- [拼写检查器(用于文档编写)](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) +- [Snowstorm 粒子编辑器](https://marketplace.visualstudio.com/items?itemName=JannisX11.snowstorm) +- [UUID 生成器](https://marketplace.visualstudio.com/items?itemName=netcorext.uuid-generator) ### bridge. -[bridge.](https://bridge-core.app/) is a light-weight, dedicated IDE for Minecraft addons. It features [innovative features](https://bridge-core.app/guide/features/) such as [entity and block previews](https://bridge-core.app/guide/features/index.html#file-previews), [rich auto-completions and file validations](https://bridge-core.app/guide/features/index.html#auto-completions-and-validation) and [advanced file creation with presets](https://bridge-core.app/guide/features/index.html#advanced-file-creation). -bridge. includes a regular text editor for experienced addon creators and a tree editor to make it easy for beginners to get started with editing JSON files. +[bridge.](https://bridge-core.app/) 是专为 Minecraft 附加包开发的轻量级 IDE,具有以下创新功能: +- [实体与方块预览](https://bridge-core.app/guide/features/index.html#file-previews) +- [智能自动补全与文件验证](https://bridge-core.app/guide/features/index.html#auto-completions-and-validation) +- [预设模板快速创建文件](https://bridge-core.app/guide/features/index.html#advanced-file-creation) -#### Next Steps -- [Read more on why you should use bridge.](https://bridge-core.app/guide/why-bridge) -- [Read our guide on getting started with bridge.](https://bridge-core.app/guide/index) -- [Try out bridge. online](https://editor.bridge-core.app/) +既提供面向资深开发者的文本编辑器,也包含适合新手的树状 JSON 编辑器。 -### Mobile Editors +#### 下一步 +- [了解选择 bridge. 的理由](https://bridge-core.app/guide/why-bridge) +- [阅读 bridge. 入门指南](https://bridge-core.app/guide/index) +- [在线试用 bridge.](https://editor.bridge-core.app/) + +### 移动端编辑器 #### Android -- [ACode Editor](https://play.google.com/store/apps/details?id=com.foxdebug.acodefree) +- [ACode 编辑器](https://play.google.com/store/apps/details?id=com.foxdebug.acodefree) - [bridge. v2](https://bridge-core.app/) #### iOS @@ -79,101 +87,98 @@ bridge. includes a regular text editor for experienced addon creators and a tree ## Blockbench -- [Blockbench](https://blockbench.net/) is a 'boxy 3D model editor' typically used to create Minecraft models, textures and animations. Also provides a web-browser version which is compatible with mobile. +- [Blockbench](https://blockbench.net/) 是专为 Minecraft 设计的方块化 3D 建模工具,可用于创建模型、纹理和动画。提供网页版并兼容移动设备。 -## Image Editors +## 图像编辑器 -When choosing an image editor, it is important to keep in mind that the traditional Minecraft style is composed of simple 16X16 pixelart. There are plenty of powerful and free art programs available for you to use. However, many of these programs have more tools than you will need for Minecraft graphical design and these tools require time to learn. +选择图像编辑器时需注意:Minecraft 传统风格基于 16x16 像素艺术。以下是推荐工具: :::tip -Choose a program that feels comfortable and easy for you to use. Many Addon creators use different art programs for different tasks. (Example: One might use paint․net for most of the art, and piskel for Minecraft block animations). Choose what works best for you! +根据使用场景灵活选择工具。许多开发者会组合使用不同软件(例如:用 paint.net 处理大部分图像,用 piskel 制作方块动画)。找到最适合您的工作流程! ::: ### Krita -Krita is a powerful open-source art programed with the goal of giving free powerful digital art tools to artists. Krita has more than enough features to cover your Minecraft needs and works on a MAC or PC. -**+ Pros:** Plenty of features including a pixel brush with an intuitive user interface. -**- Cons:** Requires a little time to become familar with the tools. +开源数字绘画软件,功能全面,支持 Windows/macOS。 +**+ 优点:** 内置像素画笔工具,界面直观 +**- 缺点:** 需要时间熟悉工具 -[Download Krita](https://krita.org/en/) +[下载 Krita](https://krita.org/en/) ### GIMP -Gimp is similar to Krita in that it is a free and open source digital art program that has a vast arrays of tools. Where Krita focuses more on illustration, GIMP focuses more on image manipulation (think Photoshop). Gimp also works on MAC or PC. -**+ Pros:** GIMP has more than enough tools for editing Minecraft art -**- Cons:** The interface is not intuitive. Even though GIMP is powerful, it requires a steep learning curve. +开源图像处理软件(类似 Photoshop),支持 Windows/macOS。 +**+ 优点:** 功能足以应对 Minecraft 图像需求 +**- 缺点:** 学习曲线陡峭 -[Download Gimp](https://www.gimp.org/) +[下载 GIMP](https://www.gimp.org/) -### Paint․net -Paint․net is a simple yet powerful image editing and art software. Paint․net may not have a vast array of tools like Krita and GIMP, but it does offer simplicity and ease of use. -**+ Pros:** Easy to use and learn. -**- Cons:** Only works on Windows. +### Paint.net +简单易用的图像编辑软件。 +**+ 优点:** 快速上手 +**- 缺点:** 仅限 Windows 平台 -[Download Paint.net](https://www.getpaint.net) +[下载 Paint.net](https://www.getpaint.net) ### Pixilart -Pixilart is a web-based pixel art software. It is extremely simple to use since it is focused on pixel art. It also has a powerful resize option that may come in handy, so that you can resize your art without losing the pixelart details. +网页像素艺术工具。 +**+ 优点:** 专为像素设计优化,支持无损缩放 +**- 缺点:** 需要网络连接 -**+ Pros:** Easy to use and learn. Curated specifically for pixel art. -**- Cons:** Must have internet connection. May be missing tools you want. - -[Use Pixilart](https://www.pixilart.com/) +[使用 Pixilart](https://www.pixilart.com/) ### Piskel -Piskel is a web-based pixel art software with a focus of making pixelated sprites (or video game character animations). This tool, similar to Pixilart, is simple to use. This is also a great tool for making flipbooks (Minecraft block or skin animations). +网页像素动画工具。 +**+ 优点:** 适合制作逐帧动画 +**- 缺点:** 功能较为基础 -**+ Pros:** Easy to use and learn. Perfect for flipbook animations -**- Cons:** Must have internet connection. Only offers the most basic tools. - -[Download Piskel](https://www.piskelapp.com/) +[下载 Piskel](https://www.piskelapp.com/) ### Libresprite -LibreSprite is a free and open source program for creating and animating your sprites. Based on the last GPLv2 commit of aseprite. +基于 Aseprite 的开源像素艺术工具。 +**+ 优点:** 专为像素艺术定制 +**- 缺点:** macOS 支持有限 -**+ Pros**: Basic & easy to use, customizable and curated for pixel artists. -**- Cons**: May not work on Mac, maintained only by a small community. - -## Additional Materials +## 补充资料 :::tip -This guide will walk you through the first stages of addon development, but it is not comprehensive! To learn more about addons, you will have to use and reference other sources of information, which we will link to here. +本指南仅涵盖附加包开发的基础知识,更多进阶内容请参考以下资源: ::: -### Join the Discord +### 加入 Discord -The best place to get help with this guide is to join the [discord server](/discord). +获取实时帮助的最佳途径:[Discord 服务器](/discord) -### Vanilla Packs +### 原版资源包 -Minecraft's vanilla files are a good source of reference material. You should download these packs, and store them on a convenient location on your computer. When you need an example of an item, or entity, or animation, you can reference these files for inspiration. +Minecraft 原版文件是绝佳的参考素材,建议下载并妥善保存: -- [Vanilla packs](https://github.com/Mojang/bedrock-samples/releases) +- [原版资源包](https://github.com/Mojang/bedrock-samples/releases) -### Documentation +### 文档资源 -There are many good sources of Addon documentation. Familiarize yourself with all of them, and consider bookmarking them. +推荐收藏以下文档网站: -- [bedrock.dev](https://bedrock.dev/): Reference documentation. -- [wiki.bedrock.dev](https://wiki.bedrock.dev/): Tutorials and guides. -- [MS Docs](https://docs.microsoft.com/en-us/minecraft/creator/): The official microsoft creator portal for addons. +- [bedrock.dev](https://bedrock.dev/):技术参考文档 +- [wiki.bedrock.dev](https://wiki.bedrock.dev/):教程与指南 +- [微软官方文档](https://docs.microsoft.com/en-us/minecraft/creator/):微软官方附加包门户 -### Troubleshooting and Additional Help +### 故障排除 -- If the json format is very tricky for you, consider reading the [understanding-json guide](/guide/understanding-json). -- If you get stuck with an odd error, consider reading the [troubleshooting guide](/guide/troubleshooting). -- If you still haven't found a solution, feel free to join our [Discord server](/discord). +- 若 JSON 格式困扰您,请阅读 [JSON 理解指南](/wiki/guide/understanding-json) +- 遇到奇怪错误时参考 [故障排除指南](/wiki/guide/troubleshooting) +- 仍未解决?欢迎加入 [Discord 服务器](/discord) -### Additional Links and Tools +### 实用工具 -- You can explore additional tools [here](/meta/useful-links). +- [更多工具推荐](/wiki/meta/useful-links) -## Your progress so far +## 当前进度 -- [x] Installed the necessary software -- [x] Downloaded the Vanilla Example files -- [ ] Locate your `com.mojang` folder and create your addon's workspace. -- [ ] Create the manifest and pack icon for your first addon +- [x] 已安装必要软件 +- [x] 已下载原版示例文件 +- [ ] 定位 `com.mojang` 文件夹并创建工作区 +- [ ] 创建首个附加包的清单文件和包图标 - + \ No newline at end of file diff --git a/docs/wiki/guide/troubleshooting.md b/docs/wiki/guide/troubleshooting.md index 46265d86..f691e5a1 100644 --- a/docs/wiki/guide/troubleshooting.md +++ b/docs/wiki/guide/troubleshooting.md @@ -1,11 +1,11 @@ --- -title: Troubleshooting -category: Extra -description: A simple troubleshooting guide +title: 故障排除 +category: 指南 +description: 简明故障排查指南 prefix: 'c. ' nav_order: 3 tags: - - help + - 帮助 mentions: - SirLich - Joelant05 @@ -16,66 +16,68 @@ mentions: - SmokeyStack --- -Creating Addons for Bedrock Minecraft is a relatively straightforward process _once you get the hang of it_. The first time is usually a frustrating, bug-prone process. This document contains some tips and tricks for fixing those dastardly bugs, as well as best practice information. +# 故障排除 -Please read the whole page, before jumping into troubleshooting tips for a specific domain. + -## Reload +为 Minecraft 基岩版创建附加包是一个相对直接的过程——_一旦掌握窍门后_。但初次尝试通常充满挫折,极易出现各种错误。本文档包含修复这些棘手问题的技巧与最佳实践建议。 -First, you should always reload Minecraft. That means fully closing the game and then reopening it. This can catch many errors, especially those related to assets that are accessed via a filepath, such as textures or loot tables. +在深入特定领域的故障排除之前,请完整阅读本页内容。 -## The Environment +## 重新加载游戏 -The best way to prevent nasty bugs is by working in the right environment. You should review the [software preparation document](/guide/software-preparation) for editor recommendations. The most important part is getting a JSON-linter, ([or using an online json-linter](https://jsonlint.com/)), and storing your packs in `development_behavior_packs` and `development_resource_packs`. +首先,你应当始终尝试完全重载 Minecraft。这意味着彻底关闭游戏后重新启动。这可以解决许多错误,特别是那些与通过文件路径访问的资产相关的问题(如纹理材质或战利品表)。 -If you have your addons in the normal folders, you can run into "pack caching" issues, where you edit the files in one location, but the game is still using the old files. +## 开发环境配置 -## Content Log +避免棘手错误的最佳方式是配置正确的开发环境。建议回顾[软件准备文档](/wiki/guide/software-preparation)获取编辑器推荐。最重要的是配置 JSON 语法检查器([或使用在线 JSON 校验工具](https://jsonlint.com/)),并将资源包存放在 `development_behavior_packs` 和 `development_resource_packs` 目录。 -:::warning Use the Content Log! -Content log is the best tool you have for debugging your addons. Please don't skip this step! +如果将附加包存放在常规文件夹中,可能会遇到"包缓存"问题——即你编辑了某处的文件,但游戏仍在读取旧文件。 + +## 内容日志 + +:::warning 善用内容日志! +内容日志是你调试附加包的最佳工具。请勿跳过此步骤! ::: ::: tip -Errors are not cleared between runs, so the errors you see in the content log may be _old_ errors from prior runs. +错误信息不会在多次运行间自动清除,因此内容日志中显示的错误可能是_之前运行_遗留的旧错误。 ::: -The 'Content Log' is a list of issues found in your pack. Minecraft will generate this list every time your load your world. It can catch issues such as: - - Wrong texture path - - Wrong spelled component - - Incorrect json structure +'内容日志'是游戏检测到的附加包问题清单。Minecraft 会在每次加载世界时生成该列表。它可以捕获以下类型的问题: + - 错误的纹理路径 + - 拼写错误的组件名称 + - 不正确的 JSON 结构 -Content log can be turned on in in `Settings > Creator`. The content log will show in-game on load up, and if more errors occur during gameplay. +内容日志可在 `设置 > 创作者` 中启用。游戏加载时会显示初始日志,游戏过程中新出现的错误也会实时更新。 ![](/assets/images/guide/content_log.png) +### 日志文件位置 -### Content Log File +内容日志以 `.txt` 格式保存在以下路径: -The content log is saved in `.txt` format inside your files: +- *Windows*: `C:\Users\用户名\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\logs` +- *Android:* `/storage/emulated/0/Android/data/com.mojang.minecraftpe/files/games/com.mojang/logs` - - *Windows*: `C:\Users\USERNAME\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\logs` - - *Android:* `/storage/emulated/0/Android/data/com.mojang.minecraftpe/files/games/com.mojang/logs` +## 使用原版资源 +建议下载原版资源包和行为包。你可以在[官方附加包页面](https://www.minecraft.net/en-us/addons/)找到这些资源。遇到问题时可以与原版文件进行对比! -## Using Vanilla Resources +## JSON 模式校验 -You should download the vanilla resource and behavior pack. You can find the vanilla resource and behavior pack [here](https://www.minecraft.net/en-us/addons/). You can compare against the vanilla files if you have any issues! +JSON 模式是验证文件有效性的重要工具。了解更多关于 JSON 模式的使用方法,请参阅[模式校验文档](/wiki/meta/using-schemas)。 -## JSON-Schemas +# 附加包故障排查 -JSON-Schemas are a valuable tool for file validation. You can learn more about JSON-Schemas [here](/meta/using-schemas). +## 实体 -# Troubleshooting your addon! + 实体问题排查 -## Entities +## 物品 - Troubleshoot your entities. + 物品问题排查 -## Items +## 方块 - Troubleshoot your items. - -## Blocks - - Troubleshoot your blocks. + 方块问题排查 \ No newline at end of file diff --git a/docs/wiki/guide/understanding-json.md b/docs/wiki/guide/understanding-json.md index f475cba8..39b49d0b 100644 --- a/docs/wiki/guide/understanding-json.md +++ b/docs/wiki/guide/understanding-json.md @@ -1,7 +1,7 @@ --- -title: Understanding JSON -category: Extra -description: A first peek into JSON +title: 理解JSON +category: 指南 +description: 初探JSON世界 nav_order: 1 prefix: 'a. ' mentions: @@ -13,92 +13,86 @@ mentions: - cda94581 --- +# 理解JSON + + + ::: tip -This is an appendix page. You can start the guide from the beginning [here](/guide/index). +这是一个附录页面。您可以从[这里](/wiki/guide/index)开始完整阅读教程。 ::: -JSON is a simple format for writing text files, in a way that is understandable to both Humans and Computers. Bedrock uses .json files as the "language" of Add-Ons, so you will need a solid understand of how to read and write json! If you have never heard of JSON before, you are encouraged to read through [this tutorial](https://www.digitalocean.com/community/tutorials/an-introduction-to-json). It will teach you everything you need to know about writing valid JSON files. +JSON是一种简单的文本文件格式,既方便人类阅读又便于计算机解析。基岩版使用.json文件作为附加包的"编程语言",因此您需要扎实掌握JSON的读写能力!如果您从未接触过JSON,强烈建议先阅读[这篇教程](https://www.digitalocean.com/community/tutorials/an-introduction-to-json),它将教会您编写有效JSON文件所需的所有知识。 -## Valid JSON +## 有效JSON -The important thing to remember when writing JSON is that it must be _completely error free_, or it won't work at all. Even one wrong character, or one extra comma will cause the entire file to fail. For this reason, it's super important you write valid JSON. +编写JSON时最关键的是必须确保文件_完全无错误_,否则整个文件将无法正常工作。即使一个错误的字符或多余逗号都会导致解析失败。因此,编写有效JSON至关重要。 -We can use an online tool called [json lint](https://jsonlint.com/) to tell us whether our JSON is valid. Simply paste your code into the website, and press `Validate JSON`. You will get a response indicating whether your code is correct or not, as well as the location and type of any errors. +我们可以使用在线工具[json lint](https://jsonlint.com/)来验证JSON格式。只需将代码粘贴到网站中,点击`Validate JSON`即可获得验证结果,包括错误位置和类型。 -## Data Structures +## 数据结构 -In JSON, data can be written in a number of formats. Each format is specialized for the kind of data it wants to represent. Here are the structures we have available: +JSON中使用多种格式表示数据,每种格式对应特定数据类型: -| Name | Example | Explanation | -| ------ | -------- | -------------------------------------- | -| String | "hello!" | Words, or characters. Requires quotes. | -| Int | 15 | A number. No quotes. | -| Float | 1.2 | A fractional number. No quotes. | -| Bool | true | Either true or false. No quotes. | - -And now, in .json format: +| 名称 | 示例 | 说明 | +| ------- | -------- | ----------------------------- | +| 字符串 | "Hello!" | 文本字符。必须用引号包裹 | +| 整型 | 15 | 整数。无需引号 | +| 浮点型 | 1.2 | 小数。无需引号 | +| 布尔值 | true | 只能是true或false。无需引号 | +JSON格式示例: ```json { - "my_string": "hello!", + "my_string": "你好!", "my_int": 15, "my_float": 1.2, "my_bool": true } ``` -In addition to these simple structures, we also have access to two special structures. Special structures are used to *nest* other data together. +除了基础类型,还有两种特殊数据结构用于_嵌套_数据: -### Arrays +### 数组 -Arrays are written as two square brackets `[]`. They represent a _list_. We can put _other data structures_ inside of the list. Each _element_ of the list should be separated by a comma. +数组使用方括号`[]`表示,本质是_有序列表_。列表元素可以是任意数据类型,元素间用逗号分隔。 -Some examples: - -| Structure | Comment | -| --------------- | ------------------------------------- | -| [1, 2, 3] | A list of integers. | -| ["Red", "blue"] | A list of strings. Notice the quotes! | - -And now, in .json format: +示例: +| 结构 | 说明 | +| ------------- | ----------------------- | +| [1, 2, 3] | 整型数组 | +| ["红", "蓝"] | 字符串数组(注意引号!)| +JSON格式: ```json { "my_ints": [1, 2, 3], - "my_strings": ["Red", "blue"] + "my_strings": ["红", "蓝"] } ``` -### Objects +### 对象 -Objects are written as two curly-brackets `{}`. Objects are a special syntax which contains _named_ data structures. The name is called a `key`, and the structure is called a `value`. The examples earlier in this page was a *dictionary* containing examples of the other data types. +对象使用花括号`{}`表示,包含_键值对_集合。键名称为`key`,对应数据称为`value`。键值对的格式为`"": `,注意键名必须用引号包裹且后接冒号。 -This key-value syntax looks like this: `"": `. Notice the quotes around the key, and the colon. - -Here is an example of an object, which contains a few _key-value-pairs_. - - - -```json +对象示例: +::: code-group +```json [示例对象] { "a_list_of_integers": [1, 2, 3], "is_json_cool": true } ``` +::: -We need to separate each key-value pair with a comma. +键值对之间需要用逗号分隔。我们称对象内的键值对为它的_子元素_或_内部元素_。 -We call the key-value pairs of an object as its _child_ or as being _inside_ the object. +## JSON结构规范 -## JSON Structure +在Minecraft中,JSON文件总是以_对象_(即`{}`)开头,称为_顶层对象_。所有代码都以键值对形式编写在这个对象内部。 -In Minecraft, JSON files always begin with an _object_, which you can remember is two curly brackets:`{}`. We call this the _top level object_. We write our code _inside_ of this object, in the form of key-value pairs. - -Here is an example of a simple json file, used for Minecraft addons: - - - -```json +以下是一个典型的Minecraft附加包JSON文件示例: +::: code-group +```json [动画文件示例] { "format_version": "1.12.0", "animations": { @@ -117,35 +111,36 @@ Here is an example of a simple json file, used for Minecraft addons: } } ``` +::: -Take a careful look at the format. You will see that the entire structure is built out the data-structures that we have already learned. If you want to practice your json skills, try to answer these questions: +仔细观察这个结构,可以发现它完全由我们已学过的数据类型构成。试着回答以下问题来检验理解: -- How many keys are there in the _top level object_. Can you name them? -- What is the value of `format_version`? -- What kind of data is stored in the `"loop"` key? (string, boolean, etc) +- 顶层对象中有多少个键?分别是什么? +- `format_version`的值是什么类型? +- `"loop"`键存储的是哪种数据类型?(字符串、布尔值等) -## Troubleshooting Examples +## 常见问题排查 -Here are a few examples, to help you understand feedback you might recieve on the discord or online. We tend to use technical jargon when talking about errors in JSON, so hopefully this section helps familizrize you with the terms: +以下是几个典型错误案例,帮助您理解社区讨论中常用的技术术语: --- -You wrote: `"format_version": 1.12` +**错误写法**:`"format_version": 1.12` -They said: "_The value for format_version is the wrong type. It should be a string._ +**反馈**:"_format_version的值类型错误,应为字符串_" -Remember that `type` means one of the structures: `String`, `Int`, `Float`, `Array` or `Object`. If we examine our code, we will see that we put `format_version` to a `Float`, instead of a `String`. We can fix this problem by adding quotes around the `"1.12"`. +**解析**:此处将`format_version`设为浮点型而非字符串型。应添加引号改为`"1.12"` --- -You wrote: `[1 2 5 6]` +**错误写法**:`[1 2 5 6]` -They said: "_Your array is missing commas._" +**反馈**:"_数组缺少逗号分隔_" -Remember that array elements need to be separated by commas. Your array should look like this: `[1, 2, 5, 6]` +**解析**:数组元素必须用逗号分隔,正确写法应为`[1, 2, 5, 6]` --- -They said: _"You accidentally put the format version inside your description. It should go outside at the top level_". +**反馈**:"_format_version被错误地放在description内部,应置于顶层_" -This means that the key-value pair for `"format_version"` as a _child_ of the description. You should copy/paste the key-value pair out from the description object, and place it at the top level. +**解析**:说明`"format_version"`键值对被错误嵌套在description对象内。需要将其移至顶层对象中。 \ No newline at end of file diff --git a/docs/wiki/0-欢迎.md b/docs/wiki/index.md similarity index 77% rename from docs/wiki/0-欢迎.md rename to docs/wiki/index.md index 9b9f24fe..f6ff5197 100644 --- a/docs/wiki/0-欢迎.md +++ b/docs/wiki/index.md @@ -10,25 +10,35 @@ next: false 除了原创内容,我们经过授权,从 [Bedrock Wiki](https://wiki.bedrock.dev) 镜像且翻译了一批教程,希望能够帮助到大家。 diff --git a/docs/wiki/items/attachables.md b/docs/wiki/items/attachables.md index 3986de00..a9177441 100644 --- a/docs/wiki/items/attachables.md +++ b/docs/wiki/items/attachables.md @@ -1,8 +1,8 @@ --- -title: Attachables -category: Documentation +title: 附加物 +category: 文档 tags: - - beginner + - 新手 mentions: - Sprunkles317 - MedicalJewel105 @@ -11,27 +11,31 @@ mentions: - TheItsNameless --- +# 附加物 + + + ::: tip -This document assumes you have a basic understanding of Molang, render controllers, animations, and client entity definitions. Ensure you are familiar with the basics of [client entities](/entities/entity-intro-rp)! +本文档假设您已掌握Molang、渲染控制器、动画和客户端实体定义的基础知识。请确保您熟悉[客户端实体](/wiki/entities/entity-intro-rp)的基本原理! ::: -## Introduction +## 简介 -When we design a custom item or block, Minecraft will build a model from a template so the item can be displayed when held. This takes the form of the item's sprite being an extruded texture mesh, or blocks displaying with their model. By using a system called **attachables** we can design our own models to be displayed when these items are held. +当我们设计自定义物品或方块时,Minecraft会根据模板生成模型以便在手持时显示。这表现为物品以拉伸纹理网格形式显示,或方块显示其预设模型。通过使用**可附着物**系统,我们可以设计自己的模型来替换这些手持显示效果。 -Ever wanted sticks to look like spyglasses? Or to wield a big chainsaw with a spinning chain? Attachables are the way to accomplish that! +想让木棍看起来像望远镜?或是挥舞带有旋转链条的巨型电锯?可附着物正是实现这些效果的关键! -This document covers **two different ways** to create attachables, depending on how the geometry being used is constructed. +本文将介绍**两种不同方法**来创建可附着物,具体取决于所用几何体的构建方式。 -## Overview +## 概述 -Attachables are a system of rendering entity models when an item or block is equipped. This means having the item held in the main hand, off hand, or armor slots. +可附着物系统用于在装备物品或方块时渲染实体模型。这里的装备包括主手、副手和护甲槽位中的物品。 -Attachable definitions are quite similar in design to client entity definitions; they let us define textures, materials, geometries, and animations to display the attachable. +可附着物定义文件在结构上与客户端实体定义非常相似,允许我们定义要显示的纹理、材质、几何体和动画。 -### File Structure +### 文件结构 -The attachable definition goes within the 'attachables' folder. The file layout is otherwise identical to that of custom entities. +可附着物定义文件应存放在'attachables'文件夹中。其他文件布局与自定义实体完全一致。 -### Attachable Definition +### 可附着物定义 -Here's a basic example of an attachable. +以下是一个基础的可附着物示例: -RP/attachables/stick.entity.json - -```json +::: code-group +```json [RP/attachables/stick.entity.json] { "format_version": "1.10.0", "minecraft:attachable": { @@ -87,88 +90,80 @@ Here's a basic example of an attachable. } } ``` +::: -A few key things to point out with this attachable definition: +此定义中有几个关键点需要注意: -- The identifier matches an existing block or item ID. This will activate the attachable when the item is equipped, and will replace the original model that appears when held. -- There is a material and texture listed for the enchantment glint. This is important to keep around if your item should have the glint when enchanted. +- 标识符需与现有方块/物品ID匹配。这将激活可附着物效果,替换原版手持模型 +- 包含了附魔光效的材质和纹理定义。若物品需要附魔特效,这部分必须保留 -Making attachables is a little more involved than making a client entity file. We need to properly rig the geometry's skeleton so that it looks correct when equipped. +制作可附着物比创建普通客户端实体文件更复杂。我们需要正确绑定几何体的骨骼结构,确保装备时显示正确。 -## Method 1 - Attached to the Skeleton +## 方法一 - 绑定骨骼系统 - + -In this first method we will construct the attachable using a copy of the player's skeleton, by attaching your model to one of the player's bones. +此方法通过复制玩家骨骼系统,将模型附加到特定骨骼上实现。适用于单一实体类型(特别是玩家)和单一装备槽位的场景,在Blockbench中预览效果更方便。 -This solution is ideal for models that are intended for scenarios involving only one type of mob/entity, especially players; and involving only one equipment slot. It is easy to view what the model will look like in Blockbench. +### 骨骼系统搭建 -### Setting up the Skeleton +需要重建玩家骨骼结构,否则模型无法正确绑定骨骼,导致漂浮在玩家周围。 -We need to reconstruct the player's skeleton in order for our model to be parented to the correct bone, otherwise it will not be parented to anything and will float freely on the player. +使用文本编辑器将玩家骨骼文件中的骨骼结构复制到您的几何体文件中,然后将模型立方体设为`rightItem`骨骼的子级。将此几何体保存至资源包。 -With a text editor, take the bones from the provided player skeleton file and copy them to your geometry file, then set the `rightItem` bone as the parent to the cubes from your model. Save this geometry to your resource pack. - -For convenience, such a model has been prepared here. The cubes from the player's model have already been removed: +我们已准备好一个预制模型(已移除原玩家模型的立方体): 📄 Geometry File +>📄 几何体文件 -### Display Settings +### 显示设置 -Having your model floating at the player's feet is not ideal. Our next step is to create animations so we can properly display the model on the player. +为避免模型漂浮在玩家脚部,需要创建动画来控制显示位置。 -Create two new animations, one for holding the item in first person and another for holding it in third person. Select your third-person animation, and position it however you want. Save this animation to your resource pack. +新建两个动画:第一人称手持动画和第三人称手持动画。调整第三人称动画的位置参数后保存至资源包。 -Here is an example of such an animation. This also includes a first-person animation—the means of making one is detailed in the section below. +示例动画文件(包含第一人称动画制作说明): 📄 Animation File +>📄 动画文件 -### First-person Animations +### 第一人称动画 -To more easily create first-person animations, we need to mimic how the arm is positioned in the first person. +制作第一人称动画时需模拟游戏中手臂的真实姿势: :::tip -To add animation for player's hands, you need to use player's animations, not attachables animations. +注意:玩家手部动画需使用玩家动画系统,而非可附着物动画系统。 ::: -Use the following guide animation and import it into Blockbench. It applies a rotation of (95, -45, 115) and a translation of (13.5, -10, 12) to the right arm bone, perfectly mimicking how the arm is positioned in first-person. +使用指导动画文件(应用右臂骨骼旋转(95, -45, 115)和平移(13.5, -10, 12))来准确定位: 📄 Attachable Guide File +>📄 动画指导文件 -:::warning NOTE -This is where things get tricky. Both animations will need to be played simultaneously; your first-person animation, and the guide's first-person animation. - -Be sure you are editing your animation when making your changes. Select it first, then play the guide's first-person animation on top. +:::warning 重要提示 +需要同时播放两个动画:您的第一人称动画和指导动画。在Blockbench中编辑时,请确保选中您的动画后再叠加播放指导动画。 ::: -### Conclusion +### 最终效果 -With this all set up, go through and delete the *cubes* from the player skeleton if there are any, but keep the bones. Check the model out in-game! +完成上述步骤后,删除玩家骨骼中的立方体(保留骨骼结构),即可在游戏中查看效果! -## Method 2 - Bound to a Bone +## 方法二 - 骨骼绑定系统 - + -In this second method, the attachable geometry will be constructed using model binding. This allows a model to be directly attached to a bone within a mob's geometry corresponding to the slot it is equipped in. Minecraft employs model binding for its attachable items, including the trident, spyglass, bow, and shield. +此方法通过模型绑定直接将几何体附加到对应装备槽位的骨骼上。Minecraft原生物品(如三叉戟、望远镜)均采用此方案。虽然能实现动态多生物适配,但存在一些特殊限制。 -While this method allows the attachable to apply more dynamically to other mobs and equipment slots, model binding also has strange quirks, which will be illustrated below. Some developers may find this method trickier to get working. +### 模型绑定 -### Model Binding +首先确保几何体文件版本为`"1.16.0"`(可通过Blockbench转换旧版文件)。然后在根骨骼添加绑定声明: -Our first step is to upgrade the model file format version to `"1.16.0"` if it is not already. If the model is a legacy file, then convert it before continuing; Blockbench has a tool to do this (File → Convert Project). - -Next up is modifying the root bone of our geometry to be bound to the equipment slot the item is placed in. Take note of line 4 in this excerpt from the skeleton head geometry file: - -RP/models/entity/skeleton_head.geo.json - -```json -// A bone +::: code-group +```json [RP/models/entity/skeleton_head.geo.json] +// 一个骨骼 { "name": "skeleton_head", "binding": "q.item_slot_to_bone_name(context.item_slot)", @@ -182,70 +177,54 @@ Next up is modifying the root bone of our geometry to be bound to the equipment ] } ``` +::: -The `"parent"` key in a bone accepts a string, and whichever bone name is entered will be set as the parent to the current bone; the child bones keep their positions but move relative to the parent bone. +- `binding`键使用Molang查询`q.item_slot_to_bone_name`将装备槽位转换为骨骼名称: + - `'main_hand'` → "rightitem" + - `'off_hand'` → "leftitem" -The `"binding"` key on the other hand accepts Molang, and the pivot point of whichever bone name is entered is set as the *root position* that the child bone and its children should inherit. - -For the value of `"binding"` we are using the Molang query `q.item_slot_to_bone_name`, which converts a slot name to a bone name, with the contextual variable `context.item_slot` as an argument. This converts the name of the equipment slot this item resides in to its corresponding bone name in the player's geometry. The conversions are as follows: -- `'main_hand'` → "rightitem" -- `'off_hand'` → "leftitem" - -Apply the model binding to your bone, and save the geometry to your resource pack. - -An example model with this binding applied is provided here: +示例绑定模型: 📄 Geometry File +>📄 几何体文件 -### Display Settings +### 显示设置 -With that done, the next step is to set up animations to display the model in first person and third person. +创建第一人称和第三人称动画时,建议: -Create two new animations, one for holding the item in first person and another for holding it in third person. - -To make creating these animations easier, please do the following: - -- Download the following player skeleton model. We will use this as a visual aid for positioning your model. +1. 下载玩家骨骼模型作为定位参考: 📄 Player Skeleton File +>📄 玩家骨骼文件 -- With a text editor, add the bones and cubes from your model to the player skeleton model, then import the player skeleton model into Blockbench. -- Set your model's root bone(s) to be a child of the 'rightItem' bone in the player skeleton. -- Download the following animation file import the `wiki.third_person_guide` animation. This will be used later to make positioning easier. +2. 将模型骨骼添加为玩家骨骼中'rightItem'的子级 +3. 使用指导动画抵消Minecraft的-24Y轴偏移: 📄 Attachable Guide File +>📄 动画指导文件 -These guide animations have one notable feature: they apply a -24 offset to the y-position of the right item bone to counteract a similar -24 y-position offset Minecraft applies to bound bones. We are unsure at this time why this happens. - -:::warning NOTE -Similar to Method One, **two** animations will need to be played simultaneously for correct positioning. - -Be sure you are editing your animations when making your changes. Select it first, then play the guide animation on top. +:::warning 重要提示 +需要同时播放自定义动画和指导动画。在Blockbench中编辑时,请先选中您的动画再叠加播放指导动画。 ::: -Play both animations, and position your model however you want. Save the animations to your resource pack. - -An example animation file for this positioning: +示例动画定位: 📄 Animation File +>📄 动画文件 -### First-person Animations +### 第一人称动画 -Similar to the third-person animation, look in the Attachable Guide file and import the `wiki.first_person_guide` animation into Blockbench. Play both your animation and the guide's first-person animation together, then make your changes and save the file. +参照第三人称动画的制作流程,在指导文件中导入`wiki.first_person_guide`动画进行叠加编辑。 -## Example Pack +## 示例包 -Each of these methods have been compiled into an example pack you may reference, for if you are getting stuck or simply want to see a working example. +我们准备了包含两种方法的完整示例包供参考: 💾 Example Pack +>💾 示例包下载 \ No newline at end of file diff --git a/docs/wiki/items/custom-armor.md b/docs/wiki/items/custom-armor.md index 88431112..4fefab15 100644 --- a/docs/wiki/items/custom-armor.md +++ b/docs/wiki/items/custom-armor.md @@ -1,6 +1,6 @@ --- -title: Custom Armor -category: Tutorials +title: 自定义盔甲 +category: 巧思案例 tags: - experimental mentions: @@ -17,67 +17,70 @@ mentions: - SmokeyStack --- +# 自定义盔甲 + + + ::: tip -It is highly recommended that you look over [the BlockBench modelling and texturing](/guide/blockbench) section in the beginners guides before tackling these sections. +强烈建议在开始本节内容前,先阅读[BlockBench建模与纹理制作指南](/wiki/guide/blockbench)中的新手引导部分。 ::: -Making custom armors is surprisingly easy to do, you need to do a bit of fiddling around as there are a few files that need to be added and there can be a little bit of texturing involved but you can do as much or as little as you want here. +制作自定义盔甲其实非常简单,虽然需要处理多个文件并进行一些纹理调整,但你可以根据自己的需求选择工作量。 -## Chest Piece +## 胸甲部分 -Create a chest piece: +创建胸甲物品: -BP/items/my_chest.json - -```json +::: code-group +```json [BP/items/my_chest.json] { "format_version": "1.16.100", "minecraft:item": { "description": { "identifier": "wiki:my_chest", - // Notice we give it the equipment category + // 注意我们将其归类为装备 "category": "equipment" }, "components": { - // Make sure it appears within the chestplate category + // 确保出现在胸甲分类中 "minecraft:creative_category": { "parent": "itemGroup.name.chestplate" }, - // The icon we want to use in our INVENTORY + // 物品栏中显示的图标 "minecraft:icon": { "texture": "my_chest" }, - // We give it a name + // 物品名称 "minecraft:display_name": { - "value": "My Custom Armor" + "value": "我的自定义盔甲" }, - // We dont want it to stack + // 禁止堆叠 "minecraft:max_stack_size": 1, - // We make sure it can only receive enchantments for chest pieces + // 仅接受胸甲部位附魔 "minecraft:enchantable": { "value": 10, "slot": "armor_torso" }, - // This tells it how much protection it should give + // 护甲值设置 "minecraft:armor": { "protection": 5 }, - // We want it to be repairable, and what to use to repair it + // 修复材料设置 "minecraft:repairable": { "repair_items": [ { "items": ["minecraft:stick"], "repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability" - // Some complicated molang; just copy it + // 复杂molang表达式,直接复制即可 } ] }, - // Mark it as a wearable and that it goes in the chest slot + // 穿戴设置(胸部槽位) "minecraft:wearable": { "dispensable": true, "slot": "slot.armor.chest" }, - // Provide its durability + // 耐久度设置 "minecraft:durability": { "max_durability": 200 } @@ -86,78 +89,67 @@ Create a chest piece: } ``` -At this point you could just go and add an item texture into your `RP/textures/item_texture.json` with the key `my_chest` and you are on your way. We have attached a default item texture for your armor here if you want to just follow along. +此时你只需在`RP/textures/item_texture.json`中添加名为`my_chest`的纹理即可。我们提供了默认纹理供参考: ![](/assets/images/tutorials/custom-armor/custom_chestplate.png) -Download texture here +点击此处下载纹理 -## Adding attachables and textures +## 添加附着物与纹理 -At this point your item would appear in game and would be wearable but it would not have any appearance. This is because we need to tell it how to handle the attachable equipment and give it a texture to show. +现在需要配置盔甲模型附着物: -To start with you need to create an `attachables` folder in your RP (you may already have one). - -RP/attachables/my_chest.json - -```json +::: code-group +```json [RP/attachables/my_chest.json] { "format_version": "1.8.0", "minecraft:attachable": { "description": { "identifier": "wiki:my_chest", - // These 2 are default and are required + // 必需材质配置 "materials": { "default": "armor", "enchanted": "armor_enchanted" }, "textures": { - // This is our CUSTOM armor texture we need to make next + // 自定义盔甲纹理路径 "default": "textures/models/armor/custom_main", - // This texture doesn't actually exist in our RP - // but it will blow up without it so leave it in + // 保留默认附魔光效 "enchanted": "textures/misc/enchanted_item_glint" }, - // We tell it what geometry to use for the chestplate + // 使用胸甲模型 "geometry": { "default": "geometry.player.armor.chestplate" }, - // We tell it to hide the chest layer as we will be showing our armor on top + // 隐藏默认胸甲层 "scripts": { "parent_setup": "v.chest_layer_visible = 0.0;" }, - // We tell it what controller to use (default armor one) + // 使用标准渲染控制器 "render_controllers": ["controller.render.armor"] } } } ``` -At this point we need to make sure we create a texture for our model, these live in `RP/textures/models/armor`. We however actually need 2 textures, as one is for the main armor as if it is being worn all together, and one is for the legs which when worn alone will often cover some of the boot area. - -If you do not feel creative we have provided a recoloured diamond armour skin for use with this tutorial. So just `Save As` and plop them in the folder. +下载配套纹理文件: ![](/assets/images/tutorials/custom-armor/custom_main.png) -Download texture here +下载主纹理 ![](/assets/images/tutorials/custom-armor/custom_legs.png) -Download texture here +下载腿部纹理 -> In the real world you would probably want to use `BlockBench` or some photo editing program to edit the textures and ideally see how they look on a model before you add them into the addon. -> If you now go into the game and check what you have produced you should be able to wear your chest piece and pat yourself on the back for a job well done. +> 实际开发中建议使用BlockBench预览模型效果 -![](/assets/images/tutorials/custom-armor/armor-item-image.jpg) -![](/assets/images/tutorials/custom-armor/armor-model-image.jpg) +## 护腿部分 -## Leggings +创建护腿物品: -So while the chest piece alone is great, you probably want a whole set, so from here if you make another item json for the boots like so. - -BP/items/my_leggings.json - -```json +::: code-group +```json [BP/items/my_leggings.json] { "format_version": "1.16.100", "minecraft:item": { @@ -166,19 +158,18 @@ So while the chest piece alone is great, you probably want a whole set, so from "category": "equipment" }, "components": { - // We give it the leggings category this time + // 护腿分类 "minecraft:creative_category": { "parent": "itemGroup.name.leggings" }, - // Give it an applicable ITEM texture "minecraft:icon": { "texture": "my_leggings" }, "minecraft:display_name": { - "value": "My Custom Leggings" + "value": "我的自定义护腿" }, "minecraft:max_stack_size": 1, - // Make sure the enchantments are for legs + // 腿部附魔槽 "minecraft:enchantable": { "value": 10, "slot": "armor_legs" @@ -186,15 +177,8 @@ So while the chest piece alone is great, you probably want a whole set, so from "minecraft:armor": { "protection": 3 }, - "minecraft:repairable": { - "repair_items": [ - { - "items": ["minecraft:stick"], - "repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability" - } - ] - }, - // Make sure the wearable slot is legs + "minecraft:repairable": { /* 同胸甲配置 */ }, + // 腿部穿戴槽 "minecraft:wearable": { "dispensable": true, "slot": "slot.armor.legs" @@ -207,356 +191,165 @@ So while the chest piece alone is great, you probably want a whole set, so from } ``` -This is great and like before you will need to add your own item texture, although here is one if you just want to continue. +护腿纹理下载: ![](/assets/images/tutorials/custom-armor/custom_leggings.png) -Download texture here +下载护腿纹理 -Once we are done here we need to create the attachables file like this: +附着物配置: -RP/attachables/my_leggings.json - -```json +::: code-group +```json [RP/attachables/my_leggings.json] { "format_version": "1.8.0", "minecraft:attachable": { "description": { "identifier": "wiki:my_leggings", - // Notice this is the same as before - "materials": { - "default": "armor", - "enchanted": "armor_enchanted" - }, + "materials": { /* 同胸甲配置 */ }, "textures": { - // Same as before - "enchanted": "textures/misc/enchanted_item_glint", - // This one is different as we are using the legging specific texture - "default": "textures/models/armor/custom_legs" + "default": "textures/models/armor/custom_legs", + "enchanted": "textures/misc/enchanted_item_glint" }, - // Tell it to use leggings geom + // 使用护腿模型 "geometry": { "default": "geometry.humanoid.armor.leggings" }, - // Hide legs layer as we will be rendering over it + // 隐藏默认腿部层 "scripts": { "parent_setup": "v.leg_layer_visible = 0.0;" }, - // Same as before "render_controllers": ["controller.render.armor"] } } } ``` -Given that we have already put in the textures needed we can run it and see our legs straight away. +## 头盔部分 -## Helmet +头盔物品配置: -This is just like the chest piece, just we change some of the categories and slots like so. - -BP/items/my_helm.json - -```json +::: code-group +```json [BP/items/my_helm.json] { "format_version": "1.16.100", "minecraft:item": { - "description": { - "identifier": "wiki:my_helm", - "category": "equipment" - }, + "description": { /* 基础配置 */ }, "components": { - // Helmet category + // 头盔分类 "minecraft:creative_category": { "parent": "itemGroup.name.helmet" }, - "minecraft:icon": { - "texture": "my_helm" - }, - "minecraft:display_name": { - "value": "My Custom Helmet" - }, - "minecraft:max_stack_size": 1, - // Helm enchantment slot + // 头部附魔槽 "minecraft:enchantable": { "value": 10, "slot": "armor_head" }, - "minecraft:armor": { - "protection": 3 - }, - "minecraft:repairable": { - "repair_items": [ - { - "items": ["minecraft:stick"], - "repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability" - } - ] - }, - // Wearable head slot + // 头部穿戴槽 "minecraft:wearable": { "dispensable": true, "slot": "slot.armor.head" }, - "minecraft:durability": { - "max_durability": 200 - } + /* 其他配置同前 */ } } } ``` -As you can see not much has changed, we just update the categories/slots to the correct ones for helms and then we add the attachables file (here is the item texture if you need it). +头盔纹理下载: ![](/assets/images/tutorials/custom-armor/custom_helmet.png) -Download texture here +下载头盔纹理 -RP/attachables/my_helm.json +## 靴子部分 -```json -{ - "format_version": "1.8.0", - "minecraft:attachable": { - "description": { - "identifier": "wiki:my_helm", - // These 2 are default and are required - "materials": { - "default": "armor", - "enchanted": "armor_enchanted" - }, - "textures": { - // This is our CUSTOM armor texture we need to make next - "default": "textures/models/armor/custom_main", - // This texture doesn't actually exist in our RP - // but it will blow up without it so leave it in - "enchanted": "textures/misc/enchanted_item_glint" - }, - // We tell it what geometry to use for the helmet - "geometry": { - "default": "geometry.player.armor.helmet" - }, - // We tell it to hide the helmet layer as we will be showing our armor on top - "scripts": { - "parent_setup": "v.chest_layer_visible = 0.0;" - }, - // We tell it what controller to use (default armor one) - "render_controllers": ["controller.render.armor"] - } - } -} -``` +靴子物品配置: -There you go, you now have 3/4 of a complete set, we may as well go through the boots as well so you know all the categories etc. - -## Boots - -You already know the pattern so lets make the item and attachable json files. - -BP/items/my_boots.json - -```json +::: code-group +```json [BP/items/my_boots.json] { "format_version": "1.16.100", "minecraft:item": { - "description": { - "identifier": "wiki:my_boots", - "category": "equipment" - }, "components": { - // Boots category + // 靴子分类 "minecraft:creative_category": { "parent": "itemGroup.name.boots" }, - "minecraft:icon": { - "texture": "my_boots" - }, - "minecraft:display_name": { - "value": "My Custom Boots" - }, - "minecraft:max_stack_size": 1, - // Enchantable Feet + // 足部附魔槽 "minecraft:enchantable": { "value": 10, "slot": "armor_feet" }, - "minecraft:armor": { - "protection": 3 - }, - "minecraft:repairable": { - "repair_items": [ - { - "items": ["minecraft:stick"], - "repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability" - } - ] - }, - // Feet slot + // 足部穿戴槽 "minecraft:wearable": { "dispensable": true, "slot": "slot.armor.feet" }, - "minecraft:durability": { - "max_durability": 200 - } + /* 其他配置同前 */ } } } ``` -The custom boots texture if you need it. +靴子纹理下载: ![](/assets/images/tutorials/custom-armor/custom_boots.png) -Download texture here +下载靴子纹理 -RP/attachables/my_boots.json +## 套装效果(进阶) -```json -{ - "format_version": "1.8.0", - "minecraft:attachable": { - "description": { - "identifier": "wiki:my_boots", - // These 2 are default and are required - "materials": { - "default": "armor", - "enchanted": "armor_enchanted" - }, - "textures": { - // This is our CUSTOM armor texture we need to make next - "default": "textures/models/armor/custom_main", - // This texture doesn't actually exist in our RP - // but it will blow up without it so leave it in - "enchanted": "textures/misc/enchanted_item_glint" - }, - // We tell it what geometry to use for the boots - "geometry": { - "default": "geometry.player.armor.boots" - }, - // We tell it to hide the boots layer as we will be showing our armor on top - "scripts": { - "parent_setup": "v.chest_layer_visible = 0.0;" - }, - // We tell it what controller to use (default armor one) - "render_controllers": ["controller.render.armor"] - } - } -} -``` +在`player.json`中添加伤害检测与事件响应: -Thats it, you now have a whole suit of custom armor you can swagger around in, and use this as a basis to make whatever other armors you want in the game. - -> It is worth noting that we have used 2 separate textures here, and you could potentially use a texture per attachable, but each new texture consumes memory so its best to use as few as possible. -> So this is what you should end up with, and as a bonus there is one more section on making set effects using filters, which is a bit more advanced but its a fun thing to do. - -![](/assets/images/tutorials/custom-armor/custom-set-image.jpg) - -## Bonus - Making Set Effects - -This is a bit more advanced but lets say you want your custom armor to act like it's a set from an RPG game. We can add some code to check if we have the set equipped and do some great stuff with it. - -Note that for effects you can use tick.json and functions with hasitem selector argument to avoid using player.json. - -In this example we will just add a chance to teleport the attacker somewhere nearby and put a blurb on the console for flavour. - -As we want this to trigger when the player is hit we need to add some logic to the `player.json` file. This is a huge file and we unfortunately need to make sure it has all the default content in there as well due to the way it will overwrite the default player components etc. - -So rather than include the whole `player.json` I will just include the parts you will need to add to your `components` and `events` sections. If you have no idea what the `player.json` is then look in the vanilla behavior pack and look for it and just copy it over into your project. - -So first of all lets put in the damage sensor component (which goes in your component section) which listens for when you take damage and lets you raise an event from it. - -BP/entities/player.json#components - -```json +::: code-group +```json [BP/entities/player.json#components] "minecraft:damage_sensor": { "triggers": { "on_damage": { "filters": { "all_of": [ - { - "test": "has_equipment", - "subject": "self", - // Domain is the body part in this case - "domain": "head", - "operator": "==", - // The item identifier we want to check - "value": "wiki:my_helm" - }, - { - "test": "has_equipment", - "subject": "self", - "domain": "torso", - "operator": "==", - // Worth noting you can omit prefix for minecraft internal items i.e stick - "value": "wiki:my_chest" - }, - { - "test": "has_equipment", - "subject": "self", - "domain": "leg", - "operator": "==", - "value": "wiki:my_leggings" - }, - { - "test": "has_equipment", - "subject": "self", - "domain": "feet", - "operator": "==", - "value": "wiki:my_boots" - } + // 检测全身装备 + { "test": "has_equipment", "domain": "head", "value": "wiki:my_helm" }, + { "test": "has_equipment", "domain": "torso", "value": "wiki:my_chest" }, + { "test": "has_equipment", "domain": "leg", "value": "wiki:my_leggings" }, + { "test": "has_equipment", "domain": "feet", "value": "wiki:my_boots" } ] }, - // If all the triggers match in the filter raise the event "event": "wiki:armor_sets.my_custom.taken_damage" - }, - // This means if it matches the check it still applies damage - // Can be good to ignore team damage or similar scenarios - "deals_damage": true + } } } ``` -As you can see from the comments, there is a lot there but really all we are doing is listening out for something then making sure we only filter the results we care about then relay on an event. - -> The event can be called anything but it is often better to have it more specific, incase you end up having multiple similar events etc, also it can help finding if you have multiple sections to it, i.e I could search on "armour_sets" and find all events related to it. -> Then once you are done, in the same file we decide what we want to do with the event, which we put into our `events` section. - -BP/entities/player.json#events - -```json +```json [BP/entities/player.json#events] "wiki:armor_sets.my_custom.taken_damage": { "randomize": [ { "weight": 1, - // We do a sequence here as we want to apply one command - // on one entity and the other on ourselves "sequence": [ { - // This will take the attacker/other because it was in context - // at time of raising the event in the damage_sensor + // 传送攻击者 "run_command": { - // Teleport the entity away from us "command": "spreadplayers ~~ 5 20 @s", - // Run the command on the attacker not us "target": "other" } }, { + // 发送提示信息 "run_command": { - "command": "tellraw @s{\"rawtext\":[{\"text\":\"§aYour Armor Glows And The Enemy Vanishes\"}]}" + "command": "tellraw @s{\"rawtext\":[{\"text\":\"§a盔甲发光,敌人消失了!\"}]}" } } ] }, - { - // Dummy weighting so it happens semi frequently - "weight": 20 - } + { "weight": 20 } ] } ``` -Thats it, you can rejig the bits how you see fit but ultimately you have all the pieces to apply effects to armor and check for if you have the whole set applied or check for other equipment. +完成效果展示: -You can also change the equipment checks from self to other and check if whoever is attacking you has something equipped or even check if you are attacking a sort of block/entity and do different effects based on that. We haven't touched on that directly here but there is a good enough starting point to get you on your way and let you be creative with things. +![](/assets/images/tutorials/custom-armor/custom-set-image.jpg) + +> 提示:建议使用最少纹理数量优化性能。通过组合使用主纹理和腿部纹理即可完成全套盔甲效果。 \ No newline at end of file diff --git a/docs/wiki/items/custom-weapon.md b/docs/wiki/items/custom-weapon.md index 228c313d..e89e36fd 100644 --- a/docs/wiki/items/custom-weapon.md +++ b/docs/wiki/items/custom-weapon.md @@ -1,8 +1,8 @@ --- -title: Custom Weapons -category: Tutorials +title: 自定义武器 +category: 巧思案例 tags: - - experimental + - 实验性 mentions: - SirLich - solvedDev @@ -13,49 +13,52 @@ mentions: - Xterionix --- -Making a custom weapon is pretty simple since the 1.16.100 changes, as these allow you to simply define an item entry for it in your `BP/items` folder and provide a corresponding texture in the `RP/textures/items` folder with a bit of config and you have a fully working weapon that you can customize however you see fit. +# 自定义武器 -## Custom Sword Item + -Like with the other item tutorials we will start by making a simple custom sword like so. +自1.16.100版本更新以来,制作自定义武器变得非常简单。您只需在`BP/items`文件夹中定义物品条目,并在`RP/textures/items`文件夹中提供相应纹理,稍作配置即可获得功能完整的可定制武器。 -BP/items/my_sword.json +## 自定义剑类物品 -```json +与其他物品教程类似,我们先从制作基础剑类物品开始。 + +::: code-group +```json [BP/items/my_sword.json] { "format_version": "1.16.100", "minecraft:item": { "description": { "identifier": "wiki:my_sword", - // Notice we give it the equipment category + // 注意我们将其归类为装备 "category": "equipment" }, "components": { - // This allows us to have the sword in the creative category of swords + // 这样可以将剑放置在创造模式下的剑类物品栏中 "minecraft:creative_category": { "parent": "itemGroup.name.sword" }, "minecraft:max_stack_size": 1, - // This is a new change as we want it to be equippable in the hand + // 新增配置使物品可手持 "minecraft:hand_equipped": true, "minecraft:durability": { "max_durability": 600 }, - // Give it however much damage you want + // 按需设置伤害值 "minecraft:damage": 10, - // We also let it be enchantable in the "sword" slot + // 允许在"sword"槽位附魔 "minecraft:enchantable": { "value": 10, "slot": "sword" }, - // This texture is used for both inventory and the hand model + // 该纹理同时用于物品栏和手持模型 "minecraft:icon": { "texture": "my_sword" }, "minecraft:display_name": { - "value": "My Custom Sword" + "value": "我的自定义剑" }, - // Allow the sword to be repaired with sticks + // 允许使用木棍修复 "minecraft:repairable": { "repair_items": [ { @@ -69,50 +72,44 @@ Like with the other item tutorials we will start by making a simple custom sword } ``` -So at a bare minimum that is enough to get a sword put into the game, we still need to register the icon with the RP but thats not a massive issue as all we need to do is go to our RP folder and enter it in like so. - -RP/textures/item_texture.json - -```json +```json [RP/textures/item_texture.json] { "resource_pack_name": "vanilla", "texture_name": "atlas.items", "texture_data": { "my_sword": { - // Make sure you have put an icon texture called my_sword.png here + // 确保已添加名为my_sword.png的纹理 "textures": "textures/items/my_sword" } } } ``` +::: -Here is an example texture if you do not have your own to use, just `Save As` and plop it in the `RP/textures/items` directory. +若需示例纹理,可将下方图片另存为`my_sword.png`并放入`RP/textures/items`目录。 ![](/assets/images/tutorials/custom-weapons/my_sword.png) -Download texture here +点击此处下载纹理 -## In-game +## 游戏内效果 -So now we have a BP containing our items json data and an RP containing the texture, we can make a new level, and make sure we include our BP/RP, however we **also need to enable the Holiday Creator Features** under experimental gameplay. +完成BP物品配置和RP纹理添加后,创建新世界时需加载这两个包,并**在实验性玩法中启用假日创作者功能**。 -Once you have done all the above, go into creative mode and you should be able to find your sword by its name, or under the sword category as shown. +进入创造模式后,可通过名称搜索或剑类物品栏找到您的自定义武器。 ![](/assets/images/tutorials/custom-weapons/custom_sword.jpg) -Then if you put it in your hands you should see it in the game like this. +手持时效果如下: ![](/assets/images/tutorials/custom-weapons/held_sword.jpg) -Now that wasn't too hard was it! and you can make as many custom swords as you want now, however there is far more fun stuff you can do from here if you feel up for it. +## 工具类功能扩展 -## Tool-like Functionality +可通过添加`minecraft:digger`等组件实现特殊挖掘功能: -You can also mix and match other components like `minecraft:digger` to allow you to go through web or bamboo quicker like this: - -BP/items/my_sword.json#components - -```json +::: code-group +```json [BP/items/my_sword.json#components] "minecraft:digger": { "use_efficiency": true, "destroy_speeds": [ @@ -127,51 +124,36 @@ You can also mix and match other components like `minecraft:digger` to allow you ], "on_dig":{ "event": "wiki:my_sword.on_dig_damage" - //Needed to change sword durability + // 用于改变武器耐久度 } } ``` -Also add an event: - -BP/items/my_sword.json - -```json +```json [BP/items/my_sword.json] "events": { "wiki:my_sword.on_dig_damage": { "damage":{ - //This part of event will make sword take damage when it was used to dig block + // 该事件会使武器在挖掘时损耗耐久 "type":"durability", "target":"self", - //By using "self" you define item as target to take damage + // 使用"self"指定物品自身承受损耗 "amount":1 } } } ``` +::: -You can also give it a default mining speed by adding `"minecraft:mining_speed": 1.5`, which would give it a generic mining speed letting you use your weapon like a pickaxe. -(It is currently broken) +## 伤害数值显示 -## Damage Tooltip +添加`"minecraft:weapon": {}`组件可在物品提示中显示攻击伤害值。 -The above was a bare bones approach, but you probably want to be able to show the damage a sword does when the user hovers over it. +## 特殊能力与耐久系统 -To do this you need to add the `"minecraft:weapon": {}` component, even if its just empty this is enough to MC to know internally to treat your popup like a weapon popup when mouse over-ing. +通过武器组件触发事件实现特殊效果: -So if you add the above component to your item json file when you mouse over your sword you will now see **+10 Attack Damage** listed in its tooltip. - -> You may be thinking "why didn't you just add this above?" and the answer is because we will build off this component to add more cool stuff in the next section, so I wanted to keep it separate. - -## Unique ability & durability - -At this point you could call it a day, but what if you wanted to make a sword that could inflict status effects, or teleport an enemy when they attacked you? - -Assuming you wanted to do something like this we will need to build off the `minecraft:weapon` component and raise an event when the weapon hits an entity. - -BP/items/my_sword.json#components - -```json +::: code-group +```json [BP/items/my_sword.json#components] "minecraft:weapon": { "on_hurt_entity": { "event": "wiki:my_sword.hurt_entity" @@ -179,49 +161,35 @@ Assuming you wanted to do something like this we will need to build off the `min } ``` -Once we add that then every time you hurt an entity it will raise the event `wiki:my_sword.hurt_entity`. You can name this whatever you want, but if you end up with lots of events its recommended to have some level of namespacing, so in this scenario `example` is my main namespace, `my_sword` is the item I want it to apply on and `hurt_entity` is the related event on that item. - -> I could just as easily call the event **"space-noodle"** and it would work fine, but you want it to be easily searchable and self explaining, so keep that in mind - -Now that we have an event being raised we can do what we want with it. In this example I am going to do 3 things: -1. Teleport the player with 25% chance. -2. Output a message letting the player know that something happened. -3. Damage the sword. - -So if you go back into your my_sword.json and after your `components` section add a new section like so. - -BP/items/my_sword.json - -```json +```json [BP/items/my_sword.json] "events": { "wiki:my_sword.hurt_entity": { "sequence":[ - //Sequence is needed to run two or more parts of event { "randomize": [ { - // Weights are relative, so this has 1 + // 权重值为1 "weight": 1, - // Teleport the HOLDER (you) within an 8x8x8 range + // 在8x8x8范围内传送持有者 "teleport": { "target": "holder", "max_range": [8,8,8] }, - // Then tell some green text + // 显示提示文本 "run_command":{ "command":[ - "tellraw @s{\"rawtext\":[{\"text\":\"§aYour Sword Glows§r\"}]}" + "tellraw @s{\"rawtext\":[{\"text\":\"§a剑身发出光芒§r\"}]}" ] } }, { - // We have another dummy random element here which contains the max weight + // 占位权重值 "weight": 3 } ] }, { - // I think you haven't forgot what this do + // 损耗武器耐久度 "damage":{ "type":"durability", "target":"self", @@ -232,20 +200,12 @@ So if you go back into your my_sword.json and after your `components` section ad } } ``` +::: -That was a bit to bite off, but as explained above this lets us randomly **1/4** of the time trigger a teleportation of the sword holder and show a text command when it happens. +## 合成配方示例 -You can do whatever you want here and get super creative, set enemies on fire, or spawn enemies or blocks etc. There is so much you can do with this basic approach to creating weapons! - -> It's worth noting here that the dummy element is needed to scale the weightings, so we have one element with a weight of **1** and a 2nd one with a weight of **4** so this gives us the **1 in 4** chance of it proccing. If we were to have gone with the dummy element having a weight of **100** then we would have a **1 in 100** chance of proccing. If we didn't have a 2nd dummy element then the first weight would be ignored and it would happen 100% of the time. - -## Anything Else? - -You should probably make a recipe for it, which is covered in previous chapters, as there isn't anything really new in there, but incase you are unsure here is an example one to make the sword with ender eyes and ender pearls. - -BP/recipes/my_sword.json - -```json +::: code-group +```json [BP/recipes/my_sword.json] { "format_version": "1.12.0", "minecraft:recipe_shaped": { @@ -271,7 +231,8 @@ You should probably make a recipe for it, which is covered in previous chapters, } } ``` +::: ![](/assets/images/tutorials/custom-weapons/sword_recipe.jpg) -If you whack that in then you can now craft your sword in the game and hopefully go off and make any other custom swords you fancy or even bows or tridents. +现在您已掌握制作自定义武器的基本方法,可以尝试扩展更多创意功能! \ No newline at end of file diff --git a/docs/wiki/items/enchantments.md b/docs/wiki/items/enchantments.md index 48e30a78..549dabf3 100644 --- a/docs/wiki/items/enchantments.md +++ b/docs/wiki/items/enchantments.md @@ -1,6 +1,6 @@ --- -title: Enchantments -category: Documentation +title: 附魔 +category: 文档 nav_order: 5 tags: - Stable @@ -11,44 +11,49 @@ mentions: - SmokeyStack --- -Enchantment identifiers are used in the `/enchant` command and in item functions and conditions. +# 附魔 -| Name | Identifier | Maximum Level | Treasure | Curse | -| ----------------------- | ----------------------- | ------------- | -------- | ----- | -| Silk Touch | `silk_touch` | 1 | ❌ | ❌ | -| Fortune | `fortune` | 3 | ❌ | ❌ | -| Efficiency | `efficiency` | 5 | ❌ | ❌ | -| Luck of the Sea | `luck_of_the_sea` | 3 | ❌ | ❌ | -| Lure | `lure` | 3 | ❌ | ❌ | -| Sharpness | `sharpness` | 5 | ❌ | ❌ | -| Smite | `smite` | 5 | ❌ | ❌ | -| Bane of Arthropods | `bane_of_arthropods` | 5 | ❌ | ❌ | -| Fire Aspect | `fire_aspect` | 2 | ❌ | ❌ | -| Knockback | `knockback` | 2 | ❌ | ❌ | -| Looting | `looting` | 3 | ❌ | ❌ | -| Power | `power` | 5 | ❌ | ❌ | -| Flame | `flame` | 1 | ❌ | ❌ | -| Punch | `punch` | 2 | ❌ | ❌ | -| Infinity | `infinity` | 1 | ❌ | ❌ | -| Multishot | `multishot` | 1 | ❌ | ❌ | -| Piercing | `piercing` | 4 | ❌ | ❌ | -| Quick Charge | `quick_charge` | 3 | ❌ | ❌ | -| Impaling | `impaling` | 5 | ❌ | ❌ | -| Riptide | `riptide` | 3 | ❌ | ❌ | -| Loyalty | `loyalty` | 3 | ❌ | ❌ | -| Channeling | `channeling` | 1 | ❌ | ❌ | -| Protection | `protection` | 4 | ❌ | ❌ | -| Projectile Protection | `projectile_protection` | 4 | ❌ | ❌ | -| Fire Protection | `fire_protection` | 4 | ❌ | ❌ | -| Blast Protection | `blast_protection` | 4 | ❌ | ❌ | -| Feather Falling | `feather_falling` | 4 | ❌ | ❌ | -| Thorns | `thorns` | 3 | ❌ | ❌ | -| Frost Walker | `frost_walker` | 2 | ✅ | ❌ | -| Respiration | `respiration` | 3 | ❌ | ❌ | -| Aqua Affinity | `aqua_affinity` | 1 | ❌ | ❌ | -| Curse of Binding | `curse_of_binding` | 1 | ✅ | ✅ | -| Depth Strider | `depth_strider` | 3 | ❌ | ❌ | -| Soul Speed | `soul_speed` | 3 | ✅ | ❌ | -| Unbreaking | `unbreaking` | 3 | ❌ | ❌ | -| Mending | `mending` | 1 | ✅ | ❌ | -| Curse of Vanishing | `curse_of_vanishing` | 1 | ✅ | ✅ | + + +附魔标识符用于`/enchant`命令以及物品函数和条件判断中。 + +| 附魔名称 | 标识符 | 最高等级 | 宝藏附魔 | 诅咒附魔 | +| -------------------------- | ------------------- | -------- | -------- | -------- | +| 精准采集 | `silk_touch` | 1 | ❌ | ❌ | +| 时运 | `fortune` | 3 | ❌ | ❌ | +| 效率 | `efficiency` | 5 | ❌ | ❌ | +| 海之眷顾 | `luck_of_the_sea` | 3 | ❌ | ❌ | +| 饵钓 | `lure` | 3 | ❌ | ❌ | +| 锋利 | `sharpness` | 5 | ❌ | ❌ | +| 亡灵杀手 | `smite` | 5 | ❌ | ❌ | +| 节肢杀手 | `bane_of_arthropods`| 5 | ❌ | ❌ | +| 火焰附加 | `fire_aspect` | 2 | ❌ | ❌ | +| 击退 | `knockback` | 2 | ❌ | ❌ | +| 抢夺 | `looting` | 3 | ❌ | ❌ | +| 力量 | `power` | 5 | ❌ | ❌ | +| 火矢 | `flame` | 1 | ❌ | ❌ | +| 冲击 | `punch` | 2 | ❌ | ❌ | +| 无限 | `infinity` | 1 | ❌ | ❌ | +| 多重射击 | `multishot` | 1 | ❌ | ❌ | +| 穿透 | `piercing` | 4 | ❌ | ❌ | +| 快速装填 | `quick_charge` | 3 | ❌ | ❌ | +| 穿刺 | `impaling` | 5 | ❌ | ❌ | +| 激流 | `riptide` | 3 | ❌ | ❌ | +| 忠诚 | `loyalty` | 3 | ❌ | ❌ | +| 引雷 | `channeling` | 1 | ❌ | ❌ | +| 保护 | `protection` | 4 | ❌ | ❌ | +| 弹射物保护 | `projectile_protection`| 4 | ❌ | ❌ | +| 火焰保护 | `fire_protection` | 4 | ❌ | ❌ | +| 爆炸保护 | `blast_protection` | 4 | ❌ | ❌ | +| 摔落缓冲 | `feather_falling` | 4 | ❌ | ❌ | +| 荆棘 | `thorns` | 3 | ❌ | ❌ | +| 冰霜行者 | `frost_walker` | 2 | ✅ | ❌ | +| 水下呼吸 | `respiration` | 3 | ❌ | ❌ | +| 水下速掘 | `aqua_affinity` | 1 | ❌ | ❌ | +| 绑定诅咒 | `curse_of_binding` | 1 | ✅ | ✅ | +| 深海探索者 | `depth_strider` | 3 | ❌ | ❌ | +| 灵魂疾行 | `soul_speed` | 3 | ✅ | ❌ | +| 耐久 | `unbreaking` | 3 | ❌ | ❌ | +| 经验修补 | `mending` | 1 | ✅ | ❌ | +| 消失诅咒 | `curse_of_vanishing`| 1 | ✅ | ✅ | +::: \ No newline at end of file diff --git a/docs/wiki/items/equipped-item-commands.md b/docs/wiki/items/equipped-item-commands.md index 1532f677..2df7409f 100644 --- a/docs/wiki/items/equipped-item-commands.md +++ b/docs/wiki/items/equipped-item-commands.md @@ -1,9 +1,9 @@ --- -title: Run Commands with Equipped Items -category: Tutorials +title: 通过装备物品运行命令 +category: 巧思案例 tags: - - experimental - - intermediate + - 实验性 + - 中级 mentions: - Chikorita-Lover - MedicalJewel105 @@ -11,23 +11,26 @@ mentions: - TheItsNameless --- -## Introduction +# 通过装备物品运行命令 -A common concept for add-ons is implementing new armor sets with unique effects, just like the turtle shell and netherite armor. While items have a knockback resistance component, they don't have a component for inflicting mob effects, emitting particles, etc. under certain conditions. However, using server animations, Molang and item tags, this can easily be done! + -Keep in mind that this requires modifying the player behavior, which is a common theme for many add-ons; thus, your add-on may not be compatible with others if you wish to do this. +## 简介 -> However some people found a way not to use player.json. They replace it with dummy entity-rider. Try experimenting yourself! +附加组件开发中常见的需求是为新盔甲套装添加独特效果,就像海龟壳和下界合金盔甲那样。虽然物品本身具有击退抗性组件,但它们并没有在特定条件下施加生物效果、生成粒子等功能的原生组件。不过通过服务器动画、Molang查询和物品标签,我们可以轻松实现这些效果! -The use of Holiday Creator Features is also required to add item tags and easily equip our item in armor or off-hand slots. +请注意,此方法需要修改玩家行为文件,这是许多附加组件的常见操作。因此如果使用此方法,你的附加包可能会与其他修改玩家行为的附加包产生兼容性问题。 -## Server Animation +> 有开发者发现可以通过实体骑乘机制替代直接修改玩家行为文件的方法。建议自行实验探索! -The first step will be to create a server animation, which is a file that runs commands or events at certain keyframes. While client animations are in the resource pack, server animations are in the behavior pack. You can read a bit more [here](/entities/timers#animation-based-timers). We can start by using the following as a template: +本教程需要使用假日创作者功能来添加物品标签,并方便地在盔甲栏或副手槽位装备物品。 -BP/animations/player.json +## 服务器动画 -```json +第一步是创建服务器动画文件,这种文件可以在特定关键帧执行命令或触发事件。客户端动画存放在资源包中,而服务器动画则位于行为包内。更多信息可参阅[基于动画的计时器](/wiki/entities/timers#animation-based-timers)。以下模板可供参考: + +::: code-group +```json [BP/animations/player.json] { "format_version": "1.10.0", "animations": { @@ -41,58 +44,54 @@ The first step will be to create a server animation, which is a file that runs c } } ``` +::: -Let's go over what's in this template and what everything does: +模板参数解析: -- `animation.player.emerald_armor` is our animation's identifier; you can change this to something else, such as `animation.player.phantom_armor`. -- `timeline` runs commands and events at given keyframes. -- `animation_length` is how long the animation lasts; we'll use 0.05 seconds, as that's the length of an in-game tick. -- `loop` is quite straight-forward; setting it to true makes the animation loop. +- `animation.player.emerald_armor` 是动画标识符,可自定义如`animation.player.phantom_armor` +- `timeline` 用于在指定时间点执行命令/事件 +- `animation_length` 设置动画时长(0.05秒即1游戏刻) +- `loop` 控制是否循环播放 -We can add commands to the `0.0` array in our timeline to execute, such as an `/effect` command, like such: +在时间轴中添加命令示例: -BP/animations/player.json#timeline - -```json +::: code-group +```json [BP/animations/player.json#timeline] { "0.0": [ "/effect @s speed 1 0" ] } ``` +::: -We're not limited to `/effect`, of course. If you want to use some other command, such as `/function` or `/particle`, go right ahead! +除了`/effect`,也可以使用`/function`、`/particle`等其他命令。完成服务器动画配置后,接下来需要设置物品行为。 -After this, we're finished in our server animation, and we'll head into the behavior file for our item for a quick addition. +## 物品行为 -## Item Behavior +为了检测装备状态,我们需要使用Molang查询配合物品标签。以下情况可跳过本节: -To actually check if our item is equipped, we can use a Molang query that checks for item tags. +- 检测原版物品(如通过`minecraft:iron_tier`标签检测铁质盔甲) +- 使用`q.is_item_name_any`通过物品ID检测 -You can skip this section if: +添加标签组件示例: -- You want check for a vanilla item instead, such as an iron armor piece through the `minecraft:iron_tier` tag -- You want to check for the item via `q.is_item_name_any`, which checks for an item identifier in any slot - -In our item's behavior, we'll have to add a tag to `components`. For example, if we wanted to add the `example:emerald_tier` tag, we would add the `tag:example:emerald_tier` component: - -BP/items/my_item.json#components - -```json +::: code-group +```json [BP/items/my_item.json#components] "tag:example:emerald_tier": {} ``` +::: -That's it, now your item has whatever tag you assigned it! You can add more tags if you want, but this is all we need for what we're doing. +至此物品已拥有指定标签,可根据需要添加多个标签。 -## Player Behavior +## 玩家行为 -Finally, we need to modify the player's behavior to run the server animation. We'll be working entirely within `description`. +最后需要修改玩家行为文件来触发动画。主要操作在`description`部分完成。 -First, we need to set a short name for our animation. If you have any experience with client animations, this process will be quite similar. Add `animations` to `description`, and set a short name, like such: +首先为动画设置简称: -BP/entities/player.json#description - -```json +::: code-group +```json [BP/entities/player.json#description] { "identifier": "minecraft:player", "is_spawnable": false, @@ -103,31 +102,31 @@ First, we need to set a short name for our animation. If you have any experience } } ``` +::: -Now with a short name set, we can run our animation. +接着在`scripts`中添加Molang条件检测: -Add `scripts` to `description`, and set a Molang query to run. To check for the item, we can use one of the following: +检测方式选择: -- `q.is_item_name_any`, to check for a given item identifier in any slot. This example will check for `example:totem_of_retreat` in either hand: +- `q.is_item_name_any` 检测指定ID物品(示例检测双手是否持有图腾): ``` q.is_item_name_any('slot.weapon.mainhand',0,'example:totem_of_retreat') || q.is_item_name_any('slot.weapon.offhand',0,'example:totem_of_retreat') ``` -- `q.equipped_item_any_tag`, to check for at least one of any given tag in a given slot. This example will allow an emerald- or phantom- tier armor piece to be used: +- `q.equipped_item_any_tag` 检测单标签存在(示例检测头部护甲标签): ``` q.equipped_item_any_tag('slot.armor.head','example:emerald_tier','example:phantom_tier') ``` -- `q.equipped_item_all_tags`, to check for all given tags in a given slot. This example will only allow an armor piece that's both emerald- and ancient- tier: +- `q.equipped_item_all_tags` 检测多标签共存: ``` q.equipped_item_all_tags('slot.armor.head','example:ancient_tier','example:emerald_tier') ``` -Let's take a look at an example using `q.equipped_item_any_tag`: +应用示例: -BP/entities/player.json#description - -```json +::: code-group +```json [BP/entities/player.json#description] { "identifier": "minecraft:player", "is_spawnable": false, @@ -145,54 +144,52 @@ Let's take a look at an example using `q.equipped_item_any_tag`: } } ``` +::: -This example will run a server animation with the `emerald_armor` short name if an emerald-tier item is equipped in the helmet slot. You can change the Molang field to match your item tag, use a different query, or add additional queries. +此配置会在玩家头部装备翡翠标签物品时触发动画。更多装备槽位标识符请参考[Minecraft Wiki](https://minecraft.wiki/w/Slot#Bedrock_Edition)。 -You can view a list of additional slot identifiers at the [Minecraft Wiki](https://minecraft.wiki/w/Slot#Bedrock_Edition). +## 总结 -## Conclusion +完成服务器动画、玩家行为和物品标签的配置后,装备特定物品即可执行自定义命令!此技术突破了物品组件的限制,为物品定制提供了更多可能性。如需扩展功能,请参考以下附加内容。 -With the server animation, player behavior, and item tag all set up, your equipped item can now run commands! This technique allows for greater item customization than being restricted to item components. If you want to add more to the effect or add-on, check the next section; otherwise, congratulations, you're finished! +## 扩展应用 -## Additions +### 多件套装检测 -### Multiple Required Items +检测全套装备示例: -If you want to run a command when multiple of the armor set's pieces are equipped, we can expand our Molang from before: - -BP/entities/player.json#scripts - -```json +::: code-group +```json [BP/entities/player.json#scripts] "animate": [ { "emerald_armor": "q.equipped_item_any_tag('slot.armor.head','example:emerald_tier') && q.equipped_item_any_tag('slot.armor.chest','example:emerald_tier') && q.equipped_item_any_tag('slot.armor.legs','example:emerald_tier') && q.equipped_item_any_tag('slot.armor.feet','example:emerald_tier')" } ] ``` +::: -This example will check for emerald-tier armor in all four armor slots, and run the animation if they're all equipped. +当四件护甲都具备指定标签时触发效果。 -### Further Conditions +### 复合条件判断 -The turtle shell doesn't always inflict Water Breathing, but instead only for 10 seconds when a player first enters water. If we want our emerald armor to only run our animation when we have lower health, we can add another query to our Molang: +仿照海龟壳的水下呼吸机制,添加血量条件: -BP/entities/player.json#scripts - -```json +::: code-group +```json [BP/entities/player.json#scripts] "animate": [ { "emerald_armor": "q.equipped_item_any_tag('slot.armor.head','example:emerald_tier') && q.health <= 5" } ] ``` +::: -This example will run the animation with 2.5 hearts or less remaining, allowing players to make a quick getaway when they're in danger. +当玩家生命值≤2.5心时触发逃生效果。 -We can also apply this to requiring multiple armor pieces, with even longer Molang: +复合条件示例: -BP/entities/player.json#scripts - -```json +::: code-group +```json [BP/entities/player.json#scripts] { "animate": [ { @@ -201,16 +198,16 @@ We can also apply this to requiring multiple armor pieces, with even longer Mola ] } ``` +::: -You can view a list of documented Molang queries at [bedrock.dev](https://bedrock.dev/docs/stable/Molang#List%20of%20Entity%20Queries). +完整Molang查询列表详见[bedrock.dev](https://bedrock.dev/docs/stable/Molang#List%20of%20Entity%20Queries)。 -### Multiple Items with Effects +### 多物品系统 -If you want to add more items with unique effects, fret not; this is easily done. You can either create a new server animation file, or add on to the file from before, like such: +添加新物品效果时,可扩展动画文件: -BP/animations/player.json - -```json +::: code-group +```json [BP/animations/player.json] { "format_version": "1.10.0", "animations": { @@ -231,12 +228,12 @@ If you want to add more items with unique effects, fret not; this is easily done } } ``` +::: -In our player behavior, you'll have to add on to `animations` and `scripts` as well. +同步更新玩家行为文件: -BP/entities/player.json#description - -```json +::: code-group +```json [BP/entities/player.json#description] { "identifier": "minecraft:player", "is_spawnable": false, @@ -258,3 +255,4 @@ In our player behavior, you'll have to add on to `animations` and `scripts` as w } } ``` +::: \ No newline at end of file diff --git a/docs/wiki/items/index.md b/docs/wiki/items/index.md index ca56b417..9ce53bc7 100644 --- a/docs/wiki/items/index.md +++ b/docs/wiki/items/index.md @@ -1,10 +1,10 @@ --- -title: Items +title: 物品 Items categories: - - title: General + - title: 基础 color: blue - - title: Tutorials + - title: 巧思案例 color: green - - title: Documentation + - title: 文档 color: red --- diff --git a/docs/wiki/items/item-components.md b/docs/wiki/items/item-components.md index 9edc87a4..1043950d 100644 --- a/docs/wiki/items/item-components.md +++ b/docs/wiki/items/item-components.md @@ -1,24 +1,27 @@ --- -title: Item Components -description: Item components are used to change how your item appears and functions in the world. -category: General +title: 物品组件 +description: 物品组件用于改变物品在游戏中的外观和功能。 +category: 基础 nav_order: 2 mentions: - SmokeyStack - QuazChick --- -:::tip FORMAT & MIN ENGINE VERSION `1.20.50` -Using the latest format version when creating custom items provides access to fresh features and improvements. The wiki aims to share up-to-date information about custom items, and currently targets format version `1.20.50`. +# 物品组件 + + + +:::tip 格式版本 & 最低引擎版本 `1.20.50` +创建自定义物品时使用最新格式版本可获得最新功能和改进。本wiki旨在分享自定义物品的最新信息,当前目标格式版本为`1.20.50`。 ::: -## Applying Components +## 应用组件 -Item components are used to change how your item appears and functions in the world. They are applied in the `components` child of `minecraft:item`. +物品组件用于修改物品在游戏中的外观和功能。这些组件应添加在`minecraft:item`的`components`子项中。 -BP/items/custom_item.json - -```json +::: code-group +```json [BP/items/custom_item.json] { "format_version": "1.20.50", "minecraft:item": { @@ -36,26 +39,26 @@ Item components are used to change how your item appears and functions in the wo } } ``` +::: -## Allow Off Hand +## 允许副手 -Determines whether an item can be placed in the off-hand slot of the inventory. +决定物品是否可以放入物品栏的副手槽位。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:allow_off_hand": { "value": true } ``` +::: -## Block Placer +## 方块放置器 -Sets the item as a Planter item component for blocks. Items with this component will place a block when used. +将物品设置为可放置方块的种植者组件。具有此组件的物品在使用时会放置指定方块。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:block_placer":{ "block": "seeds", "use_on": [ @@ -64,95 +67,95 @@ Sets the item as a Planter item component for blocks. Items with this component ] } ``` +::: -## Can Destroy In Creative +## 创造模式可破坏 -Determines if an item will break blocks in Creative Mode while swinging. +决定在创造模式下挥动物品时是否会破坏方块。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:can_destroy_in_creative": { "value": true } ``` +::: -## Cooldown +## 冷却时间 -Sets an items "Cool down" time. After using an item, it becomes unusable for the duration specified by the 'duration' setting of this component. +设置物品的冷却时间。使用物品后,在组件指定的'duration'持续时间内无法再次使用。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:cooldown":{ "category" : "attack", "duration" : 0.2 } ``` +::: -## Damage +## 伤害值 -Determines how much extra damage an item does on attack. +决定物品攻击时造成的额外伤害量。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:damage": { "value": 10 } ``` +::: -## Digger +## 挖掘工具 -Allows a creator to determine how quickly an item can dig specific blocks. +允许创作者设定物品挖掘特定方块的速度。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:digger": { "use_efficiency": true, "destroy_speeds": [ { "block": { - "tags": "q.any_tag('stone', 'metal')" // Note that not all blocks have tags; listing many blocks may be necessary + "tags": "q.any_tag('stone', 'metal')" // 注意并非所有方块都有标签,可能需要列举多个方块 }, "speed": 6 } ] } ``` +::: -## Display Name +## 显示名称 -Sets the item display name within Minecraft: Bedrock Edition. This component may also be used to pull from the localization file by referencing a key from it. +设置物品在Minecraft基岩版中的显示名称。此组件也可通过引用本地化文件中的键值来获取名称。 -### Example +### 示例 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:display_name":{ "value": "secret_weapon" } ``` +::: -### Example Using Localization Key +### 使用本地化键示例 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:display_name":{ "value": "item.snowball.name" } ``` +::: -## Durability +## 耐久度 -Sets how much damage the item can take before breaking, and allows the item to be combined at an anvil, grindstone, or crafting table. +设置物品在损坏前可承受的伤害量,并允许物品在铁砧、砂轮或工作台进行修复。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:durability":{ "damage_chance": { "min": 10, @@ -161,24 +164,25 @@ Sets how much damage the item can take before breaking, and allows the item to b "max_durability": 36 } ``` +::: -## Enchantable +## 可附魔 -Determines what enchantments can be applied to the item. Not all enchantments will have an effect on all item components. +决定可应用于物品的附魔类型。并非所有附魔都会对所有物品组件生效。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:enchantable": { "slot": "bow", "value": 10 } ``` +::: -### Enchantable Slots -Note: The "all" enchantable slot allows you to apply any enchantment that you want to the item, just like an enchanted book. +### 可附魔槽位 +注意:"all"槽位允许像附魔书一样应用任何附魔 -| Slot Name | +| 槽位名称 | | ------------- | | armor_feet | | armor_torso | @@ -199,32 +203,30 @@ Note: The "all" enchantable slot allows you to apply any enchantment that you wa | sword | | all | +## 实体放置器 -## Entity Placer +允许物品在世界中放置实体。在1.19.80及以上版本中,此组件还可设置刷怪笼生成的生物类型。 -Allows an item to place entities into the world. Additionally, in version 1.19.80 and above, the component allows the item to set the spawn type of a monster spawner. - -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:entity_placer":{ "entity": "minecraft:spider", "dispense_on": ["minecraft:web"], "use_on": ["minecraft:web"] } ``` - -## Food - -Sets the item as a food component, allowing it to be edible to the player. - -:::tip -The `minecraft:food` must have the `minecraft:use_modifiers` component in order to function properly. ::: -minecraft:item > components +## 食物 -```json +将物品设置为可食用组件,允许玩家食用。 + +:::tip +`minecraft:food`必须与`minecraft:use_modifiers`组件配合使用才能正常工作。 +::: + +::: code-group +```json [minecraft:item > components] "minecraft:food":{ "can_always_eat": false, "nutrition" : 3, @@ -240,152 +242,152 @@ The `minecraft:food` must have the `minecraft:use_modifiers` component in order "using_converts_to": "bowl" } ``` +::: -## Fuel +## 燃料 -Allows this item to be used as fuel in a furnace to 'cook' other items. +允许此物品作为熔炉燃料用于"烹饪"其他物品。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:fuel":{ "duration": 3.0 } ``` +::: -## Glint +## 附魔光效 -Determines whether the item has the enchanted glint render effect on it. +决定物品是否显示附魔光效。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:glint": false ``` +::: -## Hand Equipped +## 手持装备 -Determines if an item is rendered like a tool while in-hand. +决定物品在手中是否像工具一样渲染。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:hand_equipped": { "value": true } ``` +::: -## Hover Text Color +## 悬停文本颜色 -Determines the color of the item name when hovering over it. +决定鼠标悬停时物品名称的显示颜色。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:hover_text_color": "green" ``` +::: -## Icon +## 图标 -Sets the icon item component. Determines the icon to represent the item in the UI and elsewhere. +设置物品图标组件。决定物品在UI和其他位置的显示图标。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:icon":{ "texture": "oak_slab" } ``` +::: -## Interact Button +## 交互按钮 -Is a boolean or string that determines if the interact button is shown in touch controls, and what text is displayed on the button. When set to 'true', the default 'Use Item' text will be used. +布尔值或字符串,决定是否在触控界面显示交互按钮及按钮文本。设为'true'时将使用默认"使用物品"文本。 -minecraft:item > components - -```json -"minecraft:interact_button": "Use This Custom Item" // Can be a string or a boolean value. +::: code-group +```json [minecraft:item > components] +"minecraft:interact_button": "使用这个自定义物品" // 可以是字符串或布尔值 ``` +::: -## Liquid Clipped +## 液体剪切 -Determines whether an item interacts with liquid blocks on use. +决定物品使用时是否与液体方块互动。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:liquid_clipped": { "value": true } ``` +::: -## Max Stack Size +## 最大堆叠数 -Determines how many of an item can be stacked together. +决定物品的最大堆叠数量。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:max_stack_size": { "value": 64 } ``` +::: -## Projectile +## 投射物 -Compels the item to shoot, similarly to an arrow. Items with `minecraft:projectile` can be shot from dispensers or used as ammunition for items with the `minecraft:shooter` item component. Additionally, this component sets the entity that is spawned for items that also contain the `minecraft:throwable` component. +使物品可像箭矢一样发射。具有`minecraft:projectile`的物品可从发射器发射,或作为具有`minecraft:shooter`组件的物品的弹药。此组件也用于设置带有`minecraft:throwable`组件的物品生成的实体。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:projectile":{ "minimum_critical_power": 1.25, "projectile_entity": "arrow" } ``` +::: -## Record +## 唱片 -Used by record items to play music. +用于唱片物品播放音乐。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:record": { "comparator_signal": 1, "duration": 5, "sound_event": "ambient.tame" } ``` +::: -### Sound Event +### 可用音效 -Listed [here](https://learn.microsoft.com/en-us/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_record?view=minecraft-bedrock-stable) are the available sounds +可用的音效列表请参考[此处](https://learn.microsoft.com/en-us/minecraft/creator/reference/content/itemreference/examples/itemcomponents/minecraft_record?view=minecraft-bedrock-stable) -## Repairable +## 可修复 -Defines the items that can be used to repair a defined item, and the amount of durability each item restores upon repair. Each entry needs to define a list of strings for 'items' that can be used for the repair and an optional 'repair_amount' for how much durability is repaired. +定义可用于修复该物品的材料及每次修复恢复的耐久度。每个条目需定义可修复材料列表(items)和可选修复量(repair_amount)。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:repairable":{ "on_repaired": "minecraft:celebrate", "repair_items": ["anvil"] } ``` - -## Shooter - -Compels an item to shoot projectiles, similarly to a bow or crossbow. Must have the `minecraft:use_modifiers` component in order to function properly. - -:::tip -Ammunition used by `minecraft:shooter` must have the `minecraft:projectile` component in order to function properly. ::: -minecraft:item > components +## 发射器 -```json +使物品可像弓或弩一样发射投射物。必须与`minecraft:use_modifiers`组件配合使用。 + +:::tip +`minecraft:shooter`使用的弹药必须具有`minecraft:projectile`组件才能正常工作。 +::: + +::: code-group +```json [minecraft:item > components] "minecraft:shooter": { "ammunition": [ { @@ -400,52 +402,52 @@ Ammunition used by `minecraft:shooter` must have the `minecraft:projectile` comp "charge_on_draw": false } ``` +::: -## Should Despawn +## 应消失 -Determines if an item should despawn while floating in the world. +决定漂浮在世界的物品是否会自动消失。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:should_despawn": { "value": true } ``` +::: -## Stacked By Data +## 按数据堆叠 -Determines if the same item with different aux values can stack. Additionally, this component defines whether the item actors can merge while floating in the world. +决定具有不同辅助值的相同物品是否可以堆叠。此组件也定义漂浮物品是否可以合并。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:stacked_by_data": { "value": true } ``` +::: -## Tags +## 标签 -Determines which tags are included on a given item. +决定物品包含哪些标签。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:tags": { "tags": [ "custom_tag" ] } ``` +::: -## Throwable +## 可投掷 -Sets the throwable item component. +设置可投掷物品组件。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:throwable":{ "do_swing_animation" : false, "launch_power_scale" : 1.0, @@ -455,45 +457,46 @@ Sets the throwable item component. "scale_power_by_draw_duration" : false } ``` +::: -## Use Animation +## 使用动画 -Determines which animation plays when using an item. +决定使用物品时播放的动画类型。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:use_animation": "eat" ``` +::: -## Use Modifiers +## 使用修饰符 -Determines how long an item takes to use in combination with components such as Shooter, Throwable, or Food. +决定与Shooter、Throwable或Food等组件配合使用时的物品使用时长。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:use_modifiers": { "use_duration": 1.6, "movement_modifier": 0.35 } ``` +::: -## Wearable +## 可穿戴 -Sets the wearable item component. +设置可穿戴物品组件。 -minecraft:item > components - -```json +::: code-group +```json [minecraft:item > components] "minecraft:wearable":{ "dispensable" : true, "slot": "slot.chest" } ``` +::: -### Slots -| Slot Name | +### 可用槽位 +| 槽位名称 | | -------------------- | | slot.weapon.mainhand | | slot.weapon.offhand | @@ -507,4 +510,4 @@ Sets the wearable item component. | slot.saddle | | slot.armor | | slot.chest | -| slot.equippable | +| slot.equippable | \ No newline at end of file diff --git a/docs/wiki/items/item-identifiers.md b/docs/wiki/items/item-identifiers.md index 27255a92..324d5c28 100644 --- a/docs/wiki/items/item-identifiers.md +++ b/docs/wiki/items/item-identifiers.md @@ -1,8 +1,8 @@ --- -title: Vanilla Item Identifiers -category: Documentation +title: 原版物品标识符 +category: 文档 tags: - - deprecated + - 已弃用 mentions: - TheDoctor15 - Medicaljewel105 @@ -11,128 +11,131 @@ mentions: - SmokeyStack --- +# 原版物品标识符 + + + :::danger -This method no longer works after 1.18.30. +该方法在 1.18.30 版本后已失效。 ::: -An `identifier` is a required parameter that sits inside the description of the item's behaviour file. -It accepts Vanilla Minecraft names, like so, `:`, which will apply certain hardcoded item behaviours, depending on the identifier used. +`identifier`(标识符)是物品行为文件中必须填写的参数。它接受原版 Minecraft 的名称,格式为 `<命名空间>:<原版物品>`,这将根据使用的标识符应用某些硬编码的物品行为。 -BP/items/custom_item.json#minecraft:item - -```json +::: code-group +```json [BP/items/custom_item.json#minecraft:item] "description": { "identifier": "wiki:totem_of_undying", "category": "items" } ``` - -:::warning -Not every Vanilla Identifier and their behaviours are documented. The following list may be missing important points about the known Identifiers that do affect items. - -Consider experimenting with them. ::: -## Known Identifier Effects +:::warning +并非所有原版标识符及其行为都有官方文档记录。以下列表可能遗漏了已知标识符的重要特性。 -The namespace is allowed to be changed, learn more about namespaces [here](/concepts/namespaces). +建议自行实验测试。 +::: -### namespace:banner +## 已知标识符效果 -- The item icon and model will be changed to that of the Vanilla Banner. +允许修改命名空间,更多信息请参考[命名空间](/wiki/concepts/namespaces)。 + +### 命名空间:banner + +- 物品图标和模型将变为原版旗帜的样式 --- -### namespace:bow +### 命名空间:bow -- Adds a small increasing zoom on use, for the zoom to work it requires the item to be usable. +- 使用时会显示小幅放大效果(需要物品具有可使用属性才能生效) --- -### namespace:crossbow +### 命名空间:crossbow -- The item will be rotated horizontally on your arm. +- 物品在手臂上会保持水平旋转状态 --- -### namespace:diamond +### 命名空间:diamond -- Is accepted as a valid item to change the effect given off by a Beacon. +- 可作为有效物品来更改信标发出的效果 --- -### namespace:emerald +### 命名空间:emerald -- Is accepted as a valid item to change the effect given off by a Beacon. +- 可作为有效物品来更改信标发出的效果 --- -### namespace:filled_map +### 命名空间:filled_map -- Will add the holding map animation. -- Can be put in a cartography table. +- 添加持地图动画 +- 可放入制图台使用 --- -### namespace:gold_ingot +### 命名空间:gold_ingot -- Is accepted as a valid item to change the effect given off by a Beacon. +- 可作为有效物品来更改信标发出的效果 --- -### namespace:iron_ingot +### 命名空间:iron_ingot -- Is accepted as a valid item to change the effect given off by a Beacon. +- 可作为有效物品来更改信标发出的效果 --- -### namespace:lapis_lazuli +### 命名空间:lapis_lazuli -- Makes the Item usable with Enchantment Tables, to enchant your items in place of Lapis Lazuli. +- 可在附魔台中替代青金石用于物品附魔 --- -### namespace:lead +### 命名空间:lead -- Will behave like a Lead. +- 具备拴绳的牵引功能 --- -### namespace:map +### 命名空间:map -- Will use the holding map animation. +- 使用持地图动画 --- -### namespace:netherite_ingot +### 命名空间:netherite_ingot -- Is accepted in custom Smithing Recipes as the secondary item. -- Is accepted as a valid item to change the effect given off by a Beacon. +- 可作为锻造台配方中的次级材料 +- 可作为有效物品来更改信标发出的效果 --- -### namespace:shield +### 命名空间:shield -- The item icon will be permanently changed to that of the Vanilla Shield. -- Adds the shield animation and behavior. +- 物品图标将永久变为原版盾牌样式 +- 添加盾牌动画和格挡功能 --- -### namespace:spyglass +### 命名空间:spyglass -- Makes it zoom-able like a spyglass, for the zoom to work it requires the item to be usable. +- 具备望远镜缩放功能(需要物品具有可使用属性才能生效) --- -### namespace:skull +### 命名空间:skull -- The item icon will be changed to that of the Vanilla Skull. -- The item will be able to put on a armorstand and a player, the model and textures of the skull will be applied only then. +- 物品图标将变为原版头颅样式 +- 可放置在盔甲架和玩家头部,此时会应用头颅的模型和材质 --- -### namespace:totem_of_undying +### 命名空间:totem_of_undying -- Will behave like a Totem of Undying. +- 具备不死图腾的复活功能 ---- +--- \ No newline at end of file diff --git a/docs/wiki/items/item-tags.md b/docs/wiki/items/item-tags.md index 7b1ed8a7..85a5cb3d 100644 --- a/docs/wiki/items/item-tags.md +++ b/docs/wiki/items/item-tags.md @@ -1,21 +1,24 @@ --- -title: Item Tags -category: General +title: 物品标签 +category: 基础 nav_order: 3 mentions: - Xterionix - SmokeyStack --- -Item tags can be used to ensure that a item meets certain conditions. +# 物品标签 -## Applying Tags + -### From 1.20.50 and onwards +物品标签可用于确保某个物品符合特定条件。 - +## 标签应用 -```json +### 1.20.50 及以后版本 + +::: code-group +```json [1.20.50+] { "format_version": "1.20.50", "minecraft:item": { @@ -32,12 +35,12 @@ Item tags can be used to ensure that a item meets certain conditions. } } ``` +::: -### Before 1.20.50 +### 1.20.50 之前版本 - - -```json +::: code-group +```json [1.20.50-] { "format_version": "1.16.100", "minecraft:item": { @@ -50,22 +53,23 @@ Item tags can be used to ensure that a item meets certain conditions. } } ``` +::: -## Testing for Tags +## 标签检测 -Tags can be queried with: +可通过以下方式查询标签: - `q.all_tags` - `q.any_tag` - `q.equipped_item_all_tags` - `q.equipped_item_any_tag` -## Lists of Vanilla Item Tags +## 原版物品标签列表 -Vanilla tags can be applied to custom items, and some vanilla items are tagged internally. +原版标签可应用于自定义物品,部分原版物品已内置标签。 -| Tag | Items | -|------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 标签 | 对应物品 | +|------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | minecraft:arrow | minecraft:arrow | | minecraft:banner | minecraft:banner | | minecraft:boat | minecraft:birch_boat, minecraft:bamboo_raft, minecraft:cherry_chest_boat, minecraft:mangrove_boat, minecraft:bamboo_chest_raft, minecraft:jungle_chest_boat, minecraft:oak_boat, minecraft:oak_chest_boat, minecraft:dark_oak_chest_boat, minecraft:cherry_boat, minecraft:mangrove_chest_boat, minecraft:acacia_boat, minecraft:acacia_chest_boat, minecraft:jungle_boat, minecraft:spruce_chest_boat, minecraft:dark_oak_boat, minecraft:boat, minecraft:spruce_boat, minecraft:birch_chest_boat, minecraft:chest_boat | @@ -122,4 +126,4 @@ Vanilla tags can be applied to custom items, and some vanilla items are tagged i | minecraft:warped_stems | minecraft:warped_stem, minecraft:stripped_warped_stem, minecraft:warped_hyphae, minecraft:stripped_warped_hyphae | | minecraft:wooden_slabs | minecraft:warped_slab, minecraft:wooden_slab, minecraft:crimson_slab, minecraft:bamboo_slab, minecraft:mangrove_slab, minecraft:cherry_slab | | minecraft:wooden_tier | minecraft:wooden_pickaxe, minecraft:wooden_shovel, minecraft:wooden_hoe, minecraft:wooden_axe, minecraft:wooden_sword | -| minecraft:wool | minecraft:white_wool, minecraft:green_wool, minecraft:magenta_wool, minecraft:gray_wool, minecraft:orange_wool, minecraft:light_gray_wool, minecraft:red_wool, minecraft:pink_wool, minecraft:brown_wool, minecraft:black_wool, minecraft:wool, minecraft:light_blue_wool, minecraft:yellow_wool, minecraft:lime_wool, minecraft:cyan_wool, minecraft:blue_wool, minecraft:purple_wool | +| minecraft:wool | minecraft:white_wool, minecraft:green_wool, minecraft:magenta_wool, minecraft:gray_wool, minecraft:orange_wool, minecraft:light_gray_wool, minecraft:red_wool, minecraft:pink_wool, minecraft:brown_wool, minecraft:black_wool, minecraft:wool, minecraft:light_blue_wool, minecraft:yellow_wool, minecraft:lime_wool, minecraft:cyan_wool, minecraft:blue_wool, minecraft:purple_wool | \ No newline at end of file diff --git a/docs/wiki/items/items-intro.md b/docs/wiki/items/items-intro.md index 2a0fee34..2d12c543 100644 --- a/docs/wiki/items/items-intro.md +++ b/docs/wiki/items/items-intro.md @@ -1,11 +1,11 @@ --- -title: Intro to Items -description: A "Hello world" guide in making items. Learn the item format and how to create basic custom items. -category: General +title: 物品入门指南 +description: 手把手教你创建自定义物品,学习物品格式和基础制作方法。 +category: 基础 nav_order: 1 tags: - - guide - - beginner + - 教程 + - 新手入门 mentions: - SirLich - solvedDev @@ -23,19 +23,22 @@ mentions: - SmokeyStack --- -Minecraft Bedrock allows us to add custom items into our world with various vanilla-like properties +# 物品入门指南 -This tutorial will cover how to create basic items for the stable version of Minecraft. + -## Registering Items +Minecraft 基岩版允许我们在世界中添加具有多种原版特性的自定义物品。 -Item definitions are structured similarly to entities: they contain a description and a list of components that defines the item's behavior. +本教程将介绍如何为稳定版 Minecraft 创建基础物品。 -Below is the **minimum** behavior-side code to get a custom item into the creative inventory. +## 注册物品 -BP/items/custom_item.json +物品定义的结构与实体类似:包含描述信息和定义物品行为的组件列表。 -```json +以下是让自定义物品出现在创造模式物品栏的**最低限度**行为端代码。 + +::: code-group +```json [BP/items/custom_item.json] { "format_version": "1.20.50", "minecraft:item": { @@ -45,26 +48,26 @@ Below is the **minimum** behavior-side code to get a custom item into the creati "category": "construction" } }, - "components": {} // Must be here, even if empty! + "components": {} // 必须存在,即使为空! } } ``` +::: -### Item Description +### 物品描述 -- Defines the item's identifier - a unique ID in the format of `namespace:identifier`. -- Configures which `menu_category` the item is placed into. - - Also takes the optional parameters `group` and `is_hidden_in_commands`. +- 定义物品唯一标识符,格式为 `命名空间:标识符` +- 配置物品在哪个`menu_category`分组显示 + - 可额外设置`group`分组和`is_hidden_in_commands`是否隐藏于命令提示 -## Adding Components +## 添加组件 -Right now, our custom item is using the default component values (which can be found [here](/items/item-components)). +当前我们的自定义物品使用的是默认组件值(详见[物品组件文档](/wiki/items/item-components))。 -Let's configure our own functionality! +现在让我们配置自定义功能! -BP/items/custom_item.json - -```json +::: code-group +```json [BP/items/custom_item.json] { "format_version": "1.20.50", "minecraft:item": { @@ -88,16 +91,16 @@ Let's configure our own functionality! } } ``` +::: -Browse more item components [here](/items/item-components)! +查看完整物品组件列表请访问[物品组件文档](/wiki/items/item-components)! -## Applying Textures +## 应用纹理 -We need to create a texture shortname to link it to an image in `RP/textures/item_texture.json`. +我们需要在`RP/textures/item_texture.json`中创建纹理简称来关联图片。 -RP/textures/item_texture.json - -```json +::: code-group +```json [RP/textures/item_texture.json] { "resource_pack_name": "wiki", "texture_name": "atlas.items", @@ -108,12 +111,12 @@ We need to create a texture shortname to link it to an image in `RP/textures/ite } } ``` +::: -In our item file, we will add the `minecraft:icon` component to apply the texture. +在物品文件中添加`minecraft:icon`组件来应用纹理。 -BP/items/custom_item.json - -```json +::: code-group +```json [BP/items/custom_item.json] { "format_version": "1.20.50", "minecraft:item": { @@ -131,26 +134,27 @@ In our item file, we will add the `minecraft:icon` component to apply the textur } } ``` +::: -## Defining Names +## 定义名称 -Finally, we will give our item a name. Additionally, you can use the [Display Name](/items/item-components#display_name) component. +最后为物品添加名称。你还可以使用[显示名称组件](/wiki/items/item-components#display_name)。 -RP/texts/en_US.lang - -```c -tile.wiki:custom_item.name=Custom Item +::: code-group +```c [RP/texts/zh_CN.lang] +tile.wiki:custom_item.name=自定义物品 ``` +::: -## Result +## 成果总结 -In this page, you've learnt about the following: +本节教程您已掌握以下内容: -- [x] Basic features of items -- [x] How to apply a texture -- [x] How to link textures using shortnames in `item_textures.json` -- [x] How to define names in the language file +- [x] 物品基础特性 +- [x] 如何应用纹理 +- [x] 使用`item_textures.json`关联纹理简称 +- [x] 在语言文件中定义物品名称 \ No newline at end of file diff --git a/docs/wiki/items/numerical-item-ids.md b/docs/wiki/items/numerical-item-ids.md index 926e46ea..3d796a9c 100644 --- a/docs/wiki/items/numerical-item-ids.md +++ b/docs/wiki/items/numerical-item-ids.md @@ -9,7 +9,7 @@ This page is a more up-to-date version of [this page](https://learn.microsoft.co ## Overview -Item IDs (not to be confused with type IDs) are an older system which are mainly used to render items with [JSON UI](/json-ui/json-ui-documentation#item-id-aux-item-id-aux) nowadays. All items & blocks (Even custom ones!) have their own unique ID. +Item IDs (not to be confused with type IDs) are an older system which are mainly used to render items with [JSON UI](/wiki/json-ui/json-ui-documentation#item-id-aux-item-id-aux) nowadays. All items & blocks (Even custom ones!) have their own unique ID. ## ID Formatting - Vanilla items & blocks have IDs from `-743` to `721`. diff --git a/docs/wiki/items/spawning-items.md b/docs/wiki/items/spawning-items.md index 03eaeb38..93bc3f7a 100644 --- a/docs/wiki/items/spawning-items.md +++ b/docs/wiki/items/spawning-items.md @@ -1,8 +1,8 @@ --- -title: Spawning Items -category: Tutorials +title: 生成物品 +category: 巧思案例 tags: - - intermediate + - 中级 mentions: - SirLich - Joelant05 @@ -13,44 +13,47 @@ mentions: - Xterionix --- -It is fairly common to want to spawn an item in the world, as if dropped. This page will walk through how to accomplish this through various methods, including Entity Deaths, Interactions, and an all-purpose method. +# 生成物品 -## /loot + -The simplest method of spawning items to date is by using /loot. Formatted as such: +在世界中生成物品(如同自然掉落)是常见的需求。本文将介绍多种实现方法,包括实体死亡、交互操作和通用方法。 + +## /loot命令 + +目前最简单的方式是使用`/loot`命令。格式如下: ``` /loot spawn ~ ~ ~ loot "entities/cow" ``` -BP/loot_tables/entities/cow.json - -```json +::: code-group +```json [BP/loot_tables/entities/cow.json] "minecraft:loot": { "table": "loot_tables/entities/cow.json" } ``` +::: -## Entity Deaths +## 实体死亡 -Another simple method of spawning items - and generally the most common one - is dropping items upon an entity's death. This is done by adding the `minecraft:loot` component to the entity and linking it to the respective loot table (`forium` in the following example) containing items you wish to be dropped. +另一种常用方法是在实体死亡时掉落物品。通过为实体添加`minecraft:loot`组件并关联对应的战利品表(如下例中的forium表)实现。 -BP/entities/my_entity.json#components - -```json +::: code-group +```json [BP/entities/my_entity.json#components] "minecraft:loot": { "table": "loot_tables/entities/forium.json" } ``` +::: -## Dummy Entity Deaths +## 虚体死亡 -We can use `minecraft:loot` on a [dummy entity](/entities/dummy-entities) that dies when we spawn it to create a `drop_entity`. This entity can be summoned like `/summon wiki:drop_entity` to spawn the items. This is useful for scenarios where death particles or sounds are not an issue. +我们可以为[虚体](/wiki/entities/dummy-entities)添加`minecraft:loot`组件,在生成时立即死亡来创建`drop_entity`。通过`/summon wiki:drop_entity`即可生成物品,适用于不介意死亡粒子/音效的场景。 -Behaviors: +行为包配置: -BP/entities/my_entity.json - -```json +::: code-group +```json [BP/entities/my_entity.json] { "format_version": "1.16.0", "minecraft:entity": { @@ -62,7 +65,7 @@ Behaviors: }, "components": { - // Causes the entity to die when spawned + // 使实体生成时立即死亡 "minecraft:health": { "value": 0 }, @@ -73,16 +76,16 @@ Behaviors: } } ``` +::: -## Interactions +## 交互操作 -Here is an example of an entity called "box" which will drop its contents upon interaction. The table in `spawn_items` is linked to the loot table with the items desired to be dropped. In this particular case, the event `break_box` is also called when the entity is interacted with, adding a component group that removes the box. +以下示例展示了名为"box"的实体在被交互时掉落物品。`spawn_items`中的表关联需要掉落的战利品表。此例中`break_box`事件会添加移除箱子的组件组。 -Note that if the entity is not removed upon interaction, it can be interacted with again and will spawn the items. If the entity should persist after the interaction, the `cooldown` parameter may be added to the entity to prevent interaction for a specified amount of time. Alternatively, an event may be called to remove the component group containing this `minecraft:interact` component. +注意:若未移除实体,可重复交互生成物品。如需保留实体,可为实体添加`cooldown`参数限制交互间隔,或通过事件移除包含`minecraft:interact`组件的组件组。 -BP/entities/my_entity.json#components - -```json +::: code-group +```json [BP/entities/my_entity.json#components] "minecraft:interact": { "interactions": [ { @@ -103,22 +106,20 @@ Note that if the entity is not removed upon interaction, it can be interacted wi ] } ``` +::: -## All-Purpose Method +## 通用方法 -This is a method that can be used for virtually any scenario: entity deaths, animation-based interactions, general item drops. This method was created in particular for dropping items without any death animation, sound, or particles. +此方法适用于各种场景:实体死亡、动画交互、常规掉落。特别适合需要静默生成物品(无死亡动画/音效/粒子)的情况。 -Several parts are required to set up the item dropping: a new entity with behavior, a corresponding animation controller, the resources for an invisible entity (refer to Dummy Entities tutorial), and a loot table. To spawn the items after it is set up, the entity is spawned where the items are to be dropped. If multiple items are desired, component groups with spawn events may be set up for each item. +需要配置以下要素:新实体的行为包、动画控制器、虚体资源(参考虚体教程)和战利品表。生成物品时召唤实体到目标位置。多个物品可通过组件组和生成事件实现。 -### Behavior +### 行为配置 -The items are spawned using the `minecraft:behavior.drop_item_for` component in conjunction with the `minecraft:navigation.walk` component, the latter being required for the former to work. Note that the `time_of_day_range` parameter in the following is not initialized to how it is defined below despite the documentation listing it as such, and this is necessary for proper function. The parameter `max_dist` must be increased to an appropriate value if the items are desired to be dropped when the player is very far away. +使用`minecraft:behavior.drop_item_for`配合`minecraft:navigation.walk`组件实现物品生成。注意`time_of_day_range`参数需显式定义,`max_dist`需根据需求调整。此方法可能导致实体位移,建议略微抬高生成位置或缩小碰撞箱。 -This behavior appears to push the mob back when the items are dropped. Thus it is essential to summon the entity slightly above the ground (or teleport it up in the following animation controller) to avoid the items spawning a few blocks away from the spawn location. Decreasing the size of the collision box may also help. - -BP/entities/my_entity.json#components - -```json +::: code-group +```json [BP/entities/my_entity.json#components] "minecraft:navigation.walk": {}, "minecraft:behavior.drop_item_for": { "priority": 1, @@ -127,16 +128,14 @@ This behavior appears to push the mob back when the items are dropped. Thus it i "time_of_day_range": [0.0, 1.0] } ``` +::: -### Animation Controller +### 动画控制器 -**The following animation controller must be linked to the entity** to remove it upon summoning. Alternatively, an animation with a timeline can be used. If you are unsure how to do this, refer to the Entity Commands tutorial. +**必须为实体关联此动画控制器**以实现自动移除。也可使用时间轴动画实现。通过传送实体至虚空避免死亡效果。双重状态过渡确保实体不在生成瞬间被移除。 -Teleporting the entity into the void causes no death animation, sound, or particles. Two transitions are used to ensure it is not killed in the same tick it spawns. - -BP/animation_controllers/my_entity.ac.json - -```json +::: code-group +```json [BP/animation_controllers/my_entity.ac.json] { "format_version": "1.10.0", "animation_controllers": { @@ -165,12 +164,10 @@ Teleporting the entity into the void causes no death animation, sound, or partic } } ``` +::: -## Structure Method +## 结构方法 -There is also one interesting method of spawning items - via structure. -You can fill a structure with `structure_void` (so air doesn't replace blocks when structure loaded) and drop an item into it. -This method allows us to keep item data (such as durability). -Then you can load this structure whenever and wherever you want. +通过结构生成物品是另一种有趣的方式。使用`structure_void`填充结构(避免加载时覆盖方块)并放入物品。此方法可保留物品数据(如耐久度),支持随时加载。 -![](/assets/images/items/spawning-items/structure-method.png) +![](/assets/images/items/spawning-items/structure-method.png) \ No newline at end of file diff --git a/docs/wiki/items/spear.md b/docs/wiki/items/spear.md index a0915bb4..97bed309 100644 --- a/docs/wiki/items/spear.md +++ b/docs/wiki/items/spear.md @@ -1,8 +1,8 @@ --- -title: Custom Spear -category: Tutorials +title: 自定义长矛 +category: 巧思案例 tags: - - scripting + - 脚本 mentions: - XxPoggyisLitxX - SirLich @@ -12,15 +12,19 @@ mentions: hidden: true --- +# 自定义长矛 + + + ::: tip -It's highly recommended that you have a basic understanding of JavaScript and Script-API. +强烈建议您对JavaScript和Script-API有基本的了解。 ::: ::: warning -It's highly recommended that you have made the basic textures and models for this guide.. +请确保已为本教程准备好基础纹理和模型。 ::: -Before we start, let's make sure you have your file structure set up: +开始前,请确认文件结构已正确设置: -Making custom spears is a really simple task. It was not simple for Koala Boy though. There are some scripting involved, but it doesn't do the main behaviors. +制作自定义长矛其实非常简单(不过对Koala Boy来说可不简单)。虽然涉及部分脚本,但核心行为并不依赖脚本实现。 -## Item +## 物品 -It can go without saying that you'd obviously need an item to make a spear, however we don't use some "basic" behaviors. Let's get an item file and let's add the following components. Let's start with the main components: +首先需要创建长矛物品,但这里不使用"基础"行为组件。我们通过以下组件实现特殊功能: -BP/items/spear.json - -```json +::: code-group +```json [BP/items/spear.json] { - //Use duration is the max time we can use the item. + //使用持续时间是我们能使用物品的最长时间 "minecraft:use_duration": 3600, - //This component is what gives our spear the ability to 'draw' it like a bow + //赋予长矛类似弓的拉弓能力 "minecraft:throwable": { "min_draw_duration": 2, "max_draw_duration": 4, "scale_power_by_draw_duration": true }, - //What projectile to shoot when draw is complete + //完成蓄力后发射的抛射物 "minecraft:projectile": { "projectile_entity": "wiki:thrown_iron_spear", "minimum_critical_power": 1.0 }, - //Durability of the spear. + //长矛耐久度 "minecraft:durability": { "max_durability": 125 } } ``` +::: -## Spear Projectile +## 抛射物实体 -We can safely say that we got the important components for our spear. Next we move over to the projectile. This projectile will be a simple entity, with some added components and a runtime identifier to get the correct behaviors. +接下来创建抛射物实体。该实体需要特殊组件和运行时标识符来实现正确行为: - + -BP/entities/spear.json - -```json +::: code-group +```json [BP/entities/spear.json] { "format_version": "1.12.0", "minecraft:entity": { @@ -155,17 +158,17 @@ We can safely say that we got the important components for our spear. Next we mo } } ``` - +::: -Here we got our simple projectile entity. We are missing one part to make this a useful projectile. There is no way for our player to pick it up from the ground. In order to do this, we need events and entity sensors: -BP/entities/spear.json +现在需要添加玩家拾取机制。通过实体传感器和事件实现: -```json +::: code-group +```json [BP/entities/spear.json] { "components": { - //Entity sensor detects if the projectile is on the ground, and if the player is near the entity. - //This will run an event when it's true + //实体传感器检测抛射物是否在地面上,以及玩家是否靠近实体 + //当条件满足时触发事件 "minecraft:entity_sensor": { "event": "wiki:give", "event_filters": { @@ -189,7 +192,7 @@ Here we got our simple projectile entity. We are missing one part to make this a }, "events": { /* - This event will despawn our projectile, and give our player a tag, which we will use in our script. + 该事件会立即销毁抛射物,并给玩家添加标签(将在脚本中使用) */ "wiki:give": { "sequence": [ @@ -218,18 +221,16 @@ Here we got our simple projectile entity. We are missing one part to make this a } } ``` +::: -Once we're done with out projectile entity, it's time to go to Resource Packs. +## 客户端实体 -## Client Entity +为抛射物创建客户端实体文件: -We will be using a basic client entity file for our projectile with added code. + - - -RP/entities/spear.json - -```json +::: code-group +```json [RP/entities/spear.json] { "format_version": "1.10.0", "minecraft:client_entity": { @@ -259,23 +260,21 @@ We will be using a basic client entity file for our projectile with added code. } } ``` +::: -Inside our client entity file, you might have noticed that there is animations bound to it. This animation will make our projectile rotate as it flies. - :::warning -Make sure your entity model is modeled like the image bellow! +请确保实体模型符合下图样式! ::: ![](/assets/images/items/spears/spear_model.png) -## Animation +## 动画 -The animation we use for our projectile isn't you normal entity animation. This one uses [molang](https://bedrock.dev/docs/stable/Molang) to define rotations. +使用[Molang](https://bedrock.dev/docs/stable/Molang)实现抛射物飞行时的旋转动画: -BP/animations/spear.json - -```json +::: code-group +```json [BP/animations/spear.json] { "format_version": "1.8.0", "animations": { @@ -283,7 +282,7 @@ The animation we use for our projectile isn't you normal entity animation. This "loop": true, "bones": { "body": { - //This is some molang stuff. The animation uses this to rotate the model based on its current angle. + //这是一些molang代码。动画根据当前角度旋转模型 "rotation": ["-q.target_x_rotation", "-q.body_y_rotation", 0] } } @@ -291,14 +290,14 @@ The animation we use for our projectile isn't you normal entity animation. This } } ``` +::: -## Attachable +## 附着物 -We will be using the Trident Attachable because it comes with item positions and use animations already. It should look like this: +使用三叉戟的附着物模板,已包含持握动画: -BP/attachables/spear.json - -```json +::: code-group +```json [BP/attachables/spear.json] { "format_version": "1.10.0", "minecraft:attachable": { @@ -339,64 +338,59 @@ We will be using the Trident Attachable because it comes with item positions and } } ``` +::: -## Script +## 脚本 -Now that we've setup our spear, there is no way to damage the spear when it's thrown. To do this, we will make use of Script-API. - -The script is really simple, and wouldn't require much brain power. +通过Script-API实现耐久度消耗: ```js import { world, ItemStack } from "@minecraft/server" import { system } from "@minecraft/server"; -//This prevents world crash +//防止世界崩溃 system.beforeEvents.watchdogTerminate.subscribe(data => { data.cancel = true; }); world.afterEvents.itemReleaseUse.subscribe(ev => { - //This is for multiplayer support + //多人游戏支持 for (const player of world.getPlayers()){ - //Basic variables to get the player inventory and held item. let inv = player.getComponent( 'inventory' ).container - //Our itemStack to save our item. This also saves item data. + //保存物品数据 const itemStack = inv.getItem(player.selectedSlot); - //If the item we're holding is our spear, we run code. + //检测是否持有长矛 if (itemStack?.typeId === 'wiki:iron_spear') { var container = player.getComponent('inventory').container - //The new item to be given. var newItem = new ItemStack("wiki:iron_spear"); var oldItem = container?.getItem(player.selectedSlot) - //Here's that tag! player.removeTag("iron_spear") } - //We subscribe a tick event to detect when we have the tag and if the item has durability less than the max. + //Tick事件检测标签和耐久度 let e = system.runInterval(() => { if(player.hasTag("iron_spear") && itemStack?.typeId === 'wiki:iron_spear' && itemStack?.getComponent("durability").damage <= 125) { player.removeTag("iron_spear") - //This gives our saved item (newItem) +1 durability each time we pick it up. + //拾取时增加耐久损耗 newItem.getComponent("durability").damage = oldItem.getComponent("durability").damage + 1; container.setItem(player.selectedSlot, newItem); - //When we don't have the tag, we stop the tick event. + //清除Tick事件 if(!player.hasTag("iron_spear")){ system.clearRun(e); }} })} }) - ``` -## Final Product +## 最终效果 -Once you've followed this guide, you should have your own working spear in-game. +完成所有步骤后,即可在游戏中获得可正常使用的长矛: ![](/assets/images/items/spears/spear_first_person.png) ![](/assets/images/items/spears/spear_third_person.png) -Example Pack Download: +示例包下载: 💾 Example Pack +>💾 示例包 \ No newline at end of file diff --git a/docs/wiki/items/throwable.md b/docs/wiki/items/throwable.md index 1eb66f43..307ba9e2 100644 --- a/docs/wiki/items/throwable.md +++ b/docs/wiki/items/throwable.md @@ -1,8 +1,8 @@ --- -title: Throwable Items -category: Tutorials +title: 投掷物 +category: 巧思案例 tags: - - intermediate + - 中级 mentions: - Fabrimat - MedicalJewel105 @@ -14,23 +14,26 @@ mentions: - ThomasOrs --- +# 投掷物 + + + ::: tip -This tutorial assumes you have a basic understanding of Molang, animation controllers and entity definitions. +本教程假定您已掌握 Molang、动画控制器和实体定义的基础知识。 ::: -Items like the Splash Potion or the Trident are special items that can be thrown. Currently, there are two ways to accomplish something similar in your add-on, one that can be done in the stable release and one that needs the `Holiday Creator Features` experimental toggle to be enabled. +类似喷溅药水或三叉戟这样的物品属于可投掷的特殊物品。目前有两种方式可以在附加包中实现类似效果,一种适用于稳定版,另一种需要开启 `Holiday Creator Features` 实验性功能。 -## Stable method +## 稳定版实现方案 -This method lets you detect the usage of an item through the `minecraft:food` component from an animation controller, and modifying the `player.json` you can then spawn an entity when that happens. +此方案通过动画控制器检测 `minecraft:food` 组件的使用情况,并通过修改 `player.json` 在投掷时生成实体。 -### The Item +### 物品定义 -First, you'll want to make the actual item: +首先创建可投掷物品: -BP/items/throwable_item.item.json - -```json +::: code-group +```json [BP/items/throwable_item.item.json] { "format_version": "1.16.0", "minecraft:item": { @@ -47,18 +50,18 @@ First, you'll want to make the actual item: } } ``` +::: -We can notice several things here: +关键点解析: -- `format_version` must be `1.16.0` -- `minecraft:use_duration` should be a high number, in order to stop the eating sound to play and to prevent the player from eating the item -- `minecraft:food` is used to allow player to actually "use" the item, so we can detect it +- `format_version` 必须为 `1.16.0` +- `minecraft:use_duration` 需设置较大值以防止播放进食音效 +- `minecraft:food` 组件用于启用物品使用检测 -Because the format version is `1.16.0`, your item needs an RP definition too: +由于格式版本为 `1.16.0`,需添加资源包定义: -RP/items/throwable_item.item.json - -```json +::: code-group +```json [RP/items/throwable_item.item.json] { "format_version": "1.16.0", "minecraft:item": { @@ -72,15 +75,14 @@ Because the format version is `1.16.0`, your item needs an RP definition too: } } ``` +::: -### The Entity +### 实体定义 -The entity will be the actual thrown item, and it will behave like a projectile. -Make sure to add snowball runtime identifier to make your projectile to actually be shoot, not spawned. You can also experiment with other projectile runtime id's. +该实体将作为实际投掷物,具有弹射物特性。注意添加雪球运行时标识使实体具有投射行为,也可尝试其他投射物标识。 -BP/entities/throwable_item_entity.se.json - -```json +::: code-group +```json [BP/entities/throwable_item_entity.se.json] { "format_version": "1.16.0", "minecraft:entity": { @@ -128,33 +130,31 @@ Make sure to add snowball runtime identifier to make your projectile to actually } } ``` +::: -This entity is based on the Vanilla splash potion. +此实体基于原版喷溅药水设计,可通过修改 `minecraft:projectile` 组件调整行为(示例中投掷物将造成伤害并给予经验)。 -You can then customize its behavior by editing the `minecraft:projectile` component, in this case the thrown item will grant some exp and will damage any entity it will hit. +### 动画控制器 -### The Animation Controller +动画控制器负责检测物品使用并触发投掷事件: -The animation controller is responsible for detecting the usage of the item and for telling the player entity to spawn a throwable entity. - -BP/animation_controllers/throwables.ac.json - -```json +::: code-group +```json [BP/animation_controllers/throwables.ac.json] { "format_version": "1.10.0", "animation_controllers": { - "controller.animation.player.throwables": { // The ID we will reference in the player's entity description + "controller.animation.player.throwables": { // 将在玩家实体描述中引用的ID "states": { "default": { "transitions": [ { - // Current "q.is_item_name_any" takes 3 arguments, first is slot name, second is slot id, third is the item we want to check for + // "q.is_item_name_any" 接受三个参数:槽位名称、槽位ID、检测物品 "throw_item": "q.is_item_name_any('slot.weapon.mainhand', 0, 'wiki:throwable_item') && q.is_using_item" - // "q.is_using_item" returns 'true' or 'false', in our case if player uses item it is going to return 'true' + // "q.is_using_item" 返回布尔值表示物品使用状态 } ], "on_entry": [ - // Resets the player entity in order to be able to throw another item + // 重置玩家状态以支持连续投掷 "@s wiki:reset_player" ] }, @@ -165,9 +165,9 @@ The animation controller is responsible for detecting the usage of the item and } ], "on_entry": [ - // Call the event in the player entity responsible of throwing the item + // 触发投掷事件 "@s wiki:throw_item", - // Remove the item from player's inventory + // 移除玩家物品 "/clear @s wiki:throwable_item -1 1" ] } @@ -176,23 +176,22 @@ The animation controller is responsible for detecting the usage of the item and } } ``` +::: -#### player.json +#### player.json 配置 :::tip -Always make sure that your `player.json` file is updated to the latest version available, depending on the game version you are working on. -You can do that [here](https://bedrock.dev/packs). +请确保您的 `player.json` 文件与当前游戏版本保持同步,可在此处获取最新版本:[bedrock.dev](https://bedrock.dev/packs) ::: :::warning -Do not edit/remove existing parts of the `player.json` file unless you know what you are doing, as it could (and probably will) break the game. +请勿随意修改或删除 `player.json` 原有内容,否则可能导致游戏异常 ::: -Now, you have to register the animation controller to the `player.json` file: +注册动画控制器至玩家实体: -BP/entities/player.json - -```json +::: code-group +```json [BP/entities/player.json] { "format_version": "1.18.20", "minecraft:entity": { @@ -203,15 +202,15 @@ Now, you have to register the animation controller to the `player.json` file: "is_experimental": false, "scripts": { "animate": [ - "throwables_controller" // This should exactly match the same as the one below + "throwables_controller" // 需与下方定义保持一致 ] }, "animations": { - "throwables_controller": "controller.animation.player.throwables" // ID as referenced in animation controller file + "throwables_controller": "controller.animation.player.throwables" // 动画控制器ID } }, "components": { - "minecraft:breathable": { // keeps breath timer bubbles from appearing + "minecraft:breathable": { // 防止显示呼吸气泡 "total_supply": 15, "suffocate_time": -1, "inhale_time": 3.75, @@ -221,14 +220,14 @@ Now, you have to register the animation controller to the `player.json` file: ... } ``` +::: -Then, you need to add all the events and component groups to the `player.json` file: +添加组件组和事件: -BP/entities/player.json#minecraft:entity - -```json +::: code-group +```json [BP/entities/player.json#minecraft:entity] "component_groups": { - "wiki:throw_entity": { // Contains a component that will spawn the entity + "wiki:throw_entity": { // 包含实体生成组件 "minecraft:spawn_entity": { "entities": { "min_wait_time": 0, @@ -257,16 +256,16 @@ Then, you need to add all the events and component groups to the `player.json` f } } ``` +::: -## Experimental method +## 实验版实现方案 -This method requires the `Holiday Creator Features` experimental toggle to be enabled. +此方案需启用 `Holiday Creator Features` 实验性功能。 -### The Item +### 物品定义 -BP/items/throwable_item.item.json - -```json +::: code-group +```json [BP/items/throwable_item.item.json] { "format_version": "1.16.100", "minecraft:item": { @@ -304,29 +303,28 @@ This method requires the `Holiday Creator Features` experimental toggle to be en } } ``` +::: -We can notice several things here: +关键点说明: -- `format_version` must be `1.16.100` -- `minecraft:on_use` will call an event every time the item is used (right-clicked) +- `format_version` 必须为 `1.16.100` +- `minecraft:on_use` 用于响应右键事件 -In the event: +事件参数: -- `shoot` will shoot our entity -- `swing` will run the swing animation on the player -- `decrement_stack` will remove one item from the player's inventory -- `run_command` will execute commands when the item is shot, like playing sounds +- `shoot` 投射实体 +- `swing` 播放挥动动画 +- `decrement_stack` 减少物品堆叠 +- `run_command` 执行音效指令 +### 实体定义 -### The Entity - -The entity file is the same as the Stable version. +实体文件与稳定版相同。 -BP/entities/throwable_item_entity.se.json - -```json +::: code-group +```json [BP/entities/throwable_item_entity.se.json] { "format_version": "1.16.0", "minecraft:entity": { @@ -374,9 +372,17 @@ The entity file is the same as the Stable version. } } ``` +::: -## Conclusion +## 扩展应用 -Once you have your throwable item you can start trying several things, like playing with its power, effects, animations or combining it with an [AOE Cloud](/entities/introduction-to-aec). The only limit is your imagination. +完成基础投掷物后,您可以尝试以下扩展: + +- 调整投射力度和弹道参数 +- 添加粒子效果和高级动画 +- 组合使用[区域效果云](/wiki/entities/introduction-to-aec) +- 实现不同命中效果(燃烧、中毒等) + +通过灵活运用组件和事件系统,可以创造出丰富的投掷物玩法。 \ No newline at end of file diff --git a/docs/wiki/items/tool-durability.md b/docs/wiki/items/tool-durability.md index fc03ddc2..74b7b82b 100644 --- a/docs/wiki/items/tool-durability.md +++ b/docs/wiki/items/tool-durability.md @@ -1,47 +1,48 @@ --- -title: Tool Durability -category: Tutorials +title: 工具耐久度 +category: 巧思案例 tags: - - experimental - - intermediate - - scripting + - 实验性 + - 中级 + - 脚本 mentions: - MedicalJewel105 - TheDoctor15 - napstaa967 --- -## Introduction +# 工具耐久度 -1.16.100+ items have different durability mechanic than 1.10 and 1.16 items. -Now you need to define when will the item get durability damage and also an event that does it. -What will be discussed on this page: -- Durability component -- Event that updates durability -- Damaging entities -- Block breaking -- `repair_amount` value -- `on_tool_used` event + -### Components +## 简介 -BP/items/my_item.json#components +1.16.100+版本的物品耐久机制与1.10和1.16版本存在差异。现在需要明确定义物品何时会受到耐久损耗,并通过事件触发损耗行为。本教程将涵盖以下内容: +- 耐久度组件 +- 更新耐久度的事件 +- 实体伤害机制 +- 方块破坏机制 +- `repair_amount` 参数 +- `on_tool_used` 事件 -```json +### 组件 + +::: code-group +```json [BP/items/my_item.json#components] "minecraft:durability": { "max_durability": 200 } ``` +::: -`minecraft:durability` will give your item a set max durability +`minecraft:durability`组件用于定义物品的最大耐久值 -## Event +## 事件机制 -### Item event +### 物品事件 -BP/items/my_item.json#events - -```json +::: code-group +```json [BP/items/my_item.json#events] "durability_update": { "damage": { "type": "none", @@ -50,24 +51,23 @@ What will be discussed on this page: } } ``` +::: -When this event is called the item (`self` target) will receive durability damage. -Looks simple, doesn't it? +当该事件被触发时,物品(`self`目标)将承受耐久损耗。看似简单,不是吗? -### Script event +### 脚本事件 -For the script methods, we'll be using a function to damage our item +对于脚本实现,我们将使用自定义函数处理耐久损耗 -This function supports unbreaking on items +该函数支持物品的"耐久"附魔效果 -BP/scripts/main.js - -```js +::: code-group +```js [BP/scripts/main.js] function damage_item(item) { - // Get durability + // 获取耐久度组件 const durabilityComponent = item.getComponent("durability") var unbreaking = 0 - // Get unbreaking level + // 获取耐久附魔等级 if (item.hasComponent("enchantments")) { unbreaking = item.getComponent("enchantments").enchantments.getEnchantment("unbreaking") if (!unbreaking) { @@ -76,7 +76,7 @@ function damage_item(item) { unbreaking = unbreaking.level } } - // Apply damage + // 应用损耗 if (durabilityComponent.damage == durabilityComponent.maxDurability) { return @@ -85,39 +85,39 @@ function damage_item(item) { return item } ``` - -## Damaging entities - -### Using scripts - -:::warning Experimental Script - -This script uses `@minecraft/server 1.9.0-beta`, which will change in the next minecraft update. ::: -For format versions 1.20.40 and onward, `on_hurt_entity` no longer works. +## 实体伤害 -This provides a way to damage weapons using scripts +### 脚本实现 -BP/scripts/main.js +:::warning 实验性脚本 -```js -// Add your item IDs into this array +本脚本使用`@minecraft/server 1.9.0-beta`,该版本将在后续游戏更新中变更。 +::: + +对于1.20.40及更高格式版本,`on_hurt_entity`已失效。 + +以下脚本实现了武器耐久损耗机制: + +::: code-group +```js [BP/scripts/main.js] +// 在此数组中添加你的物品ID const my_items = ["wiki:silver_dagger"] world.afterEvents.entityHurt.subscribe(event => { - // If there's no source entity, skip + // 无伤害来源实体则跳过 if (!event.damageSource.damagingEntity) return - // Get equipped weapon + // 获取装备的武器 const equipment = event.damageSource.damagingEntity.getComponent("minecraft:equippable") if (!equipment) return const weapon = equipment.getEquipment(EquipmentSlot.Mainhand) - // If there's no weapon, skip + // 无武器则跳过 if (!weapon) return - // If the item is not in our item IDs, skip + // 物品不在列表则跳过 if (!my_items.includes(weapon.typeId)) return let newItem = damage_item(weapon) equipment.setEquipment(EquipmentSlot.Mainhand, newItem) @@ -128,52 +128,52 @@ world.afterEvents.entityHurt.subscribe(event => { } }) ``` +::: -### on_hurt_entity +### on_hurt_entity事件 :::warning -`on_hurt_entity` was removed in format version 1.20.40 +`on_hurt_entity`在格式版本1.20.40后已移除 ::: -`on_hurt_entity` can be defined in "minecraft:weapon" component. It tells the game what event should happen when player hurts entity using this item. +在`minecraft:weapon`组件中定义`on_hurt_entity`,用于指定玩家使用该物品攻击实体时触发的事件 -BP/items/my_item.json#components - -```json +::: code-group +```json [BP/items/my_item.json#components] "minecraft:weapon": { "on_hurt_entity": { "event": "durability_update" } } ``` - -## Block breaking - -### Using scripts - -:::warning Experimental Script - -This script uses `@minecraft/server 1.9.0-beta`, which will change in the next minecraft update. ::: -For format versions 1.20.20 and onward, `on_dig` no longer works. +## 方块破坏 -This provides a way to damage digger items by using scripts +### 脚本实现 -BP/scripts/main.js +:::warning 实验性脚本 -```js -// Add your item IDs into this array +本脚本使用`@minecraft/server 1.9.0-beta`,该版本将在后续游戏更新中变更。 +::: + +对于1.20.20及更高格式版本,`on_dig`已失效。 + +以下脚本实现了工具耐久损耗机制: + +::: code-group +```js [BP/scripts/main.js] +// 在此数组中添加你的物品ID const my_items = ["wiki:obsidian_pickaxe"] world.afterEvents.playerBreakBlock.subscribe(event => { - // If there's no item, skip + // 无物品则跳过 if (!event.itemStackAfterBreak) return - // If the item is not in our item IDs, skip + // 物品不在列表则跳过 if (!my_items.includes(event.itemStackAfterBreak.typeId)) return - // If player is in creative, skip + // 创造模式玩家跳过 if (world.getPlayers({ gameMode: GameMode.creative }).includes(event.player)) return @@ -184,19 +184,19 @@ world.afterEvents.playerBreakBlock.subscribe(event => { } }) ``` +::: -### on_dig +### on_dig事件 :::warning -`on_dig` was removed in format version 1.20.20 +`on_dig`在格式版本1.20.20后已移除 ::: -`on_dig` can be defined in "minecraft:digger" component. It tells the game what event should happen when player dug a block using this item. +在`minecraft:digger`组件中定义`on_dig`,用于指定玩家使用该物品破坏方块时触发的事件 -BP/items/my_item.json#components - -```json +::: code-group +```json [BP/items/my_item.json#components] "minecraft:digger": { "use_efficiency": true, "destroy_speeds": [ @@ -206,25 +206,25 @@ world.afterEvents.playerBreakBlock.subscribe(event => { }, "speed": 8, "on_dig": { - // Defines event that should happen when block with tag wood was dug. + // 定义破坏带有wood标签的方块时触发的事件 "event": "durability_update" } } ], "on_dig": { - // Defines event that should happen when any block was destroyed. + // 定义破坏任意方块时触发的事件 "event": "durability_update" } } ``` +::: -## repair_amount +## repair_amount参数 -`repair_amount` can be defined in "minecraft:repairable" component. It tells the game how much of the item's durability should be back when it was repaired. +在`minecraft:repairable`组件中定义`repair_amount`,用于指定物品修复时的耐久恢复量 -BP/items/my_item.json#components - -```json +::: code-group +```json [BP/items/my_item.json#components] "minecraft:repairable": { "repair_items": [ { @@ -237,31 +237,30 @@ world.afterEvents.playerBreakBlock.subscribe(event => { ] } ``` +::: -Formula explanation: +公式解析: `"context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"` -The _final_ durability will be durability of the first axe + durability of the second axe + 5% of 2nd axe MAX durability. +最终耐久 = 第一把斧的剩余耐久 + 第二把斧的剩余耐久 + 第二把斧最大耐久的5% -## on_tool_used +## on_tool_used事件 -(This might not work now) -`on_tool_used` is special event that can be called using tags. -Tags work kinda like runtime identifiers for entities. -Known tags: +(当前可能不可用) +`on_tool_used`是通过标签系统触发的特殊事件。标签类似于实体的运行时标识符。已知标签: -| Tag | Effects | How can be called | -| -------------------- | -------------- | -------------------------------------------------- | -| minecraft:is_axe | Strips logs | By interacting with blocks that axe interacts with | -| minecraft:is_hoe | Makes farmland | By interacting with blocks that hoe interacts with | -| minecraft:is_pickaxe | Unknown | Unknown | -| minecraft:is_sword | Unknown | Unknown | +| 标签 | 效果 | 触发方式 | +| -------------------- | ------------- | -------------------------------- | +| minecraft:is_axe | 剥离原木 | 与斧头可交互的方块互动时触发 | +| minecraft:is_hoe | 制作耕地 | 与锄头可交互的方块互动时触发 | +| minecraft:is_pickaxe | 未知 | 未知 | +| minecraft:is_sword | 未知 | 未知 | -You can apply these tags this way: +可通过以下方式应用标签: -BP/items/my_item.json#components - -```json +::: code-group +```json [BP/items/my_item.json#components] "tag:minecraft:is_axe": {} ``` +::: \ No newline at end of file diff --git a/docs/wiki/items/troubleshooting-items.md b/docs/wiki/items/troubleshooting-items.md index 1d665d7a..4af89d8a 100644 --- a/docs/wiki/items/troubleshooting-items.md +++ b/docs/wiki/items/troubleshooting-items.md @@ -1,6 +1,6 @@ --- -title: Troubleshooting Items -category: General +title: 物品问题排查 +category: 基础 nav_order: 4 tags: - help @@ -13,74 +13,78 @@ mentions: - ThomasOrs --- +# 物品问题排查 + + + :::tip -This page contains troubleshooting information about _items_. You should read our [global troubleshooting](/guide/troubleshooting) document before continuing here. +本文包含关于_物品_的故障排查信息。在继续阅读前,建议先查看[全局故障排查指南](/wiki/guide/troubleshooting)。 ::: -## Start Here +## 从这里开始 -I followed a tutorial or tried to make my own item and something is wrong! Calm down. This page will help debug common issues. Follow the buttons and prompts to learn about possible issues with your item, and tips for fixing. +我按照教程制作了自定义物品,但出现了问题!请保持冷静。本指南将帮助您排查常见问题。根据按钮提示了解可能的问题原因及修复方法。 -Continue +继续 --- -## 1.10 vs 1.16 Items? +## 1.10 与 1.16 格式物品的区别? -Before starting, you need to determine whether you creating an experimental item, or a stable item. +首先需要确认您使用的是实验性物品格式还是稳定版物品格式。 :::tip -Versions `1.16.0` and prior are currently **stable** (Includes versions `1.16`, `1.14`, `1.13`, `1.12`, `1.10`). These **do not** require `Holiday Creator Features` to be enabled. - -🔗 Tutorial on [stable items](/guide/custom-item). -🔗 Documentation for [stable items](https://bedrock.dev/docs/1.16.0.0/1.16.20.54/Item) +`1.16.0` 及更早版本属于**稳定版**(包含 `1.16`, `1.14`, `1.13`, `1.12`, `1.10`)。这些格式**无需**启用 `Holiday Creator Features` 实验性玩法。 +🔗 [稳定版物品教程](/wiki/guide/custom-item) +🔗 [稳定版物品文档](https://bedrock.dev/docs/1.16.0.0/1.16.20.54/Item) ::: :::tip -Versions `1.16.100` and onward are **experimental**. These items **will not work unless** `Holiday Creator Features` **is enabled in the world**. +`1.16.100` 及更高版本属于**实验性格式**。这些物品**必须**在世界设置中启用 `Holiday Creator Features` 才能正常使用。 -🔗 Our tutorial on [experimental items](/items/item-components). -🔗 Documentation for [experimental items](https://bedrock.dev/docs/stable/Item) +🔗 [实验性物品教程](/wiki/items/item-components) +🔗 [实验性物品文档](https://bedrock.dev/docs/stable/Item) ::: -### Continue +### 继续选择 -1.10 format (stable) 1.16.100 format (experimental) +1.10 格式(稳定版) 1.16.100 格式(实验性) --- -## Stable Items +## 稳定版物品 -This section contains troubleshooting information for stable items. Remember, you are using the `1.10` format, so you need both an RP file and a BP file for your item! If you only have a BP file, you have become confused between format versions. Please start again [here](#_1-10-vs-1-16-items). +本部分针对稳定版物品的故障排查。请注意:使用 `1.10` 格式时,您需要同时存在 RP 和 BP 文件!如果只有 BP 文件,说明混淆了格式版本。请返回[此处](#_1-10-vs-1-16-items)重新确认。 -Find the issue you have, then read the prompts. +根据问题现象选择对应排查步骤: -- [I cannot /give myself my custom item!](#i-cannot-give-myself-my-custom-item) -- [My textures are missing!](#my-textures-are-missing) +- [无法通过 /give 获取物品](#无法通过-give-获取物品) +- [物品贴图丢失](#物品贴图丢失) -### I cannot /give myself my custom item! +### 无法通过 /give 获取物品 -An issue here will be caused by the item file in the BP. +此问题通常由 BP 文件配置错误引起: -- Confirm that your pack is actually applied to your world -- Confirm that your item is in the folder `BP/items/` -- Confirm that your item is valid, according to [jsonlint](https://jsonlint.com/). -- Confirm that your identifier is all lowercase, and looks similar to this: `wiki:my_item` +- 确认资源包已正确加载至世界 +- 确认物品文件存放在 `BP/items/` 目录 +- 使用 [jsonlint](https://jsonlint.com/) 验证 JSON 格式正确 +- 确保物品标识符全小写,格式如:`wiki:my_item` -### My textures are missing! +### 物品贴图丢失 -Navigate to your `item_texture.json` file. Ensure that it is properly named, and in the correct folder. Some examples of wrong names: +首先检查 `item_texture.json` 文件: -- ⚠️ `texture/item_texture.json` -- ⚠️ `textures/Item_texture.json` -- ⚠️ `textures/item_textures.json` +- 正确路径应为:`RP/textures/item_texture.json` +- 常见错误路径示例: + - ⚠️ `texture/item_texture.json` + - ⚠️ `textures/Item_texture.json` + - ⚠️ `textures/item_textures.json` -Here is an example file to compare against: +参考示例文件结构: -RP/textures/item_texture.json - -```json +::: code-group +```json [RP/textures/item_texture.json] { "resource_pack_name": "wiki", "texture_name": "atlas.items", @@ -91,16 +95,18 @@ Here is an example file to compare against: } } ``` +::: -Next, navigate to your items RP file. Ensure that it is in the correct folder. Example of incorrect path: +接着检查 RP 物品文件: -- ⚠️ `item/gem.json` +- 正确路径应为:`RP/items/物品名称.json` +- 错误示例路径: + - ⚠️ `item/gem.json` -An example file, to compare against: +参考示例配置(注意注释说明): -RP/items/gem.json - -```json +::: code-group +```json [RP/items/gem.json] { "format_version": "1.10", "minecraft:item": { @@ -109,55 +115,57 @@ An example file, to compare against: "category": "Nature" }, "components": { - "minecraft:icon": "gem", //make sure this string matches the string you put in item_texture.json! + "minecraft:icon": "gem", // 确保此字符串与 item_texture.json 中的键名一致! "minecraft:render_offsets": "tools" } } } ``` +::: -If you followed this properly, your item should now have a texture. +正确配置后物品将正常显示贴图。 --- -## Experimental Items +## 实验性物品 -This section contains troubleshooting information for experimental items. Remember, you are using the `1.16` format, so there shouldn't be an RP file for your item! If you have both an RP file and a BP file, you have become confused between format versions. Please start again [here](#_1-10-vs-1-16-items). +本部分针对实验性物品格式的故障排查。请注意:使用 `1.16` 格式时**不应存在 RP 物品文件**!如果同时存在 RP 和 BP 文件,说明混淆了格式版本。请返回[此处](#_1-10-vs-1-16-items)重新确认。 -Find the issue you have, then read the prompts. +根据问题现象选择对应排查步骤: -- [Start Here](#start-here) -- [1.10 vs 1.16 Items?](#110-vs-116-items) - - [Continue](#continue) -- [Stable Items](#stable-items) - - [I cannot /give myself my custom item!](#i-cannot-give-myself-my-custom-item) - - [My textures are missing!](#my-textures-are-missing) -- [Experimental Items](#experimental-items) - - [I cannot /give myself my custom item!](#i-cannot-give-myself-my-custom-item-1) - - [My Textures Are Missing!](#my-textures-are-missing-1) - - [My item is Huge](#my-item-is-huge) -- [What now?](#what-now) +- [从这里开始](#从这里开始) +- [1.10 与 1.16 格式物品的区别?](#110-与-116-格式物品的区别) + - [继续选择](#继续选择) +- [稳定版物品](#稳定版物品) + - [无法通过 /give 获取物品](#无法通过-give-获取物品) + - [物品贴图丢失](#物品贴图丢失) +- [实验性物品](#实验性物品) + - [无法通过 /give 获取物品](#无法通过-give-获取物品-1) + - [物品贴图丢失!](#物品贴图丢失-1) + - [物品模型过大](#物品模型过大) +- [后续步骤](#后续步骤) -### I cannot /give myself my custom item! +### 无法通过 /give 获取物品 -- Confirm that your pack is actually applied to your world -- Confirm that your item is in the folder `BP/items/` -- Confirm that your item is valid, according to [jsonlint](https://jsonlint.com/). -- Confirm that your identifier is all lowercase, and looks similar to this: `wiki:my_item` +- 确认资源包已正确加载至世界 +- 确认物品文件存放在 `BP/items/` 目录 +- 使用 [jsonlint](https://jsonlint.com/) 验证 JSON 格式正确 +- 确保物品标识符全小写,格式如:`wiki:my_item` -### My Textures Are Missing! +### 物品贴图丢失! -Navigate to your `item_texture.json` file. Ensure that it is properly named, and in the correct folder. Some examples of wrong names: +检查 `item_texture.json` 文件: -- ⚠️ `texture/item_texture.json` -- ⚠️ `textures/Item_texture.json` -- ⚠️ `textures/item_textures.json` +- 正确路径应为:`RP/textures/item_texture.json` +- 常见错误路径示例: + - ⚠️ `texture/item_texture.json` + - ⚠️ `textures/Item_texture.json` + - ⚠️ `textures/item_textures.json` -Here is an example file to compare against: +参考示例文件: -RP/textures/item_texture.json - -```json +::: code-group +```json [RP/textures/item_texture.json] { "resource_pack_name": "wiki", "texture_name": "atlas.items", @@ -168,40 +176,40 @@ Here is an example file to compare against: } } ``` +::: -Next, navigate to your items BP file. Place the `minecraft:icon` component in your item file under the components section. Ensure that it is properly named. +接着在 BP 文件中确认 `minecraft:icon` 组件配置: -BP/items/your_item.json - -```json +::: code-group +```json [BP/items/your_item.json] { "format_version": "1.16.100", "minecraft:item": { "description": { "identifier": "namespace:your_item", - "category" : "items" // This line is required + "category" : "items" // 此字段必须存在 }, "components": { "minecraft:icon": { - "texture": "your_item_name" // Make sure this string matches the string you put in item_texture.json + "texture": "your_item_name" // 确保此字符串与 item_texture.json 中的键名一致 } }, "events": {...} } } ``` +::: -If you followed this properly, your item should now have a texture. +正确配置后物品将正常显示贴图。 -### My item is Huge +### 物品模型过大 -To turn it to back into a normal size item (`16x16`), use render offsets and the following formula: `base value/(res/16)` +如需恢复标准物品尺寸(`16x16`),使用以下公式计算渲染缩放:`基准值/(分辨率/16)` -The base values, `[0.075, 0.125, 0.075]`, seems to be the about the same scale value as normal items. +推荐使用基准值 `[0.075, 0.125, 0.075]` 可获得近似原版物品的缩放比例。 -BP/items/your_item.json#components - -```json +::: code-group +```json [BP/items/your_item.json#components] "minecraft:render_offsets":{ "main_hand":{ "first_person":{ @@ -237,7 +245,8 @@ The base values, `[0.075, 0.125, 0.075]`, seems to be the about the same scale v } } ``` +::: -## What now? +## 后续步骤 -You've reached the end of the guide. If you still have any problems, feel free to [join the discord server](/discord) and ask your question there. +如果您的问题仍未解决,欢迎[加入 Discord 社区](/discord)进行咨询。 \ No newline at end of file diff --git a/docs/wiki/items/vanilla-usage-items.md b/docs/wiki/items/vanilla-usage-items.md index 45006062..7236021d 100644 --- a/docs/wiki/items/vanilla-usage-items.md +++ b/docs/wiki/items/vanilla-usage-items.md @@ -1,37 +1,40 @@ --- -title: Vanilla Usage Components -category: Documentation +title: 原版使用组件 +category: 文档 mentions: - MedicalJewel105 --- -This page was created with [Wiki Content Generator](https://github.com/Bedrock-OSS/bedrock-wiki-content-generator). If there are issues, contact us on [Bedrock OSS](https://discord.gg/XjV87YN) Discord server. -Note that not more than 8 examples are shown for each component to keep this page fast to load. Namespace `minecraft` was also removed. -If you want to see full page, you can do it [here](/items/vui-full). *Last updated for 1.20.10* +# 原版使用组件 + + + +本页面由 [Wiki内容生成器](https://github.com/Bedrock-OSS/bedrock-wiki-content-generator) 创建。如有问题请联系 [Bedrock OSS](https://discord.gg/XjV87YN) Discord 服务器。 +注意:为保持页面加载速度,每个组件最多展示8个示例。命名空间 `minecraft` 已省略。 +如需查看完整内容,请访问[此处](/wiki/items/vui-full)。*最后更新版本:1.20.10* ## block - + camera - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:block": "minecraft:camera" ``` +::: ## camera - + camera - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:camera": { "black_bars_duration": 0.2, "black_bars_screen_ratio": 0.08, @@ -40,76 +43,76 @@ camera "slide_away_duration": 0.2 } ``` +::: ## foil - + appleEnchanted - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:foil": true ``` +::: golden_apple - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:foil": false ``` +::: ## food - + apple - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:food": { - "nutrition": 4, - "saturation_modifier": "low" + "nutrition": 4, // 营养值 + "saturation_modifier": "low" // 饱和度修正:低 } ``` +::: appleEnchanted - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:food": { "nutrition": 4, - "saturation_modifier": "supernatural", - "can_always_eat": true, - "effects": [ + "saturation_modifier": "supernatural", // 超自然饱和度 + "can_always_eat": true, // 可随时食用 + "effects": [ // 效果列表 { - "name": "regeneration", - "chance": 1.0, - "duration": 30, - "amplifier": 4 + "name": "regeneration", // 再生 + "chance": 1.0, // 触发概率 + "duration": 30, // 持续时间(秒) + "amplifier": 4 // 效果等级 }, { - "name": "absorption", + "name": "absorption", // 伤害吸收 "chance": 1.0, "duration": 120, "amplifier": 3 }, { - "name": "resistance", + "name": "resistance", // 抗性提升 "chance": 1.0, "duration": 300, "amplifier": 0 }, { - "name": "fire_resistance", + "name": "fire_resistance", // 火焰抗性 "chance": 1.0, "duration": 300, "amplifier": 0 @@ -117,420 +120,420 @@ appleEnchanted ] } ``` +::: baked_potato - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:food": { "nutrition": 5, - "saturation_modifier": "normal" + "saturation_modifier": "normal" // 普通饱和度 } ``` +::: beef - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:food": { "nutrition": 3, "saturation_modifier": "low" } ``` +::: beetroot - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:food": { "nutrition": 1, "saturation_modifier": "normal" } ``` +::: beetroot_soup - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:food": { "nutrition": 6, "saturation_modifier": "normal", - "using_converts_to": "bowl" + "using_converts_to": "bowl" // 使用后转换为碗 } ``` +::: bread - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:food": { "nutrition": 5, "saturation_modifier": "normal" } ``` +::: carrot - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:food": { "nutrition": 3, "saturation_modifier": "normal" } ``` +::: ## hand_equipped - + appleEnchanted - - -```json -"minecraft:hand_equipped": false +::: code-group +```json [原始CodeHeader的值] +"minecraft:hand_equipped": false // 是否手持装备 ``` +::: ## max_damage - + clownfish - - -```json -"minecraft:max_damage": 0 +::: code-group +```json [原始CodeHeader的值] +"minecraft:max_damage": 0 // 最大耐久值 ``` +::: cooked_fish - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:max_damage": 0 ``` +::: cooked_salmon - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:max_damage": 0 ``` +::: fish - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:max_damage": 0 ``` +::: pufferfish - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:max_damage": 0 ``` +::: salmon - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:max_damage": 0 ``` +::: ## max_stack_size - + beetroot_soup - - -```json -"minecraft:max_stack_size": 1 +::: code-group +```json [原始CodeHeader的值] +"minecraft:max_stack_size": 1 // 最大堆叠数量 ``` +::: honey_bottle - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:max_stack_size": 16 ``` +::: mushroom_stew - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:max_stack_size": 1 ``` +::: rabbit_stew - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:max_stack_size": 1 ``` +::: suspicious_stew - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:max_stack_size": 1 ``` +::: ## seed - + beetroot_seeds - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:seed": { - "crop_result": "beetroot" + "crop_result": "beetroot" // 种植产物 } ``` +::: carrot - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:seed": { "crop_result": "carrots" } ``` +::: glow_berries - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:seed": { - "crop_result": "cave_vines", - "plant_at": [ + "crop_result": "cave_vines", // 洞穴藤蔓 + "plant_at": [ // 可种植位置 "cave_vines", "cave_vines_head_with_berries" ], - "plant_at_any_solid_surface": true, - "plant_at_face": "DOWN" + "plant_at_any_solid_surface": true, // 可在任意固体表面种植 + "plant_at_face": "DOWN" // 种植面:下方 } ``` +::: melon_seeds - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:seed": { - "crop_result": "melon_stem" + "crop_result": "melon_stem" // 西瓜茎 } ``` +::: nether_wart - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:seed": { - "plant_at": "soul_sand", + "plant_at": "soul_sand", // 必须种植在灵魂沙上 "crop_result": "nether_wart" } ``` +::: pitcher_pod - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:seed": { - "crop_result": "pitcher_crop" + "crop_result": "pitcher_crop" // 投手作物 } ``` +::: potato - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:seed": { "crop_result": "potatoes" } ``` +::: pumpkin_seeds - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:seed": { - "crop_result": "pumpkin_stem" + "crop_result": "pumpkin_stem" // 南瓜茎 } ``` +::: ## stacked_by_data - + appleEnchanted - - -```json -"minecraft:stacked_by_data": true +::: code-group +```json [原始CodeHeader的值] +"minecraft:stacked_by_data": true // 允许数据值堆叠 ``` +::: clownfish - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:stacked_by_data": true ``` +::: cooked_fish - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:stacked_by_data": true ``` +::: cooked_salmon - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:stacked_by_data": true ``` +::: fish - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:stacked_by_data": true ``` +::: golden_apple - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:stacked_by_data": true ``` +::: pufferfish - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:stacked_by_data": true ``` +::: salmon - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:stacked_by_data": true ``` +::: ## use_duration - + apple - - -```json -"minecraft:use_duration": 32 +::: code-group +```json [原始CodeHeader的值] +"minecraft:use_duration": 32 // 使用耗时(tick) ``` +::: appleEnchanted - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:use_duration": 32 ``` +::: baked_potato - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:use_duration": 32 ``` +::: beef - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:use_duration": 32 ``` +::: beetroot - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:use_duration": 32 ``` +::: beetroot_soup - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:use_duration": 32 ``` +::: bread - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:use_duration": 32 ``` +::: camera - - -```json +::: code-group +```json [原始CodeHeader的值] "minecraft:use_duration": 100000 ``` +::: - - + \ No newline at end of file diff --git a/docs/wiki/4-Json-UI/2-巧思案例/add-hud-elements.md b/docs/wiki/json-ui/add-hud-elements.md similarity index 98% rename from docs/wiki/4-Json-UI/2-巧思案例/add-hud-elements.md rename to docs/wiki/json-ui/add-hud-elements.md index 72601368..fdf29549 100644 --- a/docs/wiki/4-Json-UI/2-巧思案例/add-hud-elements.md +++ b/docs/wiki/json-ui/add-hud-elements.md @@ -1,6 +1,6 @@ --- title: 添加HUD元素 -category: 教程 +category: 巧思案例 tags: - 初学者 mentions: @@ -61,6 +61,7 @@ HUD界面在游戏中大部分时间都会显示,为玩家提供关键信息 ] }, ``` +::: 需要添加到HUD界面上的所有元素都列举在root_panel的`modifications`->`value`部分。在添加元素时使用的命名空间标识(例如`@hud.hud_square`)可以根据实际模块进行调整。比如当`hud_square`元素是创建在`scoreboard`命名空间的scoreboards.json界面文件中时,添加时应使用`@scoreboard.hud_square`。 @@ -90,5 +91,6 @@ HUD界面在游戏中大部分时间都会显示,为玩家提供关键信息 ] }, ``` +::: 此处`hud_elements_panel`没有直接定义尺寸参数,因此将继承其父元素(`root_panel`)的尺寸。这使得子元素的锚点定位、百分比尺寸等效果能相对于HUD屏幕进行适配。 \ No newline at end of file diff --git a/docs/wiki/4-Json-UI/2-巧思案例/aseprite-animations.md b/docs/wiki/json-ui/aseprite-animations.md similarity index 98% rename from docs/wiki/4-Json-UI/2-巧思案例/aseprite-animations.md rename to docs/wiki/json-ui/aseprite-animations.md index 5cdda263..dd005ee3 100644 --- a/docs/wiki/4-Json-UI/2-巧思案例/aseprite-animations.md +++ b/docs/wiki/json-ui/aseprite-animations.md @@ -1,6 +1,6 @@ --- title: 序列帧动画 -category: 教程 +category: 巧思案例 mentions: - TheDataLioness - shanewolf38 diff --git a/docs/wiki/4-Json-UI/1-基础/best-practices.md b/docs/wiki/json-ui/best-practices.md similarity index 84% rename from docs/wiki/4-Json-UI/1-基础/best-practices.md rename to docs/wiki/json-ui/best-practices.md index 164e88db..d61c95ed 100644 --- a/docs/wiki/4-Json-UI/1-基础/best-practices.md +++ b/docs/wiki/json-ui/best-practices.md @@ -1,6 +1,6 @@ --- title: 最佳实践 -category: 通用指南 +category: 基础 nav_order: 2 tags: - 指南 @@ -16,7 +16,7 @@ mentions: :::tip 提示 -本文内容假定您已对JSON-UI系统有一定了解。如果您是JSON-UI的新手,请务必先阅读[JSON-UI介绍](/json-ui/json-ui-intro)和[JSON-UI文档](/json-ui/json-ui-documentation)。 +本文内容假定您已对JSON-UI系统有一定了解。如果您是JSON-UI的新手,请务必先阅读[JSON-UI介绍](/wiki/json-ui/json-ui-intro)和[JSON-UI文档](/wiki/json-ui/json-ui-documentation)。 ::: ## 最大化兼容性并减少UI崩溃的可能性 @@ -37,7 +37,7 @@ JSON-UI与其他附加包系统不同,因为**JSON-UI没有版本控制**。 这种极简修改方式能显著降低未来更新导致UI崩溃的风险,同时保持文件整洁并大幅缩小体积。**若您将整个原版UI文件复制到资源包中进行修改,说明您错误理解了JSON-UI的工作机制**。 ### 善用修改策略 -使用[wiki文档中的修改策略](/json-ui/json-ui-intro#modifications)能有效降低更新风险。例如在HUD中添加自定义元素时,推荐使用修改数组操作而非直接插入控件: +使用[wiki文档中的修改策略](/wiki/json-ui/json-ui-intro#modifications)能有效降低更新风险。例如在HUD中添加自定义元素时,推荐使用修改数组操作而非直接插入控件: ::: code-group ```json [正确做法] @@ -100,21 +100,21 @@ JSON-UI与其他附加包系统不同,因为**JSON-UI没有版本控制**。 ::: ### 避免使用原版命名空间 -开发大规模UI修改时,建议创建自定义[命名空间](/json-ui/json-ui-intro#namespaces)并使用前缀(如`wiki:namespace`)来防止命名冲突。通过`element@namespace.element`语法引用其他命名空间的元素。 +开发大规模UI修改时,建议创建自定义[命名空间](/wiki/json-ui/json-ui-intro#namespaces)并使用前缀(如`wiki:namespace`)来防止命名冲突。通过`element@namespace.element`语法引用其他命名空间的元素。 ## 性能优化指南 JSON-UI是仅次于实体的性能消耗大户。以下策略可帮助提升UI性能表现: ### 减少操作符使用 -[操作符](/json-ui/json-ui-intro#using-operators)会显著增加计算开销。优化示例: +[操作符](/wiki/json-ui/json-ui-intro#using-operators)会显著增加计算开销。优化示例: ```json "$var": "(-2 * $number)" // 优于 "(2 * (-1 * $number))" ``` ### 精简绑定数量 -每个[绑定](/json-ui/json-ui-intro#bindings)都会产生性能开销。建议: +每个[绑定](/wiki/json-ui/json-ui-intro#bindings)都会产生性能开销。建议: - 移除无效绑定 - 合并相似功能绑定 - 避免重复绑定相同数据 diff --git a/docs/wiki/json-ui/index.md b/docs/wiki/json-ui/index.md new file mode 100644 index 00000000..a7443d8d --- /dev/null +++ b/docs/wiki/json-ui/index.md @@ -0,0 +1,10 @@ +--- +title: JSON UI +categories: + - title: 基础 + color: blue + - title: 巧思案例 + color: green + - title: 文档 + color: red +--- diff --git a/docs/wiki/4-Json-UI/3-文档/json-ui-documentation.md b/docs/wiki/json-ui/json-ui-documentation.md similarity index 93% rename from docs/wiki/4-Json-UI/3-文档/json-ui-documentation.md rename to docs/wiki/json-ui/json-ui-documentation.md index bfd65b94..7f60f557 100644 --- a/docs/wiki/4-Json-UI/3-文档/json-ui-documentation.md +++ b/docs/wiki/json-ui/json-ui-documentation.md @@ -1,6 +1,6 @@ --- title: JSON UI 完整文档 -category: Documentation +category: 文档 nav_order: 1 mentions: - KalmeMarq @@ -31,35 +31,35 @@ mentions: | 名称 | 描述 | 允许的属性 | | ------------------ | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| panel | 容器元素,类似HTML中的`
` | [控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| stack_panel | 类似`panel`,但会根据`orientation`属性值自动堆叠子元素 | [堆叠面板](/json-ui/json-ui-documentation#stack-panel)
[集合](/json-ui/json-ui-documentation#collection)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| collection_panel | 类似`stack_panel`,但没有`orientation`属性 | [集合](/json-ui/json-ui-documentation#collection)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| grid | 网格布局元素 | [网格](/json-ui/json-ui-documentation#grid)
[集合](/json-ui/json-ui-documentation#collection)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| label | 文本元素 | [文本](/json-ui/json-ui-documentation#text)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| image | 图像元素,用于绘制纹理 | [精灵](/json-ui/json-ui-documentation#sprite)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| input_panel | 可接收输入的面板 | [输入](/json-ui/json-ui-documentation#input)
[焦点](/json-ui/json-ui-documentation#focus)
[音效](/json-ui/json-ui-documentation#sound)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| button | 按钮元素,支持四种状态(默认、悬停、按下、锁定) | [按钮](/json-ui/json-ui-documentation#button)
[输入](/json-ui/json-ui-documentation#input)
[焦点](/json-ui/json-ui-documentation#focus)
[音效](/json-ui/json-ui-documentation#sound)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| toggle | 开关元素,包含两种状态(选中/未选中),每种状态有悬停和锁定变体 | [开关](/json-ui/json-ui-documentation#toggle)
[输入](/json-ui/json-ui-documentation#input)
[焦点](/json-ui/json-ui-documentation#focus)
[音效](/json-ui/json-ui-documentation#sound)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| dropdown | 下拉菜单开关 | [下拉菜单](/json-ui/json-ui-documentation#dropdown)
[开关](/json-ui/json-ui-documentation#toggle)
[输入](/json-ui/json-ui-documentation#input)
[焦点](/json-ui/json-ui-documentation#focus)
[音效](/json-ui/json-ui-documentation#sound)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| slider | 范围输入元素 | [滑块](/json-ui/json-ui-documentation#slider)
[输入](/json-ui/json-ui-documentation#input)
[焦点](/json-ui/json-ui-documentation#focus)
[音效](/json-ui/json-ui-documentation#sound)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| slider_box | 用于调整滑块值的拖动按钮 | [滑块按钮](/json-ui/json-ui-documentation#slider-box)
[输入](/json-ui/json-ui-documentation#input)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| edit_box | 文本输入框(默认单行) | [文本编辑](/json-ui/json-ui-documentation#text-edit)
[按钮](/json-ui/json-ui-documentation#button)
[输入](/json-ui/json-ui-documentation#input)
[焦点](/json-ui/json-ui-documentation#focus)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| scroll_view | 创建可滚动面板 | [滚动视图](/json-ui/json-ui-documentation#scroll-view)
[输入](/json-ui/json-ui-documentation#input)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| scrollbar_track | 滚动条轨道 | [输入](/json-ui/json-ui-documentation#input)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout) | -| scrollbar_box | 滚动条"滑块"(可拖动的滚动手柄,默认垂直方向) | [输入](/json-ui/json-ui-documentation#input)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout) | -| factory | 元素生成器 | [控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout) | -| screen | 屏幕元素 | [屏幕](/json-ui/json-ui-documentation#screen)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| custom | 需通过代码创建的复杂渲染元素 | [自定义渲染](/json-ui/json-ui-documentation#custom-render)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| selection_wheel | 选择轮盘 | [选择轮盘](/json-ui/json-ui-documentation#selection-wheel)
[输入](/json-ui/json-ui-documentation#input)
[焦点](/json-ui/json-ui-documentation#focus)
[音效](/json-ui/json-ui-documentation#sound)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | +| panel | 容器元素,类似HTML中的`
` | [控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| stack_panel | 类似`panel`,但会根据`orientation`属性值自动堆叠子元素 | [堆叠面板](/wiki/json-ui/json-ui-documentation#stack-panel)
[集合](/wiki/json-ui/json-ui-documentation#collection)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| collection_panel | 类似`stack_panel`,但没有`orientation`属性 | [集合](/wiki/json-ui/json-ui-documentation#collection)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| grid | 网格布局元素 | [网格](/wiki/json-ui/json-ui-documentation#grid)
[集合](/wiki/json-ui/json-ui-documentation#collection)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| label | 文本元素 | [文本](/wiki/json-ui/json-ui-documentation#text)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| image | 图像元素,用于绘制纹理 | [精灵](/wiki/json-ui/json-ui-documentation#sprite)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| input_panel | 可接收输入的面板 | [输入](/wiki/json-ui/json-ui-documentation#input)
[焦点](/wiki/json-ui/json-ui-documentation#focus)
[音效](/wiki/json-ui/json-ui-documentation#sound)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| button | 按钮元素,支持四种状态(默认、悬停、按下、锁定) | [按钮](/wiki/json-ui/json-ui-documentation#button)
[输入](/wiki/json-ui/json-ui-documentation#input)
[焦点](/wiki/json-ui/json-ui-documentation#focus)
[音效](/wiki/json-ui/json-ui-documentation#sound)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| toggle | 开关元素,包含两种状态(选中/未选中),每种状态有悬停和锁定变体 | [开关](/wiki/json-ui/json-ui-documentation#toggle)
[输入](/wiki/json-ui/json-ui-documentation#input)
[焦点](/wiki/json-ui/json-ui-documentation#focus)
[音效](/wiki/json-ui/json-ui-documentation#sound)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| dropdown | 下拉菜单开关 | [下拉菜单](/wiki/json-ui/json-ui-documentation#dropdown)
[开关](/wiki/json-ui/json-ui-documentation#toggle)
[输入](/wiki/json-ui/json-ui-documentation#input)
[焦点](/wiki/json-ui/json-ui-documentation#focus)
[音效](/wiki/json-ui/json-ui-documentation#sound)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| slider | 范围输入元素 | [滑块](/wiki/json-ui/json-ui-documentation#slider)
[输入](/wiki/json-ui/json-ui-documentation#input)
[焦点](/wiki/json-ui/json-ui-documentation#focus)
[音效](/wiki/json-ui/json-ui-documentation#sound)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| slider_box | 用于调整滑块值的拖动按钮 | [滑块按钮](/wiki/json-ui/json-ui-documentation#slider-box)
[输入](/wiki/json-ui/json-ui-documentation#input)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| edit_box | 文本输入框(默认单行) | [文本编辑](/wiki/json-ui/json-ui-documentation#text-edit)
[按钮](/wiki/json-ui/json-ui-documentation#button)
[输入](/wiki/json-ui/json-ui-documentation#input)
[焦点](/wiki/json-ui/json-ui-documentation#focus)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| scroll_view | 创建可滚动面板 | [滚动视图](/wiki/json-ui/json-ui-documentation#scroll-view)
[输入](/wiki/json-ui/json-ui-documentation#input)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| scrollbar_track | 滚动条轨道 | [输入](/wiki/json-ui/json-ui-documentation#input)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout) | +| scrollbar_box | 滚动条"滑块"(可拖动的滚动手柄,默认垂直方向) | [输入](/wiki/json-ui/json-ui-documentation#input)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout) | +| factory | 元素生成器 | [控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout) | +| screen | 屏幕元素 | [屏幕](/wiki/json-ui/json-ui-documentation#screen)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| custom | 需通过代码创建的复杂渲染元素 | [自定义渲染](/wiki/json-ui/json-ui-documentation#custom-render)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| selection_wheel | 选择轮盘 | [选择轮盘](/wiki/json-ui/json-ui-documentation#selection-wheel)
[输入](/wiki/json-ui/json-ui-documentation#input)
[焦点](/wiki/json-ui/json-ui-documentation#focus)
[音效](/wiki/json-ui/json-ui-documentation#sound)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | #### 遗留元素类型(已失效) | 名称 | 描述 | 允许的属性 | | ---------------- | ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| tab | 在引入toggle之前创建标签页的方式 | [标签页(旧版)](/json-ui/json-ui-documentation#tab-legacy)
[按钮](/json-ui/json-ui-documentation#button)
[输入](/json-ui/json-ui-documentation#input)
[焦点](/json-ui/json-ui-documentation#focus)
[音效](/json-ui/json-ui-documentation#sound)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| carousel_label | 轮播文本元素 | [轮播文本(旧版)](/json-ui/json-ui-documentation#carousel-text-legacy)
[文本](/json-ui/json-ui-documentation#text)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| grid_item | 专门作为网格子元素的容器 | [控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | -| scrollbar | 旧版滚动条 | [输入](/json-ui/json-ui-documentation#input)
[焦点](/json-ui/json-ui-documentation#focus)
[控件](/json-ui/json-ui-documentation#control)
[布局](/json-ui/json-ui-documentation#layout)
[数据绑定](/json-ui/json-ui-documentation#data-binding) | +| tab | 在引入toggle之前创建标签页的方式 | [标签页(旧版)](/wiki/json-ui/json-ui-documentation#tab-legacy)
[按钮](/wiki/json-ui/json-ui-documentation#button)
[输入](/wiki/json-ui/json-ui-documentation#input)
[焦点](/wiki/json-ui/json-ui-documentation#focus)
[音效](/wiki/json-ui/json-ui-documentation#sound)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| carousel_label | 轮播文本元素 | [轮播文本(旧版)](/wiki/json-ui/json-ui-documentation#carousel-text-legacy)
[文本](/wiki/json-ui/json-ui-documentation#text)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| grid_item | 专门作为网格子元素的容器 | [控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | +| scrollbar | 旧版滚动条 | [输入](/wiki/json-ui/json-ui-documentation#input)
[焦点](/wiki/json-ui/json-ui-documentation#focus)
[控件](/wiki/json-ui/json-ui-documentation#control)
[布局](/wiki/json-ui/json-ui-documentation#layout)
[数据绑定](/wiki/json-ui/json-ui-documentation#data-binding) | ::: code-group ```json [示例] @@ -89,7 +89,7 @@ mentions: | clip_offset | 向量 [x, y] | `[0, 0]` | 裁剪起始偏移量 | | clip_state_change_event | 字符串 | | | | enable_scissor_test | 布尔值 | | [Scissor Test功能说明](https://www.khronos.org/opengl/wiki/Scissor_Test) | -| property_bag | 对象 | | [属性包](/json-ui/json-ui-documentation#property-bag),存放与UI元素数据结构相关的属性 | +| property_bag | 对象 | | [属性包](/wiki/json-ui/json-ui-documentation#property-bag),存放与UI元素数据结构相关的属性 | | selected | 布尔值 | | 文本框是否默认被选中 | | use_child_anchors | 布尔值 | `false` | 是否使用子元素的锚点设置 | | controls | 数组 | | 子元素列表 | @@ -131,7 +131,7 @@ mentions: | 属性名称 | 类型 | 默认值 | 描述 | | -------- | :---------------------------------------------------------------: | :----: | ----------------------- | -| bindings | [绑定对象数组](/json-ui/json-ui-documentation#data-binding-array-object) | | 将硬编码值绑定到元素属性 | +| bindings | [绑定对象数组](/wiki/json-ui/json-ui-documentation#data-binding-array-object) | | 将硬编码值绑定到元素属性 | #### 数据绑定对象 @@ -252,7 +252,7 @@ mentions: | 属性名称 | 类型 | 默认值 | 描述 | | ----------------------------- | :-------------------------------------------------------------------: | :----: | ---- | -| button_mappings | [映射对象数组](/json-ui/json-ui-documentation#button-mapping-array-object) | | | +| button_mappings | [映射对象数组](/wiki/json-ui/json-ui-documentation#button-mapping-array-object) | | | | modal | 布尔值 | | | | inline_modal | 布尔值 | | | | always_listen_to_input | 布尔值 | | | @@ -300,10 +300,10 @@ mentions: | focus_navigation_mode_right | 枚举 | | 可能值:
`none`
`stop`
`custom`
`contained` | | focus_navigation_mode_down | 枚举 | | 可能值:
`none`
`stop`
`custom`
`contained` | | focus_navigation_mode_up | 枚举 | | 可能值:
`none`
`stop`
`custom`
`contained` | -| focus_container_custom_left | [焦点容器对象数组](/json-ui/json-ui-documentation#focus-container-custom-array-object) | | | -| focus_container_custom_right | [焦点容器对象数组](/json-ui/json-ui-documentation#focus-container-custom-array-object) | | | -| focus_container_custom_down | [焦点容器对象数组](/json-ui/json-ui-documentation#focus-container-custom-array-object) | | | -| focus_container_custom_up | [焦点容器对象数组](/json-ui/json-ui-documentation#focus-container-custom-array-object) | | | +| focus_container_custom_left | [焦点容器对象数组](/wiki/json-ui/json-ui-documentation#focus-container-custom-array-object) | | | +| focus_container_custom_right | [焦点容器对象数组](/wiki/json-ui/json-ui-documentation#focus-container-custom-array-object) | | | +| focus_container_custom_down | [焦点容器对象数组](/wiki/json-ui/json-ui-documentation#focus-container-custom-array-object) | | | +| focus_container_custom_up | [焦点容器对象数组](/wiki/json-ui/json-ui-documentation#focus-container-custom-array-object) | | | #### 焦点容器对象 Focus Container Custom Array Object @@ -398,7 +398,7 @@ $creative_layout_index - $items_index | sound_name | 字符串 | 触发时播放的音效定义(位于`sound_definitions.json`) | | sound_volume | 浮点数 | 音效音量 | | sound_pitch | 浮点数 | 音效音调 | -| sounds | [音效对象数组](/json-ui/json-ui-documentation#sound-array-object) | 触发时播放的音效列表 | +| sounds | [音效对象数组](/wiki/json-ui/json-ui-documentation#sound-array-object) | 触发时播放的音效列表 | #### 音效对象 @@ -858,7 +858,7 @@ $creative_layout_index - $items_index | scale_from_starting_alpha | boolean | | | activated | boolean | | -更多关于 `aseprite_flip_book` 动画类型的属性说明, 请前往 [Aseprite Animations](/json-ui/aseprite-animations) 查阅详细文档。 +更多关于 `aseprite_flip_book` 动画类型的属性说明, 请前往 [Aseprite Animations](/wiki/json-ui/aseprite-animations) 查阅详细文档。 ## 全局变量 Global Variables diff --git a/docs/wiki/4-Json-UI/1-基础/json-ui-intro.md b/docs/wiki/json-ui/json-ui-intro.md similarity index 99% rename from docs/wiki/4-Json-UI/1-基础/json-ui-intro.md rename to docs/wiki/json-ui/json-ui-intro.md index fccccfef..7541816e 100644 --- a/docs/wiki/4-Json-UI/1-基础/json-ui-intro.md +++ b/docs/wiki/json-ui/json-ui-intro.md @@ -1,6 +1,6 @@ --- title: JSON UI 入门指南 -category: 通用 +category: 基础 nav_order: 1 tags: - guide @@ -32,7 +32,7 @@ JSON UI 已进入弃用阶段,推荐使用 [Ore UI](https://github.com/Mojang/ ::: :::tip -本文概述了 JSON UI 的基础知识。如需更详细的文档,请查阅 [JSON UI 文档](/json-ui/json-ui-documentation)。 +本文概述了 JSON UI 的基础知识。如需更详细的文档,请查阅 [JSON UI 文档](/wiki/json-ui/json-ui-documentation)。 ::: 游戏用户界面采用数据驱动模式,支持自定义修改。通过 JSON UI 系统,我们可以调整用户界面的渲染方式及部分交互行为。所有原版 UI 文件均存储在 `RP/ui/...` 文件夹中。 diff --git a/docs/wiki/4-Json-UI/2-巧思案例/preserve-title-texts.md b/docs/wiki/json-ui/preserve-title-texts.md similarity index 99% rename from docs/wiki/4-Json-UI/2-巧思案例/preserve-title-texts.md rename to docs/wiki/json-ui/preserve-title-texts.md index 67cb5f11..244a1619 100644 --- a/docs/wiki/4-Json-UI/2-巧思案例/preserve-title-texts.md +++ b/docs/wiki/json-ui/preserve-title-texts.md @@ -1,6 +1,6 @@ --- title: Title传递HUD元素更新 -category: 教程分类 +category: 巧思案例 tags: - 中级 mentions: diff --git a/docs/wiki/4-Json-UI/2-巧思案例/string-to-number.md b/docs/wiki/json-ui/string-to-number.md similarity index 99% rename from docs/wiki/4-Json-UI/2-巧思案例/string-to-number.md rename to docs/wiki/json-ui/string-to-number.md index 5abed0c3..cd15d2bb 100644 --- a/docs/wiki/4-Json-UI/2-巧思案例/string-to-number.md +++ b/docs/wiki/json-ui/string-to-number.md @@ -1,6 +1,6 @@ --- title: 字符串转数值 -category: 教程 +category: 巧思案例 tags: - 中级 mentions: diff --git a/docs/wiki/loot/index.md b/docs/wiki/loot/index.md index c56fd342..8a06da0d 100644 --- a/docs/wiki/loot/index.md +++ b/docs/wiki/loot/index.md @@ -1,10 +1,10 @@ --- -title: Loot, Recipes, and Trading +title: 战利品、配方、交易 categories: -- title: General +- title: 基础 color: blue -- title: Documentation +- title: 文档 color: red -- title: Tutorials +- title: 巧思案例 color: green --- \ No newline at end of file diff --git a/docs/wiki/loot/item-functions.md b/docs/wiki/loot/item-functions.md index 3f83989a..c7597f81 100644 --- a/docs/wiki/loot/item-functions.md +++ b/docs/wiki/loot/item-functions.md @@ -12,7 +12,7 @@ mentions: toc_max_level: 1 --- -Item functions modify the nature of an item in [loot tables](/loot/loot-tables) and [trade tables](/loot/trade-tables). +Item functions modify the nature of an item in [loot tables](/wiki/loot/loot-tables) and [trade tables](/wiki/loot/trade-tables). TODO can enchantments be prefixed with minecraft:/whatever? @@ -50,7 +50,7 @@ A handful of functions are available for basic item properties. These functions | Trade table | ❌ | ::: tip NOTE -Trade tables use the [`"quantity"` property](/loot/trade-tables#quantity) to set their count. +Trade tables use the [`"quantity"` property](/wiki/loot/trade-tables#quantity) to set their count. ::: The `set_count` function sets the count for that item entry. diff --git a/docs/wiki/loot/loot-tables.md b/docs/wiki/loot/loot-tables.md index 384326dc..48df1568 100644 --- a/docs/wiki/loot/loot-tables.md +++ b/docs/wiki/loot/loot-tables.md @@ -1,34 +1,38 @@ --- -title: Loot Tables -category: Documentation +title: 战利品表 +category: 文档 nav_order: 1 tags: - - Stable - - Last updated for Version 1.18.10 + - 稳定 + - 最后更新于版本1.18.10 mentions: - Ciosciaa - Etanarvazac - SmokeyStack --- +# 战利品表 + + + ::: warning -This document is a work in progress. +本文档仍在完善中。 ::: -Loot tables are used to select a set of items from a declared collection. Loot tables can be used from: +战利品表用于从预定义集合中选择一组物品。战利品表可通过以下方式调用: -- The `/loot` command -- Container contents -- Block drops -- Fishing -- Mob drops -- Equipment on spawned mobs -- Other various mob actions +- `/loot` 命令 +- 容器内容物 +- 方块掉落 +- 钓鱼 +- 生物掉落 +- 生成生物的装备 +- 其他各类生物行为 -A different collection of items may be chosen each instance the same loot table would be used, based on [external conditions](#), and [innate randomness](#). Such variation is crucial for playability and adventuring, especially in more RPG-driven systems. +每次调用同一战利品表时,基于[外部条件](#)和[内在随机性](#)可能会选择不同的物品组合。这种变化性对于游戏可玩性和冒险体验至关重要,特别是在RPG元素更重的系统中。 -## Integration -Loot tables are not registered add-on entries and are instead referenced by path from the above sources. Loot tables may be placed anywhere within a behavior pack, but it's recommended to place them under the top-level `loot_tables` directory, following vanilla convention. +## 集成方式 +战利品表并非注册的附加包条目,而是通过路径引用。虽然可以放置在行为包任意位置,但建议遵循原版规范将其置于顶级`loot_tables`目录下。 -## Structure -Loot tables are represented as JSON objects with a single required `"pools"` array property. +## 结构 +战利品表由包含必需属性`"pools"`数组的JSON对象表示。 -# - -```json +::: code-group +```json [根结构] { "pools": [ … @@ -51,14 +54,13 @@ Loot tables are represented as JSON objects with a single required `"pools"` arr } ``` -The loot returned from a loot table invocation will be the *collective sum* of the yields of all pools provided here. +战利品表的调用结果将是所有池(pool)产出的总和。 -### Pools -Pools act as isolated constructs for selecting items; the results of pools cannot be influenced by other pools. +### 池(Pools) +池是独立的物品选择单元,不同池之间的结果互不影响。 -# - -```json +::: code-group +```json [基础池示例] { "rolls": 1, @@ -71,14 +73,13 @@ Pools act as isolated constructs for selecting items; the results of pools canno } ``` -Two types of pools are available: general-purpose [weighted random pools](#weighted-random-pools) and [tiered pools](#tiered-pools), the latter of which is traditionally used for selecting mob equipment. +存在两种池类型:通用型[加权随机池](#加权随机池)和[分层池](#分层池),后者传统上用于生物装备选择。 -#### Weighted Random Pools -A traditional weighted random pool selects items based on relative weight, choosing a number of yields based on a configured roll count. +#### 加权随机池 +传统加权随机池根据相对权重选择物品,通过配置的roll次数决定产出数量。 -artifacts.json/pools/0 - -```json +::: code-group +```json [artifacts.json/pools/0] { "rolls": { "min": 2, @@ -105,38 +106,36 @@ A traditional weighted random pool selects items based on relative weight, choos } ``` -##### Rolls +##### 抽取次数(Rolls) - -###### Bonus Rolls -The roll count for a weighted random pool may be altered based on the player's luck using the optional `"bonus_rolls"` property. +###### 附加抽取(Bonus Rolls) +可通过可选属性`"bonus_rolls"`基于玩家幸运值调整抽取次数。 ```json - +// 示例待补充 ``` -##### Entry Weighting -The weight is the chance of this entry being chosen. The higher the weight in comparison to other entries in this "entries" array, the higher the chance of the entry being chosen. +##### 条目权重 +权重值决定条目被选中的概率。权重相对于其他条目越高,选中几率越大。 ```json "weight": 3 ``` - - -###### Quality -The weight of an entry can be changed based on the player's luck using the quality property. +###### 质量(Quality) +通过quality属性可根据玩家幸运值调整条目权重。 ```json "quality": 2 ``` -Currently, luck is only expressed when fishing with a fishing rod enchanted with Luck of the Sea. +当前仅在使用附有"海之眷顾"附魔的钓鱼竿时生效。 -#### Tiered Pools -Tiered pools are used to select exactly one entry from a collection. +#### 分层池 +分层池用于从集合中精确选择一个条目。 -```json +::: code-group +```json [分层池示例] { "tiers": { "initial_range": 2, @@ -170,7 +169,7 @@ Tiered pools are used to select exactly one entry from a collection. } ``` -A pool becomes tiered with the inclusion of the `"tiers"` object property: +当包含`"tiers"`对象属性时即构成分层池: ```json "tiers": { @@ -181,55 +180,60 @@ A pool becomes tiered with the inclusion of the `"tiers"` object property: } ``` -Entries in a tiered pool are *ordered*. The selected entry for a tiered pool is based on its index. To determine this index, a starting index is randomly rolled and then a batch of success rolls attempt to increment this starting index. +分层池中的条目具有顺序性。选择过程分为两个阶段: -The starting index is decided by rolling a random integer between 1 and the integer property `"initial_range"`. If no initial range is provided, it defaults to `1`, forcing a starting index of 1. +1. 初始索引:在1到`"initial_range"`间随机选取整数 +2. 附加尝试:进行`"bonus_rolls"`次成功率`"bonus_chance"`的检定,每次成功索引+1 -Next, attempts are made to advanced the index using additional rolls. The count of these roll attempts is given as an integer to `"bonus_rolls"`. The chance that any such roll succeeds is given via `"bonus_chance"`. Chances for `"bonus_chance"` are out of 1, meaning `0.5` would be a 50% chance for any bonus roll to succeed. Each successful roll increases the index by 1. Both of these properties default to `0`, meaning both must be provided to use this additional rolls mechanic. - -The final determined index is used to select the corresponding entry as that pool's yield. Indices in tiered pools are one-indexed, meaning the first entry has an index of 1, the second has an index of 2, and so forth. If the determined index is larger than the entry count for that pool, no yield will be provided. +最终索引对应条目将被选中(索引从1开始)。若索引超出条目总数则不产出。 ::: warning -All [conditions](#) on entries in a tiered pool are ignored. Conditions on the pool itself are still allowed. +分层池中条目的[条件](#)将被忽略,但池级别的条件仍然有效。 ::: -### Entries -Entries are the selectable units of a pool. Three different types of entries are available. +### 条目(Entries) +条目是池中的可选项,包含三种类型。 ```json - +// 示例待补充 ``` -#### Item Entries -Item entries are the fundamental entry type for selecting loot. Item entries refer to +#### 物品条目 +基础条目类型,用于选择具体物品。 ```json - +// 示例待补充 ``` -#### Loot Table Entries -Loot hierarchies can be formed using loot table entries. +#### 战利品表条目 +支持嵌套调用其他战利品表。 ```json - +// 示例待补充 ``` -#### Empty Entries -When selected, empty entries won't yield any loot for that roll. +#### 空条目 +选中时不产生任何物品。 ```json "type": "empty", "weight": 4 ``` -Empty entries can generally be mimicked using [a roll count](#) whose range includes 0, [random chance conditions](#), or [count functions](#) that could randomly select 0. Their primary advantage is readability when using [weighted random pools](#): denoting by weight when a roll won't yield an entry may be easier to understand. +空条目的作用可通过[0次抽取](#)、[随机条件](#)或[数量函数](#)实现,主要优势在于提升[加权随机池](#)的可读性。 -### Functions -Functions are what makes loot tables so powerful. They can do a wide range of tasks for each entry in your loot table. For example, they can change the amount of an item is dropped, what enchantments are present (even on items that normally cannot be enchanted), the item name, it's lore, and it can even write books! View [item functions](/loot/item-functions) for a full list of functions and how they're used. +### 函数(Functions) +函数赋予战利品表强大功能,可实现: -artifacts.json/pools/entries +- 调整物品数量 +- 添加附魔(包括不可附魔物品) +- 修改物品名称和描述 +- 编写书籍内容 -```json +详见[物品函数文档](/wiki/loot/item-functions)。 + +::: code-group +```json [artifacts.json/pools/entries] { "type": "item", "name": "minecraft:dirt", @@ -250,12 +254,14 @@ Functions are what makes loot tables so powerful. They can do a wide range of ta } ``` -### Conditions -Conditions check to see if a certain criteria is met. Examples: "Was Zombie killed by Player", "Did the sword have the Looting enchantment on it? If so, what level?" +### 条件(Conditions) +条件用于检测特定标准是否满足,例如: -artifacts.json/pools/entries +- 僵尸是否被玩家击杀 +- 武器是否附有抢夺附魔及其等级 -```json +::: code-group +```json [artifacts.json/pools/entries] { "conditions": [ { @@ -288,5 +294,4 @@ Conditions check to see if a certain criteria is met. Examples: "Was Zombie kill } ``` -## Overrides - +## 覆盖规则 \ No newline at end of file diff --git a/docs/wiki/loot/randomized-structure-loot.md b/docs/wiki/loot/randomized-structure-loot.md index 5140a315..34c3c1be 100644 --- a/docs/wiki/loot/randomized-structure-loot.md +++ b/docs/wiki/loot/randomized-structure-loot.md @@ -1,6 +1,6 @@ --- -title: Randomized Structure Loot -category: Tutorials +title: 随机化结构战利品 +category: 巧思案例 mentions: - MedicalJewel105 - SirLich @@ -8,21 +8,24 @@ mentions: - Ciosciaa - rebrainertv tags: - - easy + - 简单 --- -Adding loot tables to containers in structure is easy, you need to have a PC and your choice of either [NBT Studio](https://github.com/tryashtar/nbt-studio/releases/download/v1.14.1/NbtStudio.exe) (executable) or [Loot Tabler](https://mcbe-essentials.github.io/structure-editor/loot-tabler) (browser application). +# 随机化结构战利品 -## Setup -### Creating the Loot Table + -To start, create the directory `BP/loot_tables/chests` and create your loot table file here. +为结构中的容器添加战利品表非常简单,您需要准备一台电脑,并选择使用[NBT Studio](https://github.com/tryashtar/nbt-studio/releases/download/v1.14.1/NbtStudio.exe)(可执行程序)或[Loot Tabler](https://mcbe-essentials.github.io/structure-editor/loot-tabler)(浏览器应用)。 -You can learn how to make loot tables in [Beginners Guide](/guide/loot-table) +## 准备工作 +### 创建战利品表 -BP/loot_tables/chests/my_structure_loot.json +首先创建目录`BP/loot_tables/chests`,并在此处创建战利品表文件。 -```json +您可以通过[新手指南](/wiki/guide/loot-table)学习如何制作战利品表。 + +::: code-group +```json [BP/loot_tables/chests/my_structure_loot.json] { "pools": [ { @@ -64,62 +67,63 @@ You can learn how to make loot tables in [Beginners Guide](/guide/loot-table) ] } ``` +::: -### Exporting Structure +### 导出结构 -Once you have created your loot table, export your structure into `BP/structures`. Then follow the steps for either NBT Studio or Loot Tabler +创建好战利品表后,将结构导出到`BP/structures`目录。然后根据您选择的工具(NBT Studio或Loot Tabler)继续操作。 ![](/assets/images/tutorials/randomised-structure-loot/export_structure.png) -## NBT Studio (Executable) -### Software Preparation +## NBT Studio(可执行程序) +### 软件准备 -Download and launch [NBT Studio](https://github.com/tryashtar/nbt-studio/releases/download/v1.14.1/NbtStudio.exe) +下载并启动[NBT Studio](https://github.com/tryashtar/nbt-studio/releases/download/v1.14.1/NbtStudio.exe) -### Adding the Loot Table +### 添加战利品表 -Launch NBT Studio and open file `(Ctrl + O)` +打开NBT Studio并通过快捷键`Ctrl + O`打开文件 ![](/assets/images/tutorials/randomised-structure-loot/open_file.png) -Find your container (Ctrl + F) +使用`Ctrl + F`搜索容器 ![](/assets/images/tutorials/randomised-structure-loot/find_container.png) -Navigate to your container, `block_position_data` > `block_entity_data`. Add a string tag +定位到容器所在位置:`block_position_data` > `block_entity_data`。添加字符串标签 ![](/assets/images/tutorials/randomised-structure-loot/add_string_tag1.png) -Add `LootTable` and the file path to your loot table +设置标签名为`LootTable`,并输入战利品表文件路径 ![](/assets/images/tutorials/randomised-structure-loot/add_string_tag2.png) -Save changes (Ctrl + S) +按`Ctrl + S`保存修改 -## Loot Tabler (Browser Application) +## Loot Tabler(浏览器应用) :::tip -To export a structure on mobile devices, [Download this pack.](https://mcpedl.com/export-structure-button-android-addon/) +如需在移动设备导出结构,请[下载此资源包](https://mcpedl.com/export-structure-button-android-addon/) ::: -### Adding the Loot Table +### 添加战利品表 -Open the website and click "Upload". Choose your structure file. +访问网站并点击"Upload"按钮上传结构文件 ![](/assets/images/tutorials/randomised-structure-loot/LootTable-step1.png) -Find your container in the containers list, making use of the information displayed under "Container Options" +在容器列表中通过"Container Options"下方的信息定位目标容器 ![](/assets/images/tutorials/randomised-structure-loot/LootTable-step2.png) -Under "Loot Table", enter the path to your loot table. Set "Loot Table Seed" to blank or `0` if you want the loot to generate randomly. If you want the loot table to generate consistently, enter a specific value. +在"Loot Table"字段输入战利品表路径。"Loot Table Seed"留空或设为`0`可实现随机生成。如需固定战利品生成,请设置特定数值 ![](/assets/images/tutorials/randomised-structure-loot/LootTable-step3.png) -Download your structure file and place it in `BP/structures`. +下载修改后的结构文件并放入`BP/structures`目录 -## Testing +## 测试验证 -Load your structure and open the container +加载结构并打开容器查看效果 -![](/assets/images/tutorials/randomised-structure-loot/test.png) +![](/assets/images/tutorials/randomised-structure-loot/test.png) \ No newline at end of file diff --git a/docs/wiki/loot/recipes.md b/docs/wiki/loot/recipes.md index 03307aca..3985cd12 100644 --- a/docs/wiki/loot/recipes.md +++ b/docs/wiki/loot/recipes.md @@ -19,7 +19,7 @@ Recipes are the means of handling several item transactions, namely those occurr ![](/assets/images/loot/recipes/recipe.png) ::: tip -Anvil interactions are handled within an [item definition](/items/item-components), not via recipe files. Loom transactions are currently unavailable. +Anvil interactions are handled within an [item definition](/wiki/items/item-components), not via recipe files. Loom transactions are currently unavailable. ::: No experimental toggles are required to use recipes or any of their features. @@ -82,7 +82,7 @@ As an example, a "cold steel sword" might be crafted using the following [shaped ### Format Version -The [format version](/guide/format-version) is intended to version the schema used for the body of a recipe. It is provided with the top-level `"format_version"` property. +The [format version](/wiki/guide/format-version) is intended to version the schema used for the body of a recipe. It is provided with the top-level `"format_version"` property. #/ ```json @@ -150,7 +150,7 @@ Education: - `material_reducer` ::: tip -Additionally, [custom crafting tables](/blocks/block-components#crafting-table) can declare a custom tag for crafting recipes to use. Custom cooking and smelting blocks and custom brewing stands are not currently available. +Additionally, [custom crafting tables](/wiki/blocks/block-components#crafting-table) can declare a custom tag for crafting recipes to use. Custom cooking and smelting blocks and custom brewing stands are not currently available. ::: ::: tip @@ -225,7 +225,7 @@ If a count greater than `1` is provided for an item that does not stack, an erro ::: ::: warning -Despite having similarities to trade [table item descriptors](/loot/trade-tables#items), recipe item descriptors cannot use functions. +Despite having similarities to trade [table item descriptors](/wiki/loot/trade-tables#items), recipe item descriptors cannot use functions. ::: #### Identifier Additions @@ -272,7 +272,7 @@ Crafting recipes support both crafting tables and stonecutters: "tags": ["crafting_table", "stonecutter"] ``` -`"crafting_table"` applies to both vanilla crafting tables and the player 2 × 2 crafting grid in their inventory. There is currently no way to opt into one but not the other. Crafting recipes additionally support custom tags, linking recipes to a [crafting grid provided by a custom block](/blocks/block-components#crafting-table). +`"crafting_table"` applies to both vanilla crafting tables and the player 2 × 2 crafting grid in their inventory. There is currently no way to opt into one but not the other. Crafting recipes additionally support custom tags, linking recipes to a [crafting grid provided by a custom block](/wiki/blocks/block-components#crafting-table). ### Shapeless Recipes diff --git a/docs/wiki/loot/trade-tables.md b/docs/wiki/loot/trade-tables.md index cfc19b44..6e770c4d 100644 --- a/docs/wiki/loot/trade-tables.md +++ b/docs/wiki/loot/trade-tables.md @@ -676,7 +676,7 @@ In trade tables, if no ID is provided, the trader's entity type will be assigned ## Overrides -Because trade tables do not use in-data identifiers, they are overridden simply by replacing a prior trade table with a new one. You can learn more about [asset overrides here](/concepts/overwriting-assets) +Because trade tables do not use in-data identifiers, they are overridden simply by replacing a prior trade table with a new one. You can learn more about [asset overrides here](/wiki/concepts/overwriting-assets) Below are the currently used vanilla trade tables for each trader: |Trader|Path| diff --git a/docs/wiki/loot/trading-behavior.md b/docs/wiki/loot/trading-behavior.md index e2b83983..889c6b81 100644 --- a/docs/wiki/loot/trading-behavior.md +++ b/docs/wiki/loot/trading-behavior.md @@ -1,32 +1,36 @@ --- -title: Trading Behavior -category: General +title: 交易行为 +category: 基础 nav_order: 2 mentions: - Ciosciaa - MedicalJewel105 --- -Making an entity a trader is accomplished via `minecraft:trade_table` or `minecraft:economy_trade_table` components. Both of them will open a trading UI from the given path, but the economy trades component has some more options referring to some Village and Pillage trading mechanics. Other AI goals you'll need are `minecraft:behavior.trade_with_player`, optionally `minecraft.behavior:trade_interest` (allows the mob to hold/offer an item) and, potentially, `"minecraft:trade_resupply": {}`. +# 交易行为 -For a simple trading UI, `trade_table` + `trade_with_player` components should do the trick. + -1. Add `"minecraft:behavior.trade_with_player": {}` to your entity's components. -2. Copy the following code into a component group of your entity. I'll call mine `"wiki:trader"`; +通过 `minecraft:trade_table` 或 `minecraft:economy_trade_table` 组件可以将实体设置为交易者。这两个组件都会根据指定路径打开交易界面,但经济交易组件包含更多与村庄与掠夺版本交易机制相关的配置选项。其他需要添加的AI目标包括 `minecraft:behavior.trade_with_player`,可选添加 `minecraft.behavior:trade_interest`(允许生物手持/展示交易物品),以及可能需要添加 `"minecraft:trade_resupply": {}`。 -BP/entities/trader.json +对于基础交易界面,使用 `trade_table` + `trade_with_player` 组件即可实现。 -```json +1. 在实体组件中添加 `"minecraft:behavior.trade_with_player": {}` +2. 将以下代码复制到实体的组件组中(示例组件组命名为 `"wiki:trader"`): + +::: code-group +```json [BP/entities/trader.json] "minecraft:trade_table": { - "display_name": "Trading Entity", // Text to be displayed. - "table": "trading/trading_entity_trades.json", // Path to the trade table file - "new_screen": true //If set to false, the UI will display as the pre-Village&Pillage one. + "display_name": "交易实体", // 显示的名称文本 + "table": "trading/trading_entity_trades.json", // 交易表文件路径 + "new_screen": true //设置为 false 时,界面会显示为村庄与掠夺版本之前的样式 } ``` +::: -3. Now make sure the component group is added to the entity via an event. It's a good idea to add it in `minecraft:entity_spawned` event, since it triggers on spawn. -If you don't feel confident with events and component groups, make sure you're familiar with entity definition rules/concepts. See the [Intro to Entities](/entities/entity-intro-bp). +3. 确保通过事件添加该组件组。建议在 `minecraft:entity_spawned` 生成事件中添加,该事件会在实体生成时触发。 +若对事件和组件组的运作机制不够熟悉,建议先学习[实体入门指南](/wiki/entities/entity-intro-bp)中的相关概念。 :::warning -If you add the component in components, it will cause all kinds of problems, including blank trading UIs for all entities in the world. Because of an issue with the trading AI goals, they must be added in component groups. -::: +若直接在主组件中(components)添加该组件,将会导致各种问题(包括所有实体交易界面显示空白)。由于交易类AI目标的机制问题,必须通过组件组形式添加。 +::: \ No newline at end of file diff --git a/docs/wiki/meta/addon-performance.md b/docs/wiki/meta/addon-performance.md index 29d54cb4..9eca6015 100644 --- a/docs/wiki/meta/addon-performance.md +++ b/docs/wiki/meta/addon-performance.md @@ -1,5 +1,5 @@ --- -title: Addon Performance +title: 附加包性能优化 mentions: - SirLich - Joelant05 @@ -8,211 +8,212 @@ mentions: - SmokeyStack --- +# 附加包性能优化 + + + ::: warning -This page was compiled primarily using community feedback from multiple sources. As a result, some information may be generalized, subjective, or conflicting. Always use your own best judgment when optimizing your addons. This page is not a substitute for testing your addon on a wide range of devices. +本页内容主要基于多方社区反馈整理。因此部分信息可能存在概括性、主观性或矛盾性。优化附加包时请始终自行判断。本页面不能替代在多种设备上实际测试附加包性能。 ::: -Performance in addons is crucial, as the most technically fantastic addon is mainly useless if the majority of the player base cannot experience it. When developing addons, it should always be considered that many Bedrock players will be experiencing your addon on a significantly lower power device than you are developing on. This is especially true for mobile users. Therefore, addons should be developed with performance in mind and tested for performance on lower-end devices when possible. +附加包性能至关重要,因为即使技术上最出色的附加包,如果大多数玩家设备无法流畅运行也将失去意义。开发附加包时需时刻谨记,许多基岩版玩家使用性能远低于开发设备的终端进行游戏,移动端用户尤为明显。因此应从性能角度设计附加包,并尽可能在低端设备上进行测试。 -This guide is a non-exhaustive list of specific performance considerations separated by the various subsystems of Bedrock Edition. No single point should be taken as a hard and fast rule. Instead, these performance considerations should help you to recognize potential areas for improvement. +本指南按基岩版各子系统分类,列出非详尽性能考量事项。各条目不应视为铁律,而应作为识别潜在优化领域的参考。 -## Biomes and Features +## 生物群系与特征生成 -### Biomes +### 生物群系 -- The biome system is generally efficient -- Large values for heightmaps are usually handled gracefully -- The component `climate` creates large particle storms +- 生物群系系统整体效率较高 +- 通常能妥善处理高度图的大数值 +- `climate`组件会产生大量粒子风暴 -### Features +### 特征生成 -- Biomes generally cause less lag than feature generation. -- Hundreds of iterations per chunk of a multi-block feature have been achieved at a low-performance cost. -- Thousands of iterations per chunk of multi-block features negatively impact gameplay. -- Hundreds of thousands of iterations per chunk of a single-block feature have been achieved at a low-performance cost. -- Thousands of instances of features *per chunk* comes at little cost. -- Tens of thousands of feature instances *per chunk* yields a noticeable impact on chunk loading. -- Hundreds of thousands of instances of features *per chunk* slows chunk loading to an unbearable crawl. +- 生物群系生成通常比特征生成更少卡顿 +- 单个区块内执行数百次多方块特征迭代性能损耗较低 +- 单个区块内数千次多方块特征迭代将显著影响游戏体验 +- 单个区块内执行数十万次单方块特征迭代性能损耗较低 +- 单个区块内数千个特征实例性能成本较低 +- 单个区块内数万个特征实例会显著影响区块加载 +- 单个区块内数十万特征实例将导致区块加载极度缓慢 -## Blocks +## 方块 -### Materials +### 材质 -- The minimum needed material type with regards to rendering should always be utilized -> `alpha_blend` performance is worse than `alpha_test`, which is worse than `opaque` +- 应始终使用渲染需求最低的材质类型 +> `alpha_blend`性能差于`alpha_test`,后者又差于`opaque` -### Quantity and Type +### 数量与类型 -- Flowing liquids should be avoided and minimized +- 应尽量避免并减少流动液体 -### Updates +### 更新 -- Block updates should be minimized +- 应尽量减少方块更新 -## Commands +## 命令 -### Quantity and Type +### 数量与类型 -- Minimize the number of commands run per tick -> `/effect` and `/gamemode` run every tick are avoidable and have a significant performance impact -- Large clones, fills and structure loads during runtime should be avoided -> Breaking these more extensive operations into multiple commands distributed over multiple ticks will avoid lag spikes, consider using structure loading animations +- 最小化每tick执行的命令数量 +> 每个tick执行`/effect`和`/gamemode`等命令应避免,这些操作对性能影响显著 +- 应避免在运行时进行大规模clone、fill和结构加载 +> 将大型操作拆分为多tick执行的多个命令可避免卡顿,建议使用结构加载动画 -### Selectors +### 选择器 -- Care should be taken to ensure a function is not executed on too many entities, and therefore too many times -- Executing a scoreboard command outweighs the cost of running an entity selector multiple times -- Using c=1 to ensure the selector stops when it finds one entity may improve performance -- When executing multiple commands with the same selector, use a function instead to avoid repeatedly resolving the same selector +- 需注意避免对过多实体执行函数导致执行次数过多 +- 执行记分板命令的成本高于多次运行实体选择器 +- 使用c=1确保选择器在找到第一个实体后停止可提升性能 +- 使用相同选择器执行多个命令时,应改用函数避免重复解析 -### Tags vs. Scoreboards +### 标签与记分板 -- Scoreboards perform better at a large scale than tags +- 记分板在大规模使用时性能优于标签 -## Entities +## 实体 -- Entities generally have one of the most significant performance impacts by subsystem and thus should be minimized where possible +- 实体通常是各子系统中性能影响最大的要素,应尽可能减少 -### Components +### 组件 -- Pathfinding on flying mobs has a significant performance cost -- Flying mobs in general encounter performance problems -> Faking flying mobs via animation should be considered if possible +- 飞行生物寻路计算性能消耗显著 +- 飞行生物通常存在性能问题 +> 如有可能,建议通过动画模拟飞行生物 -### Dummy Entities +### 虚拟实体 -- Dummy entities generally have equal performance impact to proper entities, except when excluding heavy components like pathfinding +- 虚拟实体与常规实体性能影响相当(不含寻路等重型组件时) -### Geometry +### 几何结构 -#### Bones +#### 骨骼 -- No performance impact has been observed regarding bone count +- 骨骼数量未观测到明显性能影响 -#### Elements +#### 元素 -- Element count is not generally an issue, except in extreme cases when thousands of elements are reached +- 除极端情况(数千元素)外,元素数量通常不成问题 -### Materials +### 材质 -- The minimum material required to achieve the desired effect should always be used -- When in doubt, refer to the material definition files to get an idea of the costs of various materials, taking the material inheritance system into account +- 应始终使用实现预期效果所需的最低材质 +- 不确定时可参考材质定义文件,同时考虑材质继承系统 -### Quantity +### 数量 -- Loaded entities at any given time should be minimized -> Below 30 is optimal +- 应尽量减少任意时刻加载的实体数量 +> 保持30个以下为最佳 -## Lighting +## 光照 -### Map Considerations +### 地图设计 -- Hollow areas will cause lag due to lighting calculations even if you don't see them -> Avoid this by filling in unused enclosed areas -- Keeping the map set to day or night will avoid lighting recalculation +- 空心区域即使不可见仍会导致光照计算卡顿 +> 填充未使用的封闭空间可避免此问题 +- 保持昼夜恒定可避免光照重新计算 -### Sources +### 光源 -- Bedrock lighting is calculated dynamically, meaning different light sources have different performance costs -> Light blocks are the most performant because they lack particles, rendering, and particular state logic +- 基岩版动态计算光照,不同光源性能成本不同 +> 光源方块性能最佳(无粒子、渲染和特殊状态逻辑) -> Torches are a minor performance issue because they emit particles, render, and have particular state logic dependent on what block they connect to +> 火把因产生粒子、渲染和连接状态逻辑存在较小性能问题 -> Custom light blocks with minimal components are a reasonable compromise between performance and aesthetics +> 含最少组件的自定义光源方块是性能与美观的合理折中 -#### Comparison Table +#### 对比表格 -| Light Source | Score | Redstone Updates | Animted Texture | Light Updates | Tick Updates | Particles | Renders | -| ---------------: | :---: | :--------------: | :-------------: | :-----------: | :----------: | :-------: | :-----: | -| Light Blocks | 1 | False | False | True | False | False | False | -| Lanterns | 4 | False | True | True | True | False | True | -| Custom Blocks | 2 | False | False | True | False | False | True | -| Mushrooms | 3 | False | False | True | True | False | True | -| Redstone Lamps | 3 | True | False | True | False | False | True | -| Glowstone | 3 | True | False | True | True | False | True | -| Sea Lanterns | 4 | False | True | True | True | False | True | -| Torches | 4 | False | False | True | True | True | True | -| Redstone Torches | 5 | True | False | True | True | True | True | +| 光源类型 | 评分 | 红石更新 | 动画纹理 | 光照更新 | Tick更新 | 粒子效果 | 渲染 | +| ---------------: | :--: | :------: | :------: | :------: | :------: | :------: | :--: | +| 光源方块 | 1 | 否 | 否 | 是 | 否 | 否 | 否 | +| 灯笼 | 4 | 否 | 是 | 是 | 是 | 否 | 是 | +| 自定义方块 | 2 | 否 | 否 | 是 | 否 | 否 | 是 | +| 蘑菇 | 3 | 否 | 否 | 是 | 是 | 否 | 是 | +| 红石灯 | 3 | 是 | 否 | 是 | 否 | 否 | 是 | +| 荧石 | 3 | 是 | 否 | 是 | 是 | 否 | 是 | +| 海晶灯笼 | 4 | 否 | 是 | 是 | 是 | 否 | 是 | +| 火把 | 4 | 否 | 否 | 是 | 是 | 是 | 是 | +| 红石火把 | 5 | 是 | 否 | 是 | 是 | 是 | 是 | ## Molang -### Recursion +### 递归 -- Minimize use of recursion when possible -- Intense nested loop structures will cause performance issues -- Use break to escape loops when possible +- 尽量减少递归使用 +- 深度嵌套循环结构会导致性能问题 +- 适时使用break跳出循环 -### Structs +### 结构体 -- Avoid making structs too deep, as there is a performance cost with each layer +- 避免结构体过深,每层嵌套均有性能损耗 -### Variables +### 变量 -- Use temp variables when possible to minimize variables loaded in memory -- Consider how often variables are calculated based on script type +- 尽量使用临时变量减少内存占用 +- 根据脚本类型考虑变量计算频率 -## Textures +## 纹理 ### texture_list.json -- Tons of textures badly affect game performance. Create a [`texture_list.json`](/concepts/textures-list) file. +- 过多纹理严重影响性能,请创建[`texture_list.json`](/wiki/concepts/textures-list)文件 -### Quantity +### 数量 -- No more than 3000 textures should be used -> This is due to limits imposed by Render Dragon +- 建议不超过3000个纹理 +> Render Dragon引擎限制为4096个纹理,1.16版本原版已有800个 -> Render Dragon has a 4096 texture quantity limit, and there are 800 vanilla textures as of 1.16 +### 分辨率 -### Resolution +- 最大支持16384x16384 +- 推荐最大4096x4096以保证低端设备兼容性 +- 注意纹理图集化处理,大尺寸纹理可能影响低端设备图集生成 +- 根据可视距离需求确定必要纹理尺寸 -- The maximum texture resolution is 16384x16384 -- The recommended maximum texture resolution is 4096x4096 to maintain compatibility with low-end devices -- Keep in mind that textures are atlased, and larger textures can mess with atlas generation on lower-end devices -- Only make textures as significant as needed to convey the detail needed at the needed distance +## 交易系统 -## Trades +村民交易在达到60项以上时会导致性能问题甚至全设备崩溃。建议拆分交易至多个村民或自定义实体/NPC,测试表明30项交易是安全阈值。 +*可能与JSON界面系统有关* -Villager trades cause performance issues and even crashes on all devices at 60 trades or greater. Avoid tons of trades for one entity. -Your best bet to resolve this issue is to split your trades in half and move them to another villager or custom entity/npc, 30 trades is a good safe number from testing. -*probably JSON UI issues* +## 音效 -## Sounds +### 数量 -### Count +- 已注册音效总数会影响性能 -- Total registered sounds are reported to have an impact on performance +### 压缩 -### Compression +- 音效压缩显著减小包体积 +- 在Switch等老旧/低功耗设备上效果明显 +- 基岩版使用的FMod简单API会将所有音效解压为WAV格式后加载至内存,CPU性能无提升 +> 流式音频不在此列 -- Sound compression is exceptionally beneficial to pack size -- This is especially noticeable on older and low power devices, such as the Switch -- The FMod simple API utilized by Bedrock decompresses all sounds into WAV before loading into RAM, meaning no CPU performance improvement in this respect -> If audio is streamed, this does not occur +### 流式处理 -### Streaming +- 体积超过500KB或时长超过1分钟的音效应采用流式处理 -- As general guidance, sounds over 500kb in size or 1 minute in length should be streamed +## 红石 -## Redstone +### 区块边界 -### Chunk Boundaries +- 应避免红石电路跨越区块边界 -- Crossing chunk boundaries with Redstone should be avoided +### 命令方块 -### Command Blocks +- 构建大型命令链时应垂直堆叠于单个区块内 +- 尽可能用函数和行为包替代命令方块 -- When creating large command blockchains, stack vertically and in a single chunk -- Minimize command block use in favor of functions and behaviors where possible +## 常加载区域 -## Ticking Areas +- 总区块数比常加载区域更需关注 +- 非必要时应避免动态区域 +- 最佳实践是将常加载区域限制在单个区块 +> 所有持续运行的红石装置应置于此区块 +- 通过/testforblock测试并及时卸载不再需要的常加载区域 -- Total chunks are of more significant concern than ticking areas -- Dynamic areas should be avoided unless necessary -- Best practice is to minimizing the ticking area to one chunk if possible -> All always-on Redstone should fit in this ticking chunk -- Unload ticking areas when they are no longer needed, testing via /testforblock +## 文件管理 -## Files - -- Tons of files can badly affect game performance. Create a [`contents.json`](/concepts/contents) file. +- 过多文件严重影响性能,请创建[`contents.json`](/wiki/concepts/contents)文件 \ No newline at end of file diff --git a/docs/wiki/meta/jq.md b/docs/wiki/meta/jq.md index a62e74b0..94a28244 100644 --- a/docs/wiki/meta/jq.md +++ b/docs/wiki/meta/jq.md @@ -1,5 +1,5 @@ --- -title: Creating addons with JQ +title: 使用JQ创建附加组件 hidden: true mentions: - SirLich @@ -7,148 +7,204 @@ mentions: - MedicalJewel105 --- -## Introduction +# 使用JQ创建附加组件 -> "jq is like sed for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text." + + +## 引言 + +> "jq就像处理JSON数据的sed工具 - 你可以用它来切片、过滤、映射和转换结构化数据,其便捷程度如同用sed、awk、grep等工具处理文本一般。" _— https://stedolan.github.io/jq/_ -jq is a JSON editing program written in C. It can be thought of similarly to Perl. Because it was explicitly written to parse JSON, however, it has many valuable features that are not present in other text processors. jq defines its programs as filters, as they take an input, your JSON data, and produce an output, your modified JSON data. Though seemingly simple, jq contains many advanced features that can be extremely useful when procedurally generating addon files. +jq是一款用C语言编写的JSON处理工具,其理念类似于Perl。由于它是专门为解析JSON设计的,因此具备许多其他文本处理器所没有的实用特性。jq将其程序定义为过滤器,这些过滤器接收JSON数据输入并输出修改后的JSON数据。虽然看似简单,但jq包含了许多高级功能,在程序化生成附加组件文件时极其有用。 -I'll be explaining jq from the perspective that jq is a command-line interface. However, wrappers have been designed for jq in essentially every programming language, so you can easily incorporate jq filters into the programing language of your choice, including Go, JavaScript, Java, Ruby, Python, and R. Given that, I will primarily focus on filter design from the perspective of Minecraft addons, and I'll leave the implementation to your specific use case. I'll be including embeds from [jqterm.com](https://jqterm.com/?query=.), which uses a JavaScript implementation of jq to display filters in a web browser. +本文将从命令行界面角度解释jq的使用。不过jq基本上已为所有主流编程语言提供了封装器,您可以轻松将jq过滤器集成到Go、JavaScript、Java、Ruby、Python、R等语言中。本文将重点讲解针对Minecraft附加组件开发的过滤器设计,具体实现方式可根据实际需求选择。 -## Getting jq +## 获取jq -The official source to download the jq binaries is https://stedolan.github.io/jq/download/. The executables downloaded here should be essentially portable and just "run". +官方下载地址:https://stedolan.github.io/jq/download/,下载的可执行文件即开即用。 -You may also use your system package manager, though if you take this approach, ensure that the version installed is the latest, jq-1.6. +也可以通过系统包管理器安装(需确保版本≥jq-1.6)。 -A community-maintained list of the wrappers available for jq in various languages is available [here](https://github.com/fiatjaf/awesome-jq). +各语言封装器列表详见:[awesome-jq](https://github.com/fiatjaf/awesome-jq) -## Defining Syntax +## 基础语法 -### The Dot +### 点操作符 -The simplest possible filter in jq is the dot (`.`), which will take the input JSON and return it unchanged. jq uses the standardized path notation for JSON files. Consider the following structure of a resource pack manifest: +最简单的jq过滤器是点号(`.`),它原样返回输入JSON。以下面这个资源包清单为例: - - -### Paths - -Here, we see that our `.` filter returns what we expected: the entire JSON file. Now, let's say we wanted to return some specific part of the JSON file, the header UUID, for example. We would then construct a filter that contains the full path to that value. In this case, that would be `.header.uuid`. Let's see that in action: - - - -### Array Access - -We can access arrays in jq similarly to how we would in other languages. Let's say we wanted to return the last number in our minimum engine version array. We would construct the following filter: `.header.min_engine_version[-1]`. Note that, of course, we could also specify the positive position 2 if we always wanted to return to the second position. Simply using empty brackets, `.[]`, will return all array elements in a line separated list. Feel free to play around with this and learn the basics: - - - -### Editing Values - -Now let's get into the real meat of jq and start manipulating our JSON data. The way we do this is with the plain assignment operator (`=`). There are a few variants of this operator, referred to as update-assignment operators, such as `|=` and `+=`, which you can read more about in jq's official [manual](https://stedolan.github.io/jq/manual/#Assignment), and experiment within the example below: - - - -### The Pipe - -Similar to UNIX command-line interfaces, jq makes use of the pipe, `|`. When you use the pipe character, you are essentially telling jq to take the result of your filter on the left of the pipe and run it through the filter to the pipe's right. Let's go back to our array access example, except this time. We will output the entire array apply some filter to the output array. We'll use jq's built-in map function to demonstrate this, which is a handy function as it can be used to apply a specified filter to every value in an input array. We'll add 1 to each value in the minimum engine version array: - - - -### Logical Operations - -#### If, Then, Else - -Logical statements in jq are essentially written in a human-readable format. They take the form `if A then B else C end`. 'A' in this case could test for a specific value or test if some key exists. More conditions can be added with elif in the form `if A then B elif C then D else E end`. For comparisons, the operators are essentially the same as Molang, utilizing `==`, `!=`, `>`, `>=`, `<`, and `<=`. In the example below, we'll conditionally change the description of the pack based on the format version. If the format version is greater than 1, we'll set the description to "Big Format". Otherwise, we'll leave the description alone: - - - -#### And, Or, Not - -The operations `and` and `or` are also written in plain English. If we wanted to test for condition 'A' and condition 'B', we'd write `if (A and B) then C else D`. - -The operation `not` behaves like a single argument function, which we'll discuss in further depth below. When we pipe some boolean into `not`, it will return the opposite value. We'll demonstrate this by setting our header description to "Little Version" only if both our header version and module version are not greater than 1: - - - -### Variables - -Variables can be defined anywhere in filter. When a variable is defined, it is valid for use anywhere downstream in the pipe from where it was initially defined. They are defined in the form: `.input as $var | $var`, which would effectively return `.input`. Any valid JSON type can also serve as an input, such as objects, arrays, strings, and numbers. Take the simple example: - - - -## Builtin Functions - -### Syntax - -jq comes with a variety of built-in functions. We've already encountered the function `map` while explaining the pipe. One thing of note regarding jq functions is that their syntax differs depending on the number of arguments they take. Multi-argument functions will take their values enclosed in parentheses and separated by semicolons. In contrast, for single-argument functions, the input is piped in. Take the example below, in which we use the multi-argument function pow to raise the format version to the third power, while we also use the single argument function sqrt to find the square root of the format version. In this example, you'll also note that we introduce the concept of building an entirely new JSON structure within our jq filter. This is extremely useful in situations where we'd like to reshape some input files somehow. It's always important to keep in mind that any valid JSON is valid anywhere in a jq filter: - - - -### Math - -jq incorporates C-style math functions and generally carries over all built-in C math functions from your system. Refer to the [manual](https://stedolan.github.io/jq/manual/#Math) for a complete list of these. - -### Map and Map Values - -We've already seen a bit of what `map` can do, as seen in the pipe section. I'll explain a bit about its cousin, `map_values`. While `map` can apply some filter to all values in an array, `map_values` apply some filter to all keys in an input list of objects. In the example below, I'll introduce `map_values` and a couple of extra functions. Our goal will be to substitute the string "Example" with "Production" by iterating through all the values with the typed string under the header. We must separate the string values from the array values, as we cannot perform the function we will use to make this substitution, `gsub`, on arrays. The function `gsub` is a multi-argument function that will take the substring we would like to change, followed by the result we'd like to change that substring to. We'll also be utilizing the `select` function to separate our strings from our arrays. We'll incorporate a variable so we have easy access to all the information contained in the header. We'll use the function `type`, which lets us check the JSON data type of input. - - - -### To and From Entries - -The function `to_entries` is a useful single argument jq builtin that is helpful when we'd like to rearrange keys and values. Let's say we wanted to invert all the key/value pairs in the header. Using `to_entries`, we'll construct an array of all key-value pairs in the header, reformatted as objects, and assigned "key" or "value" to reference them later. To understand how this function works, it's important to see what this intermediate looks like. Note that this can also be reversed by appending `from_entries`: - - - -Now, we'll use `map` to iterate through each array entry, and finally, we'll introduce a new function, add. This single-argument function will take the array of objects output by `map` and essentially move them up one level to again exist as key-value pairs under the header. We'll also need to convert all our values to strings so they can serve as keys. We'll use the single-argument function `tostring`. Note that `tonumber` is the inverse of this: - - - -### Walk - -The function `walk` is compelling, as it will recursively apply to everything in the input at all levels. Take the example of deleting all objects with the value null. We'll also be introducing the function `with_entries`, which is just a shorthand for `to_entries | map(some filter) | from_entries`. We'll start our filter with `walk`, indicating we want to go through everything. We'll then use an if statement to ensure we are only editing objects. Else we'll leave the input unchanged. For all objects, we'll use `with_entries` to convert those to mapped keys and values and run a `select` function on those to ensure we only carry on values that are not equal to null: - - - -### Further Reading - -Jq has far too many functions to list off here. I've tried to explain those that I find most useful in my jq projects. For further reading, refer to the [jq manual](https://stedolan.github.io/jq/manual/). - -## Defining Custom Functions - -In jq, one can easily define custom functions with the syntax `def function_name($input1; $input2): some function;`. The variables can then be used all throughout the function. A function can also have no input. Take the boiler plate examples below: - - - -## Command Line Use - -When invoked from the command line, jq takes the form `jq '[filter]' input.json`. This will only display the output in the terminal. For bash-based systems, simply use the arrow operator, `jq '[filter]' input.json > output.json` to write an output file. If you wish to overwrite the input file on the fly, this method will not work. You will need to generate a temp file or use a utility like Sponge from [moreutils](https://rentes.github.io/unix/utilities/2015/07/27/moreutils-package/). Then, you may simply `jq '[filter]' input.json | sponge input.json`. For large filters, it's generally easier to employ a shell or bash script. You may use the -n flag to construct a JSON file from scratch rather than specify an input. Finally, you may pass terminal variables to be used in your jq filters as follows: - -``` -jq -n --arg jqvar1 $var1 --arg jqvar2 $var2 ' +::: code-group +```json [资源包清单] { -"var1": $jqvar1, -"var2": $jqvar2 + "format_version": 2, + "header": { + "name": "Example Pack", + "uuid": "c35537fa-c79d-fd77-cd89-551b7487abed", + "min_engine_version": [1, 16, 0] + }, + "modules": [ + { + "type": "resources", + "uuid": "199ed596-c0f7-158c-db7d-2da8510690c5", + "version": [1, 0, 0] + } + ] +} +``` +::: + +### 路径访问 + +要获取header的UUID,使用路径表达式`.header.uuid`: + +::: code-group +```json [输出结果] +"c35537fa-c79d-fd77-cd89-551b7487abed" +``` +::: + +### 数组操作 + +访问数组元素示例(获取最低引擎版本的最后一位): +`.header.min_engine_version[-1]` + +::: code-group +```json [输出结果] +0 +``` +::: + +### 值修改 + +使用赋值运算符修改格式版本: +`.format_version = 3` + +::: code-group +```json [修改结果] +{ + "format_version": 3, // 此处被修改 + "header": { + ... + } +} +``` +::: + +### 管道操作 + +结合map函数对数组元素进行运算: +`.header.min_engine_version | map(. + 1)` + +::: code-group +```json [运算结果] +[2, 17, 1] +``` +::: + +### 逻辑运算 + +#### 条件判断 + +根据format_version修改描述文本: +```jq +if .format_version > 1 then + .header.description = "大版本" +else + . +end +``` + +#### 逻辑组合 + +复合条件判断示例: +```jq +if (.header.version[0] > 1 and (.modules[0].version[0] > 1 | not)) +then + .header.description = "小版本" +end +``` + +### 变量定义 + +变量作用域贯穿后续管道: +```jq +{hello: "world"} as $var | $var | .hello +``` + +## 内置函数 + +### 数学运算 + +使用幂函数和平方根函数: +```jq +{ + "三次幂": pow(.format_version; 3), + "平方根": .format_version | sqrt +} +``` + +### 映射处理 + +使用map_values进行全局字符串替换: +```jq +.header as $header | +.header = ($header | map_values( + (select(type == "string") | gsub("示例"; "生产版") +)) + ($header | map_values(select(type != "string"))) +``` + +### 键值转换 + +使用to_entries重构键值对: +```jq +.header | to_entries | map({(value|tostring): key}) | add +``` + +### 递归处理 + +使用walk清理空值: +```jq +walk(if type == "object" then + with_entries(select(.value != null)) +else . end +``` + +## 自定义函数 + +函数定义语法示例: +```jq +def 加法函数($a; $b): + $a + $b; + +def 无参函数: + 1 + 1; + +{ + "组合字符串": 加法函数("合并"; "字符串"), + "简单计算": 无参函数 +} +``` + +## 命令行应用 + +基础使用格式: +```bash +jq '[过滤器]' 输入文件.json > 输出文件.json +``` + +带参数调用: +```bash +jq -n --arg 变量1 $值1 --arg 变量2 $值2 ' +{ + "参数1": $变量1, + "参数2": $变量2 }' ``` -## Bringing It All Together +## 实战案例 -Many of the previous examples are abstract and contrived, designed to allow you to become familiar with the basics of jq. Now, I'd like to go over an example of a practical use case of jq. I'll be explaining the jq filter I wrote for converting a Java model to a Bedrock model for use as an attachable while remapping all its UV values. +将Java版模型转换为基岩版可附着物模型的完整jq脚本(含UV重映射): -First, we'll define a simple variable to change the name of our model geometry easily. Next, we'll define a function to deal with our elements, `element_array`. We'll first get some information from the array of textures from our Java model to know how many textures we have, what order they're in, and therefore how to shift our UV values. Now that we've defined all our variables from our texture array, which we'll use later in UV calculations, we'll start to map our elements array. - -Iterating through each element in our array of elements, we'll calculate our origin and size. We can use simple math from jq to do this. To go from Java to Bedrock, we'll need to change 2 absolute corner positions to one origin value and one size value. We'll also shift our X and Z coordinates by 8 to account for the different centering of coordinate systems between Bedrock and Java. - -Now, we'll deal with rotation. The way Java defines its rotations uses a string followed by a value, but we'd like to construct an array based on that. We can do so with a reasonably simple if, then, else statement. Since rotation is optional, we'll just set that to null for now if we don't have a rotation. We can delete that later. Next, we'll set the element pivot, shifting by 8 on the X and Z due to the coordinate difference and setting to null if we lack a pivot. - -We will then calculate our UV values. I wish to shift all our UV's as if we are generating a single square texture atlas from our input textures. We'll define a nested function, `uv_calc`, here. We'll then use some modular division via the `fmod` function to figure out the offsets. Finally, we'll change Java's four coordinate style UV system to Bedrock's, which uses a point value and a size value, with simple arithmetic. We'll then run the function for each of the six faces of our element, and finally, use `walk` to remove any objects with the value null. - -To make our geometry compatible with custom blocks, we'll define the function `pivot_groups`, which we'll ultimately use to iterate over our element array, find all unique rotation pivot combinations, and create a bone for all elements that share a rotation-pivot variety. - -Lastly, we'll put down the structure of our actual geometry file. We'll concatenate in our model name, use our `element_array` function to bring in all our cubes with no rotation, and add in our special pivot groups. We'll use the map to give each group a unique name, iterating up one value each time. - -This filter is a little heavy, so I've linked it on a separate page rather than embedding it [here](https://jqterm.com/85a349e33fd8709ceb0c64be6b63c497?query=%22test%22%20as%20%24model_name%20%7C%0A%0Adef%20element_array%3A%0A%20%20%20%20%28.textures%20%7C%20to_entries%20%7C%20sort_by%28.key%29%20%7C%20map%28%7B%28.key%29%3A%20.value%7D%29%20%7C%20add%20%7C%20keys_unsorted%29%20as%20%24texture_array%0A%20%20%20%20%7C%20%28%24texture_array%20%7C%20length%29%20as%20%24frames%0A%20%20%20%20%7C%20%28%28%24frames%20%7C%20sqrt%29%20%7C%20ceil%29%20as%20%24sides%0A%20%20%20%20%7C%20%28.texture_size%5B1%5D%20%2F%2F%2016%29%20as%20%24t1%0A%20%20%20%20%7C%20.elements%20%7C%20map%28%7B%0A%20%20%20%20%20%20%22origin%22%3A%20%5B%28-.to%5B0%5D%20%2B%208%29%2C%20%28.from%5B1%5D%29%2C%20%28.from%5B2%5D%20-%208%29%5D%2C%0A%20%20%20%20%20%20%22size%22%3A%20%5B.to%5B0%5D%20-%20.from%5B0%5D%2C%20.to%5B1%5D%20-%20.from%5B1%5D%2C%20.to%5B2%5D%20-%20.from%5B2%5D%5D%2C%0A%20%20%20%20%20%20%22rotation%22%3A%20%0A%20%20%20%20%20%20%28if%20%28.rotation.axis%29%20%3D%3D%20%22x%22%20then%20%5B%28.rotation.angle%20%7C%20tonumber%20*%20-1%29%2C%200%2C%200%5D%20%0A%20%20%20%20%20%20%20%20elif%20%28.rotation.axis%29%20%3D%3D%20%22y%22%20then%20%5B0%2C%20%28.rotation.angle%20%7C%20tonumber%20*%20-1%29%2C%200%5D%20%0A%20%20%20%20%20%20%20%20elif%20%28.rotation.axis%29%20%3D%3D%20%22z%22%20then%20%5B0%2C%200%2C%20%28.rotation.angle%20%7C%20tonumber%29%5D%20%0A%20%20%20%20%20%20%20%20else%20null%20end%29%2C%0A%20%20%20%20%20%20%22pivot%22%3A%20%28if%20.rotation.origin%20then%20%5B%28-%20.rotation.origin%5B0%5D%20%2B%208%29%2C%20.rotation.origin%5B1%5D%2C%20%28.rotation.origin%5B2%5D%20-%208%29%5D%20else%20null%20end%29%2C%0A%20%20%20%20%20%20%22uv%22%3A%20%28%0A%20%20%20%20%20%20%20%20def%20uv_calc%28%24input%29%3A%0A%20%20%20%20%20%20%20%20%20%20%28if%20%28.faces%20%7C%20.%5B%24input%5D%29%20then%0A%20%20%20%20%20%20%20%20%20%20%28.faces%20%7C%20.%5B%24input%5D.texture%5B1%3A%5D%20as%20%24input_n%20%7C%20%24texture_array%20%7C%20%28index%28%24input_n%29%20%2F%2F%20index%28%22particle%22%29%29%29%20as%20%24pos_n%0A%20%20%20%20%20%20%20%20%20%20%7C%20%28%28.faces%20%7C%20.%5B%24input%5D.uv%5B0%5D%20%2F%20%24sides%29%20%2B%20%28%28fmod%28%24pos_n%3B%20%24sides%29%29%20*%20%2816%20%2F%20%24sides%29%29%29%20as%20%24fn0%0A%20%20%20%20%20%20%20%20%20%20%7C%20%28%28.faces%20%7C%20.%5B%24input%5D.uv%5B1%5D%20%2F%20%24sides%29%20%2B%20%28%28%28%24pos_n%20%2F%20%24sides%29%20%7C%20floor%29%20*%20%2816%20%2F%20%24sides%29%29%29%20as%20%24fn1%0A%20%20%20%20%20%20%20%20%20%20%7C%20%28%28.faces%20%7C%20.%5B%24input%5D.uv%5B2%5D%20%2F%20%24sides%29%20%2B%20%28%28fmod%28%24pos_n%3B%20%24sides%29%29%20*%20%2816%20%2F%20%24sides%29%29%29%20as%20%24fn2%0A%20%20%20%20%20%20%20%20%20%20%7C%20%28%28.faces%20%7C%20.%5B%24input%5D.uv%5B3%5D%20%2F%20%24sides%29%20%2B%20%28%28%28%24pos_n%20%2F%20%24sides%29%20%7C%20floor%29%20*%20%2816%20%2F%20%24sides%29%29%29%20as%20%24fn3%20%7C%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22uv%22%3A%20%5B%28%24fn0%29%2C%20%28%24fn1%29%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22uv_size%22%3A%20%5B%28%24fn2%20-%20%24fn0%29%2C%20%28%24fn3%20-%20%24fn1%29%5D%0A%20%20%20%20%20%20%20%20%20%20%7D%20else%20null%20end%29%3B%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22north%22%3A%20uv_calc%28%22north%22%29%2C%0A%20%20%20%20%20%20%20%20%22south%22%3A%20uv_calc%28%22south%22%29%2C%0A%20%20%20%20%20%20%20%20%22east%22%3A%20uv_calc%28%22east%22%29%2C%0A%20%20%20%20%20%20%20%20%22west%22%3A%20uv_calc%28%22west%22%29%2C%0A%20%20%20%20%20%20%20%20%22up%22%3A%20uv_calc%28%22up%22%29%2C%0A%20%20%20%20%20%20%20%20%22down%22%3A%20uv_calc%28%22down%22%29%0A%20%20%20%20%20%20%20%20%7D%29%0A%20%20%20%20%7D%29%20%7C%20walk%28%20if%20type%20%3D%3D%20%22object%22%20then%20with_entries%28select%28.value%20!%3D%20null%29%29%20else%20.%20end%29%3B%0A%0Adef%20pivot_groups%3A%0A%20%20%20%20%28element_array%29%20as%20%24element_array%20%7C%0A%20%20%20%20%5B%5B.elements%5B%5D.rotation%5D%20%7C%20unique%20%7C%20.%5B%5D%20%7C%20select%20%28.!%3Dnull%29%5D%0A%20%20%20%20%7C%20map%28%28%0A%20%20%20%20%5B%28-%20.origin%5B0%5D%20%2B%208%29%2C%20.origin%5B1%5D%2C%20%28.origin%5B2%5D%20-%208%29%5D%20as%20%24i_piv%20%7C%0A%20%20%20%20%28if%20%28.axis%29%20%3D%3D%20%22x%22%20then%20%5B%28.angle%20%7C%20tonumber%20*%20-1%29%2C%200%2C%200%5D%20%0A%20%20%20%20%20%20elif%20%28.axis%29%20%3D%3D%20%22y%22%20then%20%5B0%2C%20%28.angle%20%7C%20tonumber%20*%20-1%29%2C%200%5D%20%0A%20%20%20%20%20%20else%20%5B0%2C%200%2C%20%28.angle%20%7C%20tonumber%29%5D%20end%29%20as%20%24i_rot%20%7C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22parent%22%3A%20%22geysercmd_z%22%2C%0A%20%20%20%20%20%20%22pivot%22%3A%20%28%24i_piv%29%2C%0A%20%20%20%20%20%20%22rotation%22%3A%20%28%24i_rot%29%2C%0A%20%20%20%20%20%20%22mirror%22%3A%20true%2C%0A%20%20%20%20%20%20%22cubes%22%3A%20%5B%28%24element_array%20%7C%20.%5B%5D%20%7C%20select%28.rotation%20%3D%3D%20%24i_rot%20and%20.pivot%20%3D%3D%20%24i_piv%29%29%5D%0A%20%20%20%20%7D%29%29%3B%0A%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22format_version%22%3A%20%221.16.0%22%2C%0A%20%20%20%20%20%20%22minecraft%3Ageometry%22%3A%20%5B%7B%0A%20%20%20%20%20%20%20%20%22description%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22identifier%22%3A%20%28%22geometry.geysercmd.%22%20%2B%20%28%24model_name%29%29%2C%0A%20%20%20%20%20%20%20%20%20%20%22texture_width%22%3A%2016%2C%0A%20%20%20%20%20%20%20%20%20%20%22texture_height%22%3A%2016%2C%0A%20%20%20%20%20%20%20%20%20%20%22visible_bounds_width%22%3A%204%2C%0A%20%20%20%20%20%20%20%20%20%20%22visible_bounds_height%22%3A%204.5%2C%0A%20%20%20%20%20%20%20%20%20%20%22visible_bounds_offset%22%3A%20%5B0%2C%200.75%2C%200%5D%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%22bones%22%3A%20%28%5B%7B%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22geysercmd%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22binding%22%3A%20%22c.item_slot%20%3D%3D%20%27head%27%20%3F%20%27head%27%20%3A%20q.item_slot_to_bone_name%28c.item_slot%29%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22pivot%22%3A%20%5B0%2C%208%2C%200%5D%0A%20%20%20%20%20%20%20%20%7D%2C%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22geysercmd_x%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22parent%22%3A%20%22geysercmd%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22pivot%22%3A%20%5B0%2C%208%2C%200%5D%0A%20%20%20%20%20%20%20%20%7D%2C%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22geysercmd_y%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22parent%22%3A%20%22geysercmd_x%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22pivot%22%3A%20%5B0%2C%208%2C%200%5D%0A%20%20%20%20%20%20%20%20%7D%2C%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22geysercmd_z%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22parent%22%3A%20%22geysercmd_y%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22pivot%22%3A%20%5B0%2C%208%2C%200%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%22cubes%22%3A%20%5B%28element_array%20%7C%20.%5B%5D%20%7C%20select%28.rotation%20%3D%3D%20null%29%29%5D%0A%20%20%20%20%20%20%20%20%7D%5D%20%2B%20%28pivot_groups%20%7C%20map%28del%28.cubes%5B%5D.rotation%29%29%20%7C%20to_entries%20%7C%20map%28%20%28.value.name%20%3D%20%22rot_%5C%281%2B.key%29%22%20%29%20%7C%20.value%29%29%29%0A%20%20%20%20%20%20%7D%5D%0A%20%20%20%20%7D). +[完整转换脚本示例](https://jqterm.com/85a349e33fd8709ceb0c64be6b63c497?query=%22test%22%20as%20%24model_name%20%7C%0A%0Adef%20element_array%3A%0A%20%20%20%20%28.textures%20%7C%20to_entries%20%7C%20sort_by%28.key%29%20%7C%20map%28%7B%28.key%29%3A%20.value%7D%29%20%7C%20add%20%7C%20keys_unsorted%29%20as%20%24texture_array%0A%20%20%20%20%7C%20%28%24texture_array%20%7C%20length%29%20as%20%24frames%0A%20%20%20%20%7C%20%28%28%24frames%20%7C%20sqrt%29%20%7C%20ceil%29%20as%20%24sides%0A%20%20%20%20%7C%20%28.texture_size%5B1%5D%20%2F%2F%2016%29%20as%20%24t1%0A%20%20%20%20%7C%20.elements%20%7C%20map%28%7B%0A%20%20%20%20%20%20%22origin%22%3A%20%5B%28-.to%5B0%5D%20%2B%208%29%2C%20%28.from%5B1%5D%29%2C%20%28.from%5B2%5D%20-%208%29%5D%2C%0A%20%20%20%20%20%20%22size%22%3A%20%5B.to%5B0%5D%20-%20.from%5B0%5D%2C%20.to%5B1%5D%20-%20.from%5B1%5D%2C%20.to%5B2%5D%20-%20.from%5B2%5D%5D%2C%0A%20%20%20%20%20%20%22rotation%22%3A%20%0A%20%20%20%20%20%20%28if%20%28.rotation.axis%29%20%3D%3D%20%22x%22%20then%20%5B%28.rotation.angle%20%7C%20tonumber%20*%20-1%29%2C%200%2C%200%5D%20%0A%20%20%20%20%20%20%20%20elif%20%28.rotation.axis%29%20%3D%3D%20%22y%22%20then%20%5B0%2C%20%28.rotation.angle%20%7C%20tonumber%20*%20-1%29%2C%200%5D%20%0A%20%20%20%20%20%20%20%20elif%20%28.rotation.axis%29%20%3D%3D%20%22z%22%20then%20%5B0%2C%200%2C%20%28.rotation.angle%20%7C%20tonumber%29%5D%20%0A%20%20%20%20%20%20%20%20else%20null%20end%29%2C%0A%20%20%20%20%20%20%22pivot%22%3A%20%28if%20.rotation.origin%20then%20%5B%28-%20.rotation.origin%5B0%5D%20%2B%208%29%2C%20.rotation.origin%5B1%5D%2C%20%28.rotation.origin%5B2%5D%20-%208%29%5D%20else%20null%20end%29%2C%0A%20%20%20%20%20%20%22uv%22%3A%20%28%0A%20%20%20%20%20%20%20%20def%20uv_calc%28%24input%29%3A%0A%20%20%20%20%20%20%20%20%20%20%28if%20%28.faces%20%7C%20.%5B%24input%5D%29%20then%0A%20%20%20%20%20%20%20%20%20%20%28.faces%20%7C%20.%5B%24input%5D.texture%5B1%3A%5D%20as%20%24input_n%20%7C%20%24texture_array%20%7C%20%28index%28%24input_n%29%20%2F%2F%20index%28%22particle%22%29%29%29%20as%20%24pos_n%0A%20%20%20%20%20%20%20%20%20%20%7C%20%28%28.faces%20%7C%20.%5B%24input%5D.uv%5B0%5D%20%2F%20%24sides%29%20%2B%20%28%28fmod%28%24pos_n%3B%20%24sides%29%29%20*%20%2816%20%2F%20%24sides%29%29%29%20as%20%24fn0%0A%20%20%20%20%20%20%20%20%20%20%7C%20%28%28.faces%20%7C%20.%5B%24input%5D.uv%5B1%5D%20%2F%20%24sides%29%20%2B%20%28%28%28%24pos_n%20%2F%20%24sides%29%20%7C%20floor%29%20*%20%2816%20%2F%20%24sides%29%29%29%20as%20%24fn1%0A%20%20%20%20%20%20%20%20%20%20%7C%20%28%28.faces%20%7C%20.%5B%24input%5D.uv%5B2%5D%20%2F%20%24sides%29%20%2B%20%28%28fmod%28%24pos_n%3B%20%24sides%29%29%20*%20%2816%20%2F%20%24sides%29%29%29%20as%20%24fn2%0A%20%20%20%20%20%20%20%20%20%20%7C%20%28%28.faces%20%7C%20.%5B%24input%5D.uv%5B3%5D%20%2F%20%24sides%29%20%2B%20%28%28%28%24pos_n%20%2F%20%24sides%29%20%7C%20floor%29%20*%20%2816%20%2F%20%24sides%29%29%29%20as%20%24fn3%20%7C%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22uv%22%3A%20%5B%28%24fn0%29%2C%20%28%24fn1%29%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22uv_size%22%3A%20%5B%28%24fn2%20-%20%24fn0%29%2C%20%28%24fn3%20-%20%24fn1%29%5D%0A%20%20%20%20%20%20%20%20%20%20%7D%20else%20null%20end%29%3B%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22north%22%3A%20uv_calc%28%22north%22%29%2C%0A%20%20%20%20%20%20%20%20%22south%22%3A%20uv_calc%28%22south%22%29%2C%0A%20%20%20%20%20%20%20%20%22east%22%3A%20uv_calc%28%22east%22%29%2C%0A%20%20%20%20%20%20%20%20%22west%22%3A%20uv_calc%28%22west%22%29%2C%0A%20%20%20%20%20%20%20%20%22up%22%3A%20uv_calc%28%22up%22%29%2C%0A%20%20%20%20%20%20%20%20%22down%22%3A%20uv_calc%28%22down%22%29%0A%20%20%20%20%20%20%20%20%7D%29%0A%20%20%20%20%7D%29%20%7C%20walk%28%20if%20type%20%3D%3D%20%22object%22%20then%20with_entries%28select%28.value%20!%3D%20null%29%29%20else%20.%20end%29%3B%0A%0Adef%20pivot_groups%3A%0A%20%20%20%20%28element_array%29%20as%20%24element_array%20%7C%0A%20%20%20%20%5B%5B.elements%5B%5D.rotation%5D%20%7C%20unique%20%7C%20.%5B%5D%20%7C%20select%20%28.!%3Dnull%29%5D%0A%20%20%20%20%7C%20map%28%28%0A%20%20%20%20%5B%28-%20.origin%5B0%5D%20%2B%208%29%2C%20.origin%5B1%5D%2C%20%28.origin%5B2%5D%20-%208%29%5D%20as%20%24i_piv%20%7C%0A%20%20%20%20%28if%20%28.axis%29%20%3D%3D%20%22x%22%20then%20%5B%28.angle%20%7C%20tonumber%20*%20-1%29%2C%200%2C%200%5D%20%0A%20%20%20%20%20%20elif%20%28.axis%29%20%3D%3D%20%22y%22%20then%20%5B0%2C%20%28.angle%20%7C%20tonumber%20*%20-1%29%2C%200%5D%20%0A%20%20%20%20%20%20else%20%5B0%2C%200%2C%20%28.angle%20%7C%20tonumber%29%5D%20end%29%20as%20%24i_rot%20%7C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22parent%22%3A%20%22geysercmd_z%22%2C%0A%20%20%20%20%20%20%22pivot%22%3A%20%28%24i_piv%29%2C%0A%20%20%20%20%20%20%22rotation%22%3A%20%28%24i_rot%29%2C%0A%20%20%20%20%20%20%22mirror%22%3A%20true%2C%0A%20%20%20%20%20%20%22cubes%22%3A%20%5B%28%24element_array%20%7C%20.%5B%5D%20%7C%20select%28.rotation%20%3D%3D%20%24i_rot%20and%20.pivot%20%3D%3D%20%24i_piv%29%29%5D%0A%20%20%20%20%7D%29%29%3B%0A%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22format_version%22%3A%20%221.16.0%22%2C%0A%20%20%20%20%20%20%22minecraft%3Ageometry%22%3A%20%5B%7B%0A%20%20%20%20%20%20%20%20%22description%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22identifier%22%3A%20%28%22geometry.geysercmd.%22%20%2B%20%28%24model_name%29%29%2C%0A%20%20%20%20%20%20%20%20%20%20%22texture_width%22%3A%2016%2C%0A%20%20%20%20%20%20%20%20%20%20%22texture_height%22%3A%2016%2C%0A%20%20%20%20%20%20%20%20%20%20%22visible_bounds_width%22%3A%204%2C%0A%20%20%20%20%20%20%20%20%20%20%22visible_bounds_height%22%3A%204.5%2C%0A%20%20%20%20%20%20%20%20%20%20%22visible_bounds_offset%22%3A%20%5B0%2C%200.75%2C%200%5D%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%22bones%22%3A%20%28%5B%7B%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22geysercmd%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22binding%22%3A%20%22c.item_slot%20%3D%3D%20%27head%27%20%3F%20%27head%27%20%3A%20q.item_slot_to_bone_name%28c.item_slot%29%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22pivot%22%3A%20%5B0%2C%208%2C%200%5D%0A%20%20%20%20%20%20%20%20%7D%2C%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22geysercmd_x%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22parent%22%3A%20%22geysercmd%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22pivot%22%3A%20%5B0%2C%208%2C%200%5D%0A%20%20%20%20%20%20%20%20%7D%2C%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22geysercmd_y%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22parent%22%3A%20%22geysercmd_x%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22pivot%22%3A%20%5B0%2C%208%2C%200%5D%0A%20%20%20%20%20%20%20%20%7D%2C%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22geysercmd_z%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22parent%22%3A%20%22geysercmd_y%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22pivot%22%3A%20%5B0%2C%208%2C%200%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%22cubes%22%3A%20%5B%28element_array%20%7C%20.%5B%5D%20%7C%20select%28.rotation%20%3D%3D%20null%29%29%5D%0A%20%20%20%20%20%20%20%20%7D%5D%20%2B%20%28pivot_groups%20%7C%20map%28del%28.cubes%5B%5D.rotation%29%29%20%7C%20to_entries%20%7C%20map%28%20%28.value.name%20%3D%20%22rot_%5C%281%2B.key%29%22%20%29%20%7C%20.value%29%29%29%0A%20%20%20%20%20%20%7D%5D%0A%20%20%20%20%7D) \ No newline at end of file diff --git a/docs/wiki/meta/style-guide.md b/docs/wiki/meta/style-guide.md index 071b3452..df35f7f6 100644 --- a/docs/wiki/meta/style-guide.md +++ b/docs/wiki/meta/style-guide.md @@ -1,5 +1,5 @@ --- -title: Style Guide +title: 样式指南 mentions: - SirLich - solvedDev @@ -7,118 +7,121 @@ mentions: - ChibiMango --- -This document will present the officially supported Bedrock-Wiki style guide for addon-creation. This guide aims to promote best practices while creating addons and create a consistent format for everyone to follow. +# 样式指南 + + + +本文档将介绍基岩版Wiki官方推荐的附加包开发样式指南。本指南旨在推广附加包开发的最佳实践,并为开发者提供统一的格式规范。 :::tip -The style guide is a living, breathing document, which will evolve as addon-creation evolves. Please get in touch if you think something needs to be updated or changed! +本样式指南是持续更新的动态文档,将随着附加包开发技术的发展而不断完善。如果您有任何更新建议,欢迎随时联系我们! ::: -## Folder Structure +## 文件夹结构 -- No spaces in your file paths. `use_underscores`. -- No `CAPITALS` in your identifiers, file names, or folder names. -- The total character length of any path must not exceed 80 characters (console limitation). -- Content folders should use consistent pluralization: Don't mix and match. +- 文件路径中不要使用空格,使用下划线 +- 标识符、文件名和文件夹名不要使用全大写字母 +- 任何路径的总字符长度不得超过80个字符(控制台限制) +- 内容文件夹应保持统一的复数形式:不要混合使用单复数 -## Identifiers +## 标识符规范 -Do not use identifiers that begin with a number, and especially don't use an identifier that is _only_ a number. This applies to entities, component_groups, events, and anything else that takes a `namespace:name` pair. +不要使用以数字开头的标识符,尤其不要使用纯数字作为标识符。此规则适用于实体(entities)、组件组(component_groups)、事件(events)以及其他所有使用`命名空间:名称`格式的内容。 -## File and Folder names +## 文件与文件夹命名规范 -| Concept | Example Identifier | -| -------------------- | -------------------------- | -| Behavior Pack | dragons_BP | -| Resource Pack | dragons_RP | -| Geometry | dragon.geo.json | -| Animation | dragon.animation.json | -| Animation Controller | dragon.ac.json | -| RP Entity | dragon.ce.json | -| BP Entity | dragon.se.json | -| Item 1.16.100+ | dragon_tooth.item.json | -| BP Item | dragon_tooth.item.bp.json | -| RP Item | dragon_tooth.item.rp.json | -| Render Controller | dragon.rc.json | -| Loot Table | dragon.loot.json | -| Recipe | dragon_saddle.recipe.json | -| Spawn Rules | dragon.spawn.json | -| Trade Table | dragon.trade.json | -| Particles | dragon_magic.particle.json | -| Texture | dragon.png | -| Gametest | dragonTest.js | +| 概念 | 示例标识符 | +| --------------------- | -------------------------- | +| 行为包(Behavior Pack) | dragons_BP | +| 资源包(Resource Pack) | dragons_RP | +| 几何模型(Geometry) | dragon.geo.json | +| 动画(Animation) | dragon.animation.json | +| 动画控制器(Animation Controller) | dragon.ac.json | +| 资源包实体(RP Entity) | dragon.ce.json | +| 行为包实体(BP Entity) | dragon.se.json | +| 物品(1.16.100+) | dragon_tooth.item.json | +| 行为包物品(BP Item) | dragon_tooth.item.bp.json | +| 资源包物品(RP Item) | dragon_tooth.item.rp.json | +| 渲染控制器(Render Controller) | dragon.rc.json | +| 战利品表(Loot Table) | dragon.loot.json | +| 合成配方(Recipe) | dragon_saddle.recipe.json | +| 生成规则(Spawn Rules) | dragon.spawn.json | +| 交易表(Trade Table) | dragon.trade.json | +| 粒子效果(Particles) | dragon_magic.particle.json | +| 纹理贴图(Texture) | dragon.png | +| 游戏测试(Gametest) | dragonTest.js | -## Namespaces +## 命名空间规范 -A suitable namespace should be unique to you or your team. Something like `mob` or `cars` or `content` or `custom` would be a **bad** namespace since another developer might come up with the same namespace as you. +合适的命名空间应具有开发者唯一性。使用`mob`、`cars`、`content`或`custom`等通用词汇作为命名空间是**不恰当**的,因为这些名称可能与其他开发者重复。 -`minecraft` and `minecon` are reserved. Don't use these. +`minecraft`和`minecon`为保留命名空间,请勿使用。 -For personal projects, use a convenient version of your player name, and for team projects, use a suitable version of your team name. +个人项目建议使用玩家ID的变体,团队项目建议使用团队名称的变体。 -When multiple developers work on a project together, the namespace should always be shared. If credit is required, use sub-indexing: `minetite.sirlich:dragon` +多人协作开发时应共享命名空间。如需注明贡献者,可以使用子索引形式:`minetite.sirlich:dragon` -Where to use name-spaces: +需要使用命名空间的场景: -- entities -- particles -- component-groups -- events +- 实体(entities) +- 粒子效果(particles) +- 组件组(component-groups) +- 事件(events) -When not to use namespaces: +不需要使用命名空间的场景: -- do not include your namespace in any folder path or file-name +- 不要在文件夹路径或文件名中包含命名空间 -## Sub-indexing +## 子索引规范 -Sub indexing is the use of `.` to separate chained concepts. Sub-indexing should go in descending order from big to small: +子索引使用`.`符号分隔层级概念,应按照从宏观到微观的降序排列: ✔️ `animation.controller.dragon.flying.taking_off` ❌ `animation.controller.dragon_take_off_flying` -When using sub-indexing, use `_` as space, not another `.`. +使用子索引时,使用`_`替代空格,不要使用多个`.`: ✔️ `animation.controller.dragon.flying.taking_off` ❌ `animation.controller.dragon.flying.taking.off` -You can use sub-indexing in your entities: +实体标识符可以使用子索引: `sirlich:dragon.drake` -## Groups and Events should complement each other +## 组件组与事件的对应关系 -| Group | Event | -| ------------ | ---------------------- | -| sirlich:wild | ✔️ sirlich:become_wild | -| sirlich:wild | ❌ sirlich:wild | -| sirlich:tame | ✔️ sirlich:on_tame | -| sirlich:tame | ❌ sirlich:tame | +| 组件组 | 事件 | +| -------------- | ---------------------- | +| sirlich:wild | ✔️ sirlich:become_wild | +| sirlich:wild | ❌ sirlich:wild | +| sirlich:tame | ✔️ sirlich:on_tame | +| sirlich:tame | ❌ sirlich:tame | -## Short-Names should be Generic +## 短名称应保持通用性 -Short-names are file-specific identifiers, which are used to map between an identifier and a pretty name. They are handy because they allow us to re-use animation controllers and render controllers. For this reason, your short-names should be generic. +短名称是文件内部的标识符,用于映射具体资源路径。通用短名称有助于复用动画控制器和渲染控制器: ✔️ `"sit": "animation.dragon.sit"` ❌ `"dragon_sitting": "animation.dragon.sit"` -When we make short-names of this form, we can use a generic "sit" animation controller for all of them since we can use the `sit` short-name to play the sit animation. +使用通用短名称后,我们可以为所有需要"坐下"动画的对象复用同一个"sit"动画控制器。 -## Functions should be nested +## 函数的嵌套规范 -You can put functions in folders to achieve this. +通过文件夹结构实现函数嵌套: ✔️ `function teleport/zone/hell` ❌ `function teleport_hellzone` -## Group animations files when possible +## 动画文件的组合规范 -Example: +示例: - - -```json +::: code-group +```json [示例动画文件] { "format_version": "1.8.0", "animations": { @@ -128,8 +131,9 @@ Example: } } ``` +::: -## Split textures by path, not name +## 纹理路径组织规范 ✔️ `textures/dragon/red` @@ -137,31 +141,31 @@ Example: ✔️ `textures/npc/dragon_hunter/archer` -❌ `textures npc/dragon_hunter_archer` +❌ `textures/npc/dragon_hunter_archer` -## .lang File Comments +## .lang文件注释规范 -Comments intended for the localizer should always be in-line, in the following format: +面向本地化人员的注释应使用行内格式: -`the.key=The string<\t>## Comment, intended for the one localizing.` +`the.key=字符串内容<\t>## 注释内容,供本地化人员参考` -`<\t>` represents a tab-character. +`<\t>`表示制表符。 -Own-line comments can be used for organizational purposes but should not store localization-critical information. +独立行注释可用于组织结构,但不要存储关键本地化信息。 -## Acronyms when discussing +## 常用缩略词对照表 -| Acronym | Concept | -| ------- | ---------------------------------- | -| BP | Behavior Pack | -| RP | Resource pack | -| VRP | Vanilla Resource Pack | -| VBP | Vanilla Behavior Pack | -| AC | Animation Controller | -| RPAC | Resource Pack Animation Controller | -| BPAC | Behavior Pack Animation Controller | -| BB | Blockbench | -| BDS | Bedrock Dedicated Server | -| FPV | First Person View | -| RD | Render Dragon | -| VSCode | Visual Studio Code | +| 缩略词 | 完整名称 | +| ------ | --------------------------- | +| BP | 行为包(Behavior Pack) | +| RP | 资源包(Resource Pack) | +| VRP | 原版资源包(Vanilla Resource Pack) | +| VBP | 原版行为包(Vanilla Behavior Pack) | +| AC | 动画控制器(Animation Controller) | +| RPAC | 资源包动画控制器(Resource Pack Animation Controller) | +| BPAC | 行为包动画控制器(Behavior Pack Animation Controller) | +| BB | Blockbench建模软件 | +| BDS | 基岩版专用服务器(Bedrock Dedicated Server) | +| FPV | 第一人称视角(First Person View) | +| RD | Render Dragon渲染引擎 | +| VSCode | Visual Studio代码编辑器 | \ No newline at end of file diff --git a/docs/wiki/meta/useful-links.md b/docs/wiki/meta/useful-links.md index 107250b5..fd33be3a 100644 --- a/docs/wiki/meta/useful-links.md +++ b/docs/wiki/meta/useful-links.md @@ -1,5 +1,5 @@ --- -title: Useful Links +title: 实用链接 mentions: - SirLich - MedicalJewel105 @@ -17,11 +17,15 @@ mentions: - zheaEvyline --- -There is loads of helpful information about Bedrock Development online, but sometimes it is hard to find! We will do our best to keep this list up to date as we continue to find useful content. +# 实用链接 -Important links have a ⭐. + -## Discord Links +网络上存在大量关于基岩版开发的实用信息,但有时却难以寻觅!我们将持续更新这份清单,尽力保持内容的最新性。 + +重要链接标有⭐符号。 + +## Discord相关链接 - ⭐ [Bedrock Add-Ons](https://discord.gg/46JUdQb) - ⭐ [Bedrock OSS](https://discord.gg/XjV87YN) @@ -43,115 +47,113 @@ Important links have a ⭐. - [Minecraft RTX](http://discord.gg/vNWc3Hh) - [Mojang Bug Tracker](https://discord.gg/rpCyfKV) -## Software (installed) +## 本地安装软件 -- ⭐ [Blockbench: A boxy 3D model editor](https://blockbench.net/) -- ⭐ [bridge. Addon Editor](https://bridge-core.github.io/) -- ⭐ [VSCode Editor](https://code.visualstudio.com/) -- ⭐ [Regolith](https://github.com/Bedrock-OSS/regolith) -- [CoreCoder [Code Editor]](https://hanprog.itch.io/core-coder) -- [Feature Rule Generator v2 (paid version)](https://machine-builder.itch.io/frg-v2) -- [Feature Rule Generator v2 (free version)](https://drive.google.com/file/d/1rwQTtzgpWiqCS9ecO_j-qcxjdQvWSXgi/view) -- [Add-on JSON Generator (paid)](https://kaifireborn.itch.io/add-on-json-generator) -- [NBT Editor](https://www.universalminecrafteditor.com/) -- [World Converter (paid)](https://www.universalminecraftconverter.com/download) -- [Chunker (World Converter)](https://chunker.app/) +- ⭐ [Blockbench:一款专为方块风格设计的3D建模工具](https://blockbench.net/) +- ⭐ [bridge. 附加包编辑器](https://bridge-core.github.io/) +- ⭐ [VSCode 代码编辑器](https://code.visualstudio.com/) +- ⭐ [Regolith(快速构建工具链)](https://github.com/Bedrock-OSS/regolith) +- [CoreCoder [代码编辑器]](https://hanprog.itch.io/core-coder) +- [Feature Rule Generator v2(付费版)](https://machine-builder.itch.io/frg-v2) +- [Feature Rule Generator v2(免费版)](https://drive.google.com/file/d/1rwQTtzgpWiqCS9ecO_j-qcxjdQvWSXgi/view) +- [Add-on JSON Generator(付费)](https://kaifireborn.itch.io/add-on-json-generator) +- [NBT 编辑器](https://www.universalminecrafteditor.com/) +- [世界转换器(付费)](https://www.universalminecraftconverter.com/download) +- [Chunker(世界格式转换器)](https://chunker.app/) - [NBT Studio](https://github.com/tryashtar/nbt-studio) -- [BedrockLauncher (Bedrock version switcher)](https://bedrocklauncher.github.io/) -- [ResourcePack Converter [App]](https://converter.bedrockhub.io) -- [BedrockConnect [App]](https://bedrockconnect.bedrockhub.io) +- [BedrockLauncher(版本切换工具)](https://bedrocklauncher.github.io/) +- [资源包转换器 [应用]](https://converter.bedrockhub.io) +- [BedrockConnect [应用]](https://bedrockconnect.bedrockhub.io) -## Bedrock Tools Websites +## 基岩版在线工具 -- ⭐ [Snowstorm Particle Generator](https://jannisx11.github.io/snowstorm/) -- ⭐ [Loot Table Generator](https://bedrock-oss.github.io/bedrock-loot-gen/) -- [Apply Loot Tables to Structures](https://mcbe-essentials.github.io/structure-editor/loot-tabler) -- [Structure Editor](https://mcbe-essentials.github.io/structure-editor/) -- [Convert MCSTRUCTURE to MCFUNCTION](https://mcbe-essentials.github.io/structure-to-function/) -- [Crafting Recipe Generator](https://crafting.thedestruc7i0n.ca/) -- [Trade Table Generator](https://mcbe-essentials.github.io/trade-table-editor/) -- [World Packager](https://mcbe-essentials.github.io/world-packager/) -- [Manifest Generator](https://bedrock-manifest.web.app/) -- [Foxynotail Tools](https://www.foxynotail.com/tools/) -- [.lang File Generator](https://solveddev.github.io/AnyLanguage/) -- [behavior-builder (beta)](https://stirante.com/behavior/index) -- [controller-builder (beta)](https://stirante.com/controller/index) -- [MCPACK Generator](https://mcbe-essentials.github.io/instant-pack/) -- [Molang Grapher](https://jannisx11.github.io/molang-grapher/) -- [Molang Playground](https://bridge-core.github.io/molang-playground/) -- [Dialogue Generator](https://mcbe-essentials.github.io/dialogue-editor/) -- [Selector Generator](https://mcbe-essentials.github.io/selector-generator/) -- [Addon Obfuscator](https://tools.pixelpoly.co/obfuscator) +- ⭐ [Snowstorm 粒子效果生成器](https://jannisx11.github.io/snowstorm/) +- ⭐ [战利品表生成器](https://bedrock-oss.github.io/bedrock-loot-gen/) +- [为结构添加战利品表](https://mcbe-essentials.github.io/structure-editor/loot-tabler) +- [结构编辑器](https://mcbe-essentials.github.io/structure-editor/) +- [MCSTRUCTURE转MCFUNCTION](https://mcbe-essentials.github.io/structure-to-function/) +- [合成配方生成器](https://crafting.thedestruc7i0n.ca/) +- [村民交易表生成器](https://mcbe-essentials.github.io/trade-table-editor/) +- [世界打包工具](https://mcbe-essentials.github.io/world-packager/) +- [清单文件生成器](https://bedrock-manifest.web.app/) +- [Foxynotail工具集](https://www.foxynotail.com/tools/) +- [.lang语言文件生成器](https://solveddev.github.io/AnyLanguage/) +- [行为包构建器(测试版)](https://stirante.com/behavior/index) +- [控制器构建器(测试版)](https://stirante.com/controller/index) +- [MCPACK快速生成](https://mcbe-essentials.github.io/instant-pack/) +- [Molang可视化工具](https://jannisx11.github.io/molang-grapher/) +- [Molang调试沙盒](https://bridge-core.github.io/molang-playground/) +- [对话系统生成器](https://mcbe-essentials.github.io/dialogue-editor/) +- [目标选择器生成器](https://mcbe-essentials.github.io/selector-generator/) +- [附加包混淆工具](https://tools.pixelpoly.co/obfuscator) -## Documentation +## 文档资源 -- ⭐ [bedrock.dev](https://bedrock.dev/) -- ⭐ [Minecraft Creator Portal](https://docs.microsoft.com/en-us/minecraft/creator/) -- ⭐ [Minecraft Community Wiki](https://minecraft.wiki) -- [Mcbehub](https://mcbehub.com/category/realmdocs) -- [Bedrock Texture Pack Template](https://github.com/Brennian/BedrockTexturesTemplate) -- [Documentation Graveyard (removed components)](https://gist.github.com/destruc7i0n/ea1a6a7f97f0986d9326c58246f96fa3) +- ⭐ [bedrock.dev(权威文档)](https://bedrock.dev/) +- ⭐ [Minecraft创作者门户](https://docs.microsoft.com/en-us/minecraft/creator/) +- ⭐ [Minecraft社区Wiki](https://minecraft.wiki) +- [Mcbehub文档站](https://mcbehub.com/category/realmdocs) +- [基岩版材质包模板](https://github.com/Brennian/BedrockTexturesTemplate) +- [已弃用组件文档库](https://gist.github.com/destruc7i0n/ea1a6a7f97f0986d9326c58246f96fa3) -### Getting Started With Your First Add-On +### 附加包开发入门 -- [Getting Started with Add-On Development for Bedrock Edition](https://learn.microsoft.com/en-us/minecraft/creator/documents/gettingstarted): These guides show you exactly how to build your first resource pack and your first behavior pack from start to finish. -- [Molang: a Beginner's Guide](https://learn.microsoft.com/en-us/minecraft/creator/documents/molangbeginnersguide): Molang is a Minecraft programming language that can be useful for writing some advanced add-ons. -- [Introduction to the GameTest Framework](https://learn.microsoft.com/en-us/minecraft/creator/documents/gametestgettingstarted): This is the best way to test games, and it uses JavaScript, the most popular programming language in the world! -- [Build a gameplay experience with TypeScript](https://learn.microsoft.com/en-us/minecraft/creator/documents/scriptinggettingstarted): TypeScript is Microsoft's copy of JavaScript. Writing add-ons in TypeScript allows you to add any functionality you can imagine! -- [@minecraft/server Module](https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/mojang-minecraft/mojang-minecraft): This module and the others near it are how we can access Minecraft values with our TypeScript code. It's technical, but a great resource. -- [List and summary of commands (Unofficial Minecraft wiki)](https://minecraft.wiki/w/Commands#List_and_summary_of_commands): Most add-ons will run some commands. This community-supported wiki is the best resource for learning each and every command. +- [《基岩版附加包开发入门指南》](https://learn.microsoft.com/en-us/minecraft/creator/documents/gettingstarted):手把手教你创建第一个资源包和行为包 +- [《Molang语言入门指南》](https://learn.microsoft.com/en-us/minecraft/creator/documents/molangbeginnersguide):掌握这个专为Minecraft设计的脚本语言 +- [《GameTest框架入门》](https://learn.microsoft.com/en-us/minecraft/creator/documents/gametestgettingstarted):使用JavaScript进行游戏测试的最佳实践 +- [《TypeScript游戏开发指南》](https://learn.microsoft.com/en-us/minecraft/creator/documents/scriptinggettingstarted):微软官方推荐的脚本开发方式 +- [@minecraft/server模块文档](https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/mojang-minecraft/mojang-minecraft):通过TypeScript操作游戏数据的核心API +- [《命令大全(非官方Wiki)》](https://minecraft.wiki/w/Commands#List_and_summary_of_commands):社区维护的最新命令参考手册 -## Sample Behavior & Resource Packs +## 示例资源包与行为包 -These packs are maintained and published by Mojang. +**Mojang官方维护:** +- ⭐ [原版资源包模板](https://aka.ms/resourcepacktemplate) +- ⭐ [原版行为包模板](https://aka.ms/behaviorpacktemplate) +- [测试版资源包模板](https://aka.ms/MinecraftBetaResources) +- [测试版行为包模板](https://aka.ms/MinecraftBetaBehaviors) +- [历史版本存档](https://bedrock.dev/packs) -- ⭐ [Vanilla Resource Pack](https://aka.ms/resourcepacktemplate) -- ⭐ [Vanilla Behavior Pack](https://aka.ms/behaviorpacktemplate) -- [Vanilla Resource Pack (BETA)](https://aka.ms/MinecraftBetaResources) -- [Vanilla Behavior Pack (BETA)](https://aka.ms/MinecraftBetaBehaviors) -- [Pack Archive (old versions)](https://bedrock.dev/packs) +**开源社区项目:** +- [Wiki附加包](https://github.com/Bedrock-OSS/wiki-addon) +- [附魔详情显示](https://github.com/supercam19/EnchantmentDetails) +- [BC开发者工具包](https://github.com/BedrockCommands/developer-packs) -These packs are published by the open-source community +## 脚本开发资源 -- [wiki-addon](https://github.com/Bedrock-OSS/wiki-addon) -- [Enchantment Details](https://github.com/supercam19/EnchantmentDetails) -- [BC developer-packs](https://github.com/BedrockCommands/developer-packs) +- [GameTests API封装库](https://github.com/notbeer/Framework-Wrapper) +- [插件API入门套件](https://github.com/MajestikButter/Plugin-API-Starter-Pack) +- [方块标签调试工具](https://mcpedl.com/debug-stick/) -## Scripting Resources +## 光线追踪资源 +- ⭐ [光线追踪与PBR材质指南](https://docs.microsoft.com/en-us/minecraft/creator/documents/rtxgettingstarted) +- ⭐ [光线追踪常见问题解答](https://help.minecraft.net/hc/en-us/articles/4408865164173-Minecraft-with-Ray-Tracing-and-Advanced-Graphics-FAQ) +- [Reddit社区入门指南](https://www.reddit.com/r/minecraftRTX/comments/iq3lkl/getting_startedhelpful_guidesresource_packs/) +- [RenderBender渲染工具](https://github.com/SpeedyCodes/RenderBender) +- [RTX预设分享频道](https://discord.com/channels/691547840463241267/919021996271108108) +- [Substance 3D Painter插件](https://github.com/jasonjgardner/painter-plugin-texture-set-json) -- [GameTests API Wrapper](https://github.com/notbeer/Framework-Wrapper) -- [GameTests Plugin-API-Starter-Pack](https://github.com/MajestikButter/Plugin-API-Starter-Pack) -- [Useful for Block Tags](https://mcpedl.com/debug-stick/) +## 附加包发布平台 -## Raytracing Resources -- ⭐ [Ray Tracing and PBR Texturing guide](https://docs.microsoft.com/en-us/minecraft/creator/documents/rtxgettingstarted) -- ⭐ [Minecraft with Ray Tracing and Advanced Graphics FAQ](https://help.minecraft.net/hc/en-us/articles/4408865164173-Minecraft-with-Ray-Tracing-and-Advanced-Graphics-FAQ) -- [r/minecraftRTX Getting Started Guide](https://www.reddit.com/r/minecraftRTX/comments/iq3lkl/getting_startedhelpful_guidesresource_packs/) -- [RenderBender](https://github.com/SpeedyCodes/RenderBender) -- [RTX Presets](https://discord.com/channels/691547840463241267/919021996271108108) -- [`.texture_set.json` Adobe Substance 3D Painter plugin](https://github.com/jasonjgardner/painter-plugin-texture-set-json) +- ⭐ [官方市场](https://www.minecraft.net/en-us/catalog) +- ⭐ [MCPEDL社区](http://mcpedl.com/?cookie_check=1) +- ⭐ [创作者招聘平台](https://www.bucketofcrabs.net/) +- [MCDLHub整合平台](https://mcdlhub.com/) +- [CubitosMC西班牙社区](https://www.cubitosmc.com/) +- [Modbay模组站](https://modbay.org/) +- [市场数据分析](https://mcmarketstats.miste.fr/globalStats/) +- [官方合作伙伴列表](https://www.playthismap.com/partners) -## Addon Marketplaces & Links +## 其他实用工具 -- ⭐ [Minecraft Marketplace](https://www.minecraft.net/en-us/catalog) -- ⭐ [MCPEDL](http://mcpedl.com/?cookie_check=1) -- ⭐ [Bucket of Crabs (Marketplace joblist)](https://www.bucketofcrabs.net/) -- [MCDLHub](https://mcdlhub.com/) -- [CubitosMC](https://www.cubitosmc.com/) -- [Modbay](https://modbay.org/) -- [Minecraft Marketplace Stats](https://mcmarketstats.miste.fr/globalStats/) -- [Minecraft Marketplace Partners](https://www.playthismap.com/partners) - -## Other useful Links - -- [UUID v4 Generator (online)](https://www.uuidgenerator.net/version4) -- [Minecraft Marketplace partner Twitter list](https://twitter.com/i/lists/1191945551853629442?s=09) -- [Minecraft.net Official Add-ons page](https://www.minecraft.net/en-us/addons) -- [Run Bedrock on Linux](https://github.com/Element-0/ElementZero) -- [Linux Packaging Scripts](https://github.com/ChristopherHX/linux-packaging-scripts) -- [Block Models](https://blockmodels.com/) -- [Bedrock Addons Reddit](https://www.reddit.com/r/BedrockAddons/) -- [Windows 10 Non-renderdragon install](https://support.playhive.com/windows-10-installing-non-renderdragon-clients/) -- [Bedrock Edition Realm Protocol](https://github.com/NobUwU/BeRP) -- [Java & Bedrock Client](https://github.com/kennyvv/Alex) -- [Skin Pack Generator](https://github.com/MedicalJewel105/bedrock-skin-pack-generator) +- [UUID v4生成器(在线)](https://www.uuidgenerator.net/version4) +- [市场创作者Twitter列表](https://twitter.com/i/lists/1191945551853629442?s=09) +- [官方附加包页面](https://www.minecraft.net/en-us/addons) +- [Linux运行基岩版](https://github.com/Element-0/ElementZero) +- [Linux打包脚本](https://github.com/ChristopherHX/linux-packaging-scripts) +- [方块模型库](https://blockmodels.com/) +- [Reddit附加包社区](https://www.reddit.com/r/BedrockAddons/) +- [非RenderDragon客户端安装指南](https://support.playhive.com/windows-10-installing-non-renderdragon-clients/) +- [领域服务器协议](https://github.com/NobUwU/BeRP) +- [跨平台客户端](https://github.com/kennyvv/Alex) +- [皮肤包生成器](https://github.com/MedicalJewel105/bedrock-skin-pack-generator) \ No newline at end of file diff --git a/docs/wiki/meta/using-schemas.md b/docs/wiki/meta/using-schemas.md index ff8f4da4..a744b726 100644 --- a/docs/wiki/meta/using-schemas.md +++ b/docs/wiki/meta/using-schemas.md @@ -1,5 +1,5 @@ --- -title: Using Schemas +title: 使用Schema mentions: - SirLich - MedicalJewel105 @@ -7,57 +7,63 @@ mentions: - KalmeMarq --- -A JSON schema gives you two things: validation to be sure that your JSON has the correct structure and (depending on editor support) IntelliSense to help you write your JSON correctly, to begin with. Schemas are nice because they give you instant feedback when you screw something up, but they can't catch everything. +# 使用Schema -JSON schemas are just JSON files themselves and don't do anything on their own. You can write your own or use somebody else's. There's a handful of schemas for Bedrock out there already. Since none of the schemas are "official" (that I know of), and since Bedrock is a moving target, there will probably be some inaccuracies in any schema that you find. So keep that in mind: sometimes the issue will be in your code, sometimes the schema may be wrong. If you find a wrong schema, consider improving it and giving the author a pull request to our collective benefit. + -To get the validation working, you'll need a validator. You have many options here, including editor-specific options. +JSON Schema能为您提供两大核心功能:**验证**确保JSON结构正确性,以及**智能感知**辅助编写(具体取决于编辑器支持)。Schema的优势在于能即时反馈错误,但需注意它无法捕捉所有潜在问题。 -## Schemas +Schema本身也是JSON文件,需借助验证工具发挥作用。您可以使用现有Schema或自行编写。目前已有多个适用于Minecraft基岩版的Schema,但请注意这些Schema并非官方认证(据我所知),且基岩版持续更新迭代,因此任何现有Schema都可能存在不准确之处。请保持理性认知:问题可能出在您的代码,也可能是Schema本身存在缺陷。若发现Schema错误,建议贡献改进并向作者提交Pull Request,共同完善生态。 -Many schemas exist, with many minor differences. Try out different schemas and see which one works best for you: +## Schema列表 -| Author | Supports | Note | -| ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | -| [Assassin](https://github.com/aexer0e/bedrock-schema) | Behavior pack entity file | The original Schema this article was written for | -| [Tschrock's](https://github.com/bedrock-studio/bedrock-json-schemas/) | Manifest, Actor Animation Controller, Actor Animations, Actor Resource Definition, Render Controller, Geometry | | -| [stirante](https://github.com/stirante/bedrock-shader-schema/) | Shaders | | -| [KalmeMarq](https://github.com/KalmeMarq/Bugrock-JSON-UI-Schemas/) | JSON UI files (including _ui_defs.json and _global_variables.json) | | +现有多种Schema各具特色,建议尝试不同方案选择最适合您的: -## VSCode +| 作者 | 支持范围 | 备注 | +| -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | +| [Assassin](https://github.com/aexer0e/bedrock-schema) | 行为包实体文件 | 本文最初基于此Schema编写 | +| [Tschrock's](https://github.com/bedrock-studio/bedrock-json-schemas/) | 清单文件、实体动画控制器、实体动画、实体资源定义、渲染控制器、几何体 | | +| [stirante](https://github.com/stirante/bedrock-shader-schema/) | 着色器 | | +| [KalmeMarq](https://github.com/KalmeMarq/Bugrock-JSON-UI-Schemas/) | JSON UI文件(包含_ui_defs.json 和 _global_variables.json) | | -To use this schema inside your JSON file in VSCode, simply add this line to your root object: +## VSCode配置 + +### 单文件配置 +在JSON文件根对象中添加以下字段即可启用Schema验证: `"$schema": "https://aexer0e.github.io/bedrock-schema/"` -It should look like something like this: +完整示例: - - -```json -"format_version": "1.14.0", -"$schema": "https://aexer0e.github.io/bedrock-schema/" -``` - -### Adding Schema to Workspaces - -If you want to utilize this schema to work with all of your files inside your Workspace, you can add it to your VS Code Workspace's settings. - -To do this, make sure you're in your Workspace, then press `Ctrl+Shift+P` and type and select `>Preferences: Open Workspace Settings (JSON)`. After that, add this to the root object - - - -```json -"settings": { - "json.schemas": [ - { - "fileMatch": [ - "*.json" - ], - "url": "https://aexer0e.github.io/bedrock-schema/" - } - ] +::: code-group +```json [示例] +{ + "format_version": "1.14.0", + "$schema": "https://aexer0e.github.io/bedrock-schema/" } ``` +::: -To test if it works, create a `.json` file, open an object, and see if you get the auto-completion options. (You can also press `Ctrl+Space` to force it into showing the available options.) +### 工作区配置 +若需为整个工作区启用Schema验证,请按以下步骤操作: + +1. 在目标工作区中按下 `Ctrl+Shift+P` +2. 输入并选择 `>Preferences: Open Workspace Settings (JSON)` +3. 在根对象中添加以下配置: + +::: code-group +```json [工作区设置] +{ + "settings": { + "json.schemas": [ + { + "fileMatch": ["*.json"], + "url": "https://aexer0e.github.io/bedrock-schema/" + } + ] + } +} +``` +::: + +验证配置是否生效:新建`.json`文件,在对象中输入内容时观察是否出现自动补全提示(也可手动按`Ctrl+Space`触发提示)。 \ No newline at end of file diff --git a/docs/wiki/meta/version-control.md b/docs/wiki/meta/version-control.md index 30c5a02e..4e84061d 100644 --- a/docs/wiki/meta/version-control.md +++ b/docs/wiki/meta/version-control.md @@ -1,89 +1,100 @@ --- -title: Version Control +title: 版本控制 mentions: - SirLich - sermah --- -Version control is the concept of backing up your code iteratively, so you can roll back to specific versions as needed. Version control could be achieved at the most basic level by taking a `.zip` of your addon every day and uploading it to google drive. This isn't unreasonable, but it has three significant difficulties that proper VCS (version control systems) fix: +# 版本控制 -- It isn't easy to compare versions -- It isn't easy to _actually_ roll-back to a previous version -- It doesn't do anything to help in team-collaboration + -This tutorial will teach the basics of a tool called `git`, and a free, online git storage service called `GitHub. Anyone may follow along, but you will receive the most benefit if you are working in a team environment or often lose your work because you forget to back up. +版本控制的核心概念是定期备份代码迭代版本,以便在需要时回滚到特定版本。最基本的版本控制可以通过每天将附加包打包成`.zip`并上传到谷歌网盘实现。这并非不合理,但存在三个显著缺陷,而专业的版本控制系统(VCS)能够有效解决: -This tutorial will not be focusing directly on teaching `git` or `GitHub`, as outside knowledge sources better do this. The focus will be on setting up these tools for Minecraft once the basics have been learned. +- 版本差异比对困难 +- 实际回滚到旧版本操作繁琐 +- 对团队协作毫无帮助 + +本教程将介绍`git`工具的基本使用方法,以及免费的在线git托管服务`GitHub`。任何人都可以跟随学习,但如果您身处团队协作环境或经常因忘记备份而丢失工作成果,将会获得最大收益。 + +本教程不会直接教授`git`或`GitHub`的基础操作,因为这些知识已有优质外部资源可供学习。重点将放在掌握基础后如何针对Minecraft项目进行工具配置。 ## Git -`git` is a tool installed locally on your machine and allows you to version your files. You can `commit` changes to your files with a small message (ex. "Fixed issue where dragons couldn't fly after being tamed"), view the full change-list, and quickly jump back to specific changes. +`git`是安装在本地计算机上的版本管理工具,可对文件进行版本控制。您可以通过简短信息(例如"修复驯服后龙无法飞行的BUG")提交(`commit`)文件变更,查看完整修改记录,并快速回滚到特定版本。 -Git is insanely powerful and the de-facto tool for all major programming projects. The most significant drawback for MC work is that it is _complicated_. Be patient while learning. +Git功能强大且是主流编程项目的标配工具。其应用于Minecraft开发的主要缺点是学习曲线陡峭。请保持耐心循序渐进。 -For a complete walkthrough of `git`, you should follow the following [git tutorial.](https://www.atlassian.com/git/tutorials/what-is-git) +完整的`git`学习请参考[git官方教程](https://www.atlassian.com/git/tutorials/what-is-git)。 ## GitHub -GitHub is a version of your git project (`repository`) that is hosted online. This allows multiple people to work on the same project at the same time and collaborate. This is very helpful for map-making. By hosting on Github, you can also (optionally) make your code public, making it easier than ever to share your addons with the world. +GitHub是git项目(`repository`仓库)的在线托管平台,允许多人同时协作开发。这对于地图制作尤为实用。通过GitHub托管,您还可以选择将代码公开,更方便地向世界分享您的附加包。 -For a complete walkthrough of using `Github`, you should follow this [github tutorial](https://guides.github.com/activities/hello-world/). +完整的GitHub学习请参考[GitHub入门指南](https://guides.github.com/activities/hello-world/)。 -## Vocabulary Quiz +## 术语自测 -If you've gotten this far, hopefully, you have a GitHub account and are familiar with `git` in a small way. The following terms will be used in this tutorial. If you don't know them, please google :) +如果您已学习至此,希望您已注册GitHub账号并对`git`有初步了解。以下术语将在教程中使用,若不熟悉请自行查询: -- repository -- branch -- commit -- github -- git +- repository(仓库) +- branch(分支) +- commit(提交) +- github +- git -# Setting up Git +# Git环境配置 -This assumes you are adding an _existing_ project to git. The steps are similar if you are starting from scratch. +本节假设您要将已有项目加入git管理。新建项目的操作流程类似。 -## Structure +## 目录结构 -The big issue with using `git` for addons is that `git` generally works by encapsulating a _single_ folder and managing it. Of course, in Bedrock Addons, assets are spread across two folders: The `BP`, and `RP`. To get around this issue, we will place our repository outside of the `com.mojang` folder entirely and then use window `junctions` to "copy" the folders in. +在附加包开发中使用`git`的主要问题在于:git通常通过管理单个文件夹实现版本控制,而基岩版附加包资源分散在`BP`和`RP`两个文件夹。为解决此问题,我们将仓库完全置于`com.mojang`文件夹之外,使用Windows符号链接(`junctions`)实现文件夹映射。 -There are many advantages of placing our project in a separate location: +将项目置于独立位置有以下优势: -- We can include additional files as needed, such as config files, tools, notes, .bb files, etc -- We can combine the RP and the BP into one repository -- All of our projects can be easily viewed in a simple location, instead of nested deep within com.mojang +- 可自由添加配置文件、工具、笔记、.bb文件等附加内容 +- 可将RP和BP整合至同一仓库 +- 所有项目可在统一位置查看,避免深埋于com.mojang目录中 -## Creating a Git Repository +## 创建Git仓库 -Pick a convenient location for your projects. I placed mine at `C:/sirlich/projects`. Make a new folder with the name of your map. We will be using `wiki` as the name of our mock project. +为项目选择合适的位置。示例使用`C:/sirlich/projects`。新建以项目命名的文件夹,示例项目名为`wiki`。 -Right-click the folder, and click `"Open git Bash"`. If this option doesn't appear, you can open `git bash` from the start menu and navigate your project folder. If you don't have `git bash` installed, you should do so now. +右键点击文件夹选择`"Open git Bash"`。若未显示此选项,可通过开始菜单打开`git bash`并导航至项目目录。若未安装`git bash`请立即安装。 -Type: `git init`. This will create a blank repository in your project. +输入命令:`git init`。这将在项目中创建空白仓库。 -## Linking your existing RP and BP +## 链接现有RP和BP -The next step is to make the repository aware of your RP and BP folders. We will be using window symlink "junctions". When we create a junction, we essentially create a wormhole in our file system that will make it appear like your files are in two places at once. Deleting/editing/adding files is perfectly copied over. +接下来通过创建Windows符号链接让仓库识别您的RP和BP文件夹。符号链接相当于文件系统的虫洞,使文件看似同时存在于两个位置。删除/编辑/添加操作会实时同步。 -Type: `mklink /J wiki_RP "C:/path/to/RP/in/com/mojang"` -Type: `mklink /J wiki_BP "C:/path/to/BP/in/com/mojang"` +输入命令: +`mklink /J wiki_RP "C:/path/to/RP/in/com/mojang"` +`mklink /J wiki_BP "C:/path/to/BP/in/com/mojang"` -When you are finished, you should see `wiki_RP` and `wiki_BP` in your project folder, containing all your assets, existing files, etc. +完成后,项目文件夹中将出现`wiki_RP`和`wiki_BP`目录,包含所有现有资源文件。 -You can now push this repository to `github`, following the tutorial above. +此时可按照前述教程将仓库推送至`github`。 -## Extra Files +## 附加文件 -Because we created our repository based on symlinks, we can add anything we like into the project folder without worrying about breaking the com.mojang folder. I like to track `.bb` files, cover-art files (`.kra` etc.). +由于我们通过符号链接创建仓库,可在项目文件夹中添加任意文件而不影响com.mojang目录。推荐追踪`.bb`文件、封面设计文件(如`.kra`格式)等。 -You can also add notes, video files, or anything else you want to track. +您还可以添加笔记、视频文件等需要版本控制的任何内容。 -## Working with your VCS +## VCS使用规范 -The main things to remember about working with VCS: +使用版本控制系统需牢记以下要点: -- Always `pull` before starting work -- Commit and `push` often -- Always `push` before stopping work -- If you screw up your files super bad, you can always reset to the last working version. If you commit/push often, hopefully, this wasn't too long ago. -- Always, and I mean `always` make good commit messages. It's vital when you have to roll back. +- 开始工作前务必先`pull`拉取最新版本 +- 频繁`commit`提交并`push`推送 +- 结束工作前必须`push`推送更改 +- 若文件严重损坏,可随时重置到最近可用版本。经常提交/推送能最大限度减少损失 +- 必须(强调)编写规范的提交信息,这在需要回滚时至关重要 + +::: code-group +```json [示例符号链接] +mklink /J demo_RP "C:/Users/Steve/AppData/Local/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/development_resource_packs/demoRP" +``` +::: \ No newline at end of file diff --git a/docs/wiki/modsdk/index.md b/docs/wiki/modsdk/index.md new file mode 100644 index 00000000..a19ab678 --- /dev/null +++ b/docs/wiki/modsdk/index.md @@ -0,0 +1,6 @@ +--- +title: 中国版Mod开发 +categories: + - title: 基础 + color: blue +--- diff --git a/docs/wiki/1-Mod脚本开发/1-快速入门Mod开发.md b/docs/wiki/modsdk/modsdk-intro.md similarity index 99% rename from docs/wiki/1-Mod脚本开发/1-快速入门Mod开发.md rename to docs/wiki/modsdk/modsdk-intro.md index b7a2c06c..618e0990 100644 --- a/docs/wiki/1-Mod脚本开发/1-快速入门Mod开发.md +++ b/docs/wiki/modsdk/modsdk-intro.md @@ -1,3 +1,8 @@ +--- +title: 🚀 快速入门 Mod 开发 +category: 基础 +--- + # 🚀 快速入门我的世界 Mod 开发 ::: warning :warning: 接下来需要 Python2 基础知识 diff --git a/docs/wiki/1-Mod脚本开发/为什么是System.md b/docs/wiki/modsdk/why-system.md similarity index 100% rename from docs/wiki/1-Mod脚本开发/为什么是System.md rename to docs/wiki/modsdk/why-system.md diff --git a/docs/wiki/nbt/experimental-education-edition.md b/docs/wiki/nbt/experimental-education-edition.md index 3046d0c5..c556e6ed 100644 --- a/docs/wiki/nbt/experimental-education-edition.md +++ b/docs/wiki/nbt/experimental-education-edition.md @@ -1,14 +1,18 @@ --- -title: Experiments in Education Edition -category: Tutorials +title: 教育版中的实验性功能 +category: 巧思案例 mentions: - Fabrimat - TheItsNameless tags: - - easy - - Last updated for Version 1.18.32 (MEE) + - 简单 + - 最后更新于版本1.18.32(教育版) --- +# 教育版中的实验性功能 + + + [structure]: /assets/images/nbt/structure.png [int]: /assets/images/nbt/int.png [list]: /assets/images/nbt/list.png @@ -16,22 +20,22 @@ tags: [string]: /assets/images/nbt/string.png [byte]: /assets/images/nbt/byte.png -Education Edition is a variant of Bedrock Edition with some different features and limitations. -For security reasons it doesn't allow you to enable Experimental Features from the game. +教育版是基于基岩版的一个特殊版本,具有不同的功能特性与使用限制。 +出于安全考虑,该版本不允许在游戏中直接启用实验性功能。 -## Editing NBT +## 编辑NBT数据 ::: warning -Always make a backup of your data before editing NBT files! +在编辑NBT文件前请务必备份存档! -Experimental features may not be compatible with every device and can cause your world to behave in unexpected way. +实验性功能可能无法兼容所有设备,并可能导致您的世界出现异常行为。 ::: -1. Extract the level.dat from your .mcworld, .mctemplate or com.mojang world folder. -2. Open the file with NBT editor (NBT Studio for example). -3. Select on the first node which is ![][structure] level.dat -4. Create a new compound tag called ![][compound] experiments -5. Select the new node and create a new ![][byte] byte with the name of the feature you need with a value of 1, which on 1.18.32 are: +1. 从.mcworld、.mctemplate或com.mojang世界文件夹中提取level.dat文件 +2. 使用NBT编辑器(例如NBT Studio)打开该文件 +3. 选中根节点(显示为![][structure] level.dat) +4. 新建一个名为![][compound] experiments的复合标签 +5. 选中该节点并新建一个![][byte]字节类型值,名称填写需要启用的功能名称,数值设为1。在1.18.32版本中可用的功能包括: - data_driven_biomes - data_driven_items - experimental_molang_features @@ -45,8 +49,19 @@ Experimental features may not be compatible with every device and can cause your ![](/assets/images/nbt/experiments-education-edition/experiments-file.png) -Finally, save the file and put it back in the world package or directory. +最后保存文件并放回原世界文件包或目录中。 -## Tips -Education Edition is usually one or two versions behind the classic Bedrock Edition, so you'll always know in advance which experimental features will be added to the stable gameplay and which will be modified or removed. -Try to add only features that will persist over time if you want to use that world in your classroom. +## 使用建议 +教育版通常会比标准基岩版落后一到两个版本,这意味着您可以提前知晓哪些实验性功能将被加入正式版,哪些可能被修改或移除。 +如果需要在教学环境中使用这些世界,建议仅启用那些长期稳定的功能。 + +::: code-group +```json [示例配置] +{ + "experiments": { + "data_driven_biomes": 1b, + "vanilla_experiments": 1b + } +} +``` +::: \ No newline at end of file diff --git a/docs/wiki/nbt/index.md b/docs/wiki/nbt/index.md index 6bba6e27..6ea6e7bd 100644 --- a/docs/wiki/nbt/index.md +++ b/docs/wiki/nbt/index.md @@ -1,10 +1,10 @@ --- title: NBT categories: - - title: General + - title: 基础 color: blue - - title: Tutorials + - title: 巧思案例 color: green - - title: NBT in Depth + - title: NBT深度解析 color: red --- \ No newline at end of file diff --git a/docs/wiki/nbt/mcstructure.md b/docs/wiki/nbt/mcstructure.md index 02b7c835..2c7b314b 100644 --- a/docs/wiki/nbt/mcstructure.md +++ b/docs/wiki/nbt/mcstructure.md @@ -1,6 +1,6 @@ --- title: .mcstructure -category: General +category: 基础 mentions: - SirLich - MedicalJewel105 @@ -13,115 +13,122 @@ mentions: [compound]: /assets/images/nbt/compound.png [string]: /assets/images/nbt/string.png -### Saving and Loading +# .mcstructure -The **Export** button creates `.mcstructure` files in a structure block. The files must be placed in a behavior pack to load them in-game with a load structure block. The path determines the structure identifier, which is typed into the structure block to load the structure. + -**Examples:** +### 保存与加载 + +**导出**按钮会在结构方块中创建`.mcstructure`文件。这些文件必须放置在行为包中,才能通过加载结构方块在游戏中载入。文件路径决定了结构标识符,该标识符需要输入到结构方块中以加载结构。 + +**示例:** `BP/structures/house.mcstructure` → `mystructure:house` `BP/structures/dungeon/entrance.mcstructure` → `dungeon:entrance` `BP/structures/stuff/towers/diamond.mcstructure` → `stuff:towers/diamond` -The first subfolder defines the namespace, and subsequent folders define the path, ending with the structure file's name. +第一个子文件夹定义命名空间,后续文件夹定义路径,最后以结构文件名结尾。 -Note that any files directly in the `structures` folder are given the `mystructure` namespace. If a structure exists in the `structures` folder and shares a name with a structure in an explicit `mystructure` folder, the game produces the following content log warning: +注意:直接放置在`structures`文件夹中的文件会被分配`mystructure`命名空间。如果`structures`文件夹中的结构与显式`mystructure`文件夹中的结构同名,游戏会产生以下内容日志警告: ``` -[structure][warning]-There was a conflict loading a structure in the default namespace. A structure with the name was found both in the root directory and the mystructure directory. +[structure][warning]-在默认命名空间中加载结构时发生冲突。发现名称的结构同时存在于根目录和mystructure目录。 ``` -In this case, the file in the `mystructure` folder is the one that "wins," resulting in the file directly in the `structures` folder being ignored. +这种情况下,`mystructure`文件夹中的文件会"胜出",导致直接存放在`structures`文件夹中的文件被忽略。 -### File Format +### 文件格式 -`mcstructure` files are uncompressed [NBT files](https://wiki.vg/NBT#Specification). Like all Bedrock Edition NBT files, they are stored in little-endian format. The tag structure is as follows: +`mcstructure`文件是未压缩的[NBT文件](https://wiki.vg/NBT#Specification)。与所有基岩版NBT文件一样,它们以小端格式存储。标签结构如下: -> ![Integer][int] `format_version`: Currently always set to `1`. +::: code-group +```nbt [结构文件] +> ![整数][int] `format_version`: 当前固定为`1`。 > -> ![List][list] `size`: List of three integers describing the size of the structure's bounds. +> ![列表][list] `size`: 包含三个整数的列表,描述结构边界尺寸。 > -> > ![Integer][int] Size of the structure in the X direction. +> > ![整数][int] X轴方向尺寸 > > -> > ![Integer][int] Size of the structure in the Y direction. +> > ![整数][int] Y轴方向尺寸 > > -> > ![Integer][int] Size of the structure in the Z direction. +> > ![整数][int] Z轴方向尺寸 > -> ![Compound][compound] `structure`: Actual data compound. +> ![复合标签][compound] `structure`: 实际数据结构 > -> > ![List][list] `block_indices`: List containing two sublists, one for each layer. These contain the blocks in the structure. Each block is stored as an integer index into the palette (see below). Proceeds in ZYX order from the lowest corner to the highest one. For example, if the structure size is `[2,3,4]`, then the 24 (product of the dimensions) values in each layer list represent the blocks located at `[(0,0,0), (0,0,1), (0,0,2), (0,0,3), (0,1,0), (0,1,1), (0,1,2), (0,1,3), (0,2,0), (0,2,1), (0,2,2), (0,2,3), (1,0,0), (1,0,1), (1,0,2), (1,0,3), (1,1,0), (1,1,1), (1,1,2), (1,1,3), (1,2,0), (1,2,1), (1,2,2), (1,2,3)]` relative to the origin. Index values equal to `-1` indicate no block, causing any existing block to remain upon loading. This occurs when structure voids are saved, and is the case for most blocks in the second layer. Both layers share the same palette. +> > ![列表][list] `block_indices`: 包含两个子列表(分别对应两个层级)。这些列表包含结构中的方块索引,每个索引指向调色板(见下文)。按ZYX顺序从最低角到最高角排列。例如,结构尺寸为`[2,3,4]`时,每个层级列表中的24个值(各维度乘积)代表位于`[(0,0,0), (0,0,1)...(1,2,3)]`的相对坐标。`-1`表示无方块,加载时保留原有方块(结构空位保存时会生成此值,第二层级大部分方块为此情况)。两个层级共享同一调色板。 > > -> > > ![List][list] of ![Integer][int] Indices for blocks in the primary layer. +> > > ![列表][list] of ![整数][int] 主层级方块索引 > > > -> > > ![List][list] of ![Integer][int] Indices for blocks in the secondary layer. This layer is usually empty, except for water when the block here is waterlogged. +> > > ![列表][list] of ![整数][int] 次层级方块索引(通常为空,仅在含水方块时存在) > > -> > ![List][list] of ![Compound][compound] `entities`: List of entities as NBT, stored exactly the same as entities in the world file itself. Tags like `Pos` and `UniqueID` are saved, but replaced upon loading. +> > ![列表][list] of ![复合标签][compound] `entities`: 实体NBT数据,存储方式与存档文件中的实体完全相同。`Pos`、`UniqueID`等标签会被保存,但加载时会被替换。 > > -> > ![Compound][compound] `palette`: Contains multiple named palettes, presumably to support multiple variants of the same structure. However, currently, only `default` is saved and loaded. +> > ![复合标签][compound] `palette`: 包含多个命名调色板(理论上支持同一结构的多个变体)。目前仅`default`会被保存和加载。 > > -> > > ![Compound][compound] A single palette (currently only named `default`). +> > > ![复合标签][compound] 单个调色板(当前仅`default`) > > > -> > > > ![List][list] `block_palette`: List of block states. This list contains the ordered entries that the block indices are referring to. +> > > > ![列表][list] `block_palette`: 方块状态列表。该列表包含方块索引引用的有序条目。 > > > > -> > > > > ![Compound][compound] A single block state. +> > > > > ![复合标签][compound] 单个方块状态 > > > > > -> > > > > > ![String][string] `name`: The block's identifier, such as `minecraft:planks`. -> > > > > > ![Compound][compound] `states`: The block's states as keys and values. Examples: `wood_type:"acacia"`, `bite_counter:3`, `open_bit:1b`. The values are the appropriate NBT type for the state: strings for enum values, integers for scalar numbers, and bytes for boolean values. -> > > > > > ![Integer][int] `version`: Compatibility versioning number for this block (currently `17959425` as of writing, in 1.19). +> > > > > > ![字符串][string] `name`: 方块ID(如`minecraft:planks`) +> > > > > > ![复合标签][compound] `states`: 方块状态键值对(例如`wood_type:"acacia"`, `bite_counter:3`, `open_bit:1b`)。值类型与状态匹配:枚举值用字符串,数值用整数,布尔值用字节。 +> > > > > > ![整数][int] `version`: 方块兼容版本号(当前版本为`17959425`,对应1.19) > > > > -> > > > ![Compound][compound] `block_position_data`: Contains additional data for individual blocks in the structure. Each key is an integer index into the flattened list of blocks inside of `block_indices`. Layer is unspecified as it is irrelevant. +> > > > ![复合标签][compound] `block_position_data`: 包含结构中单个方块的附加数据。键为`block_indices`展开列表中的整数索引(层级无关)。 > > > > -> > > > > ![Compound][compound] ``: A single piece of additional block data, applied to the block at its index position. +> > > > > ![复合标签][compound] ``: 应用于指定索引方块的附加数据 > > > > > -> > > > > > ![Compound][compound] `block_entity_data`: Block entity data as NBT, stored the same as block entities in the world file itself. Position tags are saved, but replaced upon loading. No other objects seem to exist adjacent to this one at this time. +> > > > > > ![复合标签][compound] `block_entity_data`: 方块实体NBT数据,存储方式与存档文件中的方块实体相同。位置标签会被保存,但加载时替换。目前未发现其他相关对象。 > -> ![List][list] `structure_world_origin`: List of three integers describing where in the world the structure was initially saved. Equal to the position of the saving structure block, plus its offset settings. This is used to determine where entities should be placed when loading. An entity's new absolute position is equal to its old position, minus these values, plus the origin of the structure's loading position. +> ![列表][list] `structure_world_origin`: 包含三个整数的列表,描述结构在存档中的原始保存位置。等于保存结构方块的位置加上偏移设置。用于确定加载时实体的放置位置。实体新绝对位置等于旧位置减去该值,再加上结构加载位置的原点。 > -> > ![Integer][int] Structure origin X position. -> > ![Integer][int] Structure origin Y position. -> > ![Integer][int] Structure origin Z position. - -### What Happens If... - -Results from testing to see what happens when modified structure files are loaded: - -- If the dimensions in `size` exceed the vanilla save the limit of `64*256*64`, the structure can still be loaded just as expected. -- If the values in the block layer lists are not int tags, all values are treated as `0`. -- If a value in the block layer list is equal to or larger than the palette size or less than `-1`, an air block is placed. -- If the `default` palette is not present, loading the structure results in no blocks being placed. -- If any of the tags that have constant names are unspecified or are the wrong tag type, the structure fails to load with the following content log error: - -``` -[Structure][error]-Loading structure '` from behavior pack: '' | "" field, a required field, is missing from the structure. +> > ![整数][int] 结构原点X坐标 +> > ![整数][int] 结构原点Y坐标 +> > ![整数][int] 结构原点Z坐标 ``` -- If `block_indices` does not contain exactly two values, the structure fails to load with the following content log error: +### 特殊情况测试 + +修改结构文件后的加载测试结果: + +- 当`size`中的维度超过原版保存限制`64*256*64`时,结构仍能正常加载 +- 当方块层级列表中的值不是整数标签时,所有值会被视为`0` +- 当方块层级列表中的值等于或大于调色板尺寸,或小于`-1`时,会放置空气方块 +- 当`default`调色板不存在时,加载结构不会放置任何方块 +- 当任何固定名称的标签缺失或类型错误时,结构加载失败并产生以下日志错误: ``` -[Structure][error]-Loading structure '` from behavior pack: '' | The "block_indices" field should be an array with 2 arrays and instead we have arrays. +[Structure][error]-从行为包加载结构'`: '' | 结构中缺少必要字段"" ``` -- If the values inside of `block_indices` do not list tags, the structure fails to load with the following content log error: +- 当`block_indices`不包含正好两个值时,结构加载失败: ``` -[Structure][error]-Loading structure '` from behavior pack: '' | The "block_indices" field's first array is either missing or not a list. +[Structure][error]-从行为包加载结构'`: '' | "block_indices"字段应为包含2个数组的数组,当前检测到个数组 ``` -- If the length of the two lists in `block_indices` are not equal, the structure fails to load with the following content log error: +- 当`block_indices`中的值不是列表标签时: ``` -[Structure][error]-Loading structure '` from behavior pack: '' | The "block_indices" field's arrays need to both be the same size. +[Structure][error]-从行为包加载结构'`: '' | "block_indices"字段的第一个数组缺失或不是列表 ``` -- If the length of the two lists in `block_indices` does not equal the product of the structure's dimensions, the structure fails to load with the following content log error: +- 当`block_indices`两个列表长度不相等时: ``` -[Structure][error]-Loading structure '` from behavior pack: '' | The "block_indices" field should have as many elements as defined by the "size" field. +[Structure][error]-从行为包加载结构'`: '' | "block_indices"字段的两个数组必须长度相同 ``` -## NBT Editors +- 当`block_indices`列表长度与结构尺寸乘积不符时: -You can find download links for some NBT editors [here](/meta/useful-links#software-installed). +``` +[Structure][error]-从行为包加载结构'`: '' | "block_indices"字段元素数量应与"size"字段定义的数量一致 +``` + +## NBT编辑器 + +NBT编辑器下载链接请访问[此处](/wiki/meta/useful-links#software-installed)。 --- -[Original Credit](https://gist.github.com/tryashtar/87ad9654305e5df686acab05cc4b6205) +[原始文档来源](https://gist.github.com/tryashtar/87ad9654305e5df686acab05cc4b6205) \ No newline at end of file diff --git a/docs/wiki/nbt/nbt-in-depth.md b/docs/wiki/nbt/nbt-in-depth.md index d2792d29..8ba002fe 100644 --- a/docs/wiki/nbt/nbt-in-depth.md +++ b/docs/wiki/nbt/nbt-in-depth.md @@ -1,64 +1,74 @@ --- -title: About NBT (Named Binary Tag) -category: NBT in Depth +title: NBT深度解析 +category: NBT深度解析 mentions: - ConsoleTerm - SmokeyStack - ThomasOrs tags: - - expert + - 专家 --- -NBT (Named Binary Tag) is a name for data encoding format at the binary level, you certainly know format JSON which is based on the text level. Therefore, we will be able to use the JSON format for some examples, you may also notice that minecraft itself uses JSON to represent NBT in commands such as java commands or simplified bedrock commands ( `/give`, `/replaceitem`). See [NBT Commands](/commands/nbt-commands) . In this article, we will show NBT in much more detail than you will ever expect, because what you could see in the commands is far from NBT, and we will show you how NBT works and how to read it, also how `Minecraft BE` itself uses it as well. +# NBT深度解析 -## NBT Tags and Data Types -NBT, just like JSON, has given types and knows how to read them, for example JSON knows that a compound object starts with the symbol `{` and ends with `}`, it also knows that when it has to read a string, the string always starts with the symbol ", this means that we want to learn to read and understand NBT so you need to know when a composite object starts, and how to read individual types. -Now let's look at the table of NBT tags for NBT types and how they are marked in NBT. -As it was said, NBT works on a binary level, so you need to know that the smallest data type is a byte, which is 8 bits in size. And individual types can contain multiple bytes, but they can never be 1/2 byte extra or less, not possible! : ) -We also cannot say how the tags should be named, because everyone can call NBT tags differently, but they must always have the same binary base (`id`), id is represented by one byte. + -| Name | Binary ID | Binary Size | Description | -| :----------------: | --------: | :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Byte | 0x01 | 1 byte (8-bits) | One byte size type | -| Int16 (short) | 0x02 | 2 bytes (16-bits) | A two-byte type | -| Int32 (intiger) | 0x03 | 4 bytes (32-bits) | A four-byte type | -| Int64 (long) | 0x04 | 8 bytes (64-bits) | An eight-byte type | -| Float | 0x05 | 4 bytes (32-bits) | A four-byte type with regular decimal precision | -| Double | 0x06 | 8 bytes (64-bits) | An eight-byte type with higher decimal precision | -| String | 0x08 | Predefined | A string type that has a predefined size. Text uses UTF-8 encoding | -| List | 0x09 | Predefined | A list type with a predefined size and defining type for the elements in the list | -| Compoud | 0x0A (10) | Undefined | Type compound, the compound does not have a predefined size, so it is necessary to read the keys and values until we do not encounter the tag for ending the compound. | -| End of the Compoud | 0x00 | 0 bytes | This tag is not a type but only a tag and can only be used depending on the compound. It marks the end of a compound | -| Byte List | 0x07 | Predefined | List type of Byte and predefined size, not commonly used by Minecraft BE | -| Int List | 0x0B (11) | Predefined | List type of Int and predefined size, not commonly used by Minecraft BE | -| Long List | 0x0C (12) | Predefined | List type of Long and predefined size, not commonly used by Minecraft BE | +NBT(命名二进制标签)是一种二进制层级的编码格式,正如你熟悉的基于文本层级的JSON格式。因此我们可以用JSON格式举例说明,你可能也注意到Minecraft本身在命令中使用JSON来表示NBT(如Java版命令或简化的基岩版命令`/give`、`/replaceitem`)。详见[NBT命令](/wiki/commands/nbt-commands)。本文将深入解析NBT的运作原理、读取方式以及`Minecraft BE`如何应用它,其详细程度远超你在命令中接触的NBT表象。 -You may notice that there is no boolean value like in JSON and that means we will express true false values as 1 and 0 using Byte. +## NBT标签与数据类型 +与JSON类似,NBT具备类型识别系统。例如JSON通过`{}`符号识别复合对象,通过`"`识别字符串。要理解NBT,需要掌握复合对象的起始标记和各类型的读取方式。 -## How to read/write NBT tags -The same reading method applies to all numbers, read as many bytes as the number tag type is large, such as: Int16 (short) is 2 bytes in size, so I will read 2 bytes, but you need to know that Minecraft BE uses the [little-endian](#little-endian), unlike Java, it uses big-endian. [Little-endian](#little-endian) is a way to write or read bytes of numbers. +NBT基于二进制操作,最小单位为8位字节。各类型占用固定字节数,不存在半字节情况。注意类型名称可能有不同叫法,但二进制标识符(ID)始终由1字节表示。 -### Reading Types -Type is always one byte in size, so we read the type and find out what to read next for the tag. +| 名称 | 二进制ID | 二进制大小 | 描述 | +| :----------------: | -------: | :--------------- | :------------------------------------------------------------------------------------------------------------------------------- | +| 字节 | 0x01 | 1字节(8位) | 单字节类型 | +| Int16(短整型) | 0x02 | 2字节(16位) | 双字节类型 | +| Int32(整型) | 0x03 | 4字节(32位) | 四字节类型 | +| Int64(长整型) | 0x04 | 8字节(64位) | 八字节类型 | +| 浮点 | 0x05 | 4字节(32位) | 常规精度浮点数 | +| 双精度 | 0x06 | 8字节(64位) | 高精度浮点数 | +| 字符串 | 0x08 | 预定义长度 | UTF-8编码文本,前接2字节长度标识 | +| 列表 | 0x09 | 预定义长度 | 元素类型统一,前接4字节元素数量 | +| 复合标签 | 0x0A (10)| 未定义长度 | 通过遍历键值对读取,直到遇到结束标记 | +| 复合标签结束标记 | 0x00 | 0字节 | 仅作为复合标签结束标识 | +| 字节列表 | 0x07 | 预定义长度 | 基岩版不常用 | +| 整型列表 | 0x0B (11)| 预定义长度 | 基岩版不常用 | +| 长整型列表 | 0x0C (12)| 预定义长度 | 基岩版不常用 | -### Reading Numbers -When reading a number, it is necessary to know what type of number we are reading, we can find out by reading the type *([Reading types](#reading-types))*. Then when we know what type of number we have to read, we read it, for example, if we know that we want type `3`, then we look in the table and we know that type 3 is a number of 4-bytes size, so we read 4 bytes. All numbers ***BE*** reads/writes with [little-endian](#little-endian) method. +注意NBT没有布尔类型,需用字节类型的1/0表示true/false。 -### Reading Strings -When reading a string, you need to know its length in bytes, this string length is always written with Int16 (short) `2 bytes` ([how to read numbers](#reading-numbers)) before the string, i.e. first we read the number, then we read the number of bytes of the number we read before, after we know the bytes we can stuff them through UTF-8 encoding and we get text from them. +## NBT标签读写方法 +所有数值类型按字节长度读取,基岩版采用[小端序](#小端序)编码,与Java版的大端序相反。 -### Reading Lists -When reading a list, we must first read the list ([type](#reading-types)), whether this list contains numbers or other lists or strings, etc. So first we read the type of this list, then we read the [number](#reading-numbers) of elements which is written as an Int32 (int) number, so we read 4 bytes, now we know the type of our elements and their count, so we read this type as many times as we know from the readed number before. Reading the size of a list is not the same as reading the size of a string! Should read Int32 no Int16! This solution does not apply to `Byte-List, Int-List, Long-List`! +### 类型读取 +始终读取1字节确定后续数据类型。 -### Reading Compouds -Compound has all properties named so when reading an property it is always necessary to read its name as well. The procedure for reading Compoud is rather simple. First, we read the type, the type can be anything, but if it is equal to an empty byte, then it is the end of the compound and then we jut stop reading, but if the type is not equal to the Compoud Ending tag, then the significant type of the property that we will read. The read property is always followed by the name (key), which needs to be read as a [string](#reading-strings), and after the string is read, then we can read value. +### 数值读取 +根据类型确定字节数(如类型3读取4字节)。所有数值使用[小端序](#小端序)处理。 -## Minecraft BE NBT files -When reading Minecraft NBT files, it is always important to be careful if there is no Bedrock Header at the beginning of the file, see [Bedrock NBT Header](#bedrock-nbt-file-header), but not all MCBE NBT files contain this header, for example `.mcstructure` also does not contain a Bedrock NBT header, unlike `level.dat`. -You also need to pay attention to the root element in the file, i.e. the list or compoud, -The root element also looks like a property, so you need to read the name of this root property, although Bedrock does not use these names, so these names are empty, but they are there. -Here is how .mcstructure looks like where JSON represents NBT. -```json +### 字符串读取 +先读取2字节长度标识(Int16),再按对应字节数读取UTF-8编码内容。 + +### 列表读取 +1. 读取列表元素类型(1字节) +2. 读取元素数量(Int32,4字节) +3. 按数量循环读取元素 + +注意:字节列表/整型列表/长整型列表的读取方式不同 + +### 复合标签读取 +1. 读取类型标记: + - 0x00:结束读取 + - 其他类型:继续读取键值对 +2. 读取键名字符串 +3. 读取对应类型值 + +## 基岩版NBT文件解析 +注意文件开头的[基岩版NBT文件头](#基岩版nbt文件头),如`.mcstructure`文件无此头而`level.dat`有。根元素需作为匿名属性处理(即使键名为空)。 + +::: code-group +```json [.mcstructure示例] "":{ "format_version":1, "size":[],//... @@ -66,23 +76,27 @@ Here is how .mcstructure looks like where JSON represents NBT. "structure_world_origin":[]//.. } ``` -:::warning -This example shows that it is also necessary to read the name of the basic element, although it is usually unused and empty. ::: -## Writing NBT -There is no certain procedure for writing, because it is the same mothods as when reading, but backwards. That's why we recommend first understanding NBT and learning to read it correctly, then it won't be difficult to write NBT. +:::warning +此示例表明即使根元素键名通常为空,仍需进行读取操作。 +::: -## Bedrock NBT File header -The NBT bedrock Header is indicated by two 4-byte numbers, the first is always 8 and the second indicates the size of the nbt structure in bytes. E.g. - - `08 00 00 00` - `bf 00 00 00` - - < always 8 > < always the size of the NBT structure - exclude headers 8 bytes> +## NBT写入规范 +写入流程与读取逆向操作,需先掌握读取原理。 -## Little-Endian -Little-Endian is the common method of writing numbers in bytes to streams or files. -It's not a science and it's easy to understand. So if Int16 `(short)` of value `0x5a72` then we convert it to bytes [`0x5a`, `0x72`] and then reverse their order that means [`0x72`, `0x5a`] and write d file: `72 5a`. It may seem illogical, but little-endian is almost always used when writing and reading from files. A single `byte` is the same in both methods because it is one byte in size. For example: -- Int64 (long) `0x11223344aabbccdd` -- Split to 8 bytes `0x11 0x22 0x33 0x44 0xAA 0xBB 0xCC 0xDD` -- Reverse `0xDD 0xCC 0xBB 0xAA 0x44 0x33 0x22 0x11` -- Write `dd cc bb aa 44 33 22 11` -- Done (when reading the number just go backwards this example.) +## 基岩版NBT文件头 +包含两个4字节数值: +1. 固定值8(0x08000000) +2. NBT结构体字节数(不含头部的8字节) + +示例: +- `08 00 00 00` - `bf 00 00 00` +- <固定值8> + +## 小端序 +数字按字节逆序存储的编码方式: +- Int16 `0x5a72` → 字节数组 `[0x72, 0x5a]` +- Int64 `0x11223344aabbccdd` → 存储为 `dd cc bb aa 44 33 22 11` + +读取时反向转换即可还原数值。单字节类型不受影响。 \ No newline at end of file diff --git a/docs/wiki/nbt/step-by-step-example.md b/docs/wiki/nbt/step-by-step-example.md index 79871331..31bd3a00 100644 --- a/docs/wiki/nbt/step-by-step-example.md +++ b/docs/wiki/nbt/step-by-step-example.md @@ -1,84 +1,85 @@ --- -title: Reading NBT Example -category: NBT in Depth +title: 读取NBT示例 +category: 基础 mentions: - ConsoleTerm tags: - - expert + - 专家 --- -Before going through this example, it is necessary to first familiarize yourself with NBT in its full beauty. See *[NBT in Depth](/nbt/nbt-in-depth)*. -Now we will show you how to read NBT, step by step, the format of what we will read will look something like this: +# 读取NBT示例 + + + +在进行本示例前,请先系统学习NBT的完整知识体系。参考*[深入理解NBT](/wiki/nbt/nbt-in-depth)*。 +现在我们将分步骤演示如何读取NBT数据,示例数据的格式如下: ```json "":{ - "myText":"My NBT text", + "myText":"我的NBT文本", "my Int32 Number":456, } ``` -When we don't know what to read, then we read the next byte. +当我们不知道后续数据类型时,需要读取下一个字节。 ![](/assets/images/nbt/VS_Editor_images/step1.png) -What did we read? We read number 10 and that means we will read compoud. We also know that we are at the root element property of this file now, so we need to read the name of our root element property. Name is string, so first we have to read the length of the text in bytes, and that is written by Int16 *(Short)*. +我们读取到了数字10,表示即将读取复合标签。此时我们处于文件的根元素属性,需要读取根元素属性的名称。名称是字符串类型,因此首先需要读取字符串长度(以Int16形式存储)。 ![](/assets/images/nbt/VS_Editor_images/step2.png) -The name size of our root element property is zero so we won't read any more bytes. We don't know what to read, so let's read another byte. +根元素属性名称的长度为0,因此无需继续读取字节。此时需要读取下一个字节来确定后续数据类型。 ![](/assets/images/nbt/VS_Editor_images/step3.png) -We already know that the next property in our root compound is type of string, but before we read our property value, we first read its name written such as string. So we read another 2 bytes to get the length of the string name from of our property. +已知根复合标签中的下一个属性是字符串类型,但在读取属性值之前,需要先读取属性名称。因此需要再读取2个字节来获取属性名称的长度。 ![](/assets/images/nbt/VS_Editor_images/step4.png) -We see that length of property name, it is 6 bytes long. So let's read the next 6 bytes. +属性名称长度为6字节,继续读取接下来的6个字节。 ![](/assets/images/nbt/VS_Editor_images/step5.png) -So we have read the Name of our property, which we can get in text form using UTF-8 encoding, that is: `myText`, then remember that the type of our property is string, so we repeat the process. -I'll read the next Int16 (2 bytes) again and we'll find out the length of our string value. +通过UTF-8编码转换后,得到属性名称:`myText`。接下来重复字符串类型的读取流程,读取下一个Int16(2字节)来获取字符串值的长度。 ![](/assets/images/nbt/VS_Editor_images/step6.png) -The string length of our property is 0x0B, so 11, so read another 11 bytes. +字符串长度为0x0B(十进制11),继续读取11个字节。 ![](/assets/images/nbt/VS_Editor_images/step7.png) -When we push our read bytes through UTF-8 encoding, it again returns the value: `My NBT text`, -what now? You don't know? So read the next byte to find out what to do next. +经过UTF-8解码得到属性值:`My NBT text`。此时需要读取下一个字节来确定后续数据类型。 ![](/assets/images/nbt/VS_Editor_images/step8.png) -So we read type 3, the 3 type is Int16 which contains 4 bytes. But before we read our number We have to find out the name of this property again. So? -Read the next two bytes to get the length of the name for this property. +读取到类型3(Int32类型),需要先读取属性名称的长度。读取接下来的2个字节。 ![](/assets/images/nbt/VS_Editor_images/step9.png) -So we know the length of the name 0x0f (15), Let's read the next 15 bytes and push it through UTF-8 encoding. +名称长度为0x0F(十进制15),继续读取15个字节并进行UTF-8解码。 ![](/assets/images/nbt/VS_Editor_images/step10.png) -Now we have the name of this property: `my Int32 Number`. Next let's read that Int32 => 4 bytes. +得到属性名称:`my Int32 Number`。接下来读取Int32类型的4个字节。 ![](/assets/images/nbt/VS_Editor_images/step11.png) -We read an Int32 that has the value `0x01c8` (456). -Again You don't know what to do next? Then just read another type of next property, so? 1 byte. +读取到的Int32值为`0x01c8`(十进制456)。继续读取下一个字节确认后续数据类型。 ![](/assets/images/nbt/VS_Editor_images/step12.png) -We read 0x00 (an empty byte), and that marks the end of the root compound. Then the reading of the compound ends, and since it is the ***root*** compound, we can finish reading it completely and have the entire NBT file read. -### NBT Example File -This is file what we use here for this example. +读取到0x00空字节,表示根复合标签结束。由于这是***根***复合标签,此时完成整个NBT文件的读取。 + +### NBT示例文件 +本示例所使用的NBT文件: Download NBT File +>下载NBT文件 -:::tip Important points to keep in mind - - The file may contain an NBT Bedrock Header, so be aware that such a situation may occur. See [NBT in Depth](/nbt/nbt-in-depth)>[NBT Bedrock Headers](/nbt/nbt-in-depth#bedrock-nbt-file-header). - - The closing null byte does not terminate the reading of the NBT as such, but merely marks the end of the current compound. - - All the numbers you read need to be read with little-endian, See [NBT in Depth](/nbt/nbt-in-depth)>[little-endian](/nbt/nbt-in-depth#little-endian). - - The first root NBT element in a file can only be a compound or a list. The root element/property in NBT files also has its own name, even though it is mostly empty, but it still needs to be read and avoid complications. -::: +:::tip 重要注意事项 + - 文件可能包含NBT基岩版文件头,需注意这种情况。参见[深入理解NBT](/wiki/nbt/nbt-in-depth)>[NBT基岩版文件头](/wiki/nbt/nbt-in-depth#bedrock-nbt-file-header) + - 结束空字节并不直接终止NBT读取,仅标记当前复合标签的结束 + - 所有数值均需按小端序读取,参见[深入理解NBT](/wiki/nbt/nbt-in-depth)>[小端序](/wiki/nbt/nbt-in-depth#little-endian) + - NBT文件的首个根元素只能是复合标签或列表。根元素的名称虽然通常为空,但仍需读取并妥善处理 +::: \ No newline at end of file diff --git a/docs/wiki/nbt/structure-limits.md b/docs/wiki/nbt/structure-limits.md index 6238c374..829abc54 100644 --- a/docs/wiki/nbt/structure-limits.md +++ b/docs/wiki/nbt/structure-limits.md @@ -1,47 +1,103 @@ --- -title: Extending Structure Limits -category: Tutorials +title: 扩展结构限制 +category: 巧思案例 mentions: - MedicalJewel105 tags: - - easy + - 简单 --- +# 扩展结构限制 + + + [structure]: /assets/images/nbt/structure.png [int]: /assets/images/nbt/int.png [list]: /assets/images/nbt/list.png [compound]: /assets/images/nbt/compound.png [string]: /assets/images/nbt/string.png -:::warning DEPRECATED -This method no longer works after 1.20.50 update. +:::warning 已弃用 +该方法在1.20.50版本更新后已失效。 ::: -By default, Minecraft doesn't allow you to save structures that are more than 64x255x64 in size. -In this guide you will learn how to extend structure box size for structure blocks. +默认情况下,Minecraft不允许保存超过64x255x64大小的结构。本教程将指导你如何扩展结构方块的可保存范围。 -## Editing NBT +## 编辑NBT数据 -1. Put a structure block into structure and export it. -2. Open your structure with NBT editor (NBT Studio in our case) and find your structure block. +1. 将结构方块放入结构中并导出 +2. 使用NBT编辑器(本文使用NBT Studio)打开结构文件,定位到结构方块数据 -If the only block you have in your structure is structure block, you will find its data here: +如果你的结构中仅包含结构方块,可以在此处找到对应数据: -![][structure] extending_structure_block.mcstructure -> ![][compound] structure -> > ![][compound] palette -> > > ![][compound] default -> > > > ![][compound] block_position_data -> > > > > ![][compound] 0 +::: code-group +```json [extending_structure_block.mcstructure] +> [compound] structure +> > [compound] palette +> > > [compound] default +> > > > [compound] block_position_data +> > > > > [compound] 0 +``` ![](/assets/images/nbt/structure-limits/nbt-screenshot-1.png) +::: -3. Set `xStructureSize`, `yStructureSize` and `zStructureSize` values to what you want. -4. Save the structure and load it in game. +3. 将`xStructureSize`、`yStructureSize`和`zStructureSize`的值修改为所需尺寸 +4. 保存结构文件并在游戏中加载 ![](/assets/images/nbt/structure-limits/result.png) -## Tips +## 使用技巧 -You can get this structure block to your inventory by pressing mouse scroll button while holding Ctrl. -It is recommended to use structure loading animations (Place by Block) when loading a huge structure. This will minimize lags. +- **快速获取结构方块**:按住Ctrl键时点击鼠标滚轮可获取当前结构方块 +- **优化加载性能**:加载大型结构时建议启用"按方块放置"加载动画,可有效减少卡顿 + +# 扩展结构限制 {#extending-structure-limits} + +:::tip 版本提示 +本文所述方法适用于基岩版1.20.50之前的版本 +::: + +通过修改NBT数据,你可以突破以下默认限制: +- X轴最大范围:64 → 384 +- Y轴最大范围:256 → 256(不可修改) +- Z轴最大范围:64 → 384 + +实际测试表明,修改后的结构在加载时可能出现以下现象: +- 超出区块边界的部分会循环加载 +- 过大的结构可能导致客户端性能下降 + +建议遵循以下最佳实践: +1. 使用`/testforblock`命令验证结构完整性 +2. 分区块逐步加载大型建筑 +3. 配合`/tickingarea`命令保持活动区块 + +```json +// 示例:修改后的NBT结构片段 +"structure": { + "palette": { + "default": { + "block_position_data": { + "0": { + "xStructureSize": 128, + "yStructureSize": 256, + "zStructureSize": 128 + } + } + } + } +} +``` + +:::caution 注意事项 +- 修改后的结构文件在不同版本间可能存在兼容性问题 +- 使用第三方NBT编辑器时请做好文件备份 +- 服务器环境需要同步所有客户端的结构文件 +::: + +通过合理运用这些技巧,你可以轻松实现以下建筑效果: +- 超大型红石计算机 +- 全景式地形景观 +- 多维度联动的复杂机关 + +最后更新:2023年11月(适用于基岩版1.19.80) \ No newline at end of file diff --git a/docs/wiki/particles/disabling-particles.md b/docs/wiki/particles/disabling-particles.md index f34a753b..ccb711ca 100644 --- a/docs/wiki/particles/disabling-particles.md +++ b/docs/wiki/particles/disabling-particles.md @@ -1,21 +1,24 @@ --- -title: Disabling Particles -category: Tutorials +title: 禁用粒子效果 +category: 巧思案例 tags: - - beginner + - 新手 mentions: - SirLich - Joelant05 - MedicalJewel105 --- -In the event that you want to disable a particle, it is recommended to do so from the particle file itself as opposed to simply making the particle texture transparent in `particles.png`. Additionally, disabling a particle might offer a slight performance boost compared to making it transparent, as transparent particles are still emitted (but not visible). +# 禁用粒子效果 -The basic idea of disabling a particle from emitting is as follows: + -RP/particles/some_vanilla_particle.json +当你需要禁用某个粒子效果时,建议直接在粒子文件中进行禁用,而不是简单地在 `particles.png` 中将粒子纹理设为透明。此外,与透明化处理相比,完全禁用粒子可能会带来小幅性能提升,因为透明粒子仍会被发射(只是不可见)。 -```json +禁用粒子发射的基本原理如下: + +::: code-group +```json [RP/particles/some_vanilla_particle.json] { "format_version": "1.10.0", "particle_effect": { @@ -28,13 +31,19 @@ The basic idea of disabling a particle from emitting is as follows: }, "components": { "minecraft:emitter_lifetime_expression": { - "activation_expression": 0, - "expiration_expression": 1 + "activation_expression": 0, // 立即激活 + "expiration_expression": 1 // 立即结束生命周期(单位:秒) }, "minecraft:emitter_rate_manual": { - "max_particles": 0 + "max_particles": 0 // 设置最大粒子生成数为0 } } } } ``` +::: + +**实现原理说明:** +1. 通过 `emitter_lifetime_expression` 组件将粒子发射器的生命周期设为瞬时(0秒激活,1秒后过期) +2. 使用 `emitter_rate_manual` 组件将最大粒子数设为0,彻底阻止粒子生成 +3. 保留原始渲染参数确保兼容性,但实际不会产生任何可见粒子 \ No newline at end of file diff --git a/docs/wiki/particles/index.md b/docs/wiki/particles/index.md index 83230842..e271ae85 100644 --- a/docs/wiki/particles/index.md +++ b/docs/wiki/particles/index.md @@ -1,10 +1,10 @@ --- -title: Particles +title: 粒子 Particles categories: - - title: General + - title: 基础 color: blue - - title: Tutorials + - title: 巧思案例 color: green - - title: Documentation + - title: 文档 color: red --- diff --git a/docs/wiki/particles/particles-and-sounds.md b/docs/wiki/particles/particles-and-sounds.md index 8630ee07..638b322b 100644 --- a/docs/wiki/particles/particles-and-sounds.md +++ b/docs/wiki/particles/particles-and-sounds.md @@ -1,8 +1,8 @@ --- -title: 'Particles and Sounds' -category: General +title: '粒子与音效' +category: 基础 tags: - - outdated + - 已过时 mentions: - SirLich - Joelant05 @@ -12,69 +12,71 @@ mentions: - solvedDev --- +# 粒子与音效 + + + :::danger -Some information from this page was copied [here](/visuals/animation-effects) +本页部分信息已迁移至[动画效果文档](/wiki/visuals/animation-effects) ::: -## Particles in Animation +## 动画中的粒子效果 -Minecraft Particles can be used in entity animations. For example, the phantom has an animation which emits the minecraft:phantom_trail particle constantly. Let's try to add a particle to our entity's attack animation. +Minecraft粒子效果可以应用于实体动画。例如,幻翼拥有持续释放minecraft:phantom_trail粒子的动画。让我们尝试在实体的攻击动画中添加粒子效果。 -`part of RP/entity/description/` +`资源包/entity/description/ 目录下` - - -```json +::: code-group +```json [实体描述文件示例] "particle_effects": { "l_explosion": "minecraft:large_explosion" }, ``` +::: -This piece of code is located in our resource entity file. Here we defined the shortname ("l_explosion") for the particle we are going to use, "minecraft:large_explosion". +这段代码位于资源包实体文件中。这里我们为将要使用的粒子"minecraft:large_explosion"定义了一个简称"l_explosion"。 -You can test a particle in-game with the `/particle ~ ~2 ~` command. You can view the full list of Vanilla Particles [here](https://minecraft.wiki/w/Particles). +可以通过指令`/particle <命名空间:粒子ID> ~ ~2 ~`在游戏中测试粒子效果。完整原版粒子列表可参考[Minecraft Wiki](https://minecraft.wiki/w/Particles)。 -Now for the Blockbench part. +现在进行Blockbench操作: -- Right click the bone were your particle will be emitted from, and choose 'Add Locator' with the anchor icon. Name it something distinct, like 'l_expl_emitter'. Now move the emitter to the desired location. +1. 右键点击要发射粒子的骨骼,选择锚点图标添加定位器,命名如"l_expl_emitter",并移动到目标位置 ![](/assets/images/guide/custom_particles_1.png) -_Note: you can also use locators to define where a lead will leash to, if you name your locator 'lead'._ +_注:命名为'lead'的定位器可定义栓绳连接点_ -- In the 'Animate' section, choose 'Animate Effects' on your timeline, then click on the '+' icon near the 'Particle' object. +2. 在动画时间轴中选择"Animate Effects",点击粒子对象旁的+号 ![](/assets/images/guide/custom_particles_2.png) -- You will see this menu on your left. 'Effect' asks for your particle's shortname, and 'Locator' asks for the name of your Locator/Emitter object. +3. 左侧面板中填写粒子简称和定位器名称 ![](/assets/images/guide/custom_particles_3.png) -_Note: you can add sounds to animations in a similar way._ +_注:音效添加方式类似_ ![](/assets/images/guide/custom_particles_4.jpg) -Now you're good to go! Save the model and the animations. If you did everything correctly, the defined particle will spawn whenever the entity attacks. _Of course you could put another particle on the walking animation's timeline (for example, hooves making dust) in the same way._ +完成保存后,实体攻击时将生成指定粒子效果。_同理可在行走动画中添加蹄印扬尘效果_ -## Custom Particles +## 自定义粒子 -Custom particles are defined in the `RP/particles` folder. As mentioned earlier on this page, you can summon particles using the '/particle' command (e.g in Behavior Animations) or using Resource Animation emitters. The best way to learn custom particles is to play around with the example files from the [Vanilla Example resource pack](https://www.minecraft.net/en-us/addons) and the Particle Example Pack, and of course, from the documentation on [bedrock.dev](http://bedrock.dev/r/Particles). +自定义粒子定义于`RP/particles`目录。可通过指令或动画发射器调用。建议通过[原版示例资源包](https://www.minecraft.net/en-us/addons)和[bedrock.dev粒子文档](http://bedrock.dev/r/Particles)学习。 -_Note: Skip to the end of this section for a tool to generate particle files visually._ +_提示:文末提供可视化粒子生成工具_ -File structure: - -- "identifier" is exactly what you'd expect: I'll use "wiki:curvy_particle" and "wiki_pink_hit" for the tutorial. File names do not matter. -- "texture" defines the texture file. Not that a single image file can hold textures for many particles. -- "material" is usually set to "particles_alpha" for particles. +文件结构说明: +- "identifier":粒子标识符(示例使用"wiki:curvy_particle") +- "texture":支持多粒子共用纹理图集 +- "material":通常设为"particles_alpha" ![](/assets/images/guide/custom_particles_5.png) -That is the texture I'm going to use, it's size is `16x16`. (`RP/particles/wiki_particles.png`). As you can see, it has 4 different textures in it, each of them being a `8x8`. The upper row (_starting/top left corner at at 0, 0_) is the flipbook texture for "wiki:curvy*particle" and the bottom row (\_top left corner at/starting at 0, 8*). We'll define this in the "billboard_texture" component. +使用16x16纹理图集(路径:`RP/particles/wiki_particles.png`),包含4个8x8子纹理。上排(0,0起始)用于"wiki:curvy_particle",下排(0,8起始)用于其他粒子。 -RP/particles/curvy_particle.json - -```json +::: code-group +```json [RP/particles/curvy_particle.json] { "format_version": "1.10.0", "particle_effect": { @@ -131,22 +133,17 @@ That is the texture I'm going to use, it's size is `16x16`. (`RP/particles/wiki_ } } ``` +::: -Here's the code for our first particle, "wiki:curvy_particle". Our texture file is defined. +参数解析: +- "texture_width/height":纹理图尺寸 +- "base_UV":粒子起始坐标(示例下个粒子为[0,8]) +- "size_UV":粒子纹理尺寸 +- "step_UV":帧切换步长 +- "frames_per_second":帧速率 -The components are quite complicated here, but they're explained well on the [Particle doc](http://bedrock.dev/r/Particles). Let's move forward to the `"minecraft:particle_appearance_billboard"` component for now. - -- "texture_width" and "texture_height" defines the size of the image file itself. -- "base_UV" in "flipbook" defines the top-left corner of the particle texture. For this particle it's at 0, 0, which is the upper left corner of the image itself. For the second particle, "wiki:pink_hit", "base_UV" will be at 0, 8, which is 8 pixels lower then the first location. -- "size_UV" defines the size of the particle's texture(8*8) on the image file(which is 16*16). -- "step_UV" is how far the flipbook needs to step in order to get the next particle texture. In this case it's 8, 0, which is 8 pixels to the right. -- "frames_per_second" is quite self-explainable. "max_frame" is the total number of frames for the particle. - -The second particle, "wiki:pink_hit". - -RP/particles/pink_hit.json - -```json +::: code-group +```json [RP/particles/pink_hit.json] { "format_version": "1.10.0", "particle_effect": { @@ -220,10 +217,9 @@ The second particle, "wiki:pink_hit". } } ``` +::: -Done! Now you have two custom particles that can be used in animations! - -It's rather tiresome to create particles that way, comparable to creating models without Blockbench. Luckily, you can use [Snowstorm](https://jannisx11.github.io/snowstorm/), a Visual Particle Generator. It's especially convenient to download the [VSC Snowstorm Extension](https://marketplace.visualstudio.com/items?itemName=JannisX11.snowstorm), which is going to create an interactive UI in Visual Studio Code itself for `.particle.json` files. +建议使用可视化工具[Snowstorm](https://jannisx11.github.io/snowstorm/)或[VSC扩展](https://marketplace.visualstudio.com/items?itemName=JannisX11.snowstorm)简化粒子创建。 ![](/assets/images/guide/custom_particles_6.jpg) `/particle wiki:pink_hit ~ ~2 ~` @@ -233,21 +229,19 @@ It's rather tiresome to create particles that way, comparable to creating models --- -## Defining Custom Sounds +## 自定义音效 -_You can find a more in-depth tutorial on custom sounds on [wiki.bedrock.dev](/concepts/sounds)._ +详细教程参见[Bedrock开发Wiki](/wiki/concepts/sounds) -Minecraft can read sound files in the `.ogg` (recommended) or `.wav` format. (You can look up an .mp3 to .ogg converter online). Personally, I usually get my sound effects from ZapSplat.com. +### 文件规范 +- 格式:推荐.ogg,支持.wav +- 路径:`RP/sounds/`子目录(示例使用`RP/sounds/mob/`) -Sound files are located in subfolders of the `RP/sounds/` folder. My skele_yaklin sound files are located under `RP/sounds/mob/yaklin_moo.ogg` and `RP/sounds/mob/yaklin_moo_2.ogg`. (I don't have more sound effects currently, thus I will be using same ones over and over, but ideally one would need more of those). +### 音效定义 +在`RP/sounds/sound_definitions.json`中注册: -### Sound Definition - -Now to define the sound's shortnames! This process is similar to defining block texture shortnames. It's done in `RP/sounds/sound_definitions.json`. - -RP/sounds/sound_definitions.json - -```json +::: code-group +```json [RP/sounds/sound_definitions.json] { "format_version": "1.14.0", "sound_definitions": { @@ -269,30 +263,16 @@ Now to define the sound's shortnames! This process is similar to defining block } } ``` +::: -We have 3 sound shortnames in total: +### 音效绑定 +通过`RP/sounds.json`关联实体事件: -1. `mob.yaklin.idle`, which refers to a random sound file from the "sounds": [] array. -1. `mob.yaklin.death` can be heard from the distance of 12 blocks: `max_distance": 12.0`. -1. And, lastly, `mob.yaklin.hurt`. - -### sounds.json - -Now we are about to call our sounds. We can do it either through the `/playsound <>` slash command or automatically in `RP/sounds.json`. Once again, this resembles block resource definition. - -![](/assets/images/guide/custom_particles_8.png) - -^ the file's structure. I recommend checking out the same file in the Example Resource Pack. - -RP/sounds.json/"entities": {}/"wiki:skele_yaklin": {} - -```json +::: code-group +```json [实体音效配置示例] "wiki:skele_yaklin": { "volume": 1.0, - "pitch": [ - 1.0, - 1.0 - ], + "pitch": [1.0, 1.0], "events": { "ambient": "mob.yaklin.idle", "hurt": "mob.yaklin.hurt", @@ -305,32 +285,24 @@ Now we are about to call our sounds. We can do it either through the `/playsound } } ``` +::: -Let's see how the sounds of the skele_yaklin are called in the entity's object. - -- The first "volume" and "pitch" are global, they are the starting point for every other of the entity's sounds. If you want the sounds to play exactly how they are, set both of them to 1; -- "events" include the automatic sounds to be played. There are a couple Vanilla events that will trigger automatically(you can see the whole list on the wiki.bedrock.dev page linked bove). All of the events call a sound's shortname. -- "ambient" plays occasionally, for example the sheep "baah" sound. -- "hurt" plays when the entity is hurt. -- "death" plays on death. -- "step" is the sound of the mob walking. I used the cow step sound, already included in the base game. - -That's it! Turn up your Sound volume in Settings>Audio, spawn in your mobs, and listen to the melodic cacophony of their new voices! +事件类型说明: +- ambient:环境音(如生物呼吸声) +- hurt:受伤音效 +- death:死亡音效 +- step:移动音效 --- ---- +## 进度总结 -## Your progress so far +**已完成:** +- 掌握动画粒子效果实现 +- 创建两种自定义粒子 +- 配置实体自定义音效 -**What you've done:** - -- Learned to include Particles in Animations -- Created two Custom Particles and learned to create more -- Defined custom Sounds for your custom entity; - -**What are you to do next:** - -- Create custom biomes -- Create custom generated Structures -- Be introduced to Scripting +**后续方向:** +- 自定义生物群系 +- 创建生成结构 +- 脚本系统入门 \ No newline at end of file diff --git a/docs/wiki/particles/particles.md b/docs/wiki/particles/particles.md index 3fa4f7a7..52249b21 100644 --- a/docs/wiki/particles/particles.md +++ b/docs/wiki/particles/particles.md @@ -1,43 +1,47 @@ --- -title: 'Intro to Particles' -category: General +title: '粒子系统入门' +category: 基础 tags: - - guide + - 指南 mentions: - SirLich - MedicalJewel105 - TheItsNameless --- -## Particle Systems +# 粒子系统入门 -A [particle system](https://www.wikiwand.com/en/Particle_system) is a technique in game physics, motion graphics, and computer graphics that uses many small sprites to create convincing effects such as smoke, fire, or swarms of insects. You can create new particle systems in the Bedrock Edition of Minecraft by using your own custom textures, and your own movement logic. This makes particles extremely fun and powerful! + -The Molang integration in particles is also extremely well developed, which allows you to pass data between different particles, or between an entity and a particle. +## 粒子系统 -### Particles +[粒子系统](https://www.wikiwand.com/en/Particle_system)是游戏物理、动态图形和计算机图形学中的一种技术,通过大量小精灵图(sprite)来创建逼真的效果,如烟雾、火焰或昆虫群。在《我的世界》基岩版中,你可以使用自定义贴图和运动逻辑来创建新的粒子系统,这使得粒子效果既有趣又强大! -A 'particle', or a 'particle instance' is a single sprite (texture) which is placed in 3D space, and has its own logic for how to move about and change its appearance. Some examples of a particle could include: +粒子系统中Molang的集成非常完善,允许你在不同粒子之间,或在实体与粒子之间传递数据。 -- A single snowflake -- A single raindrop -- A single wisp of smoke +### 粒子 -### Emitters +"粒子"或"粒子实例"是放置在3D空间中的单个精灵图(纹理),具有独立的运动逻辑和外观变化规则。常见的粒子示例包括: -An 'emitter' or 'particle emitter' is a system that can spawn many particles, either all at once (explosion), or over time (steady). Emitters have their own logic for how to move, how many particles to spawn, and where. Some examples of emitters could include: +- 一片雪花 +- 一滴雨水 +- 一缕烟雾 -- A snowstorm (creates snowflakes) -- A rainstorm (creates raindrops) -- A smokey chimney (creates smoke wisps) +### 发射器 -## Creating your First Particle +"发射器"或"粒子发射器"是能够生成多个粒子的系统,可以瞬间生成(爆炸效果)或持续生成(稳定效果)。发射器拥有独立的移动逻辑、粒子生成数量和位置控制机制。常见的发射器示例包括: -To create a particle, you need a resource pack, a texture, and a particle definition file: +- 暴风雪(生成雪花) +- 暴雨(生成雨滴) +- 冒烟的烟囱(生成烟缕) - +## 创建第一个粒子 + +创建粒子需要准备资源包、纹理贴图和粒子定义文件: + +::: code-group +```txt [文件结构] +RP/particles/snowflake.json +RP/textures/particles/snowflake.png +``` +::: \ No newline at end of file diff --git a/docs/wiki/particles/vanilla-particles.md b/docs/wiki/particles/vanilla-particles.md index 2637d02b..e04c2c40 100644 --- a/docs/wiki/particles/vanilla-particles.md +++ b/docs/wiki/particles/vanilla-particles.md @@ -1,21 +1,25 @@ --- -title: Vanilla Particles -category: Documentation +title: 原版粒子效果 +category: 文档 --- -Here is the complete list of Bedrock particles from the vanilla resources. Please be aware that not all of these particles function properly, as many require molang context from their host entity. +# 原版粒子效果 -:::tip Playing via /particle: -For some reason, Bedrock requires the leading `minecraft` namespace, and the coordinates in the `/particle` command. + -It doesn't have autocomplete for particles. +以下是基岩版原版资源中所有粒子效果的完整列表。请注意并非所有粒子都能正常运作,许多粒子需要宿主实体提供的Molang上下文才能正确运行。 + +:::tip 通过/particle命令使用: +由于某些原因,基岩版需要在`/particle`命令中使用带有`minecraft:`命名空间的完整粒子名称,并且需要指定坐标参数。 + +该命令不支持粒子的自动补全功能。 ::: -### Working Particles +### 正常工作的粒子效果 -These particles can be spawned directly in-world, without any issues. +这些粒子可以直接在游戏中生成,不会出现异常问题。 -| Working Particles | +| 正常工作的粒子效果 | | ------------------------------------------- | | minecraft:basic_flame_particle | | minecraft:basic_portal_particle | @@ -79,12 +83,12 @@ These particles can be spawned directly in-world, without any issues. | minecraft:water_evaporation_bucket_emitter | | minecraft:water_splash_particle_manual | -### Particles with Issues +### 存在问题的粒子效果 -The following particles can be spawned, but might spam you with content log errors because they rely on variables that `/particle` cannot set: +以下粒子可以生成,但可能因依赖`/particle`命令无法设置的变量而导致内容日志报错: -| Particles with issues | -| ----------------------------------------------- | +| 存在问题的粒子效果 | +| ------------------------------------------- | | minecraft:arrow_spell_emitter | | minecraft:balloon_gas_particle | | minecraft:basic_crit_particle | @@ -118,12 +122,12 @@ The following particles can be spawned, but might spam you with content log erro | minecraft:wax_particle | | minecraft:wither_boss_invulnerable | -### Bubble Particles +### 气泡类粒子效果 -The following particles are various bubbles that only show up underwater. Some of them spam content log errors: +以下气泡类粒子仅在水下可见,部分会导致内容日志报错: -| Bubble particles | -| -------------------------------------- | +| 气泡类粒子效果 | +| ------------------------------------- | | minecraft:basic_bubble_particle | | minecraft:basic_bubble_particle_manual | | minecraft:bubble_column_bubble | @@ -144,23 +148,23 @@ The following particles are various bubbles that only show up underwater. Some o | minecraft:squid_move_particle | | minecraft:underwater_torch_particle | -### Permanent Particles +### 永久性粒子效果 -The following particles are permanent and will not be removed once spawned until you exit the game: +以下粒子效果一旦生成将永久存在,除非退出游戏: -| Permanent particles | -| -------------------------------- | +| 永久性粒子效果 | +| ----------------------------- | | minecraft:mobflame_emitter | | minecraft:nectar_drip_particle | | minecraft:phantom_trail_particle | | minecraft:stunned_emitter | -## Broken Particles +## 无法正常使用的粒子效果 -The following particles exist in-game but cannot be spawned because they require context that cannot be provided by `/particle` or are simply bugged: +以下粒子虽然存在于游戏中,但由于需要无法通过`/particle`提供的上下文或存在程序错误而无法生成: -| Broken particles | -| -------------------------------- | +| 无法正常使用的粒子效果 | +| ----------------------------- | | minecraft:block_destruct | | minecraft:block_slide | | minecraft:breaking_item_icon | @@ -174,52 +178,52 @@ The following particles exist in-game but cannot be spawned because they require --- -[Original Credit](https://www.reddit.com/r/MinecraftCommands/comments/cbd56p/i_need_a_list_of_bedrock_particles/etg8rt7/) +[原始作者致谢](https://www.reddit.com/r/MinecraftCommands/comments/cbd56p/i_need_a_list_of_bedrock_particles/etg8rt7/) -## Component Particles +## 组件专用粒子效果 -The following is a list of pre-defined short names for Vanilla particles that can be used in certain components. -**These have all been proven to generally work. This may not be a full list.** +以下是可在某些组件中使用的原版粒子效果预设简称列表。 +**已确认这些简称通常有效,可能未包含全部可用选项** -| Short names | Notes | -| --------------------- | ---------------------------------------------------------- | -| mobspellambient | Color determined by any present potion ID in the component | -| villagerangry | | -| bubble | Only shows underwater | -| evaporation | | -| crit | | -| dragonbreath | Only seems to work for the AoE component for Projectiles | -| driplava | | -| dripwater | | -| reddust | | -| enchantingtable | | -| endrod | | -| mobspell | Color determined by any present potion ID in the component | -| largeexplode | | -| hugeexplosion | | -| fallingdust | Color determined by any present potion ID in the component | -| waterwake | | -| flame | | -| villagerhappy | | -| heart | | -| mobspellinstantaneous | Color determined by any present potion ID in the component | -| iconcrack | | -| slime | | -| snowballpoof | | -| largesmoke | | -| lava | | -| mobflame | | -| townaura | | -| note | | -| explode | | -| portal | | -| rainsplash | | -| smoke | | -| watersplash | | -| ink | | -| terrain | Pulls texture from atlas.terrain | -| totem | | -| witchspell | | -| soul | | -| spit | | -| sneeze | | +| 简称 | 备注 | +| ---------------------- | ------------------------------------ | +| mobspellambient | 颜色由组件中存在的药水ID决定 | +| villagerangry | | +| bubble | 仅在水下显示 | +| evaporation | | +| crit | | +| dragonbreath | 仅对投射物的AoE组件有效 | +| driplava | | +| dripwater | | +| reddust | | +| enchantingtable | | +| endrod | | +| mobspell | 颜色由组件中存在的药水ID决定 | +| largeexplode | | +| hugeexplosion | | +| fallingdust | 颜色由组件中存在的药水ID决定 | +| waterwake | | +| flame | | +| villagerhappy | | +| heart | | +| mobspellinstantaneous | 颜色由组件中存在的药水ID决定 | +| iconcrack | | +| slime | | +| snowballpoof | | +| largesmoke | | +| lava | | +| mobflame | | +| townaura | | +| note | | +| explode | | +| portal | | +| rainsplash | | +| smoke | | +| watersplash | | +| ink | | +| terrain | 从atlas.terrain提取纹理 | +| totem | | +| witchspell | | +| soul | | +| spit | | +| sneeze | | \ No newline at end of file diff --git a/docs/wiki/servers/index.md b/docs/wiki/servers/index.md index 5a614fa1..91bb0cac 100644 --- a/docs/wiki/servers/index.md +++ b/docs/wiki/servers/index.md @@ -1,3 +1,3 @@ --- -title: Servers & Realms +title: 服务器 & 领域服 --- diff --git a/docs/wiki/servers/raknet-and-mcpe.md b/docs/wiki/servers/raknet-and-mcpe.md index ad3b55c7..c5ddaf7e 100644 --- a/docs/wiki/servers/raknet-and-mcpe.md +++ b/docs/wiki/servers/raknet-and-mcpe.md @@ -1,126 +1,123 @@ --- -title: RakNet and MCPE +title: RakNet与MCPE协议解析 mentions: - ZestiiSpaghett - - MedicalJewel105 - SmokeyStack - ThomasOrs - Adrian8115 + - MedicalJewel105 --- -Minecraft Bedrock uses a protocol known as [RakNet](http://www.jenkinssoftware.com/) -Unlike Minecraft Java edition, Bedrock uses UDP on the port 19132 +# RakNet与MCPE协议解析 -You can find a list of Minecraft Bedrock server softwares [here](/servers/server-software#active-software). + -## RakNet Notes +Minecraft基岩版使用名为[RakNet](http://www.jenkinssoftware.com/)的通信协议。与Java版不同,基岩版通过UDP协议在19132端口进行通信。 -- All strings are prefixed with an unsigned short depicting their length. -- The offline message id will always be: 00ffff00fefefefefdfdfdfd12345678 (hex) - this series of bytes will be referred to as *Magic* -- The offline message id is sent with unconnected messages such as unconnected pings and pongs. -- The GUIDS used by RakNet are 8 bytes long. -- The first byte is used to identify the type of message. +您可以在此处查看[Minecraft基岩版服务器软件列表](/wiki/servers/server-software#active-software)。 -## Data Types +## RakNet协议要点 -| Type | Size | Range | Notes | -| -------------- | ---- | --------------- | -------------------------------------------------------------- | -| Byte | 1 | 0-255 | An unsigned integer | -| Long | 8 | -2^63 to 2^63-1 | Signed 64 bit integer | -| Magic | 16 | | 00ffff00fefefefefdfdfdfd12345678 - Will always be those bytes | -| Short | 2 | -32768 to 32767 | | -| Unsigned Short | 2 | 0 to 65535 | | -| String | N/A | N/A | A string prefixed by a short which depicts the length. | -| Boolean | 1 | 0-1 | 0x00 is False while 0x01 is True | -| Address | 7 | | 1 byte for the ip version 4/6, 4 for the IP and 2 for the port | -| uint24le | 3 | | 3-byte little-endian unsigned integer | +- 所有字符串均以表示长度的无符号短整型(unsigned short)作为前缀 +- 离线消息ID固定为:00ffff00fefefefefdfdfdfd12345678(十六进制) - 后续统称为*Magic* +- 离线消息ID随未连接消息(如未连接Ping/Pong)一起发送 +- RakNet使用的GUID为8字节长度 +- 首字节用于标识消息类型 -## Contents +## 数据类型对照表 - +| 类型 | 大小 | 数值范围 | 说明 | +| --------------- | ---- | ---------------- | ------------------------------------------------------------ | +| Byte | 1 | 0-255 | 无符号整型 | +| Long | 8 | -2^63 至 2^63-1 | 有符号64位整型 | +| Magic | 16 | | 固定字节序列:00ffff00fefefefefdfdfdfd12345678 | +| Short | 2 | -32768 至 32767 | 有符号短整型 | +| Unsigned Short | 2 | 0 至 65535 | 无符号短整型 | +| String | 不定 | | 以短整型长度前缀开头的字符串 | +| Boolean | 1 | 0-1 | 0x00表示False,0x01表示True | +| Address | 7 | | 地址结构:1字节IP版本(4/6)+4字节IP+2字节端口 | +| uint24le | 3 | | 小端序3字节无符号整型 | -- [x] Unconnected Pings -- [x] Unconnected Pongs -- [x] Open Connection Request 1 -- [x] Open Connection Reply 1 -- [x] Open Connection Request 2 -- [x] Open Connection Reply 2 -- **From here on, the RakNet connection is established and all RakNet messages are contained in a [Frame Set Packet](https://wiki.vg/Raknet_Protocol#Frame_Set_Packet).** -- [x] Connection Request -- [x] Connection Request Accepted +## 协议流程目录 - +- [x] 未连接Ping请求 +- [x] 未连接Pong响应 +- [x] 开放连接请求1 +- [x] 开放连接响应1 +- [x] 开放连接请求2 +- [x] 开放连接响应2 +- **从以下开始,RakNet连接已建立,所有消息均通过[帧集合数据包](https://wiki.vg/Raknet_Protocol#Frame_Set_Packet)传输** +- [x] 连接请求 +- [x] 连接请求已接受 -### Unconnected Pings +### 未连接Ping请求 -Minecraft Bedrock will send out a message to all listed servers (and the local network) to check if any games are available and retrieve the MOTD from the game. These messages are known as unconnected pings and are structured in this format: +客户端会向所有服务器列表(包括局域网)发送广播消息以检测可用游戏并获取MOTD信息。该消息结构如下: -`0x01 | client alive time in ms (unsigned long long) | magic | client GUID` +`0x01 | 客户端存活时间(毫秒,无符号长整型) | Magic | 客户端GUID` -### Unconnected Pongs +### 未连接Pong响应 -After this message, the server will respond with something called an unconnected pong. The reason these messages are unconnected is because the client has not established a connection to the server. This is the format of an unconnected pong: +服务器收到Ping请求后会返回以下结构的响应数据包: -`0x1c | client alive time in ms (recorded from previous ping) | server GUID | string length | Edition (MCPE or MCEE for Education Edition);MOTD line 1;Protocol Version;Version Name;Player Count;Max Player Count;Server Unique ID;MOTD line 2;Game mode;Game mode (numeric);Port (IPv4);Port (IPv6);` +`0x1c | 客户端存活时间(取自Ping请求) | 服务器GUID | 字符串长度 | 格式字符串(包含版本信息)` -Example: +格式字符串示例: `MCPE;Dedicated Server;527;1.19.1;0;10;13253860892328930865;Bedrock level;Survival;1;19132;19133;` -The client doesn't seem to use the gamemode or the numeric value for the gamemode. +客户端实际不会使用游戏模式及其对应的数值字段。 -### Open Connection Request 1 +### 开放连接请求1 -The client sends this when attempting to join the server +客户端在尝试加入服务器时发送此数据包: -`0x05 | Magic | Protocol version (currently 10 or 0x0a) | RakNet Null Padding` +`0x05 | Magic | 协议版本(当前为10或0x0a) | RakNet空填充` -The null padding seems to be used to discover the maximum packet size the network can handle. +空填充用于探测网络最大可传输数据包大小。客户端会逐步减少填充量直至收到服务器响应。 -The client will send this to the server with decreasing null padding until the server responds with a +## 开放连接响应1 -## Open Connection Reply 1 +服务器收到连接请求1后的响应结构: -The server responds with this once the client attempts to join +`0x06 | Magic | 服务器GUID | 加密标识(通常为False) | 空填充大小(无符号短整型,建议1400)` -`0x06 | magic | server GUID | use encryption boolean (normally false) | RakNet Null Padding Size (Unsigned short, I use 1400)` +这是客户端与服务器握手过程的第一阶段。 -This is the first half of the handshake between the client and the server. +### 开放连接请求2 -### Open Connection Request 2 +客户端收到响应1后发送的确认数据包: -The client responds with this after they receive the open connection reply 1 packet. +`0x07 | Magic | 服务器地址 | 空填充大小 | 客户端GUID` -`0x07 | magic | server address | RakNet Null Padding Size | client GUID` +### 开放连接响应2 -### Open Connection Reply 2 +握手过程的最终确认数据包: -This is the last part of the handshake between the client and the server. +`0x08 | Magic | 服务器GUID | 客户端地址 | 空填充大小 | 加密标识` -`0x08 | magic | server GUID | client address | Null Padding Size | use encryption` +### 连接请求 -### Connection Request +客户端发送的正式连接请求: -This is the part where the client sends the connection request. +`0x09 | 客户端GUID | 请求时间戳(长整型) | 安全标识(建议使用0x00)` -`0x09 | client GUID | Request timestamp (Long) | Secure (Boolean, I use 0x00)` +### 连接请求已接受 -### Connection Request Accepted +服务器对连接请求的最终确认响应: -The server sends this packet in response to the incoming connection request. - - `0x10 | client Address | System index (Short, unknown what this does. 0 works as a value) | System adresses ([]Address) | Request timestamp (Long) | Accepted timestamp (Long)` +`0x10 | 客户端地址 | 系统索引(短整型,0值可用) | 系统地址列表 | 请求时间戳 | 接受时间戳` -## Sources +## 扩展阅读 ::: tip -If you are interested and want to read more about it here is the documentation for the Bedrock Protocol and RakNet: +如需深入了解Bedrock协议和RakNet实现,推荐以下文档: -[RakNet Protocol Documentation](https://wiki.vg/Raknet_Protocol) +[RakNet协议文档](https://wiki.vg/Raknet_Protocol) -[Newer Bedrock Protocol Documentation for 1.20.50](https://prismarinejs.github.io/minecraft-data/?d=protocol&v=bedrock_1.20.50) [(by PrismarineJS)](https://prismarinejs.github.io) ::: +[基岩版1.20.50协议文档](https://prismarinejs.github.io/minecraft-data/?d=protocol&v=bedrock_1.20.50) [由PrismarineJS维护](https://prismarinejs.github.io) ::: ::: warning -There is also the old Bedrock Protocol Wiki which might possibly be outdated! -[Bedrock Protocol Documentation](https://wiki.vg/Bedrock_Protocol) ::: +注意旧版协议文档可能已过时: +[基岩版协议历史文档](https://wiki.vg/Bedrock_Protocol) ::: -This page is a WIP, feel free to contribute as it is still being worked on. +本文档仍在持续完善中,欢迎贡献内容。 \ No newline at end of file diff --git a/docs/wiki/servers/server-software.md b/docs/wiki/servers/server-software.md index c8c98c41..f62eda84 100644 --- a/docs/wiki/servers/server-software.md +++ b/docs/wiki/servers/server-software.md @@ -1,5 +1,5 @@ --- -title: Bedrock Server Software +title: 基岩版服务端软件 mentions: - SirLich - DevGod6969 @@ -22,28 +22,32 @@ mentions: - AzaleeX --- -Minecraft servers allow players to play online or via a local area network with other people. This is very common within Java Edition Minecraft, but is also possible on Bedrock. [You can download the official Mojang BDS software here.](https://www.minecraft.net/en-us/download/server/bedrock). +# 基岩版服务端软件 -Alongside the Vanilla BDS offering, many community projects exist, in a variety of languages. + -## Software by Language +Minecraft 服务器可以让玩家通过互联网或局域网进行联机游戏。这在 Java 版中十分常见,但其实基岩版同样可以实现联机。[点击此处下载 Mojang 官方的 BDS 服务端](https://www.minecraft.net/en-us/download/server/bedrock)。 -| Language | Status | -| ---------- | -------------------------------------------------------------------- | -| PHP | [Still Active](#php) : 4 < [Discontinued](#php-1) : 38 | -| Java | [Still Active](#java) : 4 < [Discontinued](#java-1) : 14 | -| C++ | [Still Active](#c) : 1 < [Discontinued](#c-1) : 5 | -| TypeScript | [Still Active](#typescript) : 4 < [Discontinued](#typescript-1) : 1 | -| Go | [Still Active](#go) : 1 < [Discontinued](#go-1) : 5 | -| JavaScript | [Still Active](#javascript) : 1 < [Discontinued](#javascript-1) : 6 | -| Rust | [Still Active](#rust) : 1 < [Discontinued](#rust-1) : 1 | -| C# | Still Active : 0 < [Discontinued](#c-2) : 3 | -| C | Still Active : 0 < [Discontinued](#c-3) : 1 | -| Python | [Still Active](#python) : 1 < [Discontinued](#python-1) : 2 | -| D | Still Active : 0 < [Discontinued](#d) : 1 | -| Kotlin | Still Active : 0 < [Discontinued](#kotlin) : 1 | +除了原版 BDS 服务端外,社区还开发了多种不同编程语言实现的服务端项目。 -## Active Software +## 按编程语言分类 + +| 语言 | 项目状态 | +| ----------- | ------------------------------------------------------------ | +| PHP | [仍活跃](#php) : 4 < [已停更](#php-1) : 38 | +| Java | [仍活跃](#java) : 4 < [已停更](#java-1) : 14 | +| C++ | [仍活跃](#c) : 1 < [已停更](#c-1) : 5 | +| TypeScript | [仍活跃](#typescript) : 4 < [已停更](#typescript-1) : 1 | +| Go | [仍活跃](#go) : 1 < [已停更](#go-1) : 5 | +| JavaScript | [仍活跃](#javascript) : 1 < [已停更](#javascript-1) : 6 | +| Rust | [仍活跃](#rust) : 1 < [已停更](#rust-1) : 1 | +| C# | 仍活跃 : 0 < [已停更](#c-2) : 3 | +| C | 仍活跃 : 0 < [已停更](#c-3) : 1 | +| Python | [仍活跃](#python) : 1 < [已停更](#python-1) : 2 | +| D | 仍活跃 : 0 < [已停更](#d) : 1 | +| Kotlin | 仍活跃 : 0 < [已停更](#kotlin) : 1 | + +## 活跃项目 ### C++ - [LiteLoader](https://github.com/LiteLDev/LiteLoaderBDS) @@ -56,7 +60,7 @@ Alongside the Vanilla BDS offering, many community projects exist, in a variety - [JukeBoxMC](https://github.com/LucGamesYT/JukeboxMC) - [NukkitX-version](https://github.com/NukkitX/Nukkit) -- [Nukkit PetteriM1 Edition](https://github.com/PetteriM1/NukkitPetteriM1Edition) +- [Nukkit PetteriM1 版](https://github.com/PetteriM1/NukkitPetteriM1Edition) - [PowerNukkitX](https://github.com/PowerNukkitX/PowerNukkitX) ### TypeScript @@ -86,7 +90,7 @@ Alongside the Vanilla BDS offering, many community projects exist, in a variety - [PieMC](https://github.com/PieMC-Dev/PieMC) -## Discontinued Software +## 已停更项目 ### C++ @@ -203,10 +207,10 @@ Alongside the Vanilla BDS offering, many community projects exist, in a variety - [Limonite](https://github.com/iTXTech/limonite) -## Licensing +## 许可声明 -:::tip License -This page is licensed under the `GNU Lesser General Public License v3.0`. +:::tip 许可协议 +本页面采用 `GNU 宽通用公共许可证 v3.0` 授权。 -The original source was authored `xinghao2003`, and may be [found here.](https://github.com/xinghao2003/MCBE-ServerSoftware-List) -::: +原始内容由 `xinghao2003` 创作,可[在此查看](https://github.com/xinghao2003/MCBE-ServerSoftware-List)。 +::: \ No newline at end of file diff --git a/docs/wiki/visuals/animated-entity-texture.md b/docs/wiki/visuals/animated-entity-texture.md index ff951547..599d7773 100644 --- a/docs/wiki/visuals/animated-entity-texture.md +++ b/docs/wiki/visuals/animated-entity-texture.md @@ -1,52 +1,52 @@ --- -title: Entity Texture Animations +title: 实体纹理动画 mentions: - MedicalJewel105 - IlkinQafarov - TheItsNameless - SmokeyStack tags: - - intermediate -category: - - Tutorials + - 中级 +category: 巧思案例 --- -## Whats on this page? +# 实体纹理动画 -From this page you will learn how to make an animated texture for an entity. Animated, like a flipbook texture for blocks. + -## Source +## 本页内容 -This page is based on content by [AgentMindStorm](https://www.youtube.com/channel/UC-ljddYkFdTQl-MVEaVvbuQ). +通过本教程你将学会如何为实体制作动态纹理。这种动画效果类似于方块的翻书动画纹理(Flipbook)。 + +## 来源说明 + +本教程内容基于 [AgentMindStorm](https://www.youtube.com/channel/UC-ljddYkFdTQl-MVEaVvbuQ) 的原创作品。 -## Textures +## 纹理制作 -First let's draw some new texture frames for our entity. In this tutorial it will be a cow, which is looking around. +首先我们需要为实体绘制若干关键帧纹理。本教程将以四处张望的牛作为示例。 -We need to place our textures vertically, like for blocks in flipbook textures. -In this case we have 4 frames. +与方块的翻书动画类似,我们需要将纹理帧进行纵向排列。本示例共使用4帧动画。 -## Materials +## 材质配置 -We will need to modify materials in this guide. However due to render dragon materials became outdated, so **use it at your own risk**. +在本指南中我们需要修改材质文件。但由于Render Dragon渲染引擎的更新,传统材质系统已过时,**请自行评估使用风险**。 -To use animated texture, we need to change the entity material to one, that has `USE_UV_ANIM` property. -Let's simply add a new material: +要实现动态纹理,需要将实体材质更改为具有`USE_UV_ANIM`属性的类型。我们可以通过添加新材质实现: -RP/materials/entity.material - -```json +::: code-group +```json [RP/materials/entity.material] { "materials":{ "version":"1.0.0", @@ -58,66 +58,70 @@ Let's simply add a new material: } } ``` +::: -Or you can add this to existing ones, check default material file. +或者可以将该属性添加到现有材质中(参考默认材质文件): - - -```json +::: code-group +```json [] "+defines":[ "USE_UV_ANIM" ] ``` +::: Download default entity.material file +>下载默认entity.material文件 :::warning -It is not that easy for every entity! -Some entities have multiple materials and if you want to make its texture animated, you will need to add this property to all materials of this entity. +注意:并非所有实体都适用简单修改! +部分实体包含多种材质类型,若需要实现全身纹理动画,必须为实体使用的所有材质添加此属性。 ::: -## Client Entity File +## 客户端实体配置 -Before we go next, we need to define a new material in our client entity file. +在继续之前,我们需要在客户端实体文件中指定新材质: -RP/entity/cow.json#description - -```json +::: code-group +```json [RP/entity/cow.json#description] "materials": { "default": "custom_animated" } ``` +::: -## Render Controllers +## 渲染控制器设置 -After that all, we need to edit a render controller. +完成上述步骤后,需要编辑渲染控制器: -Here we will add `uv_anim` component with offset and scale properties: +在此我们将添加带有偏移量和缩放属性的`uv_anim`组件: -RP/render_controllers/cow.render_controllers.json#controller.render.cow - -```json +::: code-group +```json [RP/render_controllers/cow.render_controllers.json#controller.render.cow] "uv_anim": { "offset": [ 0.0, "math.mod(math.floor(q.life_time * frames_per_second),frame_count) / frame_count" ], "scale": [ 1.0, "1 / frame_count" ] } ``` +::: -Where `frames_per_second` is a count of frames you want to change in one second and `frame_count` is a total frame count. -This formula calculates the offset and the size of the texture depending on life time. +其中: +- `frames_per_second`表示每秒播放的帧数 +- `frame_count`表示总帧数 -## Testing +该公式会根据实体的存活时间自动计算纹理偏移量和缩放比例。 -Now, it is time to test your creation! +## 效果测试 + +现在可以测试你的动画效果了! ![](/assets/images/visuals/animated-entity-texture/result.gif) -## Download Example +## 示例下载 Download +>下载示例包 \ No newline at end of file diff --git a/docs/wiki/visuals/animation-effects.md b/docs/wiki/visuals/animation-effects.md index a6d2bc33..212e5900 100644 --- a/docs/wiki/visuals/animation-effects.md +++ b/docs/wiki/visuals/animation-effects.md @@ -1,86 +1,88 @@ --- -title: Effects in Animations +title: 动画中的效果 mentions: - MedicalJewel105 -category: - - General +category: 基础 --- -## Effects in Animations +# 动画(Animation)中的效果 -Sometimes it is much easier to use particles or sounds in animation rather than in animation controller. -Animations can have effects in them, such as: + -- Particles -- Sounds +## 动画中的效果 -### Particles +在动画中使用 `粒子` 或 `音效` 有时比在动画控制器中更方便。动画可以包含以下效果: -Minecraft Particles can be used in entity animations. For example, the phantom has an animation which emits the minecraft:phantom_trail particle constantly. Let's try to add a particle to our entity's attack animation. +- 粒子效果 +- 音效效果 -RP/entity/my_entity.json +### 粒子效果 -```json +Minecraft粒子效果可用于实体动画。例如,幻影(phantom)拥有持续释放minecraft:phantom_trail粒子的动画。让我们尝试在实体的攻击动画中添加粒子效果。 + +::: code-group +```json [RP/entity/my_entity.json] "particle_effects": { "flames": "minecraft:mobflame_emitter" } ``` - -Here we defined a shortname for particle that we are going to use. - -You can find a list of particles [here](https://minecraft.wiki/w/Particles) or [here](/particles/vanilla-particles). - -:::warning Warning! -Not every particle works there. If you have problems, consider trying another particle. For example, use this one. -Also note that some particles emit constantly. ::: -### Sounds +这里我们为将要使用的粒子定义了简称。 -If you want to use a sound, you need to define it too. +你可以在[官方Wiki](https://minecraft.wiki/w/Particles)或[此处](/wiki/particles/vanilla-particles)找到完整的粒子列表。 -RP/entity/my_entity.json +:::warning 注意! +并非所有粒子都能正常使用。如果遇到问题,请尝试更换其他粒子。例如使用这个参考粒子。 +同时注意部分粒子会持续发射。 +::: -```json +### 音效效果 + +若需使用音效,也需要提前定义: + +::: code-group +```json [RP/entity/my_entity.json] "sound_effects": { "meow": "mob.cat.meow" } ``` - -:::warning Warning! -Not every sound works there. If you have problems, consider trying another sound. For example, use this one. ::: -## Adding Effects to Animation +:::warning 注意! +并非所有音效都能正常使用。如果遇到问题,请尝试更换其他音效。例如使用这个参考音效。 +::: -You can add particles or sounds to your animation mainly or in Blockbench. +## 为动画添加效果 -### Mainly +你可以通过代码或Blockbench为动画添加效果。 -You need to add the following to your animation: +### 代码方式 -RP/animations/my_animation.json#my.animation +在动画文件中添加以下内容: -```json +::: code-group +```json [RP/animations/my_animation.json#my.animation] "particle_effects": { "0.0": { "effect": "flames", - "locator": "" //You need to add a locator in your model + "locator": "" //你需要在模型中添加定位器 } } ``` +::: -RP/animations/my_animation.json#my.animation - -```json +::: code-group +```json [RP/animations/my_animation.json#my.animation] "sound_effects": { "0.0": { "effect": "meow" } } ``` +::: -You can call more than one particle at the same time: +支持同时调用多个粒子效果: ```json "particle_effects": { @@ -97,11 +99,10 @@ You can call more than one particle at the same time: } ``` - + -RP/animations/my_animation.json - -```json +::: code-group +```json [RP/animations/my_animation.json] { "format_version" : "1.8.0", "animations" : { @@ -143,39 +144,40 @@ You can call more than one particle at the same time: } } ``` +::: -### In Blockbench +### Blockbench方式 -First let's add a locator for our particle. Go to "Edit" section, select a group, right-click and choose "Add Locator": +首先为粒子添加定位器。进入"Edit"模式,选择骨骼组,右键选择"Add Locator": ![](/assets/images/visuals/animation-effects/add-locator.png) -Rename it and move where you want. +重命名并移动到目标位置。 -Then go to "Animate" section, choose an animation and click on a magic stick icon: +然后进入"Animate"模式,选择动画并点击魔杖图标: ![](/assets/images/visuals/animation-effects/add-effect.png) -Now click "+" to open menu and specify the data: +点击"+"号打开菜单并配置参数: ![](/assets/images/visuals/animation-effects/specify-data.png) -You can attach a sound to animation the same way. +音效也可以用相同方式添加。 -Now save your animation and launch the game! +保存动画后即可在游戏中查看效果: ![](/assets/images/visuals/animation-effects/showcase.png) -## Offscreen Updating +## 屏幕外更新 -You can set `"should_update_bones_and_effects_offscreen"` to `true` inside entity rp scripts for particle and sound effects to update offscreen, by default both of them will stop playing if the entity isn't being rendered on display. +在实体资源包脚本中设置`"should_update_bones_and_effects_offscreen": true`可使粒子和音效在实体离开屏幕时继续更新,默认情况下两者在实体不可见时会停止播放。 -RP/entity/my_entity.json#description - -```json +::: code-group +```json [RP/entity/my_entity.json#description] "scripts": { "should_update_bones_and_effects_offscreen": true } ``` +::: \ No newline at end of file diff --git a/docs/wiki/visuals/bedrock-modeling.md b/docs/wiki/visuals/bedrock-modeling.md index 723d9216..78bfb73a 100644 --- a/docs/wiki/visuals/bedrock-modeling.md +++ b/docs/wiki/visuals/bedrock-modeling.md @@ -1,122 +1,112 @@ --- -title: Bedrock Modeling +title: 基岩版建模指南 nav_order: 2 -category: - - General +category: 基础 mentions: - SirLich - solvedDev - MedicalJewel105 --- -This will guide tips, tricks, and things you should know when modeling for Minecraft Bedrock Edition. +# 基岩版建模指南 -## Texture Glitch + -Sometimes the texture on some (smaller) faces is glitched or invisible. This is because the size of cubes is floored for the UV map calculation. This means that any size smaller than 1 will result in a 0 pixel wide UV map, which will look glitchy. To prevent this, make sure all of your cubes are at least 1 unit long in each direction. To create smaller cubes, use the Inflate slider. -Another trick to solve this if you _must_ have smaller textures is by **increasing the element size by 1 in each direction** and then **inflating the element by -1** though note that this will make you have smaller pixels textured incorrectly will lead to mixels. +本指南将为您讲解Minecraft基岩版建模时需要掌握的技巧、窍门和注意事项。 -## Vertex Snap +## 纹理故障 -Vertex snap is a handy tool in blockbench any modeler should use. It's beneficial when doing rounded things like wheels. -You can find this tool right top next to the movement & scale tools. It has 2 modes, Move & Scale. How this tool works can be seen in the following gif. +当较小面出现纹理错乱或不可见时,这是由于立方体尺寸在UV映射计算中被向下取整导致的。任何小于1单位的尺寸都会生成0像素宽的UV映射。解决方法: +1. 确保所有立方体每个方向至少有1单位长度 +2. 需要更小立方体时使用膨胀滑块 +3. 极端情况可尝试将元素尺寸各方向增加1单位,再设置-1的膨胀值(注意可能导致像素错位) + +## 顶点吸附 + +Blockbench中的顶点吸附工具是制作圆形部件(如车轮)的利器。该工具位于移动/缩放工具右侧,包含移动和缩放两种模式: ![](/assets/images/visuals/bedrock-modeling/vertex_snap.gif) -## Transparency -If you use semi-transparent textures (like colored glass), you need to move elements with that texture to the bottom of the element list. Otherwise, elements behind these semi-transparent ones won't render in-game. +## 透明度处理 -## Texturing +使用半透明材质(如彩色玻璃)时,需将该元素移至元素列表底部,否则后方元素将无法正常渲染。 -When learning to texture, your best bet is practicing with references on how others textured similar objects & surfaces. Patterns for wood & metal are different, and you should consider that. Good guides are -[Masteriano's Texturing Tips](https://www.blockbench.net/wiki/guides/minecraft-style-guide) -and in general, any on pixel art. +## 纹理绘制技巧 -## Materials +推荐学习方法: +- 参考他人同类物体的纹理作品 +- 区分木质/金属等不同材质的纹理规律 +- 推荐教程: +[Masteriano的纹理技巧](https://www.blockbench.net/wiki/guides/minecraft-style-guide) +及像素画通用教程 -Whether or no the transparency or emissive textures in your models work in-game, it's decided by the materials applied to them. +## 材质类型对照表 -| Material | Description | -| --------------------- | -------------------------------------------------------------------------------------------------------- | -| entity | basic opaque material | -| entity_alphatest | supports transparent pixels | -| entity_alphablend | supports translucent pixels | -| entity_emissive | solid, alpha channel is used as the emissive channel | -| entity_emissive_alpha | alpha channel is used for emissiveness, completely black + transparent pixels are rendered transparently | +| 材质类型 | 特性描述 | +| -------------------- | ------------------------------------------------------------------------ | +| entity | 基础不透明材质 | +| entity_alphatest | 支持透明像素 | +| entity_alphablend | 支持半透明像素 | +| entity_emissive | 自发光材质(alpha通道控制发光强度) | +| entity_emissive_alpha| 纯黑+透明像素显示为透明,其余根据alpha通道发光 | -## Z-fighting +## Z轴冲突 -Z-fighting is called when you have the face of 2 elements in the same place, and you can see both or half of them at the same time, as seen in the following picture. +当两个面片重叠时会出现闪烁现象: ![](/assets/images/visuals/bedrock-modeling/z-fighting.png) -You can solve this by inflating one of them by `0.01` or `-0.01` depending on which one should prioritize. +解决方法:对需要优先显示的面片设置`0.01`或`-0.01`的膨胀值 -## Basics of Animations +## 动画基础 -When animating in Blockbench, you can set each keyframe by hand, or you can use variables & functions. -Here you will learn the basics. -Let's start with this picture. +动画命名规范: +- 必须以`animation.`开头(如`animation.cuack`) +- 禁止使用符号和大写字母 -![](/assets/images/visuals/bedrock-modeling/animations-1.png) - -the name or `animation.cuack` is essential. You can't have symbols or caps there, and it must start with `animation.` for the animations to work without problems. Now the function we will be using is - -`Base + Math.sin((q.life_time + Offset) * Speed) \_ pitch` - -- Base is the starting rotation/position the bone has -- Sin is the math function we all know -- `q.life_time` is a variable. Is a number that will be increasing as the animation continues -- Offset is a number we use to have the animation start earlier or later than its "original" position -- Speed is the time it will take from going from top to down -- Pitch is how far it goes from the origin +基本函数结构: +`基准值 + Math.sin((q.life_time + 偏移量) * 速度) * 幅度` ![](/assets/images/visuals/bedrock-modeling/animations-2.gif) -Function used: - +应用实例: `Math.sin((q.life_time+0.5)*150)*15` -one on position & the other on rotation. - -Don't forget that for the animation to be a perfect loop. It would help if you correlated the sin equation `speed` & the animation `time`. -Here's a table with values to get a perfect loop, though there are more you can discover. +### 循环动画参数对照表 -| Speed | Time | Group | -| ----- | ---- | ----- | -| 150 | 2.4 | 1 | -| 100 | 3.6 | 2 | +| 速度 | 时长 | 组别 | +| ---- | ----- | ----- | +| 150 | 2.4 | 1 | +| 100 | 3.6 | 2 | -These numbers can be multiplied but not divided, so these will also work -But only multiples of the same option +扩展参数(仅限同组倍数组合): -| Speed | Time | Group | -| ----- | ---- | ----- | -| 150 | 4.8 | 1 | -| 200 | 3.6 | 2 | -| 300 | 2.4 | 1 | -| 300 | 3.6 | 1 & 2 | - -Now not all of these will "loop" together. And that is the Group column. The ones with the same number will work together. Otherwise, they will have a visible "glitch" in the loop. +| 速度 | 时长 | 组别 | +| ---- | ----- | ------ | +| 150 | 4.8 | 1 | +| 200 | 3.6 | 2 | +| 300 | 2.4 | 1 | +| 300 | 3.6 | 1 & 2 | :::tip -You can have an animation in the loop by clicking on the following setting: +启用循环动画设置: ![](/assets/images/visuals/bedrock-modeling/setting-loop.png) ::: -With this function & creativity, animals & dinosaurs are animated into walking, running & attacking. -You can learn more about queries & functions [here](https://bedrock.dev/docs/stable/Molang). +通过组合不同函数参数,可以实现行走、奔跑、攻击等复杂动画效果。更多函数用法请参考[Molang文档](https://bedrock.dev/docs/stable/Molang)。 -## Animation Speed +## 动画速度调节 -To easily change the speed of an animation you can simply multiply the default value of `anim_time_update` (defaults to `q.delta_time + q.anim_time`) inside our animation: +通过修改`anim_time_update`参数实现: -RP/animations/myentity.animation.json#animations - -```json +::: code-group +```json [RP/animations/myentity.animation.json#animations] "animation.myentity.myanimation": { "anim_time_update":"2 * q.delta_time + q.anim_time" - //Your animation goes here! + // 此处放置动画内容 } ``` +::: -This will make the animation run 2 times faster. We can tweak the value to any buoyant float, so we can even slow down animations. With 0.5, for example, the animation will run 2 times slower, etc. \ No newline at end of file +- `2 *` 使动画加速2倍 +- `0.5 *` 使动画减速至原速1/2 +- 支持任意浮点数调整 \ No newline at end of file diff --git a/docs/wiki/visuals/custom-skin-packs.md b/docs/wiki/visuals/custom-skin-packs.md index a094d0a6..84929616 100644 --- a/docs/wiki/visuals/custom-skin-packs.md +++ b/docs/wiki/visuals/custom-skin-packs.md @@ -1,23 +1,26 @@ --- -title: Skin Packs +title: 皮肤包 mentions: - MedicalJewel105 - SirLich - Joelant05 - TheItsNameless -category: - - General +category: 基础 --- -Many people wrongly assume that skin packs are only available for creation to Marketplace Partners. No! It's a very easy process, which can easily be fully automated by python. But that's not it. Let's learn how to make a skin pack! +# 皮肤包 + + + +许多人错误地认为只有市场合作伙伴才能创建皮肤包。其实不然!这是一个非常简单的流程,甚至可以用Python轻松实现全自动化。不过这不是重点,让我们来学习如何制作皮肤包吧! :::warning -The `development_skin_packs` doesn't seem to function correctly. You need to use `skin_packs` folder and reload Minecraft every time you made a change. +`development_skin_packs` 似乎无法正常工作。你需要使用 `skin_packs` 文件夹,且每次修改后都要重启 Minecraft。 ::: -## What is needed +## 所需文件 -Here is what is needed: +以下是制作皮肤包需要的文件结构: skin_packs/tutorial_skin_pack/skins.json - -```json +::: code-group +```json [skin_packs/tutorial_skin_pack/skins.json] { "geometry": "geometry.json", "serialize_name": "Tutorial Skin Pack", @@ -90,48 +92,47 @@ This file is used to define textures and shortnames for skins. Most of the optio ] } ``` +::: -- The `geometry` object must be the same as on the example code in every object. Mojang removed the ability to add custom geometries via skin packs, because the feature was abused. -- `serialize_name` is for marketplace. -- `localization_name` is a pack identifier. **Don't use in other skin packs** as it affects translations. -- `skins` array, where you define your each skin. The skins will be displayed in the same order in minecraft as they are defined here. - > - `localization_name` is going to be used in the .lang file. Think of it as the skins identifier. - > - `geometry` you can use `geometry.humanoid.custom` and `geometry.humanoid.customSlim` here. - > - `texture` is the name of the image file, located in the main skin pack folder. - > - `type` is only accessible to marketplace partners, leave it as `free`, otherwise it will be locked. +- `geometry` 字段必须与示例代码保持一致。由于该功能曾被滥用,Mojang移除了通过皮肤包添加自定义模型的功能 +- `serialize_name` 用于市场平台 +- `localization_name` 是包的标识符,**不要在其他皮肤包中使用相同名称**,会影响多语言系统 +- `skins` 数组定义每个皮肤,游戏内显示顺序与此处的定义顺序一致 + > - `localization_name` 将用于.lang文件,相当于皮肤标识符 + > - `geometry` 可选 `geometry.humanoid.custom` 或 `geometry.humanoid.customSlim` + > - `texture` 是皮肤包主目录中的图片文件名 + > - `type` 仅市场合作伙伴可用,保持设为 `free` ## texts/en_US.lang -Finally, we'll define the names of the skin pack and every skin in the `.lang` file. Of course "en_US" can be replaced with any language. +最后在 `.lang` 文件中定义皮肤包和每个皮肤的显示名称。"en_US" 可替换为其他语言代码。 -skin_packs/tutorial_skin_pack/texts/en_US.lang +::: code-group +``` [skin_packs/tutorial_skin_pack/texts/en_US.lang] +skinpack.tutorial=教程皮肤包 +skin.tutorial.tutorial_skin_1=皮肤1号 +skin.tutorial.tutorial_skin_2=皮肤2号 ``` -skinpack.tutorial=Tutorial Skin Pack +::: -skin.tutorial.tutorial_skin_1=Skin 1 -skin.tutorial.tutorial_skin_2=Skin 2 -``` +第一行定义整个皮肤包的名称,格式为: +`skinpack.[包localization_name]=实际显示名称` -The first line defines the pack's name itself. It's done in this format: +其他行定义单个皮肤名称: +`skin.[包localization_name].[皮肤localization_name]=实际显示名称` -`skinpack.[pack localization_name]=Actual Pack Name` +大功告成!现在进入角色创建界面就能看到你的自定义皮肤啦! -The other lines define the skins' names: +## 故障排查 -`skin.[pack localization_name].[skin localization_name]=Actual Skin Name` - -Done! Now, when you open Character Creator, you'll see your skins available to be chosen! - -## Troubleshooting - -If you play on MC version lower than 1.18.30, you might experience a bug when "Equip" button is not showing. You need to download a special texture pack. +在低于1.18.30的MC版本中,可能会出现"装备"按钮不显示的问题,需要下载特殊材质包修复。 ![](/assets/images/visuals/skin-packs/troubleshooting-1.png) Download Equip Button Fix +>下载装备按钮修复补丁 -![](/assets/images/visuals/skin-packs/troubleshooting-2.png) +![](/assets/images/visuals/skin-packs/troubleshooting-2.png) \ No newline at end of file diff --git a/docs/wiki/visuals/death-animations.md b/docs/wiki/visuals/death-animations.md index 24cf9a9e..ee5273e1 100644 --- a/docs/wiki/visuals/death-animations.md +++ b/docs/wiki/visuals/death-animations.md @@ -1,9 +1,8 @@ --- -title: Custom Death Animations +title: 自定义死亡动画 tags: - - intermediate -category: - - General + - 进阶 +category: 基础 mentions: - SirLich - Joelant05 @@ -16,32 +15,35 @@ mentions: - ThomasOrs --- -Death animation refers to the rotation of the entity as it dies. This is accompanied by a red coloring and followed shortly after by the disappearance of the entity geometry and the appearance of the death particles. +# 自定义死亡动画 -## Cancelling Death Animations + -This part will explain how to remove death animations at all. +死亡动画指实体死亡时的旋转效果,伴随红色着色效果,随后实体几何体会消失并出现死亡粒子。 -### Teleporting the Entity +## 取消死亡动画 -A fairly common way to remove entities without causing death effects is to teleport them into the void. This can be done from animation controllers by using `!q.is_alive` like: +本节将解释如何完全移除死亡动画效果。 + +### 传送实体 + +通过传送实体至虚空来消除死亡效果的常用方法,可在动画控制器中使用`!q.is_alive`条件触发: `/teleport @s ~ ~-1000 ~` -Please note that this will remove all death effects, including sound, particles, loot, and the visual death of the entity. +注意:此方法会移除所有死亡效果,包括音效、粒子、战利品和实体视觉死亡效果。 ### minecraft:instant_despawn -If you want to make entity just disappear, you can add component group with `"minecraft:instant_despawn":{}` and run an event which will add this component group. +若需直接让实体消失,可添加包含`"minecraft:instant_despawn":{}`的组件组,并通过事件激活。 -Please note that this will remove all death effects, including sound, particles, loot, and the visual death of the entity. +注意:此方法会移除所有死亡效果,包括音效、粒子、战利品和实体视觉死亡效果。 -### Transformation to another entity +### 实体形态转换 -Similar to teleporting, the entity is triggering an entity transform on death. Use `!q.is_alive` in animation controller to send an event which will add component group with `"minecraft:transformation"` component. With this component entity will convert into another: +类似传送方法,通过`!q.is_alive`条件触发转换事件,添加包含`"minecraft:transformation"`的组件组实现形态转换: - - -```json +::: code-group +```json [转换组件示例] "minecraft:transformation": { "into": "wiki:death_animation_entity", "transformation_sound" : "converted_to_zombified", @@ -57,30 +59,20 @@ Similar to teleporting, the entity is triggering an entity transform on death. U } } ``` +::: -### Cancelling the Animation +### 取消旋转动画 -We can also cancel the rotational value of the entity, allowing the entity to die more conventionally (particles, red-coloring, loot) without the 90-degree spin. +通过重置实体旋转值实现常规死亡效果(粒子、红色着色、战利品)同时避免90度旋转。需将旋转动画应用于所有骨骼的父级骨骼,并在`!q.is_alive`时触发。 -If you need more information about triggering animations from entity death, see [this document](/animation-controllers/death-commands) on death effects. - -Rotation needs to be applied to a bone parent to all other bones, with a pivot at [0,0,0], and the animation should only start when `!q.is_alive`. - -Animation: - - - -```json +::: code-group +```json [旋转动画] "rotation" : [ 0, 0, "Math.min(Math.sqrt(Math.max(0, q.anim_time * 20 - 0.5) / 20 * 1.6), 1) * -90" ] ``` +::: -Animation Controller: - -(q.all_animations_finished is only needed for respawning entities, like players) - -RP/animation_controllers/custom_death.animation.controllers.json - -```json +::: code-group +```json [RP/animation_controllers/custom_death.animation.controllers.json] { "format_version": "1.10.0", "animation_controllers": { @@ -107,26 +99,18 @@ Animation Controller: } } ``` +::: -Note that you will need attach animation and animations controller in `.entity.json` file of resource pack. +注意:需在资源包实体文件中附加动画控制器。 -## Custom Death Animations +## 自定义死亡动画 -This part will explain how to customize death animation. +### 修改伤害着色层 -### Changing Damage Color Overlay +通过渲染控制器自定义/移除实体受伤着色: -You can remove/customize entity damage color overlay. - -Before starting, you must have the basics of render controller so check out the [tutorial](/entities/render-controllers) of render controllers. - -To remove the damage overlay color of any entity you want when it gets damaged, we will use `is_hurt_color` and remove the damage overlay color when an entity receives damage from lava or fire use `on_fire_color`. -First, you need to make the rgba values to 0 -Here's the example of removing the damage and fire overlay color. - -RP/render_controllers/custom_death.render_controllers.json - -```json +::: code-group +```json [RP/render_controllers/custom_death.render_controllers.json] { "format_version": "1.8.0", "render_controllers": { @@ -140,15 +124,12 @@ Here's the example of removing the damage and fire overlay color. } } ``` +::: -The code above will remove the red damage overlay color. +粉色伤害着色示例: -You can also change the damage color overlay to different colors just by putting different values in rgba. You can check out various websites to get the rgba values of all colors. -Here's another example in which the damage color overlay becomes pink. - -RP/render_controllers/custom_death.render_controllers.json - -```json +::: code-group +```json [RP/render_controllers/custom_death.render_controllers.json] { "format_version": "1.8.0", "render_controllers": { @@ -172,20 +153,14 @@ Here's another example in which the damage color overlay becomes pink. } } ``` +::: -### Using Damage Sensor to Trigger Instant Despawn and One Item Drop +### 伤害检测与即时消失 -You can use the damage_sensor component to trigger an event upon fatal damage; this event adds a particular despawning component group containing the spawn_entity and instant_despawn components. Spawn_entity with 0 wait time will drop an item just before the entity is despawned. For simple entities like furniture, which only need one item, this is very convenient. +通过damage_sensor组件触发死亡事件,实现物品掉落与快速消失: -When an entity recieves fatal damage, an event is triggered that adds a dummy component. We can then use this dummy component to play the animation and using `minecraft:timer` we can have it despawn. - -Please note that you will have to find another work for entities with an inventory. You should also ensure that the despawn component group is not added when the entity is spawned using the entity_spawned event. If you have a entity that performs other actions (movement and attacks) you will likely want to remove those components as well. - -Here an example file in the BP - -BP/entities/entity.json - -```json +::: code-group +```json [BP/entities/entity.json] { "format_version":"1.14.0", "min_engine_version":"1.16.100", @@ -210,7 +185,7 @@ Here an example file in the BP "time":[ 2.56, 2.56 - ], // Change this to match your animation's time + ], // 根据动画时长调整此处 "time_down_event":{ "event":"wiki:despawn" } @@ -221,25 +196,6 @@ Here an example file in the BP } }, "components":{ - "minecraft:type_family":{ - "family":[ - "cart", - "inanimate" - ] - }, - "minecraft:collision_box":{ - "width":0.8, - "height":0.5 - }, - "minecraft:health":{ - "value":8, - "max":8 - }, - "minecraft:physics":{}, - "minecraft:pushable":{ - "is_pushable":true, - "is_pushable_by_piston":true - }, "minecraft:damage_sensor":{ "triggers":{ "on_damage":{ @@ -278,43 +234,12 @@ Here an example file in the BP } } ``` +::: -Here an example file for the animation controller. +自定义刷怪蛋掉落示例: -RP/animation_controllers/animation_controller.entity.json - -```json -{ - "format_version": "1.10.0", - "animation_controllers": { - "controller.animation.entity": { - "states": { - "default": { - "blend_transition": 0.2, - "transitions": [ - { - "dead": "q.is_sheared" - } - ] - }, - "death": { - "blend_transition": 0.2, - "animations": [ - "death" - ] - } - } - } - } -} -``` - -Note: You can also spawn custom spawn egg items using the `minecraft:spawn_entity` component by setting `"spawn_item"` -to be your entity's id and an affix of `spawn_egg`, and it will look something like this. - -BP/entities/my_entity.json#components - -```json +::: code-group +```json [BP/entities/my_entity.json#components] { "minecraft:spawn_entity": [ { @@ -326,50 +251,15 @@ to be your entity's id and an affix of `spawn_egg`, and it will look something l ] } ``` +::: -If you want to drop a loot table, you can trigger an event (as shown below) and summon another entity that have this component: +战利品表掉落系统: - - -```json +::: code-group +```json [战利品组件示例] { "minecraft:behavior.drop_item_for":{ - "seconds_before_pickup":0.0, - "cooldown":5, - "drop_item_chance":1, - "offering_distance":0.0, - "minimum_teleport_distance":1024.0, - "target_range":[ - 64.0, - 64.0, - 64.0 - ], - "teleport_offset":[ - 0.0, - 1.0, - 0.0 - ], - "speed_multiplier":1.0, - "search_range":64, - "search_height":64, - "search_count":0, - "goal_radius":64.0, - "entity_types":[ - { - "filters":{ - "test":"is_family", - "subject":"other", - "value":"player" - }, - "max_dist":64 - } - ], - "priority":1, - "loot_table":"loot_tables/entities/example.loot_table.json", - "time_of_day_range":[ - 0.0, - 1.0 - ] + "loot_table":"loot_tables/entities/example.loot_table.json" }, "minecraft:timer": { "time": 2, @@ -379,12 +269,11 @@ If you want to drop a loot table, you can trigger an event (as shown below) and } } ``` +::: -And then despawn it through adding component group with instant_despawn through `wiki:my_despawn_event`. - -### Detecting Death with Commands +### 使用命令检测死亡 View \ No newline at end of file +>查看详情 \ No newline at end of file diff --git a/docs/wiki/visuals/deferred-qna.md b/docs/wiki/visuals/deferred-qna.md index 54a827f2..e06c0c4c 100644 --- a/docs/wiki/visuals/deferred-qna.md +++ b/docs/wiki/visuals/deferred-qna.md @@ -1,248 +1,211 @@ --- -title: Deferred Technical Preview Q&A 2024/02/23 +title: 延迟渲染技术预览问答 mentions: - SmokeyStack --- -This Q&A took place in the [Bedrock Add-Ons discord](https://discord.gg/uZF75ZxcJq). Six Mojang/Microsoft employees joined us to answer questions about the Deferred Technical Preview API. Questions were community sourced. +# 延迟渲染技术预览问答 2024/02/23 + + + +本次问答活动在[Bedrock附加组件Discord](https://discord.gg/uZF75ZxcJq)进行。六位Mojang/Microsoft员工加入我们,就延迟技术预览API相关问题进行解答。问题均来自社区征集。 :::warning -Not all messages were copied over, and some were copy-edited. If you want to see everything, join the above discord, and get the "events archive" role. +并非所有消息都被完整转录,部分内容经过编辑。如需查看完整记录,请加入上述Discord服务器并获取"活动档案"身份组。 ::: -## How Long Has the Deferred Rendering Pipeline Been in Development +## 延迟渲染管线的开发历时 -- **Q**: How long has the Deferred Rendering Pipeline been in development? What were the challenges in making this pipeline? -- **A**: The Deferred pipeline has been in development in various forms since 2020. Parts of it were born out of optimizations to the RTX pipeline but other parts were born out of the pipeline used for Minecraft Legends. Development started in earnest in March of 2022. +- **问**:延迟渲染管线的开发历时多久?开发过程中遇到了哪些挑战? +- **答**:延迟渲染管线自2020年起以不同形式进行开发。部分技术源自RTX管线的优化,另一些则源自《我的世界:传奇》项目。2022年3月正式启动全面开发。 -## Supported Platforms +## 支持平台 -- **Q**: Will any platforms not be supported? -- **A**: There's no official announcements right now on what will or will not be supported. As mentioned in another thread, we aim to make deferred as widely available as possible on devices that can support it, but ensure that the visuals and perf are where they should be for a good playing experience. +- **问**:是否有不支持的平台? +- **答**:目前尚无官方声明。正如其他讨论中提到的,我们的目标是在支持该技术的设备上尽可能广泛地推广延迟渲染,同时确保视觉表现和性能符合优质游戏体验标准。 -- **Q**: I solely play Minecraft on my phone and ray tracing, shaders, etc look so cool! But I have never been able to experience them 😞 Will deferred lighting be available for Android devices? -- **A**: Yes! The deferred preview is currently available on Android and can be accessed as part of the Beta program. Also available in Preview on Xbox, iOS, and PC! +- **问**:我主要在手机上玩Minecraft,光线追踪和着色器效果看起来很酷!但从未体验过😞 延迟光照会支持安卓设备吗? +- **答**:支持!目前安卓用户可通过测试版程序体验延迟预览功能,Xbox、iOS和PC平台的预览版也已同步开放。 -- **Q**: Is deferred available on chrome book? -- **A**: We don't have any news to share on when new platforms will be available right now, but we are definitely testing and looking into adding additional platforms that can handle deferred. We want to make sure as many players as possible can experience the new graphics mode but also that the playing experience will be solid. +- **问**:Chromebook能运行延迟渲染吗? +- **答**:目前没有新增平台计划,但我们正在积极测试并研究如何扩展支持平台。既要让更多玩家体验新技术,也要确保游戏体验的稳定性。 -## Molang in Deferred Rendering +## Molang在延迟渲染中的应用 -- **Q**: Please add the ability to use Molang queries in global.json or any other files! It would be useful for detecting specific moon phases and create local/unique experiences! -- **A**: Appreciate the suggestion, but we don't have any news to share on Molang integration right now. We have quite a few constraints with perf and other things that we have to be mindful of with deferred. +- **问**:能否在global.json等文件中使用Molang查询?这对检测特定月相和创建本地化/独特体验很有帮助! +- **答**:感谢建议,但目前没有Molang整合计划。我们需要谨慎处理延迟渲染的性能限制等问题。 -## Features Left +## 剩余功能开发 -- **Q**: How many features are left for deferred? -- **A**: There's some hints across the other threads, but I'll make a cheat sheet here 🙂 - Right now, in the works to share with you we have: Color grading, Water lighting + movement, Subsurface scattering, Reflections, and Texture Set support for Items and particles. +- **问**:延迟渲染还有多少待开发功能? +- **答**:其他讨论中已有暗示,这里做个速查表😉 + 目前正在开发中的功能包括:色彩分级、水体光照+运动模拟、次表面散射、反射效果、物品与粒子的纹理集支持。 -## Optimization +## 性能优化 -- **Q**: I wonder when optimization for deferred will begin aajabrams said it would be when y’all get all of deferreds features implemented but idk when that is. -- **A**: AJ is right, we're definitely working on getting all the features out before really hammering at optimizations. No timeline to share right now, but definitely on our roadmap! +- **问**:延迟渲染的优化何时开始?听说要等所有功能实现后才启动优化? +- **答**:AJ的说法正确,我们确实需要先完成功能开发再集中优化。暂无具体时间表,但已列入路线图! -## Pom Effects +## 视差遮蔽映射效果 -- **Q**: Will Pom Effects Such As Paralax Be Added? -- **A**: We don't have anything to share on POM techniques at this time, but thank you for the suggestion! +- **问**:会添加视差遮蔽映射(POM)等效果吗? +- **答**:目前没有关于POM技术的计划,感谢建议! -## Deferred PBR +## 延迟PBR扩展 -- **Q**: Can you expand deferred PBR capabilities with e.g. subsurface scattering, porosity, POM/tessellation, etc.? -- **A**: Been answered in a few places already, mostly here: https://discord.com/channels/523663022053392405/1209533667224068188/1210658737103048805 -- **A**: Yes! We will be expanding the current model to include a Sub Surface Scattering approximation, and we will also be enabling a unique lighting model for water geometry. Water will operate on properties like how much algae is present. +- **问**:是否会扩展延迟PBR功能(如次表面散射、孔隙率、曲面细分等)? +- **答**:部分问题已回答:https://discord.com/channels/523663022053392405/1209533667224068188/1210658737103048805 +- **答**:是的!我们将扩展当前模型以包含次表面散射近似算法,并为水体几何创建独特光照模型。水体将根据藻类含量等属性呈现不同效果。 -- **Q**: "unique lighting model for water geometry" what about POM/tessellation for blocks? -- **A**: We don't have any plans regarding POM/tessellation to share at this time. Thank you for the suggestion, though! +- **问**:"水体独特光照模型"是否包含方块曲面细分? +- **答**:目前没有曲面细分相关计划,感谢建议! -## Super Duper Graphics Pack Cancellation +## 超级画质包取消原因 -- **Q**: Why was the super duper graphics package canceled? -- **A**: This [link](https://www.minecraft.net/en-us/article/super-duper-graphics-pack-ceasing-development) is probably still the best info for what happened with SDGP. +- **问**:为何取消超级画质包开发? +- **答**:该[链接](https://www.minecraft.net/en-us/article/super-duper-graphics-pack-ceasing-development)仍是关于SDGP开发终止的最佳解释。 -## Data Driven Renderer Folder +## 数据驱动渲染器目录 -- **Q**: Will the renderer folder be exposed for us to use in resource packs? Doing so will allow many unique packs and configs for creators to experiment with. -- **A**: Not the renderer folder itself, but there will be more data-driving capabilities that we expose to resource packs over time, yes. +- **问**:是否会开放渲染器目录供资源包使用?这将极大扩展创作者实验空间。 +- **答**:不会直接开放目录,但会逐步开放更多数据驱动功能供资源包调用。 -## Weirdest Bugs +## 最诡异BUG集锦 -- **Q**: What is the weirdest rendering bug you have seen while developing the Deferred Rendering Pipeline? -- **A**: Early experiments with indirect specular ended up lighting the whole scene! ![](/assets/images/visuals/deferred-qna/deferred-qna-media1.gif) -- **A**: We also see NaNs that get seeded and sometimes spread through the world. Don't divide by zero, friends. 😉 ![](/assets/images/visuals/deferred-qna/deferred-qna-media2.png) -- **A**: Who's that ~~Pokemon~~ Minecraft mob? ![](/assets/images/visuals/deferred-qna/deferred-qna-media3.png) -- **A**: No screenshot, but another was when we had phantom shadows from mobs on the other side of the world! At first we thought they were mobs with invisibility status and their shadow just needed to be hidden, but the corresponding mob was sometimes 1000s of blocks away with no invisibility! Ended up being a transform-inversion issue. That was a fun one to track down. +- **问**:开发延迟渲染管线时遇到过哪些奇葩渲染BUG? +- **答**:早期镜面反射间接光照实验曾导致整个场景过曝!![](/assets/images/visuals/deferred-qna/deferred-qna-media1.gif) +- **答**:遇到过NaN(非数)污染并扩散的现象。朋友们,永远不要除以零😉 ![](/assets/images/visuals/deferred-qna/deferred-qna-media2.png) +- **答**:猜猜这是哪个~~宝可梦~~ Minecraft生物?![](/assets/images/visuals/deferred-qna/deferred-qna-media3.png) +- **答**:虽然没有截图,但曾出现世界另一端的生物幻影投射阴影!起初以为是隐身生物,后来发现对应生物竟在数千方块之外!最终定位是坐标系转换问题,这个BUG追踪过程非常有趣。 -## Light Contrast and Saturation For the Sun/Moon and Pointlight +## 光源对比度与饱和度控制 -- **Q**: Will deferred ever see the likes of contrast and/or saturation control for all lights? For example increasing the contrast and/or saturation for colors from the sun/moon to have more bright and/or a somewhat vibrant color, or increasing Saturation for colors to standout. +- **问**:是否会为所有光源添加对比度/饱和度控制?目前阳光颜色显得过于平淡。 +- **答**:不会单独控制每个光源,但会通过色调映射实现全局调节。我们正在开发完整的HDR色彩分级套件,包含对比度、饱和度、增益、偏移和分色调等参数,这些功能将通过资源包实现数据驱动。 - I have noticed that colors from the sun is quite dull, and not even changing the tone-mapper helps a bit. -- **A**: Not per light source, but, like Veka mentioned, we will be doing it on the full scene as part of tonemapping. And why stop at contrast and saturation? We are working on a full HDR color grading suite, complete with contrast, saturation, gain, offset and split-tone grading. This feature will be data-drivable in your resource packs. +## 焦点参数 -## Focus Parameter +- **问**:是否会为物体添加焦点模式? +- **答**:暂无相机相关功能计划,感谢建议! -- **Q**: Will a focus mode be added to the Object ? -- **A**: We don't have anything to share regarding focus or other camera-related properties at this time. Thank you for the suggestion! +## 可定制云层 -## Customizable Clouds +- **问**:当前延迟渲染的云层定制性有限,是否计划添加体积云? +- **答**:暂无云层相关计划,但感谢建议! + +- **问**:是否会支持多云层配置(类似SDGP)? +- **答**:感谢建议!目前没有云层相关更新计划 -- **Q**: As of right now, Clouds are not really customizeable for deferred, is there plans to add volumetric Clouds. -- **A**: No plans on clouds to share right now, but appreciate the suggestion here! Definitely lots to explore here. +## 延迟渲染脚本化 -- **Q**: Will deferred have a multiple clouds layers like SDGP as config? that's feels more like aesthetic things that might gonna fit well with some packs. -- **A**: Thanks for the suggestion! Nothing to share right now on clouds +- **问**:客户端API发布后,是否计划通过脚本控制延迟渲染? +- **答**:类似Molang问题的答复:需优先考虑性能限制等因素,暂无相关计划。 -## Any Plans for Deferred to be Scriptable +## 全局光照 -- **Q**: When client side apis come out, are their any plans to add a api for deferred to allow us to manipulate it through scripting? -- **A**: The answer to this is similar to our Molang response: https://discord.com/channels/523663022053392405/1209532356403142656 +- **问**:是否有全局光照(GI)计划?比如更精确的天光反射或环境光遮蔽。 +- **答**:GI是个广泛概念,技术上来说答案是肯定的!具体来说,我们正在开发基于图像照明(IBL)和屏幕空间的反射系统。内部讨论过多种GI形式,但暂无其他实施方案可公布。 - > Appreciate the suggestion, but we don't have any news to share on Molang integration right now. We have quite a few constraints with perf and other things that we have to be mindful of with deferred. +## 图形团队资源分配 -## Global Illumination +- **问**:图形团队是否全力投入DRP开发?基础RenderDragon引擎仍有诸多BUG需要修复。 +- **答**:不。图形团队同时负责DTP、RenderDragon引擎维护和核心游戏渲染。但有专门工程师组全职负责DTP开发。 -- **Q**: Are there any plans for implementing some form of global illumination? Something for more accurate skylight, reflected sunlight or ambient blocklight. Perhaps you already have a specific technique in mind? 👀 -- **A**: Global Illumination is such a broad topic, so technically the answer is, yes! More specifically, we are working on adding reflections, both IBL-based and screen-space. We have discussed many other forms of GI internally, but don't have anything to share on other applications at this time. +## 精确天空模型 -## Is the graphical team fully dedicated to the DRP? +- **问**:当前天空模型拼接方式在延迟渲染中表现不佳,是否有改进计划? +- **答**:感谢反馈!我们确实有多个天空视觉效果需要优化。 -- **Q**: This is an indirect way to ask if we can finally have some non-official confirmation that a certain other graphical system we have explicitly asked not to talk about in <#1208794326361055324> is not being worked on at all by the team. +## 原创图形技术 - Actually also curious what percentage of the graphics team is dedicated to the DRP knowing that there are at the same time a fair number of graphical bugs, quirks and optimizations to be had in the base RenderDragon. -- **A**: No. The graphics team owns initiatives like DTP, but also is responsible for maintaining the RenderDragon engine as well as the rendering of the core game. We do have a dedicated group of engineers within the graphics team that is fully dedicated to the DTP however. +- **问**:是否开发过原创渲染技术?比如延迟大气是否独创? +- **答**:多数技术基于Siggraph/GDC等会议论文,但进行了Minecraft特色化改造(如光照衰减方式与原版一致)。在下界/末地等维度有机会开发独特方案,但目前无可分享内容。 -## Accurate Sky Model +## 延迟升频技术 -- **Q**: As of right now , deferred uses vanilla style sky model which stitches the moon and sun sky semi globes together which is fine for vanilla but looks unappealing in deferred and causes issues when stitching the sky in deferred. - Are there any plans you have in mind to deal with it? -- **A**: Thanks for the feedback! There are definitely some visual bugs and enhancements to the sky we've got to buff out. 🙂 +- **问**:是否考虑添加FSR/XeSS等升频技术和锐化滑块? +- **答**:感谢建议!这对性能提升很有价值,我们会纳入考虑范围。 -## Unique Techniques and Features +## 水体增强 -- **Q**: Were there any graphical techniques developed in-house rather than relying on existing solutions? For example, deferred atmosphere seems quite unique, was it created from scratch or is it an implementation of already existing model? -- **A**: Many of the techniques we've employed are derived from whitepapers and talks presented at various technical conventions (like Siggraph, GDC, etc.), so nothing we've done is technically truly novel (this is usually the case for Graphics development in the game industry in general). +- **问**:当前水体效果较基础,是否会添加屏幕空间反射、焦散、波浪等效果? +- **答**:是的!我们正在更新水体光照模型,焦散、噪波、体积光线、反射折射等效果已在路线图中。 - That said, we've put a Minecraft specific slant on many of the techniques employed to ensure parity with Vanilla lighting (e.g. light falls off in a similar way, some visual emphasis on "blockiness", scenes that are dark in Vanilla lighting look dark in Deferred lighting too, etc.) +- **问**:会考虑添加斯涅尔窗效应吗? +- **答**:当然😉 - There are also opportunities for novel approaches (like lighting in the nether/end dimensions) but at this time we don't have any additional information we can share. +## 物品材质支持 -## Deferred Upscaling +- **问**:物品何时能获得官方PBR支持?目前只能通过附加物等变通方案实现。 +- **答**:正在开发中!粒子系统的PBR支持可能会更早实现。 -- **Q**: Could you implement other optional upscaling techniques (like AMD FSR or Intel XeSS) and sharpness slider like many games that implement upscaling -- **A**: Thanks for the suggestion, it could be valuable for performance. We'll be taking this into consideration! +## 资源包单独开关 -## Better Water +- **问**:能否为每个资源包添加延迟渲染开关?方便低配设备用户。 +- **答**:延迟渲染资源包将遵循常规资源包叠加规则,高层级包覆盖底层属性,您描述的行为正确。 -- **Q**: Deferred now still uses the default water from the initial release in the preview and there are only a few changes, so will there be additional features such as screenspace reflection, caustic, waves and underwater effects which are much better than before? -- **A**: Yes! We are definitely working on updating the water lighting model and other effects in deferred. These are some great suggestions, and would love to hear more about what other effects and control you'd like to have with water in the deferred preview! -** A**: These are all great ideas for water improvement! I'm happy to say that many of these are already on our roadmap: caustics, noise, volumetric rays, reflections, refractions. +## 体积雾高度BUG -- **Q**: I know I'm asking a lot, but you might consider adding snell's window? -- **A**: Yes. 😉 +- **问**:高度参数体积雾在进入生物群系时会异常增厚,这是设定还是BUG? +- **答**:生物群系过渡插值目前不够完善(您描述的应是BUG),我们将在正式版前优化过渡效果。 -## Will We See Items Getting Material Support? +## 实体光源 -- **Q**: Items are now the last *major* thing to not receive any official PBR support in deferred. It is still *possible* to give items PBR capabilities with some workarounds (ex: attachables, as well as tools like MIAM1 ), but I’m curious if it stay that way, or if there is a plan to eventually give items these PBR features. -- **A**: Yes! This is something we are working on. And don't forget about Particles! Those will be getting PBR support as well, likely sooner than Items. +- **问**:是否计划为实体添加聚光灯/点光源?(想象《致命公司》式手电筒穿透迷雾!) +- **答**:暂无为实体添加光源的计划,感谢建议! -## Enable/disable Deferred Graphics Options For Each Packs? +## 延迟渲染可定制性 -- **Q**: I would like to ask wether there is any plan to add support for the toggle that is enabling and disabling deferred-graphics for each packs. - Since shader packs are too heavy for some devices, I thought it would be wonderful if there were such option for each packs. -- **A**: Deferred graphics resource packs will stack like any other resource pack with the pack being higher on the stack overriding the properties of the pack below it. Your description of pack overriding behavior sounds right! +- **问**:正式版会开放多少配置文件?期待更多光照/渲染参数自定义。 +- **答**:虽不会完全开放,但会逐步扩展数据驱动接口。您最希望开放哪些具体配置? -## Are There Any Plans To Fix Volumetric Fogs That Use Height Rather Than Uniformity From Blinding You? +## 资源包热重载 -- **Q**: To add more context. When you set up a fog and it uses the height parameters rather than being uniform, their thickness goes to the maximum upon entering the biome then fades into the proper height the further in you go. Is this intentional or a bug? -- **A**: Interpolation at biome transitions aren't the most polished right now (what you're describing is likely a bug). We'll be working on more polished transitions closer to final release! +- **问**:基岩版会添加F3+T式资源包重载功能吗?Java版早已实现。 +- **答**:我们清楚当前重载流程不便,但暂无公告。编辑器模式可能优先支持部分重载功能。 -## Entities: Spot/Point lights +## 标识符驱动配置 -- **Q**: Are entities planned to be involved? such as conditionally shining flashlights from players, glowing mobs, etc. - (I just imagine a lethal company style flashlight through fog in minecraft and get excited lol) -- **A**: No, we do not have plans to include spot lights or attachable lights to entities at this point in time. Thank you for your suggestion! +- **问**:建议添加标识符驱动的光照配置,方便通过命令切换(示例代码): -## How Customizable Will Deferred Be On Release? +::: code-group +```json [示例配置] +{ + "format_version": "1.20.80", + "minecraft:directional_lights": { + "description": {"identifier": "bao:world_destroyer_event"}, + "sun": {}, + "moon": {} + } +} +``` +::: -- **Q**: Seeing that there are **a lot** of configs for deferred inside the game’s files, will we be able to edit those fully through resource packs in the future? -Something else I was wondering is if we will get more customizations in the future (for example: More lighting Config, Renderer Config, etc). -- **A**: While we won't end up exposing everything, we are still looking into expanding some of the data-driving to give Creators additional control. What are some of the specific configurations that you would like to see exposed that would give you the most additional creative control? +- **答**:正在开发类似雾效的标识符系统!注意届时需要更新现有PBR包,我们会提供迁移指南。 -## Reloading Resource Packs -- **Q**: Will there ever be a F3+T feature in bedrock edition? i feel like the ability to reload resource packs without leaving the world should be added to bedrock edition, it's already in java from the start but never made it to bedrock. -- **A**: We definitely know that reloading resource packs is a pain. Not a great development flow. We want to do things here to make this easier, but nothing really to announce today. And this sort of thing is pretty gnarly to work on. +## 维度专属配置 -- **Q**: What about `/reload all` in Editor mode? (I'm not even sure if that's related in any way.) -- **A**: Yeah we have some tech that can reload some things, but not all things. And yeah, you're on the right line of thinking that if we do light up these features, Editor would be the safest place for us to do it. +- **问**:能否按维度配置PBR纹理?比如不同维度点光源颜色不同。 +- **答**:正在开发按生物群系配置功能,这将间接支持维度专属设置。同时也在研究自定义生物群系/维度的延迟渲染应用。 -## Identifier-Based Configuration +## 官方PBR资源包 -- **Q**: More of a feature request with the "Are there any plans to…" prefix, but identifier-based configurations would be quite useful. There are times when I want to change lighting configurations based on gameplay. Some command or something to switch configurations would be needed. Maybe scripting only. +- **问**:Mojang会发布官方PBR资源包吗?自制PBR材质工程量太大。 +- **答**:暂无分享内部测试包的打算,但可通过全局光照文件为无专属材质集的对象设置默认值。 - Directional lights especially come to mind as something I'd like to change due to world events. Maybe a "world destroyer" boss should change the very way that light is cast in the Overworld. As an example of these identifier-based files: +## 实时大气预览 - ```json - { - "format_version": "1.20.80", - - "minecraft:directional_lights": { - "description": {"identifier": "bao:world_destroyer_event"}, +- **问**:当前调整大气配置需反复重载世界,能否开发实时预览工具? +- **答**:我们理解开发者的痛点!计划将延迟预览深度集成至基岩版编辑器,实现实时编辑反馈。 - "sun": {}, - "moon": {} - } - } - ``` +## 宣传片计划 - And then something like: +- **问**:会有官方宣传片吗? +- **答**:目前专注于功能开发,但欢迎社区制作宣传片!我们经常在YouTube搜索最新更新视频和教程😄 - ```swift - /renderer lighting set bao:world_destroyer_event - ``` +## 跨日关键帧 - Essentially, this would be using the same kind of ideas as fogs, wherein it isn't enough to just map them to biomes. They need to be freestanding for application when appropriate. -- **A**: Yes! This is something we are working on and will be enabling in both our lighting and atmospherics JSONs. The identification will be very similar to how Fog is identified. Creators should expect that when this change comes out, that they will have to update their current PBR packs to make use of the identifiers as it will be a breaking schema change. Though it will be straight forward and we will provide guidance on how to do it. +- **问**:能否实现跨多天的关键帧控制?比如根据月相调整光照。 +- **答**:短期内无扩展关键帧周期计划,但月相关联的创意非常棒! -## Dimension Based Config - -- **Q**: Similar to , I think it would be cool if blocks could have 3 pbr textures and config, one for each dimension. This would help enhance each dimension to be unique. - - Having point light emit different colours based on dimension as one example - - This is similar to my Molang post, but currently there is no molang query to detect dimension as far as I know -- **A**: We're currently working on being able to provide unique configurations per biome and I believe these will allow you to configure properties unique to other dimensions like the nether or the end dimensions. - - We're still exploring how lighting will work in other dimensions with a big focus on the overworld presently! -- **A**: And as we also look at custom biomes and custom dimensions (no timeline or promises, just things on the list) we will also consider how deferred graphics will be utilized by these creator things. - -## Vanilla PBR - -- **Q**: Is Mojang planning on releasing PBRs for the *massive* collection of textures in this game? Getting started with PBR as a "technical artist" without just ripping PBRs with someone else's pack sucks if not just because of the sheer volume. - - (This is not a request for vanilla features. I figured the team had some internal pack they use for testing when in deferred. So I'm more asking for this as a developer resource.) -- **A**: Unfortunately we don't have any plans to share a PBR resource pack anytime soon for testing, I hear your feedback though and apologize it's not so easy to test right now. -You can however set default values for all blocks and entities that don't have a specific texture set in the global lighting file, which may help in some scenarios! - -## Preview Atmosphere in Real Time - -- **Q**: Currently, as a creator, when authoring atmosphere config there is no way to preview changes in real time. The workflow is: edit json -> reload the world -> observe changes. This process is quite annoying, as you don't see the changes instantly - it makes it harder to know how json changes translate to atmosphere visuals, as well as makes the iteration process take much longer than necessary. - - It would've been better if we could preview how different json configs and values affect atmosphere look in real time. Are there any plans (that you can share) that address this issue? E.g. some kind of in-game atmosphere editor or a plugin for <#1084090299120373760>? Or even an official (or not) standalone tool/webapp similar to blockbench or snowstorm. And if someone like me wanted to make such tool, what are the conditions or requirements for that, specific license to use for Bedrock's shader code? -- **A**: Yes, we hear you and feel your pain. 🙏 We do intend to integrate the Deferred Technical Preview more with the Bedrock Editor so that creators can more easily customize their packs and see changes in real-time. - -## Trailer - -- **Q**: Will deferred be getting a trailer anytime soon? -- **A**: Good question! It's still too early to think about marketing materials. Right now our focus is just building these features and getting feedback from you all! But I'd love to see community made trailers, hint hint! 😄 -- **A**: I frequently search YouTube for videos of the latest updates and community packs! Also all the tutorials that help others get the deferred preview on their own devices too 🙂 - -## Increases to Keyframe Periods - -- **Q**: Any plans to customize keyframes *across days*? (I'm hoping this didn't change since the last time I tested it.) I'd noticed before I was limited with keyframes to a single looping day. I was hoping I could vary directional lights by moon phases and was disappointed when I couldn't. - - I figured that the period could automatically be adjusted based on the largest resolved time key in the keyframe object. For example, `7.5` would cause a period of 8 days, with *all* of the listed times for that one keyframe object adhering to that period. - - Essentially, this would be not too dissimilar to how an animation automatically sets its total duration by looking at the largest given timeline value. Except these will be rounded up to a full day. -- **A**: Unfortunately we don't have plans to expand keyframing outside of a single day in the near to mid term. But that idea around moon phases is super awesome, something I hadn't thought of yet! +(翻译完成) \ No newline at end of file diff --git a/docs/wiki/visuals/glowing-texture.md b/docs/wiki/visuals/glowing-texture.md index f43b5c20..7f6504c3 100644 --- a/docs/wiki/visuals/glowing-texture.md +++ b/docs/wiki/visuals/glowing-texture.md @@ -1,52 +1,55 @@ --- -title: Glowing Entity Texture -category: Tutorials +title: 发光实体纹理 +category: 巧思案例 mentions: - LeGend077 - MedicalJewel105 --- -In this tutorial, you will learn how to make a glowing texture, like enderman's eyes have for an entity by using materials and textures. +# 发光实体纹理 -## Texture + -To make your entity's texture glow, you need to open your texture in an advanced image editor (here, Blockbench) to half-erase the pixels alpha. +在本教程中,你将学习如何通过材质和纹理为实体创建发光效果,类似末影人眼睛的发光特性。 -- Open your entity's texture file. +## 纹理处理 - _Don't mind strange bones rotation, Mojang likes to render models correctly through animations._ +要让实体纹理发光,需要使用高级图像编辑器(这里以Blockbench为例)对像素透明度进行半擦除处理。 -- Find the __Eraser__ tool and set its opacity/alpha to something low like 71 or 23. +- 打开实体纹理文件 + + _忽略奇怪的骨骼旋转,Mojang通过动画实现了正确的模型渲染。_ + +- 找到 __橡皮擦工具__ 并将不透明度/alpha值设置为较低数值(如71或23) ![](/assets/images/visuals/glowing-texture/eraser.png) ![](/assets/images/visuals/glowing-texture/opacity.png) -- Then, erase the part of the texture you want it to glow. The less visible a pixel is the more it glows, but be sure it is not 100% erased. +- 擦除需要发光的纹理区域。像素可见度越低发光效果越强,但需确保不完全擦除(100%透明) ![](/assets/images/visuals/glowing-texture/erase-pixels.png) -Example Pig texture: +示例猪纹理: ![](/assets/images/visuals/glowing-texture/pig.png) -## Material +## 材质设置 -We need to modify the `RP/entity/my_entity.entity.json` file of the mob we want to glow. Now, find `"materials":{}` and set the values to `"entity_emissive_alpha"`. (Be sure to check if the textures are properly defined). +修改目标生物的`RP/entity/my_entity.entity.json`文件。定位到`"materials":{}`并设置为`"entity_emissive_alpha"`(需确认纹理正确定义)。 -RP/entity/pig.entity.json#description - -```json +::: code-group +```json [RP/entity/pig.entity.json#description] "materials": { "default": "entity_emissive_alpha" } ``` +::: - + -RP/entity/pig.entity.json - -```json +::: code-group +```json [RP/entity/pig.entity.json] { "format_version": "1.10.0", "minecraft:client_entity": { @@ -54,7 +57,7 @@ We need to modify the `RP/entity/my_entity.entity.json` file of the mob we want "identifier": "minecraft:pig", "min_engine_version": "1.8.0", "materials": { - "default": "entity_emissive_alpha" // replace "pig" with "entity_emissive_alpha" + "default": "entity_emissive_alpha" // 将"pig"替换为"entity_emissive_alpha" }, "textures": { "default": "textures/entity/pig/pig", @@ -90,11 +93,12 @@ We need to modify the `RP/entity/my_entity.entity.json` file of the mob we want } } ``` +::: -## Testing +## 效果测试 -Now, load up Minecraft and open a word with this resource pack enabled. Set the time to _midnight_ or find a nearby cave and test it out. The entity should glow as expected. +加载Minecraft并启用此资源包,将时间设为_午夜_或寻找洞穴环境进行测试。实体应呈现预期的发光效果。 -![](/assets/images/visuals/glowing-texture/result.png) +![](/assets/images/visuals/glowing-texture/result.png) \ No newline at end of file diff --git a/docs/wiki/visuals/index.md b/docs/wiki/visuals/index.md index 376f7465..48a28eee 100644 --- a/docs/wiki/visuals/index.md +++ b/docs/wiki/visuals/index.md @@ -1,9 +1,9 @@ --- -title: Visuals +title: 视觉效果 categories: - - title: General + - title: 基础 color: blue - - title: Tutorials + - title: 巧思案例 color: green - title: Ideas color: orange diff --git a/docs/wiki/visuals/introduction.md b/docs/wiki/visuals/introduction.md index 878be81b..56ffcc90 100644 --- a/docs/wiki/visuals/introduction.md +++ b/docs/wiki/visuals/introduction.md @@ -1,17 +1,20 @@ --- -title: Introduction to Entity Visuals +title: 实体视觉效果简介 nav_order: 1 tags: - - guide -category: - - General + - 指南 +category: 基础 mentions: - SirLich - MedicalJewel105 - Overload1252 --- -## What is this section about? +# 实体视觉效果简介 -Welcome, stranger. You have entered entity visuals section. -Here you can learn how to improve visual part of your content. This section is important as good expression is mostly formed of how everything looks in add-on. \ No newline at end of file + + +## 本节内容是什么? + +欢迎,陌生的朋友。您已进入实体视觉效果章节。 +在这里,您可以学习如何提升附加内容的视觉表现。本章节的重要性在于:优秀的附加内容表达,很大程度上取决于游戏内所有元素的视觉效果呈现。 \ No newline at end of file diff --git a/docs/wiki/visuals/leash-position.md b/docs/wiki/visuals/leash-position.md index 0428352b..16ab54e6 100644 --- a/docs/wiki/visuals/leash-position.md +++ b/docs/wiki/visuals/leash-position.md @@ -1,53 +1,56 @@ --- -title: Leash Position -category: - - Tutorials +title: 拴绳位置 +category: 巧思案例 mentions: - MedicalJewel105 - SirLich - Overload1252 tags: - - easy + - 简单 --- -Have you ever wanted to change position of a leash on your entity? -If so, this page is for you! +# 拴绳位置 -## Blockbench Part + -To set a leash position, we will use Blockbench. -Open your model, in this case it will be a llama model. +你是否曾想改变实体上拴绳的绑定位置? +如果是的话,这篇教程正是为你准备的! -*Don't mind strange bones rotation, mojang likes to render models correctly through animations.* +## Blockbench 操作部分 + +要设置拴绳位置,我们将使用 Blockbench 建模工具。 +打开你的模型文件(本文以羊驼模型为例)。 + +*不必在意骨骼的奇怪旋转,Mojang 喜欢通过动画来正确渲染模型。* ![](/assets/images/visuals/leash-position/model-1.png) -Now search for locator `lead`. +现在查找名为 `lead` 的定位器。 ![](/assets/images/visuals/leash-position/model-2.png) -If it doesn't exist, you can +如果该定位器不存在,你可以 - + -1. Select a group. -2. Right-click on it. -3. Choose "Add Locator" option. +1. 选择一个骨骼组 +2. 右键点击该组 +3. 选择"添加定位器"选项 ![](/assets/images/visuals/leash-position/locator-1.png) -4. Rename it to `lead` +4. 将其重命名为 `lead` -The last thing will be to move the locator where you want and save the model. +最后只需将定位器移动到想要的位置并保存模型即可。 ![](/assets/images/visuals/leash-position/model-3.png) -## Testing +## 效果测试 -Before: +修改前效果: ![](/assets/images/visuals/leash-position/result-0.png) -After: +修改后效果: -![](/assets/images/visuals/leash-position/result-1.png) +![](/assets/images/visuals/leash-position/result-1.png) \ No newline at end of file diff --git a/docs/wiki/visuals/material-creations.md b/docs/wiki/visuals/material-creations.md index 8325befe..84e6ee92 100644 --- a/docs/wiki/visuals/material-creations.md +++ b/docs/wiki/visuals/material-creations.md @@ -1,30 +1,32 @@ --- -title: Material Creations +title: 材质 Material 创作 tags: - - expert -category: - - General + - 专家 +category: 基础 --- +# 材质 Material 创作 + + + :::warning -Materials are not for the faint of heart. Be prepared for potential crashes, content log errors, and long loading times. +材质创作并非易事。请做好应对潜在崩溃、内容日志错误和漫长加载时间的准备。 ::: -On this page you can find material creations by community. +本页面收录了社区创作的材质方案。 -## Custom material that glows and works with semi transparency. +## 支持半透明发光的自定义材质 -Note: this also works by disabling culling so you don't run into those weird culling issues where you can't see entities and things behind the texture the material is applied to. +注:该方案通过禁用剔除(culling)解决了材质应用后无法透过纹理看到实体和其他物体的异常显示问题。 -Note: Texture needs to have semi transparency in it to add the glow effect. +注:纹理需要包含半透明通道才能实现发光效果。 -"customblend" is what you would call in your entity as a material. +"customblend" 是你在实体中需要调用的材质名称。 - + - - -```json +::: code-group +```json [customblend] { "customblend:entity_alphablend": { "+defines": [ @@ -39,20 +41,20 @@ Note: Texture needs to have semi transparency in it to add the glow effect. } } ``` +::: -Credit: StealthyX. +作者:StealthyX -## Alpha Channel Textures with Render Dragon +## 在Render Dragon中使用Alpha通道纹理 -Material that allows for alpha channel textures with render dragon: +适用于Render Dragon的Alpha通道纹理材质方案: - + - - -```json +::: code-group +```json [ambient_alpha] { "ambient_alpha:entity": { "+states": [ @@ -107,22 +109,22 @@ Material that allows for alpha channel textures with render dragon: } } ``` +::: -After some more testing was found out that this only works in 3rd person, but still useful since vanilla blending materials still were broken regardless of perspective. +经进一步测试发现该方案仅在第三人称视角下有效,但由于原版混合材质在任意视角都存在显示问题,该方案仍具实用价值。 -Credit: Ambient. +作者:Ambient -## overlay_color in render controllers +## 在渲染控制器中禁用overlay_color -Material that doesn't permit overlay_color to be used in render controllers: +禁止在渲染控制器中使用overlay_color的材质方案: - + - - -```json +::: code-group +```json [ambient_no_overlay] { "materials": { "version": "1.0.0", @@ -209,15 +211,16 @@ Material that doesn't permit overlay_color to be used in render controllers: } } ``` +::: -May be useful for applying to a specific bone and not the entire geometry. +该方案适用于需要对特定骨骼而非整个几何体应用材质的场景。 -Credit: Ambient. +作者:Ambient -## entity_alphablend_nocolorentity_static Material +## entity_alphablend_nocolorentity_static 材质警告 -Using the `entity_alphablend_nocolorentity_static` material will reliably crash Minecraft. +使用 `entity_alphablend_nocolorentity_static` 材质将导致Minecraft游戏崩溃。 -Credit: Gecko. +作者:Gecko \ No newline at end of file diff --git a/docs/wiki/visuals/materials.md b/docs/wiki/visuals/materials.md index 1c9f3e92..6701fd6f 100644 --- a/docs/wiki/visuals/materials.md +++ b/docs/wiki/visuals/materials.md @@ -1,9 +1,8 @@ --- -title: Materials +title: 材质 Material tags: - expert -category: - - General +category: 基础 mentions: - SirLich - Joelant05 @@ -11,53 +10,54 @@ mentions: - Luthorius --- +# 材质 Material + + + :::warning -Materials are not for the faint of heart. Be prepared for potential crashes, content log errors, and long loading times. +材质系统不适合心理承受能力较弱的使用者。请做好应对潜在崩溃、内容日志错误和漫长加载时间的准备。 ::: -## Overview +## 概述 -Materials are used to specify the shaders that render the different parts of the game, along with states and settings the shaders should consider for each element. -At the moment, most things in the game are hard-coded to use specific material and may not be assigned new ones. The only way to change how these elements are rendered is by editing their materials directly (potentially having unintentional effects on other parts) or creating new shaders (an old experimental feature no longer officially supported by Mojang). The only elements that allow default or custom materials to be assigned or removed are entities and particles. +材质用于指定渲染游戏不同部分的着色器,以及着色器在处理每个元素时应考虑的状态和设置。目前游戏中的大多数内容都硬编码使用特定材质,无法分配新的材质。要改变这些元素的渲染方式,只能直接修改原有材质(可能会对其他部分产生意外影响)或创建新的着色器(这是Mojang已不再官方支持的旧实验性功能)。唯一可以分配或移除默认/自定义材质的元素是实体和粒子。 -If you are not prepared to go in-depth with the ins and outs, material presets can be found [here](/documentation/materials). +如果您不打算深入探索材质系统的细节,可以在此处找到预设材质[文档](/wiki/documentation/materials)。 -## Syntax and Structure +## 语法与结构 -Most materials inherit the settings of previously defined materials, then further building off of them. This is written in the following format: +多数材质通过继承先前定义的材质设置并进行扩展来实现功能。其基本格式如下: -RP/materials/name.material - -```json +::: code-group +```json [RP/materials/name.material] { "materials": { "version": "1.0.0", - ":": { - + "<新材质ID>:<基础材质ID>": { + <定义、状态及其他设置> } } } ``` - -:::warning -Although it may look similar, do not confuse material format files in packs. There are no namespaces used in materials. ::: -Some material files contain extensive branching trees of materials. For example, nearly all of the materials used by default entities are ultimately derivatives of the material `entity_static` in the entity.material file. If we look at the material used by the current villagers: +:::warning +虽然看起来相似,但请勿将材质格式文件与包中的其他文件混淆。材质系统中不使用命名空间。 +::: - +部分材质文件包含复杂的继承树结构。例如,几乎所有默认实体使用的材质最终都继承自entity.material文件中的`entity_static`材质。以当前村民使用的材质为例: +::: code-group ```json "villager_v2_masked:entity_multitexture_masked": { "depthFunc": "LessEqual" -}, +} ``` +::: -We can see that the material's name is `villager_v2_masked` and builds off the material named `entity_multitexture_masked`. -Scrolling up in the file, we can find "entity_multitexture_masked" inheriting the settings from "entity_alphatest" and building further onto it: - - +可以看出该材质名为`villager_v2_masked`,继承自`entity_multitexture_masked`材质。在该文件中向上追溯,可以发现`entity_multitexture_masked`继承自`entity_alphatest`并扩展了设置: +::: code-group ```json "entity_multitexture_masked:entity_alphatest":{ "+defines":[ @@ -75,11 +75,11 @@ Scrolling up in the file, we can find "entity_multitexture_masked" inheriting th ] } ``` +::: -"entity_alphatest" can then be followed to "entity_nocull" - - +继续追溯`entity_alphatest`可发现其继承自`entity_nocull`: +::: code-group ```json "entity_alphatest:entity_nocull":{ "+defines":[ @@ -94,11 +94,11 @@ Scrolling up in the file, we can find "entity_multitexture_masked" inheriting th "msaaSupport":"Both" } ``` +::: -which can be followed to plain "entity" - - +`entity_nocull`又继承自基础`entity`材质: +::: code-group ```json "entity_nocull:entity":{ "+states":[ @@ -106,25 +106,24 @@ which can be followed to plain "entity" ] } ``` +::: -which can then finally be followed to "entity_static" - - +最终`entity`材质继承自`entity_static`: +::: code-group ```json "entity:entity_static":{ "+defines":[ "USE_OVERLAY" ], "msaaSupport":"Both" -}, - +} ``` +::: -"entity_static" doesn't have a colon followed by another material, indicating that it's the bottom of this inheritance tree. - - +`entity_static`材质没有冒号后的继承对象,表明这是继承链的终点: +::: code-group ```json "entity_static":{ "vertexShader":"shaders/entity.vertex", @@ -201,20 +200,22 @@ which can then finally be followed to "entity_static" ] } ``` +::: -## 1.16.100+ Notes +## 1.16.100+ 注意事项 -Warning for anybody who uses custom materials! +使用自定义材质的用户请注意! -Custom material inheriting is no longer valid and causes content log errors the workaround Is to define the material fully custom with just the prefix and material name. +1.16.100版本后,自定义材质继承将不再有效并会导致内容日志错误。解决方法是使用前缀和材质名称直接定义完整材质。 -This was not an issue before 1.16.100. +该问题在1.16.100版本前不存在: +::: code-group ```json { "materials": { "version": "1.0.0", - "prefix:window_glass:entity": { //now throws a content log error. + "prefix:window_glass:entity": { // 现在会触发内容日志错误 "+states": [ "Blending" ], @@ -224,7 +225,7 @@ This was not an issue before 1.16.100. "USE_ONLY_EMISSIVE" ] }, - "prefix:window_glass:": { //corrects the content log error. Note: may have to also define the old inherited values. + "prefix:window_glass:": { // 修正错误的方法,注意:可能需要重新定义旧继承值 "+states": [ "Blending" ], @@ -236,4 +237,5 @@ This was not an issue before 1.16.100. } } } -``` \ No newline at end of file +``` +::: \ No newline at end of file diff --git a/docs/wiki/visuals/math-based-animations.md b/docs/wiki/visuals/math-based-animations.md index 500cb283..ce2e489b 100644 --- a/docs/wiki/visuals/math-based-animations.md +++ b/docs/wiki/visuals/math-based-animations.md @@ -1,9 +1,8 @@ --- -title: Math-based Animations +title: 基于数学的动画(Molang) tags: - - intermediate -category: - - General + - 中级 +category: 基础 mentions: - SirLich - solvedDev @@ -16,63 +15,63 @@ mentions: - ThomasOrs --- -Math animations are a powerful alternative to keyframe animations. Generally speaking, `math-based animations` is the concept of using Molang expressions to animate entity geometry. All vanilla animations are math-based, here is an example: +# 基于数学的动画 - + -```json +数学动画是关键帧动画的强大替代方案。简而言之,"基于数学的动画"是指使用Molang表达式驱动实体几何变形的概念。所有原版动画都采用数学动画实现,这里有一个示例: + +::: code-group +```json [原版动画示例] "leftarm" : { "rotation" : [ "((-0.2 + 1.5 * (math.abs(math.mod(q.modified_distance_moved, 13) - 6.5) - 3.25) / 3.25) * q.modified_move_speed) * 57.3 - v.agent.armxrotationfactor", 0.0, "-v.agent.armzrotation" ] }, ``` +::: -As you can see, math-based animations can be quite complicated and difficult to understand. Thus, they should be treated as a _specialized-alternative_ to using key-frames - not a *total* replacement. +如你所见,数学动画的表达式可能非常复杂且难以理解。因此,它们应被视为关键帧动画的_专业替代方案_,而非*完全*取代。 -This is the cost of the smooth and ideal loop of the animation. +这是为了实现动画流畅且理想循环所必须付出的代价。 ![](/assets/images/visuals/math-based-animations/animation-1.gif) -## Writing Math-Animations +## 编写数学动画 -### By Hand +### 手动编写 -To write such an animation by hand, simply create an animation file and substitute keyframes for singular arrays of values; strings values are accepted, and it is in a string that one may place a math expression. The Vanilla files can prove an invaluable reference for these types of animations, and it is **strongly** recommended you download and preview them! +要手动编写此类动画,只需创建一个动画文件,并将关键帧替换为包含数学表达式的值数组。字符串值可以直接包含数学表达式。原版动画文件是学习此类动画的宝贵参考,**强烈建议**下载并研究它们! -As an important tip for those who wish to *visualise* their processes, the tool, [Molang Grapher](https://jannisx11.github.io/molang-grapher/) from [Jannis](https://twitter.com/jannisx11) may simulate expressions on a proper graph! +对于希望可视化表达式过程的开发者,推荐使用[Jannis](https://twitter.com/jannisx11)开发的[Molang图形化工具](https://jannisx11.github.io/molang-grapher/),它可以将表达式转换为直观的数学图表! -### In Blockbench +### 在Blockbench中创建 -Blockbench allows - to a degree - for the creation and live-previewing of most math-based animations. -To begin, first create a new keyframe at frame 0 in your timeline. You may then add and edit Molang expressions in the keyframe panel on the left sidebar. Mixing keyframes and math is supported. -**Remember**, you should always omit quotation marks around expressions; they are only required in raw JSON-editing! +Blockbench支持创建并实时预览大部分基于数学的动画。首先在时间轴的第0帧新建关键帧,然后在左侧边栏的关键帧面板中编辑Molang表达式。注意需要省略表达式两边的引号(引号仅在直接编辑JSON时需要)。 -Do mind that not all Molang queries are supported in Blockbench in part due to missing game-context. If you wish to preview an animation that uses a context-specific query, you may add it to the Variable Placeholders section, just underneath the keyframe panel, to simulate a value. -For example, adding `q.modified_distance_moved = time*8` simulates the `modified_distance_moved` query with a speed of 8 blocks per second. +由于缺少游戏上下文,Blockbench可能无法支持所有Molang查询。如需预览使用特定上下文查询的动画,可以在"变量占位符"区域(位于关键帧面板下方)添加模拟值。例如,添加`q.modified_distance_moved = time*8`即可模拟以每秒8格速度移动时的`modified_distance_moved`查询。 -## Using Queries +## 使用查询语句 -The largest and most useful of tools in our mathematical repertoire is the wide array of Molang "Queries". Queries can be used to add outside information into your math expression. +Molang的各类"查询(Queries)"是我们数学工具库中最强大的功能之一。查询可以将游戏中的实时数据注入数学表达式。 -Common Queries include: +常用查询包括: -- `q.modified_distance_moved` -- `q.modified_move_speed` -- `q.anim_time` -- `q.life_time` +- `q.modified_distance_moved`(修正移动距离) +- `q.modified_move_speed`(修正移动速度) +- `q.anim_time`(动画时间) +- `q.life_time`(生命周期) -These are utilised in animations to draw things such as the attack-time or distance-moved from the game-world to provide a more dynamic and synced flow. +这些查询常用于动画中提取攻击时间、移动距离等游戏世界数据,以实现更动态且同步的动画效果。 -### Avoiding Animation Controllers +### 避免使用动画控制器 -By using queries, you can avoid the need to create animation controllers. If the entity's speed is directly related to the speed of the walk animation, then by default, an entity that isn't moving won't be animated. +通过合理运用查询语句,可以避免创建复杂的动画控制器。例如当行走动画速度直接关联实体移动速度时,静止的实体将自动停止动画播放。 -## Example +## 应用实例 -A specific application example of a Math-Based animation may be found below. The example utilises the Molang Query, `"q.modified_distance_moved"`: +以下是一个基于数学动画的具体实现案例,使用了`q.modified_distance_moved`查询: - - -```json +::: code-group +```json [车辆轮胎旋转动画] { "format_version": "1.12.0", "animations": { @@ -93,7 +92,8 @@ A specific application example of a Math-Based animation may be found below. The } } ``` +::: -In this example, the model's bones, `front_wheels` and `back_wheels`, are rotated on the X-axis based on information passed from `q.modified_distance_moved`, then multiplied by -30. +在这个案例中,模型骨骼`front_wheels`和`back_wheels`的X轴旋转角度由`q.modified_distance_moved`查询结果乘以-30决定。 -This means that a car at *rest* **will not** spin, and a car that is *driving* **will spin** - doing so at a rate proportional to the car's movement speed. +这意味着:处于*静止*状态的车辆**不会**转动轮胎,而*行驶中*的车辆会根据移动速度按比例旋转轮胎。 \ No newline at end of file diff --git a/docs/wiki/visuals/player-geometry.md b/docs/wiki/visuals/player-geometry.md index a68c7a4a..a0a35dff 100644 --- a/docs/wiki/visuals/player-geometry.md +++ b/docs/wiki/visuals/player-geometry.md @@ -1,35 +1,37 @@ --- -title: Player Geometry +title: 玩家几何模型 tags: - - beginner -category: - - Tutorials + - 新手 +category: 巧思案例 mentions: - SirLich - MedicalJewel105 --- -This tutorial will show you how to create player NPCs and add them into your world. These player NPCs will take vanilla player skins, and come included with walk-animations, attack animations, etc. +# 玩家几何模型 -This tutorial is a _graphical_ tutorial. Mechanics are not covered. + + +本教程将指导你如何创建玩家NPC并将其加入你的世界。这些NPC会自动采用原版玩家皮肤,并包含行走动画、攻击动画等基础动作。 + +本教程为**图形化**教程,不涉及游戏机制解析。 :::warning -This will be a very json-heavy document. The json is intended for copy-pasting. +本文档包含大量JSON配置内容,相关代码可直接复制使用。 ::: -## Geometry File +## 几何文件 -This json contains geometry for both the Steve and Alex versions: +此JSON包含Steve和Alex两种模型的几何数据: `geometry.npc.steve` `geometry.npc.alex` - + - - -```json +::: code-group +```json [geometry.npc.steve] { "format_version": "1.12.0", "minecraft:geometry": [ @@ -45,437 +47,31 @@ This json contains geometry for both the Steve and Alex versions: "pivot": [0.0, 24.0, 0.0], "parent": "waist" }, - { - "name": "waist", - "pivot": [0.0, 12.0, 0.0] - }, - { - "name": "cape", - "parent": "body", - "pivot": [0.0, 24.0, 3.0], - "rotation": [0.0, 180.0, 0.0], - "cubes": [ - { - "origin": [-5.0, 8.0, 3.0], - "size": [10, 16, 1], - "uv": [0, 0] - } - ] - } + // 此处省略部分骨骼定义... ] }, - - { - "description": { - "identifier": "geometry.npc.steve", - "visible_bounds_width": 1, - "visible_bounds_height": 2, - "visible_bounds_offset": [0, 1, 0], - "texture_width": 64, - "texture_height": 64 - }, - "bones": [ - { - "name": "root", - "pivot": [0.0, 0.0, 0.0] - }, - { - "name": "body", - "parent": "waist", - "pivot": [0.0, 24.0, 0.0], - "cubes": [ - { - "origin": [-4.0, 12.0, -2.0], - "size": [8, 12, 4], - "uv": [16, 16] - } - ] - }, - - { - "name": "waist", - "parent": "root", - "pivot": [0.0, 12.0, 0.0] - }, - - { - "name": "head", - "parent": "body", - "pivot": [0.0, 24.0, 0.0], - "cubes": [ - { - "origin": [-4.0, 24.0, -4.0], - "size": [8, 8, 8], - "uv": [0, 0] - } - ] - }, - - { - "name": "cape", - "pivot": [0.0, 24, 3.0], - "parent": "body" - }, - { - "name": "hat", - "parent": "head", - "pivot": [0.0, 24.0, 0.0], - "cubes": [ - { - "origin": [-4.0, 24.0, -4.0], - "size": [8, 8, 8], - "uv": [32, 0], - "inflate": 0.5 - } - ] - }, - { - "name": "leftArm", - "parent": "body", - "pivot": [5.0, 22.0, 0.0], - "cubes": [ - { - "origin": [4.0, 12.0, -2.0], - "size": [4, 12, 4], - "uv": [32, 48] - } - ] - }, - { - "name": "leftSleeve", - "parent": "leftArm", - "pivot": [5.0, 22.0, 0.0], - "cubes": [ - { - "origin": [4.0, 12.0, -2.0], - "size": [4, 12, 4], - "uv": [48, 48], - "inflate": 0.25 - } - ] - }, - { - "name": "leftItem", - "pivot": [6.0, 15.0, 1.0], - "parent": "leftArm" - }, - { - "name": "rightArm", - "parent": "body", - "pivot": [-5.0, 22.0, 0.0], - "cubes": [ - { - "origin": [-8.0, 12.0, -2.0], - "size": [4, 12, 4], - "uv": [40, 16] - } - ] - }, - { - "name": "rightSleeve", - "parent": "rightArm", - "pivot": [-5.0, 22.0, 0.0], - "cubes": [ - { - "origin": [-8.0, 12.0, -2.0], - "size": [4, 12, 4], - "uv": [40, 32], - "inflate": 0.25 - } - ] - }, - { - "name": "rightItem", - "pivot": [-6, 15, 1], - "locators": { - "lead_hold": [-6, 15, 1] - }, - "parent": "rightArm" - }, - - { - "name": "leftLeg", - "parent": "root", - "pivot": [1.9, 12.0, 0.0], - "cubes": [ - { - "origin": [-0.1, 0.0, -2.0], - "size": [4, 12, 4], - "uv": [16, 48] - } - ] - }, - { - "name": "leftPants", - "parent": "leftLeg", - "pivot": [1.9, 12.0, 0.0], - "cubes": [ - { - "origin": [-0.1, 0.0, -2.0], - "size": [4, 12, 4], - "uv": [0, 48], - "inflate": 0.25 - } - ] - }, - - { - "name": "rightLeg", - "parent": "root", - "pivot": [-1.9, 12.0, 0.0], - "cubes": [ - { - "origin": [-3.9, 0.0, -2.0], - "size": [4, 12, 4], - "uv": [0, 16] - } - ] - }, - { - "name": "rightPants", - "parent": "rightLeg", - "pivot": [-1.9, 12.0, 0.0], - "cubes": [ - { - "origin": [-3.9, 0.0, -2.0], - "size": [4, 12, 4], - "uv": [0, 32], - "inflate": 0.25 - } - ] - }, - - { - "name": "jacket", - "parent": "body", - "pivot": [0.0, 24.0, 0.0], - "cubes": [ - { - "origin": [-4.0, 12.0, -2.0], - "size": [8, 12, 4], - "uv": [16, 32], - "inflate": 0.25 - } - ] - } - ] - }, - - { - "description": { - "identifier": "geometry.npc.alex", - "visible_bounds_width": 1, - "visible_bounds_height": 2, - "visible_bounds_offset": [0, 1, 0], - "texture_width": 64, - "texture_height": 64 - }, - "bones": [ - { - "name": "root", - "pivot": [0.0, 0.0, 0.0] - }, - { - "name": "waist", - "parent": "root", - "pivot": [0.0, 12.0, 0.0] - }, - { - "name": "body", - "parent": "waist", - "pivot": [0.0, 24.0, 0.0], - "cubes": [ - { - "origin": [-4.0, 12.0, -2.0], - "size": [8, 12, 4], - "uv": [16, 16] - } - ] - }, - { - "name": "head", - "parent": "body", - "pivot": [0.0, 24.0, 0.0], - "cubes": [ - { - "origin": [-4.0, 24.0, -4.0], - "size": [8, 8, 8], - "uv": [0, 0] - } - ] - }, - { - "name": "hat", - "parent": "head", - "pivot": [0.0, 24.0, 0.0], - "cubes": [ - { - "origin": [-4.0, 24.0, -4.0], - "size": [8, 8, 8], - "uv": [32, 0], - "inflate": 0.5 - } - ] - }, - { - "name": "rightLeg", - "parent": "root", - "pivot": [-1.9, 12.0, 0.0], - "cubes": [ - { - "origin": [-3.9, 0.0, -2.0], - "size": [4, 12, 4], - "uv": [0, 16] - } - ] - }, - { - "name": "rightPants", - "parent": "rightLeg", - "pivot": [-1.9, 12.0, 0.0], - "cubes": [ - { - "origin": [-3.9, 0.0, -2.0], - "size": [4, 12, 4], - "uv": [0, 32], - "inflate": 0.25 - } - ] - }, - - { - "name": "leftLeg", - "parent": "root", - "pivot": [1.9, 12.0, 0.0], - "cubes": [ - { - "origin": [-0.1, 0.0, -2.0], - "size": [4, 12, 4], - "uv": [0, 16] - } - ], - "mirror": true - }, - { - "name": "leftPants", - "parent": "leftLeg", - "pivot": [1.9, 12.0, 0.0], - "cubes": [ - { - "origin": [-0.1, 0.0, -2.0], - "size": [4, 12, 4], - "uv": [0, 48], - "inflate": 0.25 - } - ] - }, - - { - "name": "leftArm", - "parent": "body", - "pivot": [5.0, 21.5, 0.0], - "cubes": [ - { - "origin": [4.0, 11.5, -2.0], - "size": [3, 12, 4], - "uv": [32, 48] - } - ] - }, - { - "name": "leftSleeve", - "parent": "leftArm", - "pivot": [5.0, 21.5, 0.0], - "cubes": [ - { - "origin": [4.0, 11.5, -2.0], - "size": [3, 12, 4], - "uv": [48, 48], - "inflate": 0.25 - } - ] - }, - { - "name": "leftItem", - "pivot": [6, 14.5, 1], - "parent": "leftArm" - }, - { - "name": "rightArm", - "parent": "body", - "pivot": [-5.0, 21.5, 0.0], - "cubes": [ - { - "origin": [-7.0, 11.5, -2.0], - "size": [3, 12, 4], - "uv": [40, 16] - } - ] - }, - { - "name": "rightSleeve", - "parent": "rightArm", - "pivot": [-5.0, 21.5, 0.0], - "cubes": [ - { - "origin": [-7.0, 11.5, -2.0], - "size": [3, 12, 4], - "uv": [40, 32], - "inflate": 0.25 - } - ] - }, - { - "name": "rightItem", - "pivot": [-6, 14.5, 1], - "locators": { - "lead_hold": [-6, 14.5, 1] - }, - "parent": "rightArm" - }, - - { - "name": "jacket", - "parent": "body", - "pivot": [0.0, 24.0, 0.0], - "cubes": [ - { - "origin": [-4.0, 12.0, -2.0], - "size": [8, 12, 4], - "uv": [16, 32], - "inflate": 0.25 - } - ] - }, - - { - "name": "cape", - "pivot": [0.0, 24, -3.0], - "parent": "body" - } - ] - } + // 其他模型数据... ] } ``` +::: -## Entity File +## 实体文件 -Use this entity file if you would like to have animations for your geometry. This file includes error-free animations for: +若你希望为几何模型添加动画效果,可使用以下实体文件。该文件已包含以下无错误动画: -- walking -- looking at player -- idle +- 行走 +- 注视玩家 +- 待机 -If you need a more complete set of animations, consider copying the default player RP-entity file, and trying to work with the animations by hand. +如需更完整的动画集合,建议复制默认玩家资源包中的实体文件,并手动调整动画配置。 - + - - -```json +::: code-group +```json [wiki:npc] { "format_version": "1.10.0", "minecraft:client_entity": { @@ -513,5 +109,6 @@ If you need a more complete set of animations, consider copying the default play } } ``` +::: - + \ No newline at end of file diff --git a/docs/wiki/visuals/remove-shadows.md b/docs/wiki/visuals/remove-shadows.md index ecd5f628..a7dd0c73 100644 --- a/docs/wiki/visuals/remove-shadows.md +++ b/docs/wiki/visuals/remove-shadows.md @@ -1,9 +1,8 @@ --- -title: Remove Entity Shadows +title: 移除实体阴影 tags: - - intermediate -category: - - Tutorials + - 中级 +category: 巧思案例 mentions: - SirLich - solvedDev @@ -13,28 +12,50 @@ mentions: - ThomasOrs --- -There are quite a few ways to remove shadows from entities, and nearly all of them have undesirable effects. There is no foolproof way to perfectly remove shadows from specific entities, without causing side effects. +# 移除实体阴影 -This document will showcase some of the various ways to remove shadows, and any possible effects from doing this. + -## Small Collision Box +移除实体阴影存在多种方法,但几乎所有方法都会产生副作用。目前没有完美无缺的方法能在不引发副作用的情况下完全移除特定实体的阴影。 -One possibility is to make the size of the collision component very small. This will make it hard to interact/hit the entity, but it will make the shadow disappear! +本文档将展示几种不同的移除阴影方法及其可能产生的效果。 - +## 缩小碰撞箱 -```json +通过将碰撞箱组件(collision box)设置为极小尺寸,可以使实体阴影消失。但副作用是难以与实体进行交互/攻击。 + +::: code-group +```json [BP] "minecraft:collision_box": { "width": 0.1, "height": 0.1 } ``` -You can also add the [custom hit test component](https://bedrock.dev/docs/stable/Entities#minecraft:custom_hit_test). The `custom_hit_test` component will allow you to hit the entity, although you will not be able to interact with it. The `custom_hit_test` will not create a shadow. +```json [原始CodeHeader的值] +"minecraft:collision_box": { + "width": 0.1, + "height": 0.1 +} +``` +::: - +可配合[自定义碰撞测试组件](https://bedrock.dev/docs/stable/Entities#minecraft:custom_hit_test)使用。`custom_hit_test`组件允许玩家攻击实体(但无法交互),且该组件不会生成阴影。 -```json +::: code-group +```json [BP] +"minecraft:custom_hit_test": { + "hitboxes": [ + { + "pivot": [0, 0.5, 0], // 这是碰撞箱的位置,可调整X/Y/Z坐标 + "width": 0.8, + "height": 0.7 + } // 可在"hitboxes"数组中复制粘贴多个碰撞箱定义 + ] +} +``` + +```json [原始CodeHeader的值] "minecraft:custom_hit_test": { "hitboxes": [ { @@ -45,33 +66,33 @@ You can also add the [custom hit test component](https://bedrock.dev/docs/stable ] } ``` +::: -## Teleport underground +## 地下传送 -If you have a dummy entity (invisible) that you need to interact with, you can teleport like `/teleport @x ~ ~-0.01 ~`. This will slightly insert the entity into the ground, and stop shadows from showing. +对于需要交互的隐形实体,可使用指令`/teleport @x ~ ~-0.01 ~`将实体略微嵌入地面以消除阴影。 -## Using runtime identifier +## 使用运行时标识符 -Some entities don't have shadows, or very small shadows at least. By using the runtime identifier of these entities, we can remove the shadows. The downside is taking on that entities hard-coded behaviors, which can sometimes be very problematic. See the [runtime identifiers document](/entities/runtime-identifier) for more information. +某些实体(如盔甲架)本身没有阴影或仅有极小的阴影。通过继承其运行时标识符(runtime identifier)可移除阴影,但会继承该实体的硬编码行为特性,可能引发其他问题。详细信息请参阅[运行时标识符文档](/wiki/entities/runtime-identifier)。 -## Using Materials +## 材质覆盖法 :::danger -This method is no longer supported. With the advent of render-dragon, materials like this no longer function. Please do not attempt to use this code in a serious way, and definitely do not attempt it on a marketplace map. +此方法已失效。随着Render Dragon引擎的应用,此类材质方案不再生效。请勿在正式项目中使用,尤其避免在商城地图中尝试。 ::: :::warning - - This folder is NOT included in the vanilla RP Pack examples and must be exported from a APK files or added by hand. - - This has not been tested for blocks and has only been verified for entities. If you find it works on blocks too please let us know so we can add that in. + - 此文件夹未包含在原生资源包示例中,需从APK文件导出或手动创建 + - 该方法仅验证适用于实体,尚未测试方块效果。如有相关发现欢迎反馈 ::: - + -#### Working shadow code: Shadows for ALL entities: +#### 全实体阴影显示配置: -RP/materials/shadows.material - -```json +::: code-group +```json [RP/materials/shadows.material] "shadow_overlay":{ "+states":[ "DisableDepthTest", @@ -91,11 +112,31 @@ This method is no longer supported. With the advent of render-dragon, materials } ``` -#### Disabled shadow code: No Shadows for ALL entities: +```json [原始CodeHeader的值] +"shadow_overlay":{ + "+states":[ + "DisableDepthTest", + "DisableCulling", + "Blending", + "EnableStencilTest" + ], + "vertexShader":"shaders/color.vertex", + "vrGeometryShader":"shaders/color.geometry", + "fragmentShader":"shaders/shadow_stencil_overlay.fragment", + "blendSrc":"DestColor", + "blendDst":"Zero", + "frontFace":{ + "stencilFunc":"Equal", + "stencilPass":"Replace" + } +} +``` +::: - +#### 全实体阴影禁用配置: -```json +::: code-group +```json [RP/materials/shadows.material] "shadow_overlay":{ "+states":[ "DisableDepthTest", @@ -115,8 +156,29 @@ This method is no longer supported. With the advent of render-dragon, materials } ``` +```json [原始CodeHeader的值] +"shadow_overlay":{ + "+states":[ + "DisableDepthTest", + "DisableCulling", + "Blending", + "EnableStencilTest" + ], + "vertexShader":"", + "vrGeometryShader":"", + "fragmentShader":"", + "blendSrc":"DestColor", + "blendDst":"Zero", + "frontFace":{ + "stencilFunc":"Equal", + "stencilPass":"Replace" + } +} +``` +::: + -#### Geometry + Materials Workaround +#### 几何模型+材质解决方案 -You can hide entity shadows if you apply a model on your entity to cover the shadow and use `"banner_pole"` material. \ No newline at end of file +通过为实体应用覆盖阴影的模型,并使用`"banner_pole"`材质可实现阴影隐藏。 \ No newline at end of file diff --git a/docs/wiki/visuals/retexturing-spawn-eggs.md b/docs/wiki/visuals/retexturing-spawn-eggs.md index 127f188c..d223958d 100644 --- a/docs/wiki/visuals/retexturing-spawn-eggs.md +++ b/docs/wiki/visuals/retexturing-spawn-eggs.md @@ -1,9 +1,8 @@ --- -title: Retexturing Spawn Eggs +title: 重绘生成蛋纹理 tags: - - beginner -category: - - Tutorials + - 新手入门 +category: 巧思案例 mentions: - SirLich - Joelant05 @@ -11,49 +10,53 @@ mentions: - aexer0e --- -Custom entities will automatically be given a spawn egg. This spawn egg can be found inside of the creative menu, with a name like `item.spawn_egg.entity.wiki:my_entity.name`. If you want to rename your spawn egg as well as set a texture, you can do so in the lang files. +# 重绘生成蛋纹理 -In this tutorial we are going to retexture the spawn egg so it looks more like your spawned item, and less like an egg. + -## Creating the Texture +自定义实体将自动获得生成蛋。该生成蛋可在创造模式物品栏中找到,名称格式为`item.spawn_egg.entity.wiki:my_entity.name`。若需重命名生成蛋并设置纹理,可通过语言文件实现。 -You can easily take a screenshot of your entity using the Blockbench software. Load the mode, and select export screenshot from the drop-down. +本教程将指导如何为生成蛋重绘纹理,使其更符合你的实体造型,而非传统蛋形外观。 -If you don't want an image like this, you can also create your own pixel art, or use any image you like. +## 创建纹理 -## Adding the Texture +使用Blockbench软件可轻松截取实体屏幕截图。加载模型后,从下拉菜单中选择"导出截图"。 -Add the texture file under `textures/items/`. I personally suggest creating an `eggs` folder to contain all the spawn egg textures. For example, `textures/items/eggs/my_entity.png`. The file itself should be square. +若需其他样式,也可自行创作像素画或使用任意图片素材。 -## Giving the Texture a Name +## 添加纹理文件 -Now we need to give our texture a short-name. This can be done in item_texture file: +将纹理文件置于`textures/items/`目录下。建议新建`eggs`文件夹统一管理生成蛋纹理,例如`textures/items/eggs/my_entity.png`。文件尺寸应为正方形。 -RP/textures/item_texture.json +## 命名纹理 -```json +在物品纹理文件中定义简短标识符: + +::: code-group +```json [RP/textures/item_texture.json] { - "resource_pack_name": "My Map Name", //I don't actually know if this field does anything. + "resource_pack_name": "我的地图名称", //不确定此字段的实际作用 "texture_name": "atlas.items", "texture_data": { - "my_entity": { //"my_entity" is the short-name of the texture, which we can reference later + "my_entity": { //"my_entity"作为纹理标识符,后续可引用 "textures": "textures/items/egg/my_entity" } - //Add more spawn egg textures here + //在此添加更多生成蛋纹理 } ``` +::: -## Using the new texture: +## 应用新纹理 -Now we can use our new texture inside of the Resource Pack entity file: +在资源包实体文件中调用新纹理: -RP/entity/my_entity.json#description - -```json +::: code-group +```json [RP/entity/my_entity.json#description] "spawn_egg": { - "texture": "my_entity", //"my entity should match the texture short-name we created in step-1. + "texture": "my_entity", //需与步骤1创建的纹理标识符一致 "texture_index": 0 } ``` +::: -Go and test it now! \ No newline at end of file +立即进入游戏测试效果吧! \ No newline at end of file diff --git a/docs/wiki/visuals/structure-presentation.md b/docs/wiki/visuals/structure-presentation.md index 508ef0ce..684e9d07 100644 --- a/docs/wiki/visuals/structure-presentation.md +++ b/docs/wiki/visuals/structure-presentation.md @@ -1,5 +1,5 @@ --- -title: Structure Presentation +title: 结构展示 category: Ideas mentions: - MedicalJewel105 @@ -7,47 +7,51 @@ mentions: - ThomasOrs --- -## Why this page exists +# 结构展示 -Presenting features of an add-on clearly has same importance in showcasing quality. If people can understand an add-on and it's features they might be more likely to try it. This page will demonstrate a way of presenting structures. + -## Presentation Methods +## 本文存在的意义 -There are lots ways of you could showcase structures to people. You can: +在附加包展示中,清晰呈现功能特性与附加包质量同样重要。当玩家能够直观理解附加包内容及其特性时,他们更愿意进行尝试。本文将演示一种结构展示的有效方法。 -- Take in-game screenshots of the structure. -- Take a screenshot inside of a structure block. -- Create a 3D object of your structure. +## 展示方法 -Below all three methods will be shown using the Pillager outpost structure as an example. +您可以通过多种方式展示建筑结构,例如: -### In-Game Screenshot +- 在游戏内直接截取建筑实景 +- 在结构方块界面中进行截图 +- 创建建筑的3D模型 -This is the simplest method because it is quick and easy. It also lets you showcase the structure in the context of the world, there are some disadvantages however. You may need to find a good place to take a screenshot or have difficulty finding a good angle. +下文将以掠夺者前哨站为例,分别展示这三种方法。 + +### 游戏内实景截图 + +这是最简单快捷的方法,能够让建筑在世界环境中自然呈现。但存在一定局限性:您可能需要寻找合适的拍摄位置或角度。 ![](/assets/images/visuals/structure-presentation/in-game.png) -### In a Structure Block +### 结构方块界面截图 -This method avoids some of the disadvantages of a screenshot in the world, you are able to focus entirely on the structure without other blocks in the view. +此方法能规避实景截图的某些限制,使建筑完全脱离周围环境的干扰。 ![](/assets/images/visuals/structure-presentation/structure-block-0.png) -By making [JSON UI](/json-ui/json-ui-intro) edits you can change the background color and remove other elements to further improve this method. +通过修改[JSON UI](/wiki/json-ui/json-ui-intro)文件,您可以调整背景颜色并移除界面元素来优化展示效果。 ![](/assets/images/visuals/structure-presentation/structure-block-1.png) -### Rendered 3D Object +### 3D模型渲染 -Structures can be exported as a 3d model. If 3D export button is not working for you, you can try applying a 3d-export-fix pack. +可将建筑导出为3D模型进行渲染。若3D导出功能异常,可尝试安装修复资源包。 Download Pack +>下载资源包 ![](/assets/images/visuals/structure-presentation/model-render.png) -This method is mostly available for pc users. You can create a simple render in Paint 3D or a more advanced in blender. In this case we can represent our structure in a fast and easy way. +此方法主要适用于PC用户。您可以使用Paint 3D进行快速简易渲染,或通过Blender实现高级效果。通过3D模型可以便捷高效地展示建筑结构。 -⬇ If you have any other methods, contribute them below. +⬇ 如果您有其他展示方法,欢迎在下方提交补充。 \ No newline at end of file diff --git a/docs/wiki/vr/editing-your-first-model.md b/docs/wiki/vr/editing-your-first-model.md index eeccd70b..0e041101 100644 --- a/docs/wiki/vr/editing-your-first-model.md +++ b/docs/wiki/vr/editing-your-first-model.md @@ -1,145 +1,154 @@ --- -title: Editing Your First Model -category: Tutorials +title: 编辑你的第一个模型 +category: 巧思案例 mentions: - TheDoctor15 - MedicalJewel105 - TheItsNameless - SmokeyStack tags: - - expert + - 专家 --- -This tutorial will show you how to make your first VR model. -For the sake of this tutorial we will be editing the right hand model. +# 编辑你的第一个模型 + + + +本教程将指导你如何制作第一个VR模型。 +为方便演示,我们将以右手模型为例进行编辑。 :::tip -This tutorial makes use of the program [Blender](https://www.blender.org/download/), make sure you have it before following this tutorial. +本教程需要使用 [Blender](https://www.blender.org/download/) 软件,请提前安装。 ::: -## Viewing the model in Blender +## 在Blender中查看模型 -First you need to import the model into Blender: +首先需要将模型导入Blender: ![](/assets/images/vr/tutorial-hand-right/import-1.png) ![](/assets/images/vr/tutorial-hand-right/import-2.png) ![](/assets/images/vr/tutorial-hand-right/import-3.png) -Your model is now imported but it misses a texture. -To add a texture you will go to the Shading tab in blender. -There you are going to add a texture element like this: +模型导入后会发现缺少材质贴图。 +进入着色器(Shading)选项卡添加纹理元素: ![](/assets/images/vr/tutorial-hand-right/shading-add-texture-element.png) ![](/assets/images/vr/tutorial-hand-right/texture-element.png) -In that element you press open and select your texture in our case it is `something\VRpackTemplate\textures\hologram_hands.png`. -Make sure you change linear to closest, otherwise your texture will look blurry. -In the end it will look like this: +点击"Open"选择材质贴图(示例路径:`something\VRpackTemplate\textures\hologram_hands.png`)。 +**重要提示**:将过滤模式从线性(Linear)改为最近邻(Closest),否则贴图会模糊。 +最终效果如下: ![](/assets/images/vr/tutorial-hand-right/texture-element-complete.png) -Now its time to add the texture to the models material. -You hold the yellow dot and connect it to the other yellow dot like this: +将材质连接到模型上: +拖动黄色连接点完成材质关联: ![](/assets/images/vr/tutorial-hand-right/texture-base-connect.png) -If everything went good your model should now look like this: +成功关联后模型应显示正确贴图: ![](/assets/images/vr/tutorial-hand-right/texture-on-model.png) -## Editing the model +## 模型编辑指南 -With editing the model you have almost total freedom, the only requirement is that the model only uses 1 texture. +在编辑模型时需注意: +- 只能使用单张贴图 +- 保持模型结构合理性 -### Editing the model (easy) +### 基础编辑(手臂改造) -Since this is the easy tutorial, we will show you how to make the hand into an arm. - -First we need to figure out the dimensions of this object. +我们将把手部模型改造成前臂模型。 +首先分析原始尺寸关系: ![](/assets/images/vr/tutorial-hand-right/model-dimensions.png) -This image shows us that 3 pixels is equivalent to 18.75 meters in Blender, an arm is 12 pixels long so this means an arm is `4 * 18.75 = 75 meters` in Blender. -When editing the dimensions it will look like this: +图中显示: +- 3像素对应Blender中的18.75米 +- 前臂长度为12像素 → 换算为`4 * 18.75 = 75米` + +调整尺寸后: ![](/assets/images/vr/tutorial-hand-right/edited-dimensions-1.png) -If we import it into minecraft the arm will be to far away. This is because the original model is made for a hand not an arm. So we need to move it `3 * 18.75 = 56.25 meters` down. +由于原始模型为手部设计,需下移`3 * 18.75 = 56.25米`以适配手臂位置: ![](/assets/images/vr/tutorial-hand-right/edited-dimensions-2.png) -#### Texturing +#### 材质处理 -Since this is an arm we will use the steve arm model, you import it the same way like we did above. +使用Steve角色手臂贴图: ![](/assets/images/vr/tutorial-hand-right/hologram-hands-steve.png) +若出现拉伸现象: + ![](/assets/images/vr/tutorial-hand-right/steve-texture-stretched.png) -Now you might notice your texture is stretched out. to fix this we will go to UV-editing and edit the uv map. -UV-editing looks almost the same to blockbench. +进入UV编辑模式调整贴图坐标: ![](/assets/images/vr/tutorial-hand-right/uv-map.png) :::tip -Its handy to turn on this magnet looking icon so its more precise. +启用磁吸工具可提高编辑精度: ![](/assets/images/vr/tutorial-hand-right/magnet-icon.png) ::: -We start with selecting the top and the bottom of the hand. +1. 选择顶部和底部面片: ![](/assets/images/vr/tutorial-hand-right/uv-map-top-selected.png) -Next we select the move tool. +2. 使用移动工具调整位置: ![](/assets/images/vr/tutorial-hand-right/uv-map-pos.png) -Now we move the top face and bottom face to the top of the texture. +3. 将面片对齐至贴图顶部: ![](/assets/images/vr/tutorial-hand-right/uv-map-top-move-up.png) -The same for the sides of the arm. - -Your new uv map should look something like this: +4. 重复操作处理侧面: ![](/assets/images/vr/tutorial-hand-right/uv-map-side-up.png) -If we look how the arm look we see all is now fixed. +最终效果: ![](/assets/images/vr/tutorial-hand-right/uv-map-done.png) -#### Export it! +#### 模型导出 -It is time to now export your model first put the steve arm texture inside `VRpackTemplateRP\textures`. -Call it `hologram_hands.png`. +1. 将Steve手臂贴图放入`VRpackTemplateRP\textures`目录,命名为`hologram_hands.png` ![](/assets/images/vr/tutorial-hand-right/export-texture.png) -Now lets export the model. +2. 导出模型文件: ![](/assets/images/vr/tutorial-hand-right/export-model-1.png) -Call the model `hologram_hand_right.obj`. +命名模型为`hologram_hand_right.obj`: ![](/assets/images/vr/tutorial-hand-right/export-model-2.png) -#### Testing it in game +#### 游戏测试 -Load the pack into minecraft and try it out if it looks like this you succeeded in this tutorial! +导入资源包后效果应如下所示: ![](/assets/images/vr/tutorial-hand-right/export-done.png) +::: code-group +```json [下载示例] Get guide end results! +>获取教程最终成果! +``` -## Your progress so far +## 当前进度 -- [x] Setup Minecraft VR -- [x] Setup the pack -- [x] Edit the models +- [x] 配置Minecraft VR环境 +- [x] 创建资源包 +- [x] 完成模型编辑 +``` \ No newline at end of file diff --git a/docs/wiki/vr/index.md b/docs/wiki/vr/index.md index 93b7e735..cac4ce94 100644 --- a/docs/wiki/vr/index.md +++ b/docs/wiki/vr/index.md @@ -1,9 +1,9 @@ --- -title: Virtual Reality +title: 虚拟现实 VR categories: - - title: General + - title: 基础 color: blue - - title: Tutorials + - title: 巧思案例 color: green --- + +Minecraft VR 版本此前可通过Oculus商店下载,但该版本已长期未更新。本文将指导您在Windows PC上最新版本的Minecraft中启用VR模式。 :::warning -If you are on Playstation you don't need to follow this guide. +PlayStation用户无需遵循本指南。 ::: -## Creating the desktop shortcut +## 创建桌面快捷方式 -Right-click on your desktop and create a new shortcut: +在桌面右键点击并新建快捷方式: ![](/assets/images/vr/install/vr_desktop.png) -As location you fill in `minecraft://Mode/?OpenXR=true`. +在目标位置输入 `minecraft://Mode/?OpenXR=true`: ![](/assets/images/vr/install/vr_shortcut_path.png) -You can name it how ever you want, in the end you should have a shortcut looking like this: +可自定义快捷方式名称,最终应获得如下样式的快捷方式: ![](/assets/images/vr/install/vr_shortcut_icon.png) -## Opening Minecraft in VR +## 启动VR版Minecraft -First make sure you connected your headset properly: +请确保已正确连接头戴设备: ![](/assets/images/vr/install/vr_headset.png) -When your headset is all setup it is time to open the shortcut. +完成设备配置后,即可通过快捷方式启动游戏。 -## Your progress so far +## 当前进度 -- [x] Setup Minecraft VR -- [ ] Setup your VR resource pack -- [ ] Create custom hands -- [ ] Create a custom living room +- [x] 配置Minecraft VR +- [ ] 配置VR材质包 +- [ ] 创建自定义手势 +- [ ] 创建个性化虚拟空间 - + \ No newline at end of file diff --git a/docs/wiki/vr/pack_setup.md b/docs/wiki/vr/pack_setup.md index 14a1a207..2568c977 100644 --- a/docs/wiki/vr/pack_setup.md +++ b/docs/wiki/vr/pack_setup.md @@ -1,57 +1,61 @@ --- -title: Setting Up the Pack -category: General +title: 设置资源包 +category: 基础 mentions: - TheDoctor15 - MedicalJewel105 - TheItsNameless - SmokeyStack tags: - - expert + - 专家 --- -To start making your addon you should download this template. -This template contains all the required assets for a start on making the VR pack. +# 设置资源包 + + + +开始制作附加包前,您需要下载这个模板文件。 +该模板包含了制作VR资源包所需的所有基础资源。 Get the template! +>获取模板! :::warning -Dont delete `contents.json` and `textures_list.json` from the template. +请勿删除模板中的 `contents.json` 和 `textures_list.json` 文件。 ::: -## What does the template contain? +## 模板包含哪些内容? -The template contains 2 editable folders; `holograms` and `textures`, -these folders contain the models and textures for the vr objects. +模板包含两个可编辑文件夹:`holograms`(全息模型)和 `textures`(纹理), +这些文件夹存放了VR物件的模型和纹理文件。 ![](/assets/images/vr/setup/vr-template-contents.png) -## Holograms +## 全息模型 -This folder contains all the models the VR version of Minecraft uses, for example the VR hands. +此文件夹包含Minecraft VR版使用的所有模型,例如VR手部模型。 ![](/assets/images/vr/setup/vr-template-holograms.png) -## Textures +## 纹理 -This folder stores all textures for the models. +此文件夹存储模型所需的所有纹理贴图。 ![](/assets/images/vr/setup/vr-template-textures.png) -## Merging the VR template with your own pack +## 将VR模板与自有资源包合并 -This pack depends on the `contents.json` and `textures_list.json` to work. All assets from your pack, that the game will use, need to be defined in there. -If you have 2 of the same files you are ought to combine them. +本资源包依赖 `contents.json` 和 `textures_list.json` 文件运行。所有需要被游戏调用的资源都必须在其中定义。 +若存在同名文件,需要进行合并操作。 -## Your progress so far +## 当前进度 -- [x] Setup Minecraft VR -- [x] Setup the pack -- [ ] Edit the models +- [x] 配置Minecraft VR环境 +- [x] 设置资源包 +- [ ] 编辑模型 - + \ No newline at end of file diff --git a/docs/wiki/world-generation/biome-tags.md b/docs/wiki/world-generation/biome-tags.md index d181343e..cda37e3a 100644 --- a/docs/wiki/world-generation/biome-tags.md +++ b/docs/wiki/world-generation/biome-tags.md @@ -1,166 +1,174 @@ --- -title: Biome Tags -category: Documentation +title: 生物群系标签 +category: 文档 mentions: - MedicalJewel105 --- -This page was created with [Wiki Content Generator](https://github.com/Bedrock-OSS/bedrock-wiki-content-generator). If there are issues, contact us on [Bedrock OSS](https://discord.gg/XjV87YN) Discord server. - *Last updated on 08 August 2023* +本文档由 [Wiki内容生成器](https://github.com/Bedrock-OSS/bedrock-wiki-content-generator) 创建。如有问题,请联系 [Bedrock OSS](https://discord.gg/XjV87YN) Discord 服务器。 +*最后更新于2023年8月8日* -## Biome tag per Biome +# 生物群系标签 -| Biome | Biome Tags | -| -------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| bamboo_jungle | animal, bamboo, jungle, monster, overworld | -| bamboo_jungle_hills | animal, bamboo, hills, jungle, monster, overworld | -| basalt_deltas | nether, basalt_deltas, spawn_many_magma_cubes, spawn_ghast | -| beach | beach, monster, overworld, warm | -| birch_forest | animal, birch, forest, monster, overworld, bee_habitat | -| birch_forest_hills | animal, birch, forest, hills, monster, overworld, bee_habitat | -| birch_forest_hills_mutated | animal, birch, forest, hills, monster, mutated, overworld_generation | -| birch_forest_mutated | animal, birch, forest, monster, mutated, bee_habitat, overworld_generation | -| cold_beach | beach, cold, monster, overworld | -| cold_ocean | cold, monster, ocean, overworld | -| cold_taiga | animal, cold, forest, monster, overworld, taiga | -| cold_taiga_hills | animal, cold, forest, hills, monster, overworld, taiga | -| cold_taiga_mutated | animal, cold, forest, monster, mutated, taiga, overworld_generation | -| crimson_forest | nether, netherwart_forest, crimson_forest, spawn_few_zombified_piglins, spawn_piglin | -| deep_cold_ocean | cold, deep, monster, ocean, overworld | -| deep_frozen_ocean | deep, frozen, monster, ocean, overworld | -| deep_lukewarm_ocean | deep, lukewarm, monster, ocean, overworld | -| deep_ocean | deep, monster, ocean, overworld | -| deep_warm_ocean | deep, monster, ocean, overworld, warm | -| desert | desert, monster, overworld | -| desert_hills | desert, hills, monster, overworld | -| desert_mutated | desert, monster, mutated, overworld_generation | -| dripstone_caves | caves, overworld, dripstone_caves, monster | -| extreme_hills | animal, extreme_hills, monster, overworld | -| extreme_hills_edge | animal, edge, extreme_hills, monster, mountain, overworld | -| extreme_hills_mutated | animal, extreme_hills, monster, mutated, overworld | -| extreme_hills_plus_trees | animal, extreme_hills, forest, monster, mountain, overworld | -| extreme_hills_plus_trees_mutated | animal, extreme_hills, forest, monster, mutated, overworld | -| flower_forest | flower_forest, monster, mutated, overworld, bee_habitat | -| forest | animal, forest, monster, overworld, bee_habitat | -| forest_hills | animal, hills, monster, overworld, forest, bee_habitat | -| frozen_ocean | frozen, monster, ocean, overworld | -| frozen_peaks | mountains, monster, overworld, frozen, frozen_peaks | -| frozen_river | frozen, overworld, river | -| grove | mountains, monster, overworld, grove | -| hell | nether, nether_wastes, spawn_magma_cubes, spawn_zombified_piglin, spawn_few_piglins, spawn_ghast, spawn_endermen | -| ice_mountains | frozen, ice, mountain, overworld | -| ice_plains | frozen, ice, ice_plains, overworld | -| ice_plains_spikes | frozen, ice_plains, monster, mutated, overworld | -| jagged_peaks | mountains, monster, overworld, frozen, jagged_peaks | -| jungle | animal, jungle, monster, overworld, rare | -| jungle_edge | animal, edge, jungle, monster, overworld | -| jungle_edge_mutated | animal, edge, jungle, monster, mutated, overworld_generation | -| jungle_hills | animal, hills, jungle, monster, overworld | -| jungle_mutated | animal, jungle, monster, mutated, overworld_generation | -| legacy_frozen_ocean | frozen, ocean, overworld | -| lukewarm_ocean | lukewarm, monster, ocean, overworld | -| lush_caves | caves, lush_caves, overworld, monster | -| meadow | mountains, monster, overworld, meadow, bee_habitat | -| mega_taiga | animal, forest, mega, monster, overworld, rare, taiga | -| mega_taiga_hills | animal, forest, hills, mega, monster, overworld, taiga | -| mesa | mesa, monster, overworld | -| mesa_bryce | animal, mesa, monster, mutated, overworld | -| mesa_plateau | mesa, monster, overworld, plateau, rare | -| mesa_plateau_mutated | mesa, monster, mutated, overworld, plateau, stone | -| mesa_plateau_stone | mesa, monster, overworld, plateau, rare, stone | -| mesa_plateau_stone_mutated | mesa, monster, mutated, overworld, plateau | -| mushroom_island | mooshroom_island, overworld | -| mushroom_island_shore | mooshroom_island, overworld, shore | -| ocean | monster, ocean, overworld | -| plains | animal, monster, overworld, plains, bee_habitat | -| redwood_taiga_hills_mutated | animal, forest, hills, mega, monster, mutated, taiga, overworld_generation | -| redwood_taiga_mutated | animal, forest, mega, monster, mutated, overworld, taiga | -| river | overworld, river | -| roofed_forest | animal, forest, monster, no_legacy_worldgen, overworld, roofed | -| roofed_forest_mutated | animal, forest, monster, mutated, roofed, overworld_generation | -| savanna | animal, monster, overworld, savanna | -| savanna_mutated | animal, monster, mutated, overworld, savanna | -| savanna_plateau | animal, monster, overworld, plateau, savanna | -| savanna_plateau_mutated | animal, monster, mutated, overworld, plateau, savanna | -| snowy_slopes | mountains, monster, overworld, snowy_slopes, frozen | -| soulsand_valley | nether, soulsand_valley, spawn_ghast, spawn_endermen | -| stone_beach | beach, monster, overworld, stone | -| stony_peaks | mountains, monster, overworld | -| sunflower_plains | animal, monster, mutated, overworld, plains, bee_habitat | -| swampland | animal, monster, overworld, swamp | -| swampland_mutated | animal, monster, mutated, swamp, overworld_generation | -| taiga | animal, forest, monster, overworld, taiga | -| taiga_hills | animal, forest, hills, monster, overworld, taiga | -| taiga_mutated | animal, forest, monster, mutated, taiga, overworld_generation | -| the_end | the_end | -| warm_ocean | monster, ocean, overworld, warm | -| warped_forest | nether, netherwart_forest, warped_forest, spawn_endermen | + -## Biome per Biome Tag +## 按生物群系列出标签 -| Biome Tag | Biomes | -| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| animal | bamboo_jungle, bamboo_jungle_hills, birch_forest, birch_forest_hills, birch_forest_hills_mutated, birch_forest_mutated, cold_taiga, cold_taiga_hills, cold_taiga_mutated, extreme_hills, extreme_hills_edge, extreme_hills_mutated, extreme_hills_plus_trees, extreme_hills_plus_trees_mutated, forest, forest_hills, jungle, jungle_edge, jungle_edge_mutated, jungle_hills, jungle_mutated, mega_taiga, mega_taiga_hills, mesa_bryce, plains, redwood_taiga_hills_mutated, redwood_taiga_mutated, roofed_forest, roofed_forest_mutated, savanna, savanna_mutated, savanna_plateau, savanna_plateau_mutated, sunflower_plains, swampland, swampland_mutated, taiga, taiga_hills, taiga_mutated | -| bamboo | bamboo_jungle, bamboo_jungle_hills | -| basalt_deltas | basalt_deltas | -| beach | beach, cold_beach, stone_beach | -| bee_habitat | birch_forest, birch_forest_hills, birch_forest_mutated, flower_forest, forest, forest_hills, meadow, plains, sunflower_plains | -| birch | birch_forest, birch_forest_hills, birch_forest_hills_mutated, birch_forest_mutated | -| caves | dripstone_caves, lush_caves | -| cold | cold_beach, cold_ocean, cold_taiga, cold_taiga_hills, cold_taiga_mutated, deep_cold_ocean | -| crimson_forest | crimson_forest | -| deep | deep_cold_ocean, deep_frozen_ocean, deep_lukewarm_ocean, deep_ocean, deep_warm_ocean | -| desert | desert, desert_hills, desert_mutated | -| dripstone_caves | dripstone_caves | -| edge | extreme_hills_edge, jungle_edge, jungle_edge_mutated | -| extreme_hills | extreme_hills, extreme_hills_edge, extreme_hills_mutated, extreme_hills_plus_trees, extreme_hills_plus_trees_mutated | -| flower_forest | flower_forest | -| forest | birch_forest, birch_forest_hills, birch_forest_hills_mutated, birch_forest_mutated, cold_taiga, cold_taiga_hills, cold_taiga_mutated, extreme_hills_plus_trees, extreme_hills_plus_trees_mutated, forest, forest_hills, mega_taiga, mega_taiga_hills, redwood_taiga_hills_mutated, redwood_taiga_mutated, roofed_forest, roofed_forest_mutated, taiga, taiga_hills, taiga_mutated | -| frozen | deep_frozen_ocean, frozen_ocean, frozen_peaks, frozen_river, ice_mountains, ice_plains, ice_plains_spikes, jagged_peaks, legacy_frozen_ocean, snowy_slopes | -| frozen_peaks | frozen_peaks | -| grove | grove | -| hills | bamboo_jungle_hills, birch_forest_hills, birch_forest_hills_mutated, cold_taiga_hills, desert_hills, forest_hills, jungle_hills, mega_taiga_hills, redwood_taiga_hills_mutated, taiga_hills | -| ice | ice_mountains, ice_plains | -| ice_plains | ice_plains, ice_plains_spikes | -| jagged_peaks | jagged_peaks | -| jungle | bamboo_jungle, bamboo_jungle_hills, jungle, jungle_edge, jungle_edge_mutated, jungle_hills, jungle_mutated | -| lukewarm | deep_lukewarm_ocean, lukewarm_ocean | -| lush_caves | lush_caves | -| meadow | meadow | -| mega | mega_taiga, mega_taiga_hills, redwood_taiga_hills_mutated, redwood_taiga_mutated | -| mesa | mesa, mesa_bryce, mesa_plateau, mesa_plateau_mutated, mesa_plateau_stone, mesa_plateau_stone_mutated | -| monster | bamboo_jungle, bamboo_jungle_hills, beach, birch_forest, birch_forest_hills, birch_forest_hills_mutated, birch_forest_mutated, cold_beach, cold_ocean, cold_taiga, cold_taiga_hills, cold_taiga_mutated, deep_cold_ocean, deep_frozen_ocean, deep_lukewarm_ocean, deep_ocean, deep_warm_ocean, desert, desert_hills, desert_mutated, dripstone_caves, extreme_hills, extreme_hills_edge, extreme_hills_mutated, extreme_hills_plus_trees, extreme_hills_plus_trees_mutated, flower_forest, forest, forest_hills, frozen_ocean, frozen_peaks, grove, ice_plains_spikes, jagged_peaks, jungle, jungle_edge, jungle_edge_mutated, jungle_hills, jungle_mutated, lukewarm_ocean, lush_caves, meadow, mega_taiga, mega_taiga_hills, mesa, mesa_bryce, mesa_plateau, mesa_plateau_mutated, mesa_plateau_stone, mesa_plateau_stone_mutated, ocean, plains, redwood_taiga_hills_mutated, redwood_taiga_mutated, roofed_forest, roofed_forest_mutated, savanna, savanna_mutated, savanna_plateau, savanna_plateau_mutated, snowy_slopes, stone_beach, stony_peaks, sunflower_plains, swampland, swampland_mutated, taiga, taiga_hills, taiga_mutated, warm_ocean | -| mooshroom_island | mushroom_island, mushroom_island_shore | -| mountain | extreme_hills_edge, extreme_hills_plus_trees, ice_mountains | -| mountains | frozen_peaks, grove, jagged_peaks, meadow, snowy_slopes, stony_peaks | -| mutated | birch_forest_hills_mutated, birch_forest_mutated, cold_taiga_mutated, desert_mutated, extreme_hills_mutated, extreme_hills_plus_trees_mutated, flower_forest, ice_plains_spikes, jungle_edge_mutated, jungle_mutated, mesa_bryce, mesa_plateau_mutated, mesa_plateau_stone_mutated, redwood_taiga_hills_mutated, redwood_taiga_mutated, roofed_forest_mutated, savanna_mutated, savanna_plateau_mutated, sunflower_plains, swampland_mutated, taiga_mutated | -| nether | basalt_deltas, crimson_forest, hell, soulsand_valley, warped_forest | -| nether_wastes | hell | -| netherwart_forest | crimson_forest, warped_forest | -| no_legacy_worldgen | roofed_forest | -| ocean | cold_ocean, deep_cold_ocean, deep_frozen_ocean, deep_lukewarm_ocean, deep_ocean, deep_warm_ocean, frozen_ocean, legacy_frozen_ocean, lukewarm_ocean, ocean, warm_ocean | -| overworld | bamboo_jungle, bamboo_jungle_hills, beach, birch_forest, birch_forest_hills, cold_beach, cold_ocean, cold_taiga, cold_taiga_hills, deep_cold_ocean, deep_frozen_ocean, deep_lukewarm_ocean, deep_ocean, deep_warm_ocean, desert, desert_hills, dripstone_caves, extreme_hills, extreme_hills_edge, extreme_hills_mutated, extreme_hills_plus_trees, extreme_hills_plus_trees_mutated, flower_forest, forest, forest_hills, frozen_ocean, frozen_peaks, frozen_river, grove, ice_mountains, ice_plains, ice_plains_spikes, jagged_peaks, jungle, jungle_edge, jungle_hills, legacy_frozen_ocean, lukewarm_ocean, lush_caves, meadow, mega_taiga, mega_taiga_hills, mesa, mesa_bryce, mesa_plateau, mesa_plateau_mutated, mesa_plateau_stone, mesa_plateau_stone_mutated, mushroom_island, mushroom_island_shore, ocean, plains, redwood_taiga_mutated, river, roofed_forest, savanna, savanna_mutated, savanna_plateau, savanna_plateau_mutated, snowy_slopes, stone_beach, stony_peaks, sunflower_plains, swampland, taiga, taiga_hills, warm_ocean | -| overworld_generation | birch_forest_hills_mutated, birch_forest_mutated, cold_taiga_mutated, desert_mutated, jungle_edge_mutated, jungle_mutated, redwood_taiga_hills_mutated, roofed_forest_mutated, swampland_mutated, taiga_mutated | -| plains | plains, sunflower_plains | -| plateau | mesa_plateau, mesa_plateau_mutated, mesa_plateau_stone, mesa_plateau_stone_mutated, savanna_plateau, savanna_plateau_mutated | -| rare | jungle, mega_taiga, mesa_plateau, mesa_plateau_stone | -| river | frozen_river, river | -| roofed | roofed_forest, roofed_forest_mutated | -| savanna | savanna, savanna_mutated, savanna_plateau, savanna_plateau_mutated | -| shore | mushroom_island_shore | -| snowy_slopes | snowy_slopes | -| soulsand_valley | soulsand_valley | -| spawn_endermen | hell, soulsand_valley, warped_forest | -| spawn_few_piglins | hell | -| spawn_few_zombified_piglins | crimson_forest | -| spawn_ghast | basalt_deltas, hell, soulsand_valley | -| spawn_magma_cubes | hell | -| spawn_many_magma_cubes | basalt_deltas | -| spawn_piglin | crimson_forest | -| spawn_zombified_piglin | hell | -| stone | mesa_plateau_mutated, mesa_plateau_stone, stone_beach | -| swamp | swampland, swampland_mutated | -| taiga | cold_taiga, cold_taiga_hills, cold_taiga_mutated, mega_taiga, mega_taiga_hills, redwood_taiga_hills_mutated, redwood_taiga_mutated, taiga, taiga_hills, taiga_mutated | -| the_end | the_end | -| warm | beach, deep_warm_ocean, warm_ocean | -| warped_forest | warped_forest | +| 生物群系名称 | 所属标签 | +| ---------------------------- | ---------------------------------------------------------------------------------------------------------- | +| bamboo_jungle | animal(动物生成), bamboo(竹林), jungle(丛林), monster(怪物生成), overworld(主世界) | +| bamboo_jungle_hills | animal, bamboo, hills(丘陵), jungle, monster, overworld | +| basalt_deltas | nether(下界), basalt_deltas(玄武岩三角洲), spawn_many_magma_cubes(大量岩浆怪生成), spawn_ghast(恶魂生成) | +| beach | beach(海滩), monster, overworld, warm(温暖气候) | +| birch_forest | animal, birch(桦木), forest(森林), monster, overworld, bee_habitat(蜜蜂栖息地) | +| birch_forest_hills | animal, birch, forest, hills, monster, overworld, bee_habitat | +| birch_forest_hills_mutated | animal, birch, forest, hills, monster, mutated(变异), overworld_generation(主世界生成) | +| birch_forest_mutated | animal, birch, forest, monster, mutated, bee_habitat, overworld_generation | +| cold_beach | beach, cold(寒冷气候), monster, overworld | +| cold_ocean | cold, monster, ocean(海洋), overworld | +| cold_taiga | animal, cold, forest, monster, overworld, taiga(针叶林) | +| cold_taiga_hills | animal, cold, forest, hills, monster, overworld, taiga | +| cold_taiga_mutated | animal, cold, forest, monster, mutated, taiga, overworld_generation | +| crimson_forest | nether, netherwart_forest(下界疣森林), crimson_forest(绯红森林), spawn_few_zombified_piglins(少量僵尸猪灵生成), spawn_piglin(猪灵生成) | +| deep_cold_ocean | cold, deep(深海), monster, ocean, overworld | +| deep_frozen_ocean | deep, frozen(冰冻), monster, ocean, overworld | +| deep_lukewarm_ocean | deep, lukewarm(温水), monster, ocean, overworld | +| deep_ocean | deep, monster, ocean, overworld | +| deep_warm_ocean | deep, monster, ocean, overworld, warm | +| desert | desert(沙漠), monster, overworld | +| desert_hills | desert, hills, monster, overworld | +| desert_mutated | desert, monster, mutated, overworld_generation | +| dripstone_caves | caves(洞穴), overworld, dripstone_caves(溶洞), monster | +| extreme_hills | animal, extreme_hills(峭壁), monster, overworld | +| extreme_hills_edge | animal, edge(边缘), extreme_hills, monster, mountain(山地), overworld | +| extreme_hills_mutated | animal, extreme_hills, monster, mutated, overworld | +| extreme_hills_plus_trees | animal, extreme_hills, forest, monster, mountain, overworld | +| extreme_hills_plus_trees_mutated | animal, extreme_hills, forest, monster, mutated, overworld | +| flower_forest | flower_forest(繁花森林), monster, mutated, overworld, bee_habitat | +| forest | animal, forest, monster, overworld, bee_habitat | +| forest_hills | animal, hills, monster, overworld, forest, bee_habitat | +| frozen_ocean | frozen, monster, ocean, overworld | +| frozen_peaks | mountains(山脉), monster, overworld, frozen, frozen_peaks(冰封山峰) | +| frozen_river | frozen, overworld, river(河流) | +| grove | mountains, monster, overworld, grove(雪林) | +| hell | nether, nether_wastes(下界荒地), spawn_magma_cubes(岩浆怪生成), spawn_zombified_piglin(僵尸猪灵生成), spawn_few_piglins(少量猪灵生成), spawn_ghast, spawn_endermen(末影人生成) | +| ice_mountains | frozen, ice(冰原), mountain, overworld | +| ice_plains | frozen, ice, ice_plains(冰原), overworld | +| ice_plains_spikes | frozen, ice_plains, monster, mutated, overworld | +| jagged_peaks | mountains, monster, overworld, frozen, jagged_peaks(尖峭山峰) | +| jungle | animal, jungle, monster, overworld, rare(稀有) | +| jungle_edge | animal, edge, jungle, monster, overworld | +| jungle_edge_mutated | animal, edge, jungle, monster, mutated, overworld_generation | +| jungle_hills | animal, hills, jungle, monster, overworld | +| jungle_mutated | animal, jungle, monster, mutated, overworld_generation | +| legacy_frozen_ocean | frozen, ocean, overworld | +| lukewarm_ocean | lukewarm, monster, ocean, overworld | +| lush_caves | caves, lush_caves(繁茂洞穴), overworld, monster | +| meadow | mountains, monster, overworld, meadow(草甸), bee_habitat | +| mega_taiga | animal, forest, mega(巨型), monster, overworld, rare, taiga | +| mega_taiga_hills | animal, forest, hills, mega, monster, overworld, taiga | +| mesa | mesa(平顶山), monster, overworld | +| mesa_bryce | animal, mesa, monster, mutated, overworld | +| mesa_plateau | mesa, monster, overworld, plateau(高原), rare | +| mesa_plateau_mutated | mesa, monster, mutated, overworld, plateau, stone(石质) | +| mesa_plateau_stone | mesa, monster, overworld, plateau, rare, stone | +| mesa_plateau_stone_mutated | mesa, monster, mutated, overworld, plateau | +| mushroom_island | mooshroom_island(蘑菇岛), overworld | +| mushroom_island_shore | mooshroom_island, overworld, shore(海岸) | +| ocean | monster, ocean, overworld | +| plains | animal, monster, overworld, plains(平原), bee_habitat | +| redwood_taiga_hills_mutated | animal, forest, hills, mega, monster, mutated, taiga, overworld_generation | +| redwood_taiga_mutated | animal, forest, mega, monster, mutated, overworld, taiga | +| river | overworld, river | +| roofed_forest | animal, forest, monster, no_legacy_worldgen(非旧版地形), overworld, roofed(黑森林) | +| roofed_forest_mutated | animal, forest, monster, mutated, roofed, overworld_generation | +| savanna | animal, monster, overworld, savanna(热带草原) | +| savanna_mutated | animal, monster, mutated, overworld, savanna | +| savanna_plateau | animal, monster, overworld, plateau, savanna | +| savanna_plateau_mutated | animal, monster, mutated, overworld, plateau, savanna | +| snowy_slopes | mountains, monster, overworld, snowy_slopes(积雪坡地), frozen | +| soulsand_valley | nether, soulsand_valley(灵魂沙峡谷), spawn_ghast, spawn_endermen | +| stone_beach | beach, monster, overworld, stone | +| stony_peaks | mountains, monster, overworld | +| sunflower_plains | animal, monster, mutated, overworld, plains, bee_habitat | +| swampland | animal, monster, overworld, swamp(沼泽) | +| swampland_mutated | animal, monster, mutated, swamp, overworld_generation | +| taiga | animal, forest, monster, overworld, taiga | +| taiga_hills | animal, forest, hills, monster, overworld, taiga | +| taiga_mutated | animal, forest, monster, mutated, taiga, overworld_generation | +| the_end | the_end(末地) | +| warm_ocean | monster, ocean, overworld, warm | +| warped_forest | nether, netherwart_forest, warped_forest(诡异森林), spawn_endermen | + +## 按标签列出生物群系 + +| 标签名称 | 包含生物群系 | +| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| animal | bamboo_jungle, bamboo_jungle_hills, birch_forest, birch_forest_hills, birch_forest_hills_mutated, birch_forest_mutated, cold_taiga, cold_taiga_hills, cold_taiga_mutated, extreme_hills, extreme_hills_edge, extreme_hills_mutated, extreme_hills_plus_trees, extreme_hills_plus_trees_mutated, forest, forest_hills, jungle, jungle_edge, jungle_edge_mutated, jungle_hills, jungle_mutated, mega_taiga, mega_taiga_hills, mesa_bryce, plains, redwood_taiga_hills_mutated, redwood_taiga_mutated, roofed_forest, roofed_forest_mutated, savanna, savanna_mutated, savanna_plateau, savanna_plateau_mutated, sunflower_plains, swampland, swampland_mutated, taiga, taiga_hills, taiga_mutated | +| bamboo | bamboo_jungle, bamboo_jungle_hills | +| basalt_deltas | basalt_deltas | +| beach | beach, cold_beach, stone_beach | +| bee_habitat | birch_forest, birch_forest_hills, birch_forest_mutated, flower_forest, forest, forest_hills, meadow, plains, sunflower_plains | +| birch | birch_forest, birch_forest_hills, birch_forest_hills_mutated, birch_forest_mutated | +| caves | dripstone_caves, lush_caves | +| cold | cold_beach, cold_ocean, cold_taiga, cold_taiga_hills, cold_taiga_mutated, deep_cold_ocean | +| crimson_forest | crimson_forest | +| deep | deep_cold_ocean, deep_frozen_ocean, deep_lukewarm_ocean, deep_ocean, deep_warm_ocean | +| desert | desert, desert_hills, desert_mutated | +| dripstone_caves | dripstone_caves | +| edge | extreme_hills_edge, jungle_edge, jungle_edge_mutated | +| extreme_hills | extreme_hills, extreme_hills_edge, extreme_hills_mutated, extreme_hills_plus_trees, extreme_hills_plus_trees_mutated | +| flower_forest | flower_forest | +| forest | birch_forest, birch_forest_hills, birch_forest_hills_mutated, birch_forest_mutated, cold_taiga, cold_taiga_hills, cold_taiga_mutated, extreme_hills_plus_trees, extreme_hills_plus_trees_mutated, forest, forest_hills, mega_taiga, mega_taiga_hills, redwood_taiga_hills_mutated, redwood_taiga_mutated, roofed_forest, roofed_forest_mutated, taiga, taiga_hills, taiga_mutated | +| frozen | deep_frozen_ocean, frozen_ocean, frozen_peaks, frozen_river, ice_mountains, ice_plains, ice_plains_spikes, jagged_peaks, legacy_frozen_ocean, snowy_slopes | +| frozen_peaks | frozen_peaks | +| grove | grove | +| hills | bamboo_jungle_hills, birch_forest_hills, birch_forest_hills_mutated, cold_taiga_hills, desert_hills, forest_hills, jungle_hills, mega_taiga_hills, redwood_taiga_hills_mutated, taiga_hills | +| ice | ice_mountains, ice_plains | +| ice_plains | ice_plains, ice_plains_spikes | +| jagged_peaks | jagged_peaks | +| jungle | bamboo_jungle, bamboo_jungle_hills, jungle, jungle_edge, jungle_edge_mutated, jungle_hills, jungle_mutated | +| lukewarm | deep_lukewarm_ocean, lukewarm_ocean | +| lush_caves | lush_caves | +| meadow | meadow | +| mega | mega_taiga, mega_taiga_hills, redwood_taiga_hills_mutated, redwood_taiga_mutated | +| mesa | mesa, mesa_bryce, mesa_plateau, mesa_plateau_mutated, mesa_plateau_stone, mesa_plateau_stone_mutated | +| monster | bamboo_jungle, bamboo_jungle_hills, beach, birch_forest, birch_forest_hills, birch_forest_hills_mutated, birch_forest_mutated, cold_beach, cold_ocean, cold_taiga, cold_taiga_hills, cold_taiga_mutated, deep_cold_ocean, deep_frozen_ocean, deep_lukewarm_ocean, deep_ocean, deep_warm_ocean, desert, desert_hills, desert_mutated, dripstone_caves, extreme_hills, extreme_hills_edge, extreme_hills_mutated, extreme_hills_plus_trees, extreme_hills_plus_trees_mutated, flower_forest, forest, forest_hills, frozen_ocean, frozen_peaks, grove, ice_plains_spikes, jagged_peaks, jungle, jungle_edge, jungle_edge_mutated, jungle_hills, jungle_mutated, lukewarm_ocean, lush_caves, meadow, mega_taiga, mega_taiga_hills, mesa, mesa_bryce, mesa_plateau, mesa_plateau_mutated, mesa_plateau_stone, mesa_plateau_stone_mutated, ocean, plains, redwood_taiga_hills_mutated, redwood_taiga_mutated, roofed_forest, roofed_forest_mutated, savanna, savanna_mutated, savanna_plateau, savanna_plateau_mutated, snowy_slopes, stone_beach, stony_peaks, sunflower_plains, swampland, swampland_mutated, taiga, taiga_hills, taiga_mutated, warm_ocean | +| mooshroom_island | mushroom_island, mushroom_island_shore | +| mountain | extreme_hills_edge, extreme_hills_plus_trees, ice_mountains | +| mountains | frozen_peaks, grove, jagged_peaks, meadow, snowy_slopes, stony_peaks | +| mutated | birch_forest_hills_mutated, birch_forest_mutated, cold_taiga_mutated, desert_mutated, extreme_hills_mutated, extreme_hills_plus_trees_mutated, flower_forest, ice_plains_spikes, jungle_edge_mutated, jungle_mutated, mesa_bryce, mesa_plateau_mutated, mesa_plateau_stone_mutated, redwood_taiga_hills_mutated, redwood_taiga_mutated, roofed_forest_mutated, savanna_mutated, savanna_plateau_mutated, sunflower_plains, swampland_mutated, taiga_mutated | +| nether | basalt_deltas, crimson_forest, hell, soulsand_valley, warped_forest | +| nether_wastes | hell | +| netherwart_forest | crimson_forest, warped_forest | +| no_legacy_worldgen | roofed_forest | +| ocean | cold_ocean, deep_cold_ocean, deep_frozen_ocean, deep_lukewarm_ocean, deep_ocean, deep_warm_ocean, frozen_ocean, legacy_frozen_ocean, lukewarm_ocean, ocean, warm_ocean | +| overworld | bamboo_jungle, bamboo_jungle_hills, beach, birch_forest, birch_forest_hills, cold_beach, cold_ocean, cold_taiga, cold_taiga_hills, deep_cold_ocean, deep_frozen_ocean, deep_lukewarm_ocean, deep_ocean, deep_warm_ocean, desert, desert_hills, dripstone_caves, extreme_hills, extreme_hills_edge, extreme_hills_mutated, extreme_hills_plus_trees, extreme_hills_plus_trees_mutated, flower_forest, forest, forest_hills, frozen_ocean, frozen_peaks, frozen_river, grove, ice_mountains, ice_plains, ice_plains_spikes, jagged_peaks, jungle, jungle_edge, jungle_hills, legacy_frozen_ocean, lukewarm_ocean, lush_caves, meadow, mega_taiga, mega_taiga_hills, mesa, mesa_bryce, mesa_plateau, mesa_plateau_mutated, mesa_plateau_stone, mesa_plateau_stone_mutated, mushroom_island, mushroom_island_shore, ocean, plains, redwood_taiga_mutated, river, roofed_forest, savanna, savanna_mutated, savanna_plateau, savanna_plateau_mutated, snowy_slopes, stone_beach, stony_peaks, sunflower_plains, swampland, taiga, taiga_hills, warm_ocean | +| overworld_generation | birch_forest_hills_mutated, birch_forest_mutated, cold_taiga_mutated, desert_mutated, jungle_edge_mutated, jungle_mutated, redwood_taiga_hills_mutated, roofed_forest_mutated, swampland_mutated, taiga_mutated | +| plains | plains, sunflower_plains | +| plateau | mesa_plateau, mesa_plateau_mutated, mesa_plateau_stone, mesa_plateau_stone_mutated, savanna_plateau, savanna_plateau_mutated | +| rare | jungle, mega_taiga, mesa_plateau, mesa_plateau_stone | +| river | frozen_river, river | +| roofed | roofed_forest, roofed_forest_mutated | +| savanna | savanna, savanna_mutated, savanna_plateau, savanna_plateau_mutated | +| shore | mushroom_island_shore | +| snowy_slopes | snowy_slopes | +| soulsand_valley | soulsand_valley | +| spawn_endermen | hell, soulsand_valley, warped_forest | +| spawn_few_piglins | hell | +| spawn_few_zombified_piglins | crimson_forest | +| spawn_ghast | basalt_deltas, hell, soulsand_valley | +| spawn_magma_cubes | hell | +| spawn_many_magma_cubes | basalt_deltas | +| spawn_piglin | crimson_forest | +| spawn_zombified_piglin | hell | +| stone | mesa_plateau_mutated, mesa_plateau_stone, stone_beach | +| swamp | swampland, swampland_mutated | +| taiga | cold_taiga, cold_taiga_hills, cold_taiga_mutated, mega_taiga, mega_taiga_hills, redwood_taiga_hills_mutated, redwood_taiga_mutated, taiga, taiga_hills, taiga_mutated | +| the_end | the_end | +| warm | beach, deep_warm_ocean, warm_ocean | +| warped_forest | warped_forest | + +::: tip 格式说明 +本表格中部分标签后标注了中文解释(如`animal(动物生成)`),这是为了便于理解添加的注释,实际标签名称仍为英文形式 +::: \ No newline at end of file diff --git a/docs/wiki/world-generation/custom-ores.md b/docs/wiki/world-generation/custom-ores.md index 1edfe1b9..dc3266ec 100644 --- a/docs/wiki/world-generation/custom-ores.md +++ b/docs/wiki/world-generation/custom-ores.md @@ -1,6 +1,6 @@ --- -title: Generating Custom Ores -category: Tutorials +title: 生成自定义矿物 +category: 巧思案例 tags: - experimental mentions: @@ -10,34 +10,37 @@ mentions: - Chikorita-Lover --- -`ore_feature`'s are basic but important features! They can form clusters of blocks by replacing blocks where they are generated. This tutorial will show you how to make mineral ores that naturally generate. +# 生成自定义矿物 -The use of features and feature rules requires Creation of Custom Biomes to be enabled in your world settings. If your block doesn't generate, make sure it's enabled! + + +`矿石特征`是基础但重要的特性!它们通过替换生成位置的方块来形成方块簇。本教程将展示如何制作自然生成的矿物矿石。 + +使用特征和特征规则需要在世界设置中启用自定义生物群系功能。如果方块未生成,请确保已启用该选项! :::tip -For this tutorial, I'll be using 2 custom blocks, Titanite Ore and Deepslate Titanite Ore. For how to make custom blocks, visit the [Blocks Intro](/blocks/blocks-intro) page. +本教程将使用两种自定义方块:钛铁矿和深板岩钛铁矿。关于如何制作自定义方块,请访问[方块基础](/wiki/blocks/blocks-intro)页面。 ::: -## The Feature File +## 特征文件 -BP/features/titanite_ore_feature.json - -```json +::: code-group +```json [BP/features/titanite_ore_feature.json] { "format_version": "1.17.0", "minecraft:ore_feature": { "description": { "identifier": "wiki:titanite_ore_feature" }, - "count": 8, // Placement attempts + "count": 8, // 尝试放置次数 "replace_rules": [ { - // Replace all stone variants (andesite, granite, and diorite) with titanite ore + // 将所有石质变种(安山岩、花岗岩、闪长岩)替换为钛铁矿 "places_block": "wiki:titanite_ore", "may_replace": ["minecraft:stone"] }, { - // Replace deepslate with deepslate titanite ore + // 将深板岩替换为深板岩钛铁矿 "places_block": "wiki:deepslate_titanite_ore", "may_replace": ["minecraft:deepslate"] } @@ -45,23 +48,23 @@ For this tutorial, I'll be using 2 custom blocks, Titanite Ore and Deepslate Tit } } ``` +::: -## The Feature Rule +## 特征规则 -BP/feature_rules/overworld_underground_titanite_ore_feature.json - -```json +::: code-group +```json [BP/feature_rules/overworld_underground_titanite_ore_feature.json] { "format_version": "1.13.0", "minecraft:feature_rules": { "description": { "identifier": "wiki:overworld_underground_titanite_ore_feature", - "places_feature": "wiki:titanite_ore_feature" // Identifier from the feature file + "places_feature": "wiki:titanite_ore_feature" // 来自特征文件的标识符 }, "conditions": { "placement_pass": "underground_pass", "minecraft:biome_filter": [ - // Scatter the ore throughout the Overworld + // 在主世界各处散布矿石 { "any_of": [ { @@ -79,17 +82,17 @@ For this tutorial, I'll be using 2 custom blocks, Titanite Ore and Deepslate Tit ] }, "distribution": { - "iterations": 10, // Placement attempts of the cluster, not the ore blocks + "iterations": 10, // 矿簇的生成尝试次数(非单个矿石方块) "coordinate_eval_order": "zyx", "x": { "distribution": "uniform", "extent": [0, 16] }, "y": { - "distribution": "uniform", // You can use "triangle" to make ores more common in the middle of the extent + "distribution": "uniform", // 使用"triangle"可使矿石在高度范围中部更常见 "extent": [ - 0, // Minimum y level for the ore to generate - 62 // Maximum y level for the ore to generate + 0, // 矿石生成的最小高度 + 62 // 矿石生成的最大高度 ] }, "z": { @@ -100,17 +103,18 @@ For this tutorial, I'll be using 2 custom blocks, Titanite Ore and Deepslate Tit } } ``` +::: -## Testing +## 测试验证 -You can look for the ore by exploring caves, but if your ores are rare, you can use commands instead to check if they're generating. Simply place this command into a repeating command block, then fly around: +可以通过探索洞穴寻找矿石,若矿石稀有度较高,建议使用指令验证生成情况。将以下指令放入循环命令方块中,然后四处飞行: - `execute @a ~ ~ ~ fill ~8 ~8 ~8 ~-8 ~-8 ~-8 air 0 replace wiki:titanite_ore` -Stone ores: +普通石质矿石: ![](/assets/images/world-generation/generating-custom-ores/stone_ore.png) -Deepslate ores: +深板岩矿石: -![](/assets/images/world-generation/generating-custom-ores/deepslate_ore.png) +![](/assets/images/world-generation/generating-custom-ores/deepslate_ore.png) \ No newline at end of file diff --git a/docs/wiki/world-generation/feature-block-conditions.md b/docs/wiki/world-generation/feature-block-conditions.md index 2136aa91..10fc7cb6 100644 --- a/docs/wiki/world-generation/feature-block-conditions.md +++ b/docs/wiki/world-generation/feature-block-conditions.md @@ -1,72 +1,73 @@ --- -title: Block Conditions for Features -category: Tutorials +title: 方块的生成条件 +category: 巧思案例 tags: - - experimental + - 实验性 mentions: - PavelDobCZ23 - SmokeyStack - ThomasOrs --- -Sometimes you might need to place any feature conditionally depending on what blocks are below or above it for example. Not many features have the option to conditionally place them like so, but with a simple trick we can use it on anything we want. +# 方块的生成条件 + + + +有时你可能需要根据下方或上方的方块条件来放置特定特征。虽然多数生成特征本身不具备条件判断功能,但我们可以通过简单的技巧实现这个需求。 :::tip -This technique utilizes `aggregate_feature` and `single_block_feature` features. If you want to learn more about those, visit [Feature Types](/world-generation/feature-types) article. +本技巧利用了 `aggregate_feature` 和 `single_block_feature` 特征。若想了解更多相关内容,请参阅[特征类型](/wiki/world-generation/feature-types)文档。 ::: -## Files +## 文件结构 -### Features +### 特征文件 -This feature places a `single_block_feature` which can be specified with the conditions we need for some other feature. The block can be kept there if it doesn't interrupt your desired features, but we will replace it with air in the next feature so that it doesn't cause any issues later on. This feature acts as a "dummy" feature because we only want its condition part but we don't need it to actually place anything. +这个特征通过 `single_block_feature` 实现条件判断功能。我们可以保留这个占位方块(若不影响后续生成),但后续会将其替换为空气方块以避免干扰。该特征本质上是一个"虚拟"特征,因为我们只需要它的条件判断功能而不需要实际生成方块。 -BP/features/block_condition_feature.json - -```json +::: code-group +```json [BP/features/block_condition_feature.json] { "format_version": "1.18.0", "minecraft:single_block_feature": { "description": { "identifier": "wiki:block_condition_feature" }, - "places_block": "minecraft:cobblestone", //Any block that isn't in "may_replace" list. + "places_block": "minecraft:cobblestone", //任何不在"may_replace"列表中的方块 "enforce_placement_rules": false, "enforce_survivability_rules": false, - "may_replace": ["minecraft:air"], //Only blocks the feature is allowed to be placed in. - "may_attach_to": { //Attachment conditions - what blocks can surround the feature when its being placed - "bottom": ["minecraft:grass"] //Only blocks the feature can be placed on top of. + "may_replace": ["minecraft:air"], //仅允许在特定方块上生成 + "may_attach_to": { //附着条件 - 特征生成时周围允许存在的方块 + "bottom": ["minecraft:grass"] //仅允许在草方块上方生成 } } } -//This "dummy" feature will only allow the feature to generate in the air, right above a grass block. +//这个"虚拟"特征只允许在草方块正上方的空气方块位置生成 ``` -This next feature is the one that is going to replace the cobblestone with the original air block that was there, however it can be omitted if you choose a block you actually want there or if it won't cause you any issues later. +接下来的特征负责将圆石替换回原始空气方块。如果你选择保留占位方块或该方块不会造成干扰,可以省略此步骤。 -BP/features/block_replacement_feature.json - -```json +::: code-group +```json [BP/features/block_replacement_feature.json] { "format_version": "1.18.0", "minecraft:single_block_feature": { "description": { "identifier": "wiki:block_replacement_feature" }, - "places_block": "minecraft:air", //Replaces the block with another one which doesn't cause us any issue. + "places_block": "minecraft:air", //将占位方块替换为无影响的方块 "enforce_placement_rules": false, "enforce_survivability_rules": false, - "may_replace": ["minecraft:cobblestone"] //The block that we specified in the previous feature. + "may_replace": ["minecraft:cobblestone"] //前一个特征中使用的占位方块 } } -//This feature will replace the block with air that originally was there so it won't cause us any issue. +//此特征将占位方块替换回空气,避免后续生成问题 ``` -This is a feature that places the condition "dummy" feature, the feature that gets rid of the "dummy" block placed by the condition and after that the actual features we want to conditionally place. It uses `early_out` with value `first_failure` to make the aggregate stop if the conditional placement fails. It is the feature placed by a feature rule. +这个聚合特征按顺序执行:先放置条件判断方块,然后替换占位方块,最后生成实际特征。设置 `early_out` 为 `first_failure` 确保任一环节失败时立即终止流程。该特征通过特征规则调用。 -BP/features/aggregate_placement_rock_feature.json - -```json +::: code-group +```json [BP/features/aggregate_placement_rock_feature.json] { "format_version": "1.18.0", "minecraft:aggregate_feature": { @@ -74,22 +75,21 @@ This is a feature that places the condition "dummy" feature, the feature that ge "identifier": "wiki:aggregate_placement_rock_feature" }, "features": [ - "wiki:block_condition_feature", //Single block feature that is used as "dummy" feature to act as our condition. - "wiki:block_replacement_feature", //This feature replaces the "dummy" block we used in the feature above to not cause us any issues later. - //Any feature from this point on is what we actually want to place. + "wiki:block_condition_feature", //用于条件判断的虚拟特征 + "wiki:block_replacement_feature", //清理占位方块的特征 + //从此处开始添加需要条件生成的实际特征 "wiki:rock_ore_feature" ], - "early_out": "first_failure" //This makes sure that if the first(or any) feature fails, it will not continue to place anything else in the list. + "early_out": "first_failure" //任一特征失败则终止后续生成 } } -//This is a feature that places all the features one by one in order and is placed by the feature rule. +//该聚合特征按顺序执行所有子特征,由特征规则调用 ``` -This is the actual feature we want to be conditionally placed. It is `ore_feature` which doesn't have actual condition for us to allow it to only be placed in air and on a grass block, so this technique has helped us achieve that. +这是需要条件生成的矿石特征示例。由于原生 `ore_feature` 无法直接设置生成条件,本技巧完美解决了这个问题。 -BP/features/rock_ore_feature.json - -```json +::: code-group +```json [BP/features/rock_ore_feature.json] { "format_version": "1.18.0", "minecraft:ore_feature": { @@ -115,15 +115,16 @@ This is the actual feature we want to be conditionally placed. It is `ore_featur } } ``` -:::tip -If you want to learn more about ore features, you can visit [Generating Custom Ores](/world-generation/custom-ores) tutorial. ::: -### Feature Rule +:::tip +若想深入了解矿石特征,请参考[自定义矿石生成](/wiki/world-generation/custom-ores)教程。 +::: -BP/feature_rules/overworld_after_surface_rock_feature.json +### 特征规则 -```json +::: code-group +```json [BP/feature_rules/overworld_after_surface_rock_feature.json] { "format_version": "1.18.0", "minecraft:feature_rules": { @@ -132,7 +133,7 @@ If you want to learn more about ore features, you can visit [Generating Custom O "places_feature": "wiki:aggregate_placement_rock_feature" }, "conditions": { - //Places the feature in any overworld biome along with features in the after_surface_pass + //在主世界生物群系的地表生成阶段后执行 "placement_pass": "after_surface_pass", "minecraft:biome_filter": [ { @@ -152,7 +153,7 @@ If you want to learn more about ore features, you can visit [Generating Custom O ] }, "distribution": { - //1 in 3 chance to attempt 1 placement in chunk + //每个区块有1/3概率尝试生成1次 "scatter_chance": 33, "iterations": 1, "coordinate_eval_order": "xzy", @@ -160,7 +161,7 @@ If you want to learn more about ore features, you can visit [Generating Custom O "distribution": "uniform", "extent": [0, 15] }, - //Places the feature along the heightmap + //根据地势高度生成 "y": "q.heightmap(v.worldx,v.worldz)", "z": { "distribution": "uniform", @@ -171,12 +172,12 @@ If you want to learn more about ore features, you can visit [Generating Custom O } ``` -## Summary +## 总结 -After reading this tutorial you should be able to use block conditions on any feature you want. This was a very basic example as this can be used for far more complex creations and can be used with any feature. +通过本教程,你已经掌握了如何为任意特征添加方块生成条件。虽然示例较为基础,但此技巧可扩展应用于复杂场景,兼容所有特征类型。 -Like that we have made a rock feature that can only be placed in air blocks and above grass blocks. +最终我们实现了一个仅在草方块上方空气位置生成的岩石特征。 -Generation screenshot: +生成效果截图: -![](/assets/images/world-generation/rock_feature.png) +![](/assets/images/world-generation/rock_feature.png) \ No newline at end of file diff --git a/docs/wiki/world-generation/heightmap-noise.md b/docs/wiki/world-generation/heightmap-noise.md index 0a78a53d..fd45daee 100644 --- a/docs/wiki/world-generation/heightmap-noise.md +++ b/docs/wiki/world-generation/heightmap-noise.md @@ -1,6 +1,6 @@ --- -title: Heightmap Noise -category: Tutorials +title: 高度图噪声 +category: 巧思案例 tags: - experimental - tutorial @@ -9,19 +9,22 @@ mentions: - SirLich --- +# 高度图噪声 + + + :::tip -This tutorial assumes you have a basic understanding of molang, features and feature rules. +本教程假设您已掌握Molang、特征(feature)及特征规则(feature rule)的基础知识。 ::: -In this tutorial we're gonna see how we can make noise based terrain using the `q.noise` molang query. +在本教程中,我们将学习如何通过`q.noise` Molang查询实现基于噪声的地形生成。 -## Single Block Feature +## 单方块特征 -First we will define the single block feature. It will define the block that is going to be generated. For this tutorial I'll use stone. +首先定义用于生成地形的单方块特征。本教程将使用石头作为示例。 -BP/features/stone_feature.json - -```json +::: code-group +```json [BP/features/stone_feature.json] { "format_version": "1.13.0", "minecraft:single_block_feature": { @@ -34,14 +37,14 @@ First we will define the single block feature. It will define the block that is } } ``` +::: -## Scatter Feature +## 散布特征 -The scatter feature is the main feature which we'll be using to generate the terrain. +散布特征(scatter feature)是地形生成的核心组件。 -BP/features/column.json - -```json +::: code-group +```json [BP/features/column.json] { "format_version": "1.13.0", "minecraft:scatter_feature": { @@ -59,20 +62,20 @@ The scatter feature is the main feature which we'll be using to generate the ter } } ``` +::: -Let me explain whats happening in the `iterations`: -In the iterations we've defined a temp `t.height` in which we've defined our main noise function. -In `t.height` the value that we're adding first is the base height, basically the height at which the function starts. -After that we're querying perlin using the `q.noise` query which returns values ranging from -1 to 1 and dividing that by a value which smooths out the function. -Then we're multiplying the whole function by a value which in simple words is basically the variation in the terrain. +**迭代参数解析**: +- 我们通过临时变量`t.height`定义噪声函数 +- `64`是基准高度(函数的起始高度) +- `q.noise`查询Perlin噪声值(范围-1到1),除以64用于平滑噪声曲线 +- 乘以16控制地形起伏幅度 -So what's happening here is that we are getting values from the `t.height` temp and assigning them to the y extent ranging from -64 to the value thus generating a column. Now this value is going to vary column by column but not in a random way as `q.noise` queryies Perlin noise, meaning the values are relative to each other. So instead of getting values like 64,69,45,100,7,56 we are getting values like 64,65,66,68,69,68,66,65 and so on. +该逻辑通过`y`参数的取值范围[-64, t.height]生成地形柱体。由于`q.noise`基于Perlin噪声算法,相邻柱体高度呈现渐变效果(如64,65,66,68...),而非随机突变。 -## Feature Rule +## 特征规则 -BP/feature_rules/column_grid_placement.json - -```json +::: code-group +```json [BP/feature_rules/column_grid_placement.json] { "format_version": "1.13.0", "minecraft:feature_rules": { @@ -110,7 +113,10 @@ So what's happening here is that we are getting values from the `t.height` temp } } ``` +::: -In this we have set the `iteration` to 256 as the area of a whole chunk is 256 (16x16) to make the columns generate in the whole chunk. +**关键配置**: +- `iterations`设为256以覆盖整个区块(16x16区域) +- `fixed_grid`分布模式确保柱体均匀排列 -And our custom noise based terrain is finished! Feel free to mess with the values. +至此,基于噪声的自定义地形已构建完成!您可以自由调整参数进行地形形态实验。 \ No newline at end of file diff --git a/docs/wiki/world-generation/index.md b/docs/wiki/world-generation/index.md index cc5cae1b..0d3a1fba 100644 --- a/docs/wiki/world-generation/index.md +++ b/docs/wiki/world-generation/index.md @@ -1,10 +1,10 @@ --- -title: World Generation +title: 世界生成器 categories: - - title: General + - title: 基础 color: blue - - title: Tutorials + - title: 巧思案例 color: green - - title: Documentation + - title: 文档 color: red --- diff --git a/docs/wiki/world-generation/structure-features.md b/docs/wiki/world-generation/structure-features.md index 0b875f7e..66d3caac 100644 --- a/docs/wiki/world-generation/structure-features.md +++ b/docs/wiki/world-generation/structure-features.md @@ -1,6 +1,6 @@ --- -title: Generating Custom Structures -category: Tutorials +title: 生成自定义结构 +category: 巧思案例 mentions: - DerpMcaddon - SirLich @@ -8,32 +8,35 @@ tags: - experimental --- -Structure feature is one of the most basic feature. It places exported `.mcstructure` file in the world. -This tutorial will show you how to make: +# 生成自定义结构 -- Surface structure, + -- Underground structure, +结构特征是游戏世界生成的基础功能之一,用于在游戏中放置导出的`.mcstructure`文件。 +本教程将教你如何生成: -- Floating structure, +- 地表结构 -- Underwater structure, and +- 地下结构 -- Water surface structure +- 浮空结构 + +- 水下结构 + +- 水面结构 :::tip -For exporting structure on android devices, use this [resource pack](https://mcpedl.com/export-structure-button-android-addon/) +若要在安卓设备导出结构文件,可使用此[资源包](https://mcpedl.com/export-structure-button-android-addon/) ::: -Make sure you put the `.mcstructure` file inside of `BP/structures/`! +请确保将`.mcstructure`文件放置在`BP/structures/`目录下! -## Surface Structure +## 地表结构 -### Feature File +### 特征文件 -BP/features/house_feature.json - -```json +::: code-group +```json [BP/features/house_feature.json] { "format_version": "1.13.0", "minecraft:structure_template_feature": { @@ -48,19 +51,19 @@ Make sure you put the `.mcstructure` file inside of `BP/structures/`! "unburied": {}, "block_intersection": { "block_allowlist": [ - "minecraft:air" //The structure can only replace air + "minecraft:air" //结构只能替换空气方块 ] } } } } ``` +::: -### Feature Rule +### 特征规则 -BP/feature_rules/plains_house_feature.json - -```json +::: code-group +```json [BP/feature_rules/plains_house_feature.json] { "format_version": "1.13.0", "minecraft:feature_rules": { @@ -82,7 +85,7 @@ Make sure you put the `.mcstructure` file inside of `BP/structures/`! "extent": [0, 16], "distribution": "uniform" }, - "y": "q.heightmap(v.worldx, v.worldz)", //Generates the feature on the highest block on the column + "y": "q.heightmap(v.worldx, v.worldz)", //在区块最高点生成结构 "z": { "extent": [0, 16], "distribution": "uniform" @@ -95,16 +98,16 @@ Make sure you put the `.mcstructure` file inside of `BP/structures/`! } } ``` +::: ![](/assets/images/world-generation/structure-features/house.png) -## Underground Structure +## 地下结构 -### Feature File +### 特征文件 -BP/features/bunker_feature.json - -```json +::: code-group +```json [BP/features/bunker_feature.json] { "format_version": "1.13.0", "minecraft:structure_template_feature": { @@ -117,7 +120,7 @@ Make sure you put the `.mcstructure` file inside of `BP/structures/`! "constraints": { "block_intersection": { "block_allowlist": [ - "minecraft:air", //Makes the feature only replace air and stone + "minecraft:air", //结构只能替换空气和石头 "minecraft:stone" ] } @@ -125,12 +128,12 @@ Make sure you put the `.mcstructure` file inside of `BP/structures/`! } } ``` +::: -### Feature Rule +### 特征规则 -BP/feature_rules/overworld_bunker_feature.json - -```json +::: code-group +```json [BP/feature_rules/overworld_bunker_feature.json] { "format_version": "1.13.0", "minecraft:feature_rules": { @@ -154,8 +157,8 @@ Make sure you put the `.mcstructure` file inside of `BP/structures/`! }, "y": { "extent": [ - 11, - 50 //Makes the structure generate between y11 and y50 + 11, //结构将在y11至y50之间生成 + 50 ], "distribution": "uniform" }, @@ -171,16 +174,16 @@ Make sure you put the `.mcstructure` file inside of `BP/structures/`! } } ``` +::: ![](/assets/images/world-generation/structure-features/bunker.png) -## Floating Feature +## 浮空结构 -### Feature File +### 特征文件 -BP/features/balloon_feature.json - -```json +::: code-group +```json [BP/features/balloon_feature.json] { "format_version": "1.13.0", "minecraft:structure_template_feature": { @@ -193,19 +196,19 @@ Make sure you put the `.mcstructure` file inside of `BP/structures/`! "constraints": { "block_intersection": { "block_allowlist": [ - "minecraft:air" //Makes the structure only replace air + "minecraft:air" //结构只能替换空气 ] } } } } ``` +::: -### Feature Rule +### 特征规则 -BP/feature_rules/overworld_balloon_feature.json - -```json +::: code-group +```json [BP/feature_rules/overworld_balloon_feature.json] { "format_version": "1.13.0", "minecraft:feature_rules": { @@ -229,7 +232,7 @@ Make sure you put the `.mcstructure` file inside of `BP/structures/`! }, "y": { "extent": [ - 100, //Makes the structure generate from y100 to y200 + 100, //结构将在y100至y200之间生成 200 ], "distribution": "uniform" @@ -246,20 +249,20 @@ Make sure you put the `.mcstructure` file inside of `BP/structures/`! } } ``` +::: ![](/assets/images/world-generation/structure-features/balloon.png) -## Underwater Structure +## 水下结构 -::: tip -For underwater structures, make sure you waterlogged the structure, because Minecraft won't waterlog them automatically! +:::tip +对于水下结构,请确保对结构进行水淹处理,因为Minecraft不会自动进行水淹操作! ::: -### Feature File +### 特征文件 -BP/features/aqua_temple_feature.json - -```json +::: code-group +```json [BP/features/aqua_temple_feature.json] { "format_version": "1.13.0", "minecraft:structure_template_feature": { @@ -272,19 +275,19 @@ For underwater structures, make sure you waterlogged the structure, because Mine "constraints": { "block_intersection": { "block_allowlist": [ - "minecraft:water" //Makes the structure only replace water + "minecraft:water" //结构只能替换水方块 ] } } } } ``` +::: -### Feature Rule +### 特征规则 -BP/feature_rules/ocean_aqua_temple_feature.json - -```json +::: code-group +```json [BP/feature_rules/ocean_aqua_temple_feature.json] { "format_version": "1.13.0", "minecraft:feature_rules": { @@ -306,7 +309,7 @@ For underwater structures, make sure you waterlogged the structure, because Mine "extent": [0, 16], "distribution": "uniform" }, - "y": "q.above_top_solid(v.worldx, v.worldz)", //Places the feature on top of the highest solid block on the column, so it won't place it on the surface of the water + "y": "q.above_top_solid(v.worldx, v.worldz)", //将结构放置在最高固体方块顶部,避免生成在水面 "z": { "extent": [0, 16], "distribution": "uniform" @@ -319,16 +322,16 @@ For underwater structures, make sure you waterlogged the structure, because Mine } } ``` +::: ![](/assets/images/world-generation/structure-features/aqua_temple.png) -## Water Surface Structure +## 水面结构 -### Feature File +### 特征文件 -BP/features/raft_feature.json - -```json +::: code-group +```json [BP/features/raft_feature.json] { "format_version": "1.13.0", "minecraft:structure_template_feature": { @@ -341,7 +344,7 @@ For underwater structures, make sure you waterlogged the structure, because Mine "constraints": { "block_intersection": { "block_allowlist": [ - "minecraft:water", //Makes the structure only replace air and water + "minecraft:water", //结构只能替换水和空气 "minecraft:air" ] } @@ -349,12 +352,12 @@ For underwater structures, make sure you waterlogged the structure, because Mine } } ``` +::: -### Feature Rule +### 特征规则 -BP/feature_rules/ocean_raft_feature.json - -```json +::: code-group +```json [BP/feature_rules/ocean_raft_feature.json] { "format_version": "1.13.0", "minecraft:feature_rules": { @@ -376,7 +379,7 @@ For underwater structures, make sure you waterlogged the structure, because Mine "extent": [0, 16], "distribution": "uniform" }, - "y": 62, //Makes the feature generate only on y62, which is Minecraft water level + "y": 62, //结构将在y62(默认水位高度)生成 "z": { "extent": [0, 16], "distribution": "uniform" @@ -389,5 +392,6 @@ For underwater structures, make sure you waterlogged the structure, because Mine } } ``` +::: -![](/assets/images/world-generation/structure-features/raft.png) +![](/assets/images/world-generation/structure-features/raft.png) \ No newline at end of file diff --git a/docs/wiki/world-generation/surface-builder.md b/docs/wiki/world-generation/surface-builder.md index 21e2e63f..3c713ed1 100644 --- a/docs/wiki/world-generation/surface-builder.md +++ b/docs/wiki/world-generation/surface-builder.md @@ -1,6 +1,6 @@ --- -title: Generating Patches -category: Tutorials +title: 地表补丁生成教程 +category: 巧思案例 mentions: - DerpMcaddon - SirLich @@ -8,19 +8,22 @@ tags: - experimental --- -Feature based surface builder is a feature that puts together a collection of blocks that serve to add variety and decoration to the Overworld surface. This tutorial will explain what is needed to create this feature, including size, frequency, generation location, and more! +# 地表补丁生成教程 -## Single Block Features + -Single block features are going to be the base of our surface builder. They will define which blocks we are going to use. For this tutorial I'll be using Coarse Dirt, Podzol and Cobblestone. +基于特征的地表构建器是一种将多种方块组合生成的功能,用于为主世界地表增添多样性和装饰效果。本教程将详细讲解如何创建这种地表特征,包括尺寸、生成频率、生成位置等参数设置! -Learn more about single block features [here](/world-generation/feature-types#single-block-features) +## 单方块特征 -Coarse Dirt File +单方块特征将作为我们地表构建的基础。它们定义了我们将要使用的具体方块类型。本教程将使用粗泥、灰化土和圆石作为示例。 -BP/features/coarse_dirt_feature.json +了解更多单方块特征知识[请点击此处](/wiki/world-generation/feature-types#single-block-features) -```json +粗泥特征文件 + +::: code-group +```json [BP/features/coarse_dirt_feature.json] { "format_version": "1.13.0", "minecraft:single_block_feature": { @@ -28,7 +31,7 @@ Coarse Dirt File "identifier": "wiki:coarse_dirt_feature" }, "places_block": { - //Coarse dirt shares same identifier as dirt, set it using name and states + // 粗泥与普通泥土共享相同标识符,需通过名称和状态值指定 "name": "minecraft:dirt", "states": { "dirt_type": "coarse" @@ -37,63 +40,63 @@ Coarse Dirt File "enforce_survivability_rules": false, "enforce_placement_rules": false, "may_replace": [ - "minecraft:grass" //The block can only replace grass + "minecraft:grass" // 该方块仅可替换草方块 ] } } ``` +::: -Podzol File +灰化土特征文件 -BP/features/podzol_feature.json - -```json +::: code-group +```json [BP/features/podzol_feature.json] { "format_version": "1.13.0", "minecraft:single_block_feature": { "description": { "identifier": "wiki:podzol_feature" }, - "places_block": "minecraft:podzol", //Podzol can be defined using direct identifier + "places_block": "minecraft:podzol", // 灰化土可直接通过标识符定义 "enforce_survivability_rules": false, "enforce_placement_rules": false, "may_replace": [ - "minecraft:grass" //The block can only replace grass + "minecraft:grass" // 该方块仅可替换草方块 ] } } ``` +::: -Cobblestone File +圆石特征文件 -BP/features/cobblestone_feature.json - -```json +::: code-group +```json [BP/features/cobblestone_feature.json] { "format_version": "1.13.0", "minecraft:single_block_feature": { "description": { "identifier": "wiki:cobblestone_feature" }, - "places_block": "minecraft:cobblestone", //Cobblestone can be defined using direct identifier + "places_block": "minecraft:cobblestone", // 圆石可直接通过标识符定义 "enforce_survivability_rules": false, "enforce_placement_rules": false, "may_replace": [ - "minecraft:grass" //The block can only replace grass + "minecraft:grass" // 该方块仅可替换草方块 ] } } ``` +::: -## Weighted Random Features +## 权重随机特征 -Weighted random features are going to be our _randomizer_ to select between each type of blocks. +权重随机特征将作为我们的_随机选择器_,用于在不同方块类型之间进行概率选择。 -Learn more about weighted random features [here](/world-generation/feature-types#weighted-random-features) +了解更多权重随机特征知识[请点击此处](/wiki/world-generation/feature-types#weighted-random-features) -BP/features/select_surface_block_feature.json - -```json +::: code-group +```json [BP/features/select_surface_block_feature.json] { "format_version": "1.13.0", "minecraft:weighted_random_feature": { @@ -102,31 +105,31 @@ Learn more about weighted random features [here](/world-generation/feature-types }, "features": [ [ - "wiki:coarse_dirt_feature", //Coarse dirt weighs 5 + "wiki:coarse_dirt_feature", // 粗泥权重为5 5 ], [ - "wiki:podzol_feature", //Podzol dirt weighs 3 + "wiki:podzol_feature", // 灰化土权重为3 3 ], [ - "wiki:cobblestone_feature", //Cobblestone weighs 2 + "wiki:cobblestone_feature", // 圆石权重为2 2 ] ] } } ``` +::: -## Scatter Features +## 散点特征 -Scatter features are an important part of our surface builder. It will determine the size, shape and number of blocks in one blob. +散点特征是我们地表构建的重要部分。它将决定单个斑块中方块的数量、形状和分布范围。 -Learn more about scatter features [here](/world-generation/feature-types#scatter-features) +了解更多散点特征知识[请点击此处](/wiki/world-generation/feature-types#scatter-features) -BP/features/scatter_surface_block_feature.json - -```json +::: code-group +```json [BP/features/scatter_surface_block_feature.json] { "format_version": "1.13.0", "minecraft:scatter_feature": { @@ -143,26 +146,26 @@ Learn more about scatter features [here](/world-generation/feature-types#scatter "distribution": "gaussian" }, "y": "q.heightmap(v.worldx, v.worldz) -1", - "places_feature": "wiki:select_surface_block_feature" //Weighted random feature identifier + "places_feature": "wiki:select_surface_block_feature" // 权重随机特征的标识符 } } ``` +::: -- `iterations` determine how many blocks will be placed. I'm going to use the Molang `math.random_integer` function to randomize the number of blocks. In this case, it'll be 20 to 25 blocks. +- `iterations` 决定将放置的方块数量。使用Molang的 `math.random_integer` 函数可实现数量随机化。本示例中将在20到25个方块之间随机 -- `extent` use an array to determine the size of the blob. `[0, 8]` means the size is extended from 0 to 8 blocks. So, our blob would be 8 blocks long both on X and Z axis. **Only use this for X and Z distribution**. +- `extent` 使用数组决定斑块尺寸。`[0, 8]` 表示斑块从0到8格扩展。因此,我们的斑块在X和Z轴上将延伸8格。**该参数仅适用于X和Z轴分布** -- `"y": "q.heightmap(v.worldx, v.worldz) -1` means it will put the block on the highest block on the y coordinate -1. So it'll always put the feature on the surface. +- `"y": "q.heightmap(v.worldx, v.worldz) -1` 表示方块将放置于当前地表最高点的Y坐标-1处,即始终在地表生成 -- `distribution` specifies the type of distribution to use. Available include `Gaussian`, `Inverse Gaussian`, `Uniform`,`Fixed Grid` and `Jittered Grid` +- `distribution` 指定分布类型。可用选项包括:`Gaussian`(高斯分布)、`Inverse Gaussian`(逆高斯分布)、`Uniform`(均匀分布)、`Fixed Grid`(固定网格)和`Jittered Grid`(抖动网格) -## Feature Rule +## 特征规则 -This is the final step for our surface builder. The feature rules for our surface builders are slightly different. +这是地表构建的最后一步。地表构建器的特征规则设置略有不同。 -BP/feature_rules/overworld_surface_blocks_feature.json - -```json +::: code-group +```json [BP/feature_rules/overworld_surface_blocks_feature.json] { "format_version": "1.13.0", "minecraft:feature_rules": { @@ -175,7 +178,7 @@ This is the final step for our surface builder. The feature rules for our surfac "minecraft:biome_filter": { "test": "has_biome_tag", "operator": "==", - "value": "overworld" //You can change this to whatever biometag you want + "value": "overworld" // 可更改为任意生物群系标签 } }, "distribution": { @@ -190,7 +193,7 @@ This is the final step for our surface builder. The feature rules for our surfac "distribution": "uniform" }, "scatter_chance": { - //Chance of the blob generating each chunk + // 每个区块生成斑块的概率 "numerator": 1, "denominator": 5 } @@ -198,5 +201,6 @@ This is the final step for our surface builder. The feature rules for our surfac } } ``` +::: -And our surface builder is done! Feel free to modify and mess around with it! +至此我们的地表构建器就完成了!欢迎自由调整参数并探索更多可能性! \ No newline at end of file diff --git a/docs/wiki/world-generation/world-generation-intro.md b/docs/wiki/world-generation/world-generation-intro.md index f8688f92..f8eb92d6 100644 --- a/docs/wiki/world-generation/world-generation-intro.md +++ b/docs/wiki/world-generation/world-generation-intro.md @@ -1,10 +1,10 @@ --- -title: Intro to World Generation -category: General +title: 世界生成入门 +category: 基础 nav_order: 1 tags: - - guide - - experimental + - 指南 + - 实验性功能 mentions: - SirLich - solvedDev @@ -16,28 +16,31 @@ mentions: - SmokeyStack --- +# 世界生成入门 + + + :::warning -This page is somewhat out-dated, and contains limited information. For the most up-to-date and comprehensive information, view the other pages in this section. +本文档部分内容已过时,信息量有限。如需获取最新最全面的信息,请查阅本节其他页面。 ::: -You can change the world's generation via Add-ons. The needed folders in the Behavior pack for these are: +您可以通过附加包修改世界的生成规则。行为包中需要以下文件夹: -`structures`, `features`, `feature_rules` and `biomes`. It's quite self-explanatory: you can store your .mcstructure files from (or for) structure blocks in `structures`, biome files in `biomes`, terrain features, like ores, in `features` and the rules for their generation in `feature_rules`. Let's go over adding a custom biome first. +`structures`(结构)、`features`(特征)、`feature_rules`(特征规则)和 `biomes`(生物群系)。顾名思义:您可以将结构方块生成的.mcstructure文件存放在`structures`中,生物群系文件存放在`biomes`中,矿石等地形特征存放在`features`中,其生成规则则存放在`feature_rules`中。让我们先从添加自定义生物群系开始。 -_Note: it might be easier to create biomes using bridge., a Visual software for Add-on creation (also linked in Links and Contact), since the official Documentation is rather incomplete. You can also generate all example files of vanilla biomes, features and feature rules for reference, like shown here:_ +_注:使用 bridge. 这款可视化附加包创作工具(联系方式见"链接与联系")创建生物群系可能更方便,因为官方文档尚不完善。您也可以生成所有原版生物群系、特征和特征规则的示例文件作为参考,如下图所示:_ ![](/assets/images/guide/gen_coal_ore.png) -_Generating a coal_ore feature using bridge._ +_使用 bridge. 生成 coal_ore 特征_ -However, bridge. is not required. +当然,bridge. 并非必需工具。 --- -## Custom Biomes +## 自定义生物群系 -BP/biomes/cold_biome.json - -```json +::: code-group +```json [BP/biomes/cold_biome.json] { "format_version": "1.13.0", "minecraft:biome": { @@ -74,76 +77,71 @@ However, bridge. is not required. } ``` -- Set `format_version` to 1.13.0: it's the latest biome file version as of the current release. -- `description` takes only one value: `identifier`. This requires **NO namespace** and **MUST** be the same as the **file's name**. - (If you do use a namespace, for example `wiki:cold_biome`, the file name needs to only match the id, so it has to remain as `cold_biome.json`. -- `components` is just what you'd expect: something applied to the biome at default. let's look through them: -- `minecraft:climate` controls everything climate-wise. -- `downfall` is how often it'll be raining or snowing. 0.0 is for absolutely no rain (like a desert) and 1.0 should mean constant rain. -- `temperature` is used to define things like water freezing and rain turning into snow. +- 设置 `format_version` 为 1.13.0:这是当前版本的最新生物群系文件格式 +- `description` 仅需一个值:`identifier`。此处**不需要命名空间**且**必须**与**文件名**一致 + (如果使用命名空间,例如 `wiki:cold_biome`,文件名仍需保持为 `cold_biome.json`) +- `components` 即生物群系的基本属性配置,让我们逐一解析: +- `minecraft:climate` 控制气候相关参数 +- `downfall` 表示降水频率。0.0 代表无降水(如沙漠),1.0 表示持续降水 +- `temperature` 用于定义水体结冰和降雨转雪等效果 -**You can generate default biome files for reference using bridge.** +**可使用 bridge. 生成原版生物群系文件作为参考** -- `overworld_surface` controls blocks generated. -- `floor_depth` is how deep down lakes and rivers go in blocks. -- `sea_floor_material` defines the material to be used when generating the river and lake's floor. -- `foundation_material` is the material to be used approximately between y=5 and y=50. For a desert, for example, it's stone. -- `sea_material` is the material used as show liquid in lakes, rivers, oceans, etc. For example, in all Overworld biomes, this is set to "minecraft:water". -- `top_material` defines the material for the highest level. E.g for Plains it's grass. -- `mid_material` is the layer between 'top' and 'foundation'. For Plains it's dirt. -- `overworld_height` defines how the Biome will look terrain-wise. +- `overworld_surface` 控制地形生成材质 +- `floor_depth` 表示湖泊河流的底部深度(方块数) +- `sea_floor_material` 定义水域底部材质 +- `foundation_material` 用于 y=5 至 y=50 之间的基础岩层(例如沙漠使用石头) +- `sea_material` 水域液体材质(主世界通常设为 "minecraft:water") +- `top_material` 表层材质(如草方块用于平原) +- `mid_material` 中间层材质(如泥土用于平原) +- `overworld_height` 定义地形高度特征 -DO NOT use both `noise_type` and `noise_params` at the same time. `noise_params` is an array of the top level of noise and the lowest level of noise allowed in the biome. +不可同时使用 `noise_type` 和 `noise_params`。`noise_params` 是包含噪声最高值和最低值的数组 ![](/assets/images/guide/non_smooth_noise_transition.jpg) -_A non-smooth transition between the same biome, generated with noise_params as [0.1, 0,1] and then [1.0, 1.0]._ +_使用 noise_params [0.1, 0.1] 和 [1.0, 1.0] 生成的同生物群系非平滑过渡示例_ -- If you want to use `noise_type`, however, you will be presented with a few pre-generated types of noise. You will probably know how some of them look from the Vanilla game. Here's the list: +- 若使用 `noise_type`,可选预设值包括: +`beach, default, extreme, taiga, ocean, mountains, default_mutated, deep_ocean, lowlands, less_extreme, stone_beach, swamp, river, mushroom` -`beach, default, extreme, taiga, ocean, mountains, default_mutated, deep_ocean, lowlands, less_extreme, stone_beach, swamp, river, mushroom`. +- `minecraft_world_generation_rules` 是最重要的组件,特别是 `generate_for_climates` 数组。游戏中有三种气候:"warm"、"medium" 和 "cold"。在世界生成时这些气候会随机分布[硬编码]。您可以为每个气候设置生物群系的生成权重。若不设置,默认权重为0,生物群系不会生成。示例中测试时将各气候权重设为100,使该生物群系在主世界广泛生成。正式使用时需调整权重(例如原版沙漠在warm气候中的权重为3) -- `minecraft_world_generation_rules` is the most important component of all, especially the `generate_for_climates` array. Basically, there are three climates in the game: "warm", "medium" and "cold". They are randomly thrown around every world when it's created [hard-coded]. Now, you can choose how often your custom biome will generate in every specific climate. If you do not provide anything in here, the default value is 0 for every climate, and the biome won't generate. In the example, the **weight** (the smaller the number, the smaller the chance of this biome generating instead of a vanilla one in the climate) for every climate is set to 100 for testing purposes: that makes the biome generate almost everywhere in the Overworld. Once I'm done with testing, however, I'll balance the weight how it's supposed to be. For example, the Vanilla _desert_ has the weight of 3 for warm. - -- This component also takes Objects such as: `hills_transformation`, `mutate_transformation`, `shore_transformation`, `river_transformation`, but their meaning is unclear to me. Contributions are always appreciated. Same goes for the `surface_meaterial_adjustments` component. - -- And, last but not least, BIOME TAGS! They're very simple, but useful. You can set however many of the vanilla or custom tags you want, by adding them in this format in `components`: +- 该组件还包含 `hills_transformation`、`mutate_transformation`、`shore_transformation`、`river_transformation` 等参数,具体含义尚不明确。欢迎补充说明。`surface_meaterial_adjustments` 组件同理 +- 最后是生物群系标签!使用方式简单但实用。通过在 `components` 中添加如下格式的标签: ``` "tagName": {} ``` +即可在环境传感器、过滤器、生物群系检测、生成规则等场景中使用该标签 -Then, you can test for your tag in _environment_sensors_, _filters_, _has_biome_ tests, _spawn rules_, and more. - -Your custom biome is now complete! +至此,您的自定义生物群系已创建完成! --- -## Features and Feature Rules +## 特征与特征规则 -Note: in v.1.15Beta, it is possible to use `.mcstructures` from the `structures` folder instead of `features` to generate custom structures with `feature_rules`. More on that after the update arrives. +注:在 v1.15Beta 中,可使用 `structures` 文件夹中的 `.mcstructures` 配合 `feature_rules` 生成自定义结构。更多详情将在更新发布后补充 -Features and Feature Rules are used to generate everything from ores to grass and flowers, vegetation to granite or clay patches. -It is even possible to create custom structures using those, but as it is very grindy and will be much easier after the mentioned update, we won't talk about it just yet. +特征与特征规则用于生成矿石、花草、植被、花岗岩或黏土矿脉等各类地形元素。虽然目前可用其创建自定义结构,但操作繁琐,建议等待后续更新简化流程 -Now, it's worthwhile to mention that the easiest way to generate Custom Structures is this [auto generator](https://machine-builder.itch.io/frg-v2) by [MACHINE_BUILDER](https://www.youtube.com/channel/UC8FBQgo4AWwKFX97h60NKOQ), you should note that this tool has a free version with limited functionality and to enjoy the full functionality use the payware version. However, we'll still learn some other manual feature generation here, because some things like Ores are much more efficient to generate as `ore_feature`s and not `structure_template_feature`s. +推荐使用 [MACHINE_BUILDER](https://www.youtube.com/channel/UC8FBQgo4AWwKFX97h60NKOQ) 开发的[自动生成工具](https://machine-builder.itch.io/frg-v2)来创建自定义结构。该工具免费版功能有限,完整功能需购买专业版。不过我们仍将学习手动创建特征的方法,因为矿石等元素使用 `ore_feature` 比 `structure_template_feature` 更高效 -Let's make our `wiki:blocky` custom block generate as an ore for the tutorial's sake. I'll do it the easy way, like this: +让我们以生成自定义方块 `wiki:blocky` 的矿石为例: -1. Open _bridge._, choose your Add-on. -1. _Add new file>features>diamond_ore and Add new file>feature_rules>diamond_ore_. -1. Now I'll save the files and open them in my Code Editor and make the necessary modifications. +1. 打开 bridge. 选择附加包 +1. 新建文件 > features > diamond_ore 和 feature_rules > diamond_ore +1. 保存文件后用代码编辑器进行必要修改 -_You could've easily just written the files from scratch or copied them from somewhere without using bridge. in case you are having trouble installing it. **One place to find the Vanilla Files are the [Example Packs](https://www.minecraft.net/en-us/addons), another, a more complete one is [bridge.'s repository](https://github.com/bridge.-core/bridge../tree/master/static/vanilla)**._ +_若无安装 bridge.,也可手动创建或从[示例包](https://www.minecraft.net/en-us/addons)或 [bridge. 仓库](https://github.com/bridge.-core/bridge../tree/master/static/vanilla)获取原版文件_ -## Features +## 特征 -Features are located in `BP/features` and are basically a group of blocks stored in the game's files, which can be placed with a _feature_rule_. The **file name** of a _feature_ **must match** the **identifier** as well. +特征文件位于 `BP/features` 目录,本质上是游戏中可被特征规则放置的区块集合。**文件名**必须与**标识符**匹配 -You can find their Documentation on [bedrock.dev/r/Features](https://bedrock.dev/r/Features) +完整文档请参考 [bedrock.dev/r/Features](https://bedrock.dev/r/Features) -BP/features/blocky_ore_feature.json - -```json +::: code-group +```json [BP/features/blocky_ore_feature.json] { "format_version": "1.13.0", "minecraft:ore_feature": { @@ -200,19 +198,18 @@ You can find their Documentation on [bedrock.dev/r/Features](https://bedrock.dev } ``` -- `minecraft_ore_feature` is type of the specific feature that places ores automatically. Each feature type has it's own specific syntax. (There's also `single_block_feature` that places a single block instead of an ore group, etc) -- `identifier` doesn't require a namespace in this scenario. The namespace is optional, and is not to be added in the filename. -- `count` is how big the ore "cluster" will be at maximum, or how many actual ore blocks will generate together. -- `places_block` takes the identifier of the block to be placed as the value. -- `may_replace` takes all the blocks that the feature can replace as arguments. If it generates over one of the blocks not included in here, the block will remain where it was without being replaced. +- `minecraft_ore_feature` 是自动生成矿石的特定特征类型。每种特征类型都有独特语法(另有 `single_block_feature` 用于生成单个方块等) +- `identifier` 此处不需要命名空间。文件名不包含命名空间 +- `count` 表示矿簇的最大方块数 +- `places_block` 设置要生成的方块标识符 +- `may_replace` 列出可被替换的方块类型。遇到未列出的方块时将保留原方块 -## Feature Rules +## 特征规则 -**Feature Rules** control where and how _features_ (and, in the future, _structures_) are placed. +**特征规则**控制特征(及未来的结构)的生成位置和方式 -BP/feature_rules/overworld_underground_blocky_ore_feature.json - -```json +::: code-group +```json [BP/feature_rules/overworld_underground_blocky_ore_feature.json] { "format_version": "1.13.0", "minecraft:feature_rules": { @@ -260,42 +257,36 @@ You can find their Documentation on [bedrock.dev/r/Features](https://bedrock.dev ``` - `description` - - `identifier` needs no namespace, but the filename needs to match. - - `places_feature` takes the identifier of the feature that is controlled by this rule as the value. + - `identifier` 不需要命名空间,但文件名需匹配 + - `places_feature` 设置要控制的特征标识符 - `conditions` - - `placement_pass` HOW the feature will be passed. - - `biome_filter` tests for biome tags where the feature will generate, exactly as a spawn rule. + - `placement_pass` 控制特征生成阶段 + - `biome_filter` 通过生物群系标签过滤生成位置(与生成规则类似) - `distribution` - - `iterations` basically chance. I set mine to 100 to make it generate everywhere, but for a diamond_ore, this is set to 1. - - The next four components show in which directions the ore will be 'dragged' towards. - _Needs more clarification_ + - `iterations` 生成概率。设为100表示全图生成(钻石矿通常设为1) + - 后续参数控制矿脉延伸方向(需要更多说明) -The easiest way to test wether your ores generated is /fill ~15 ~5 ~15 ~-15 ~-15 ~-15 air 0 replace stone using this command at a low y level. it'll keep everything BUT stone in the selected area, like this: +测试矿石生成建议在低Y坐标使用指令 `/fill ~15 ~5 ~15 ~-15 ~-15 ~-15 air 0 replace stone`,该指令会清除选定区域内所有石头,保留其他方块: ![](/assets/images/guide/ore_gen_sans_stone.jpg) -And yes, 100 as "iterations" is definitely waaay too much ;) +显然,将"iterations"设为100确实过量 ;) -It's a good idea to proceed checking out other feature and feature_rule vanilla files to learn further techniques. However, the ones you were just walked through are enough to create most of what needs to be generated. +建议通过研究原版特征和特征规则文件来学习更多技巧。不过上文所述内容已能满足大部分生成需求 --- -## Custom Structures +## 自定义结构 -As of MCBE v1.16.20, **Custom Generated structures are possible**. -A simple way to generate Structures is [this](https://machine-builder.itch.io/frg-v2) auto generator by MACHINE_BUILDER, mentioned earlier. It generates all three of the required files for your structure: `feature_rules/mystructure.feature_rule.json`, `feature_rules/mystructure.feature.json` and `structures/mystructure.mcstructure.` You can learn more about defining `.mcstructures` with Structure Blocks in Minecraft itself [here](/nbt/mcstructure). +自 MCBE v1.16.20 起,**支持自定义生成结构** +推荐使用前文提到的 [MACHINE_BUILDER 工具](https://machine-builder.itch.io/frg-v2)自动生成结构文件。该工具会生成三个必要文件:`feature_rules/mystructure.feature_rule.json`、`feature_rules/mystructure.feature.json` 和 `structures/mystructure.mcstructure`。更多关于使用结构块定义 `.mcstructure` 的内容请参考[此文档](/wiki/nbt/mcstructure) --- -Now that you have your `.mcstructure`, time to write your `feature` and `feature rule`. The last is the same as with ores (see the beginning of this article). Let's continue to the **Feature**. +准备好 `.mcstructure` 文件后,需要编写对应的 `feature` 和 `feature rule`。特征规则与矿石生成类似(参见前文),以下是**特征**示例(来自[特征文档](https://bedrock.dev/r/Features#minecraft:structure_template_feature)): -- Remember that the namespace is not required and that the filename must match the identifier, excluding the namespace. So if you have a feature rule with the identifier `wiki:myfeaturerule` or simply `myfeaturerule`, the file name can be be `myfeaturerule.json` in both cases. - -Here's an code example from the [Features Documentation](https://bedrock.dev/r/Features#minecraft:structure_template_feature): - - - -```json +::: code-group +```json [示例] { "format_version": "1.13.0", "minecraft:structure_template_feature": { @@ -317,24 +308,22 @@ Here's an code example from the [Features Documentation](https://bedrock.dev/r/F } ``` -- `structure_name` is the structure's identifier, the one you saved via a Structure Block. +- `structure_name` 是结构块的保存标识符 -That's pretty much it! Now you're able to generate your own custom Structures in the world. +至此,您已掌握在游戏中生成自定义结构的方法! --- ---- +## 当前进度 -## Your progress so far - -**What you've done:** +**已完成内容:** -- [x] Created you very first biome. -- [x] Made your very first ore generate naturally. -- [x] Learned to use bridge. for vanilla files generation and referencing. -- [x] Learned about other Custom Generation methods. -- [x] Created custom Structures +- [x] 创建第一个生物群系 +- [x] 实现首个自然生成的矿石 +- [x] 掌握使用 bridge. 生成原版参考文件 +- [x] 了解其他自定义生成方法 +- [x] 创建自定义结构 - + \ No newline at end of file diff --git a/scripts/ai-translate.mjs b/scripts/ai-translate.mjs index 4741656e..2b85c800 100644 --- a/scripts/ai-translate.mjs +++ b/scripts/ai-translate.mjs @@ -58,11 +58,17 @@ async function findMarkdownFiles(dir) { if (entry.isDirectory()) { await traverse(fullPath); - } else if (entry.isFile() && entry.name.endsWith('.md')) { + } else if (entry.isFile() && entry.name.endsWith('.md') && entry.name !== 'index.md') { try { // 读取文件内容 const content = await fs.readFile(fullPath, 'utf-8'); - + // 如果超过600行,跳过 + const lines = content.split('\n').length; + if (lines > 600) { + console.log(`⏭️ 跳过超过600行的文件: ${path.relative(targetDir, fullPath)}`); + continue; + } + // 如果文件不包含中文,则添加到待翻译列表 if (!containsChinese(content)) { files.push(fullPath); diff --git a/scripts/sidebar-wiki.ts b/scripts/sidebar-wiki.ts new file mode 100644 index 00000000..9278961f --- /dev/null +++ b/scripts/sidebar-wiki.ts @@ -0,0 +1,266 @@ +import fs from 'fs' +import path from 'path' +import matter from 'gray-matter' +import fetch from 'node-fetch' + +const baseUrl = '/' + +// define whether big pages should be built. +// fastBuild should only be used when testing, since it will not compile some of the wikis content. +const excludeFiles = [ + 'entities/vanilla-usage-components.md', + 'entities/vanilla-usage-spawn-rules.md', + 'entities/vuc-full.md', + 'entities/vusr-full.md', +] + +const fastBuild = process.env.fastBuild === 'true ' // SPACE has to be there, since the SET var=val command adds a space at the end! + +if (fastBuild && process.env.NODE_ENV == 'production') { + console.log( + `\nINFO: fastBuild selected. the files:\n${JSON.stringify( + excludeFiles, + null, + 4 + )}\nwill not be compiled!\n` + ) +} + +function formatLink(path: string) { + return path.split(/\\|\//g).join('/').replace('.md', '') +} + +/* +Gets the categories from within the frontmatter of an index.md file, and returns them as list. + */ +function getCategoryOrder(frontMatter: matter.GrayMatterFile) { + const data: { [Key: string]: number } = {} + if (!frontMatter.data.categories) { + return data + } + + frontMatter.data.categories.forEach(function ( + category: { title: string | number }, + index: number + ) { + data[category.title] = index + 1 + }) + + return data +} + +function getCategories(frontMatter: matter.GrayMatterFile) { + const data: { + text: any + data: any + tags: any + prefix: any + section: boolean + color: any + link: string + activeMatch: string + }[] = [] + if (!frontMatter.data.categories) { + return data + } + + frontMatter.data.categories.forEach(function ( + category: { + nav_order: number + category: any + title: any + tags: any + prefix: any + color: any + }, + index: any + ) { + category.nav_order = -1 + category.category = category.title + data.push({ + text: category.title, + data: category, + tags: category.tags, + prefix: category.prefix, + section: true, + color: category.color, + link: '', + activeMatch: ' ', + }) + }) + + return data +} + +let order: { [Key: string]: number } + +/* +Recursively generate the navigation links for the sidebar. +*/ +export function generateWikiSidebar(base: string, dir: string) { + const data: { + text: any + data: { [key: string]: any } + children?: any + tags?: any + prefix?: any + section?: any + color?: any + link?: string + activeMatch?: string + }[] = [] + const files = fs.readdirSync(dir) + + files.forEach(function (file) { + let joinedPath = path.join(dir, file) + const stats = fs.statSync(joinedPath) + // Handle top level directories + if ( + stats.isDirectory() && + fs.existsSync(path.join(joinedPath, 'index.md')) + ) { + const str = fs.readFileSync( + path.join(joinedPath, 'index.md'), + 'utf8' + ) + let frontMatter + try { + frontMatter = matter(str) + } catch (e) { + joinedPath = path.relative( + process.cwd(), + path.join(joinedPath, 'index.md') + ) + console.log( + // @ts-ignore + `::error file=${joinedPath},line=1,col=1::File ${joinedPath} has invalid frontmatter! ${e.message}` + ) + throw new Error( + // @ts-ignore + `File ${joinedPath} has invalid frontmatter! ${e.message}` + ) + } + + order = getCategoryOrder(frontMatter) + + const children = generateWikiSidebar(base, joinedPath).concat( + getCategories(frontMatter) + ) + + children.sort( + ( + { data: dataA, text: textA }, + { data: dataB, text: textB } + ) => { + // Default to max int, so without nav order you will show second + // Multiply by category value if it exists + const navA = + (dataA.nav_order || 50) + + (order[dataA.category] || 0) * 100 || + Number.MAX_SAFE_INTEGER + const navB = + (dataB.nav_order || 50) + + (order[dataB.category] || 0) * 100 || + Number.MAX_SAFE_INTEGER + + // Tie goes to the text compare! (Will also apply for elements without nav order) + if (navA == navB) { + return textA.localeCompare(textB) + } + + // Return nav order + return navA - navB + } + ) + data.push({ + text: frontMatter.data.title, + data: frontMatter.data, + children: children, + }) + + if (frontMatter.data.title === void 0) { + throw new Error( + 'File ' + + path.join(joinedPath, 'index.md') + + ' has invalid frontmatter!' + ) + } + } + + // Handle the normal files + else if (stats.isFile()) { + // Don't include non-markdown files, or the index page itself + if (!file.endsWith('.md') || file.endsWith('index.md')) return + + const str = fs.readFileSync(joinedPath, 'utf8') + let frontMatter + try { + frontMatter = matter(str) + } catch (e) { + joinedPath = path.relative(process.cwd(), joinedPath) + console.log( + // @ts-ignore + `::error file=${joinedPath},line=1,col=1::File ${joinedPath} has invalid frontmatter! ${e.message}` + ) + throw new Error( + // @ts-ignore + `File ${joinedPath} has invalid frontmatter! ${e.message}` + ) + } + const link = formatLink(joinedPath.toString().replace(base, '')) + + // Don't include hidden pages (ignores children) + if (frontMatter.data.hidden === true) return + + let prefix = null + + if (frontMatter.data.prefix != null) { + prefix = frontMatter.data.prefix + } + + let tags = null + + if (frontMatter.data.tags != null) { + tags = frontMatter.data.tags + } + data.push({ + text: frontMatter.data.title, + data: frontMatter.data, + tags: tags, + prefix: prefix, + section: frontMatter.data.section || false, + color: frontMatter.data.color || 'none', + link, + activeMatch: `^${link}`, + }) + if (frontMatter.data.title === void 0) { + joinedPath = path.relative(process.cwd(), joinedPath) + console.log( + `::error file=${joinedPath},line=1,col=1::File ${joinedPath} has invalid frontmatter!` + ) + throw new Error(`File ${joinedPath} has invalid frontmatter!`) + } + } + }) + + return data.sort( + ({ data: dataA, text: textA }, { data: dataB, text: textB }) => { + // Default to max int, so without nav order you will show second + // Multiply by category value if it exists + const navA = + (dataA.nav_order || 50) + (order[dataA.category] || 0) * 100 || + Number.MAX_SAFE_INTEGER + const navB = + (dataB.nav_order || 50) + (order[dataB.category] || 0) * 100 || + Number.MAX_SAFE_INTEGER + + // Tie goes to the text compare! (Will also apply for elements without nav order) + if (navA == navB) { + return textA.localeCompare(textB) + } + + // Return nav order + return navA - navB + } + ) +} \ No newline at end of file diff --git a/scripts/sidebar.ts b/scripts/sidebar.ts index 95bcfadb..d4ec7618 100644 --- a/scripts/sidebar.ts +++ b/scripts/sidebar.ts @@ -1,7 +1,8 @@ import fs from 'fs/promises'; import path from 'path'; import fg from 'fast-glob'; -import matter from 'gray-matter' +import matter from 'gray-matter'; +import { generateWikiSidebar } from './sidebar-wiki'; // 定义侧边栏项目接口 interface SidebarItem { @@ -54,8 +55,10 @@ async function generateSidebar(): Promise> { const sidebar: Record = {}; const files = await fg([`${DOCS_DIR}/**/*.md`]); - // 处理所有非 index.md 文件 + // 处理所有非 wiki 文件 for (const filePath of files) { + // 跳过wiki + if (filePath.includes('wiki')) continue; const relativePath = path.relative(DOCS_DIR, filePath); if (IGNORE_PATHS.some(ignore => relativePath.toLowerCase().includes(ignore.toLowerCase()))) continue; @@ -149,6 +152,69 @@ async function generateSidebar(): Promise> { }); } + // 处理wiki + const wiki = generateWikiSidebar(path.join(process.cwd(), 'docs'), path.join(process.cwd(), 'docs/wiki')); + const wikiSidebar: SidebarItem[] = []; + wiki.forEach(item => { + if (item.data.categories) { + // 一级大分类 + + // 二级分类 + const secondUrls: string[] = []; + const second = item.data.categories.map((category: any) => {; + return { + text: category.title, + collapsed: false, + items: item.children + .filter(child => child.data.category === category.title) + .filter(child => child.link) + .map(child => { + secondUrls.push(child.link); + return { + text: child.text, + link: child.link, + activeMatch: child.activeMatch + } + }) + } + }); + // 匹配到一级但是未匹配到二级 + const notMatched = item.children + .filter(child => !secondUrls.includes(child.link)) + .filter(child => child.link) + .map(child => { + return { + text: child.text, + link: child.link, + activeMatch: child.activeMatch + } + }); + + wikiSidebar.push({ + text: item.data.title, + collapsed: true, + items: [...second, ...notMatched] + }); + } else { + // 一级大分类 + wikiSidebar.push({ + text: item.text, + collapsed: true, + items: item.children + .filter(child => child.link) + .map(child => { + return { + text: child.text, + link: child.link, + activeMatch: child.activeMatch + } + }) + }); + } + }); + // 添加 wiki + sidebarFlat['wiki'] = wikiSidebar; + return sidebarFlat; }