完整版BedrockWiki镜像!
This commit is contained in:
@@ -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!
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
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?
|
||||
## 下一步建议
|
||||
|
||||
<BButton
|
||||
link="/guide/software-preparation"
|
||||
color=blue
|
||||
>Check out software and preparation page!</BButton>
|
||||
>查看软件准备指南!</BButton>
|
||||
|
||||
::: 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
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
:::
|
||||
@@ -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 配置
|
||||
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
::: 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!
|
||||
:::
|
||||
本页面内容尚在完善中!
|
||||
:::
|
||||
@@ -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.
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
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. 将出现以下界面
|
||||
|
||||

|
||||
|
||||
- `"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. 点击确认后进入工作区:
|
||||
|
||||

|
||||
|
||||
- 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的教学视频
|
||||
|
||||
<YouTubeEmbed id="XqzxL_-XjA0" />
|
||||
|
||||
<YouTubeEmbed id="j7ISUImhgpc" />
|
||||
|
||||
## 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`),勾选"模板:"可生成带辅助线的纹理模板
|
||||

|
||||
1. Check everything and change your resolution to the one you set in the very first step.
|
||||
3. 确认分辨率与初始设置一致
|
||||

|
||||
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:
|
||||
建议通过工具栏设置添加"导出动画"和"导入动画"按钮:
|
||||

|
||||
|
||||
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帧处调整腿部位置创建第一关键帧
|
||||

|
||||
1. Create the second frame under 0.5 on the timeline.
|
||||
2. 在时间轴0.5帧处创建第二关键帧
|
||||

|
||||
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. 右键动画选择"循环"使动画持续播放
|
||||

|
||||
|
||||
## 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?_
|
||||
恭喜完成首个实体视觉创作!下方提供完整文件示例参考。
|
||||
|
||||
<Spoiler title="Show code">
|
||||
_不妨尝试为你的独特实体升级视觉效果,或创作全新角色?_
|
||||
|
||||
<CodeHeader>RP/models/entity/ghost.geo.json</CodeHeader>
|
||||
<Spoiler title="显示代码">
|
||||
|
||||
```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
|
||||
}
|
||||
```
|
||||
|
||||
<CodeHeader>RP/animations/ghost.a.animations.json</CodeHeader>
|
||||
|
||||
```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
|
||||
}
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
</Spoiler>
|
||||
|
||||
## What you have learned
|
||||
## 学习总结
|
||||
|
||||
<Checklist>
|
||||
|
||||
- [x] How to create an entity in Blockbench
|
||||
- [x] How to use Blockbench to model, texture, and animate your entity
|
||||
|
||||
</Checklist>
|
||||
- [x] 掌握Blockbench实体创建流程
|
||||
- [x] 学会使用Blockbench进行建模、纹理绘制与动画制作
|
||||
|
||||
</Checklist>
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
在Minecraft中,我们可以创建自定义物品,这些物品可以像普通物品一样被丢弃、交易、合成和使用。该系统具有强大的功能,包括制作食物、燃料和工具的能力。
|
||||
|
||||
在本教程中,我们将学习如何创建一个简单的"灵质"(ectoplasm)物品,后续将作为幽灵实体的战利品掉落。
|
||||
|
||||
<br>
|
||||
<img src="/assets/images/guide/custom_item/ectoplasm_view.png" width=150>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
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个。这些都是通过行为组件实现的。
|
||||
|
||||
<Spoiler title="Example Components">
|
||||
<Spoiler title="组件示例">
|
||||
|
||||
<CodeHeader>BP/items/example.json/components/</CodeHeader>
|
||||
|
||||
```json
|
||||
"minecraft:food":
|
||||
::: code-group
|
||||
```json [示例组件]
|
||||
"minecraft:food": {...},
|
||||
"minecraft:foil": true,
|
||||
"minecraft:max_stack_size": 16
|
||||
```
|
||||
:::
|
||||
|
||||
</Spoiler>
|
||||
|
||||
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:
|
||||
|
||||
<CodeHeader>BP/items/ectoplasm.json</CodeHeader>
|
||||
|
||||
```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:<file_type>"`.
|
||||
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"`:
|
||||
|
||||
<CodeHeader>ectoplasm.json/minecraft:item/</CodeHeader>
|
||||
|
||||
```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).
|
||||
组件部分定义行为特性:
|
||||
|
||||
<CodeHeader>ectoplasm.json/minecraft:item/</CodeHeader>
|
||||
|
||||
```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.
|
||||
完整物品文件应如下所示:
|
||||
|
||||
<CodeHeader>BP/items/ectoplasm.json</CodeHeader>
|
||||
|
||||
```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.
|
||||
|
||||

|
||||
|
||||
<BButton link="https://raw.githubusercontent.com/Bedrock-OSS/wiki-addon/86b0380310d3d5748a43a4be1f93d4c59668e4bf/guide/guide_RP/textures/items/ectoplasm.png">Download texture here</BButton>
|
||||
|
||||
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格式。
|
||||
|
||||
<FolderView
|
||||
:paths="[
|
||||
@@ -181,46 +156,32 @@ Your folder layout should look like this:
|
||||
]"
|
||||
/>
|
||||
|
||||
### 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.
|
||||
|
||||
<CodeHeader>RP/textures/item_texture.json</CodeHeader>
|
||||
|
||||
```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:
|
||||
### 应用纹理
|
||||
|
||||
<CodeHeader>RP/textures/item_texture.json/texture_data</CodeHeader>
|
||||
在物品组件中添加`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.
|
||||
|
||||
<CodeHeader>ectoplasm.json/minecraft:item/</CodeHeader>
|
||||
|
||||
```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.
|
||||
|
||||
<CodeHeader>RP/texts/en_US.lang</CodeHeader>
|
||||
在语言文件中添加翻译:
|
||||
|
||||
::: 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`命令获取,并在创造菜单显示。完整文件结构:
|
||||
|
||||
<FolderView :paths="[
|
||||
'RP/textures/item_texture.json',
|
||||
@@ -265,10 +219,9 @@ Your folder structure should look like this:
|
||||
'BP/pack_icon.png',
|
||||
]"></FolderView>
|
||||
|
||||
<Spoiler title="Full ectoplasm.json">
|
||||
<CodeHeader>BP/items/ectoplasm.json</CodeHeader>
|
||||
|
||||
```json
|
||||
<Spoiler title="完整ectoplasm.json">
|
||||
::: code-group
|
||||
```json [完整物品文件]
|
||||
{
|
||||
"format_version": "1.16.100",
|
||||
"minecraft:item": {
|
||||
@@ -285,13 +238,12 @@ Your folder structure should look like this:
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
</Spoiler>
|
||||
|
||||
<Spoiler title="Full item_texture.json">
|
||||
<CodeHeader>RP/textures/item_texture.json</CodeHeader>
|
||||
|
||||
```json
|
||||
<Spoiler title="完整item_texture.json">
|
||||
::: code-group
|
||||
```json [完整纹理文件]
|
||||
{
|
||||
"resource_pack_name": "Ghostly Guide",
|
||||
"texture_name": "atlas.items",
|
||||
@@ -302,21 +254,21 @@ Your folder structure should look like this:
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
</Spoiler>
|
||||
|
||||
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
|
||||
## 进度追踪
|
||||
|
||||
<Checklist>
|
||||
|
||||
- [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] 设置物品纹理
|
||||
- [ ] 创建自定义实体
|
||||
- [ ] 实现实体战利品、生成规则和合成配方
|
||||
|
||||
</Checklist>
|
||||
</Checklist>
|
||||
@@ -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
|
||||
---
|
||||
|
||||
# 下载示例包
|
||||
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
::: 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:
|
||||
下载地址:
|
||||
|
||||
<BButton
|
||||
link="https://github.com/Bedrock-OSS/wiki-addon/releases/download/download/legacy_guide.mcaddon"
|
||||
color=gray
|
||||
>Download Add-On</BButton>
|
||||
>下载附加包</BButton>
|
||||
|
||||
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)实现参考
|
||||
@@ -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
|
||||
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
格式版本是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 |
|
||||
@@ -1,10 +1,10 @@
|
||||
---
|
||||
title: Beginners Guide
|
||||
title: 新手指南
|
||||
nav_order: 1
|
||||
categories:
|
||||
- title: Guide
|
||||
- title: 指南
|
||||
color: green
|
||||
- title: Extra
|
||||
- title: 扩展内容
|
||||
color: blue
|
||||
---
|
||||
|
||||
|
||||
@@ -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.
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
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脚本开发。部分章节还提供了相关主题的深度技术文档。
|
||||
|
||||
@@ -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
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
First, we'll make the ghost drop Ectoplasm upon death: create the following file:
|
||||
接下来我们将为自定义的幽灵实体添加更多基础机制:
|
||||
|
||||
<CodeHeader>BP/loot_tables/entities/ghost.json</CodeHeader>
|
||||
## 战利品表
|
||||
|
||||
```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:
|
||||
接下来配置幽灵在沙漠生物群系的夜间生成规则:
|
||||
|
||||
<CodeHeader>BP/spawn_rules/ghost.json</CodeHeader>
|
||||
|
||||
```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:
|
||||
最后实现将灵质合成史莱姆方块的功能:
|
||||
|
||||
<CodeHeader>BP/recipes/ectoplasm_slime_blocks.json</CodeHeader>
|
||||
|
||||
```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 学习要点
|
||||
- 创建战利品表配置生物掉落
|
||||
- 设置生物生成规则
|
||||
- 制作合成配方
|
||||
:::
|
||||
|
||||
## 当前进度
|
||||
|
||||
**已完成内容:**
|
||||
|
||||
<Checklist>
|
||||
|
||||
- [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] 添加实体掉落、生成规则与合成配方
|
||||
|
||||
</Checklist>
|
||||
|
||||
Congratulations! you have finished the Guide and created your first Add-on. 🎉
|
||||
恭喜!你已完成全部教程并创建了第一个附加包 🎉
|
||||
@@ -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.
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
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, `../<current location>` 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.
|
||||
|
||||
<codeHeader>BP/manifest.json</codeHeader>
|
||||
|
||||
```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.
|
||||
|
||||
<codeHeader>RP/manifest.json</codeHeader>
|
||||
|
||||
```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.
|
||||
|
||||
<WikiImage src="/assets/images/guide/project-setup/pack_icon.png" alt="Pack Icon" pixelated/>
|
||||
<WikiImage src="/assets/images/guide/project-setup/pack_icon.png" alt="包图标示例" pixelated/>
|
||||
|
||||
<BButton
|
||||
link="/assets/images/guide/project-setup/pack_icon.png" download
|
||||
color=default
|
||||
>Download Image</BButton>
|
||||
>下载示例图标</BButton>
|
||||
|
||||
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.
|
||||
|
||||
<codeHeader>BP/texts/en_US.lang</codeHeader>
|
||||
|
||||
```
|
||||
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贡献者制作!
|
||||
```
|
||||
|
||||
<codeHeader>BP/texts/languages.json</codeHeader>
|
||||
|
||||
```json
|
||||
```json [BP/texts/languages.json]
|
||||
["en_US"]
|
||||
```
|
||||
|
||||
<codeHeader>RP/texts/en_US.lang</codeHeader>
|
||||
|
||||
```
|
||||
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贡献者制作!
|
||||
```
|
||||
|
||||
<codeHeader>RP/texts/languages.json</codeHeader>
|
||||
|
||||
```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`.
|
||||

|
||||
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.
|
||||

|
||||
|
||||
If done correctly, Minecraft will display a banner for both packs. First is `Importing...`. After should be `Successfully imported "<your pack name>"`. 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.
|
||||
内容日志是调试附加包的重要工具,请务必开启
|
||||
:::
|
||||
|
||||

|
||||
|
||||
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. 确保以下设置:
|
||||
- 实验性玩法:全部开启
|
||||
- 默认游戏模式:创造模式
|
||||
- 世界权限:仅邀请(单人游戏不影响)
|
||||
|
||||

|
||||

|
||||
|
||||
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.
|
||||
|
||||

|
||||

|
||||
|
||||
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`.
|
||||
完成配置后项目应包含以下文件:
|
||||
|
||||
<FolderView :paths="[
|
||||
'com.mojang/development_resource_packs/guide_RP/manifest.json',
|
||||
@@ -236,26 +230,26 @@ Remember that in future, we will represent `com.mojang/development_behavior_pack
|
||||
'com.mojang/development_behavior_packs/guide_BP/texts/languages.json',
|
||||
]"></FolderView>
|
||||
|
||||
## 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
|
||||
## 进度追踪
|
||||
|
||||
<Checklist>
|
||||
|
||||
- [x] Setup your pack
|
||||
- [ ] Create a custom item
|
||||
- [ ] Create a custom entity
|
||||
- [ ] Create a custom block
|
||||
- [x] 完成项目基础配置
|
||||
- [ ] 创建自定义物品
|
||||
- [ ] 创建自定义实体
|
||||
- [ ] 创建自定义方块
|
||||
|
||||
</Checklist>
|
||||
</Checklist>
|
||||
@@ -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!
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
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专用指南。
|
||||
:::
|
||||
|
||||
<BButton
|
||||
link="./project-setup-android"
|
||||
color=blue
|
||||
>Android guide</BButton>
|
||||
>Android指南</BButton>
|
||||
|
||||
:::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`。初始内容可复制以下代码:
|
||||
|
||||
<CodeHeader>BP/manifest.json</CodeHeader>
|
||||
|
||||
```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.
|
||||
|
||||
<CodeHeader>RP/manifest.json</CodeHeader>
|
||||
|
||||
```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:
|
||||
包图标是附加包在游戏内的展示图片。建议使用低分辨率正方形图片,或下载以下示例图标:
|
||||
|
||||
<WikiImage src="/assets/images/guide/project-setup/pack_icon.png" alt="Pack Icon" pixelated/>
|
||||
<WikiImage src="/assets/images/guide/project-setup/pack_icon.png" alt="包图标" pixelated/>
|
||||
|
||||
<BButton
|
||||
link="/assets/images/guide/project-setup/pack_icon.png" download
|
||||
color=default
|
||||
>Download Image</BButton>
|
||||
>下载图片</BButton>
|
||||
|
||||
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)。
|
||||
|
||||
<CodeHeader>RP/texts/en_US.lang</CodeHeader>
|
||||
|
||||
```json
|
||||
pack.name=Wiki Resource Pack
|
||||
pack.description=A Ghostly Guide
|
||||
::: code-group
|
||||
```json [RP/texts/en_US.lang]
|
||||
pack.name=Wiki资源包
|
||||
pack.description=幽灵指南
|
||||
```
|
||||
:::
|
||||
|
||||
<CodeHeader>BP/texts/en_US.lang</CodeHeader>
|
||||
|
||||
```json
|
||||
pack.name=Wiki Behavior Pack
|
||||
pack.description=A Ghostly Guide
|
||||
::: code-group
|
||||
```json [BP/texts/en_US.lang]
|
||||
pack.name=Wiki行为包
|
||||
pack.description=幽灵指南
|
||||
```
|
||||
:::
|
||||
|
||||
<CodeHeader>RP/texts/languages.json</CodeHeader>
|
||||
|
||||
```json
|
||||
::: code-group
|
||||
```json [RP/texts/languages.json]
|
||||
["en_US"]
|
||||
```
|
||||
:::
|
||||
|
||||
<CodeHeader>BP/texts/languages.json</CodeHeader>
|
||||
|
||||
```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)。
|
||||
|
||||

|
||||
|
||||
## Turn on Content Log
|
||||
## 启用内容日志
|
||||
|
||||
:::warning
|
||||
Content log is the most useful tool you have for debugging your addons. Please do not skip this step.
|
||||
内容日志是调试附加包最重要的工具,请务必启用。
|
||||
:::
|
||||
|
||||

|
||||
|
||||
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. 确保以下设置:
|
||||

|
||||

|
||||
|
||||
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`
|
||||
|
||||
<FolderView :paths="[
|
||||
'com.mojang/development_resource_packs/guide_RP/manifest.json',
|
||||
@@ -275,26 +277,26 @@ Remember that in future, we will represent `com.mojang/development_behavior_pack
|
||||
'com.mojang/development_behavior_packs/guide_BP/texts/languages.json',
|
||||
]"></FolderView>
|
||||
|
||||
## 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
|
||||
## 进度追踪
|
||||
|
||||
<Checklist>
|
||||
|
||||
- [x] Setup your pack
|
||||
- [ ] Create a custom item
|
||||
- [ ] Create a custom entity
|
||||
- [ ] Create the entity's loot, spawn rules and a custom recipe
|
||||
- [x] 完成基础设置
|
||||
- [ ] 创建自定义物品
|
||||
- [ ] 创建自定义实体
|
||||
- [ ] 配置实体战利品、生成规则与合成配方
|
||||
|
||||
</Checklist>
|
||||
</Checklist>
|
||||
@@ -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
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
在开始制作附加包之前,您需要先安装必要的工具和软件。虽然在 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/)
|
||||
|
||||
<Spoiler title="Configuring VSCode">
|
||||
<Spoiler title="配置 VSCode">
|
||||
|
||||
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)
|
||||
|
||||
</Spoiler>
|
||||
|
||||
### 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
|
||||
## 当前进度
|
||||
|
||||
<Checklist>
|
||||
|
||||
- [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` 文件夹并创建工作区
|
||||
- [ ] 创建首个附加包的清单文件和包图标
|
||||
|
||||
</Checklist>
|
||||
</Checklist>
|
||||
@@ -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.
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
## 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.
|
||||
内容日志可在 `设置 > 创作者` 中启用。游戏加载时会显示初始日志,游戏过程中新出现的错误也会实时更新。
|
||||
|
||||

|
||||
|
||||
### 日志文件位置
|
||||
|
||||
### 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!
|
||||
<BButton link="/entities/troubleshooting-entities"> 实体问题排查</BButton>
|
||||
|
||||
## Entities
|
||||
## 物品
|
||||
|
||||
<BButton link="/entities/troubleshooting-entities"> Troubleshoot your entities.</BButton>
|
||||
<BButton link="/items/troubleshooting-items"> 物品问题排查</BButton>
|
||||
|
||||
## Items
|
||||
## 方块
|
||||
|
||||
<BButton link="/items/troubleshooting-items"> Troubleshoot your items.</BButton>
|
||||
|
||||
## Blocks
|
||||
|
||||
<BButton link="/blocks/troubleshooting-blocks"> Troubleshoot your blocks.</BButton>
|
||||
<BButton link="/blocks/troubleshooting-blocks"> 方块问题排查</BButton>
|
||||
@@ -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
|
||||
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
::: 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`。键值对的格式为`"<key>": <value>`,注意键名必须用引号包裹且后接冒号。
|
||||
|
||||
This key-value syntax looks like this: `"<key>": <any structure>`. Notice the quotes around the key, and the colon.
|
||||
|
||||
Here is an example of an object, which contains a few _key-value-pairs_.
|
||||
|
||||
<CodeHeader></CodeHeader>
|
||||
|
||||
```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:
|
||||
|
||||
<CodeHeader></CodeHeader>
|
||||
|
||||
```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对象内。需要将其移至顶层对象中。
|
||||
Reference in New Issue
Block a user