搬运一批Bedrock wiki内容,完善翻译

This commit is contained in:
boybook
2025-03-20 00:13:44 +08:00
parent ead7392a76
commit 4896c1a4f2
163 changed files with 33930 additions and 1464 deletions

View File

@@ -0,0 +1,84 @@
---
title: contents.json
mentions:
- MedicalJewel105
- Osaxely
- SirLich
- solvedDev
- Joelant05
- Jorginhor
- TheItsNameless
---
`contents.json` is a file that is _probably_ used for the game to process the pack files more easily. It is _probably_ intended for marketplace content creators and Mojang, it is not required to have this file in the pack for the pack to work properly.
You will find there some instructions about the usage of this file.
## Structure of the file
`contents.json` is located at the root of the add-on directory. It contains a list of the files that are included in the pack.
Example:
<CodeHeader>RP/contents.json</CodeHeader>
```json
{
"content": [
{
"path": "texts/en_US.lang"
},
{
"path": "contents.json"
},
{
"path": "manifest.json"
},
{
"path": "animations/my_animation.animation.json"
},
{
"path": "animation_controllers/my_ac.ac.json"
},
{
"path": "entity/my_entity.entity.json"
},
{
"path": "textures/textures_list.json"
},
{
"path": "textures/blocks/my_block.png"
}
]
}
```
<FolderView
:paths="[
'RP/texts/en_US.lang',
'RP/manifest.json',
'RP/contents.json',
'RP/animations/my_animation.animation.json',
'RP/animation_controllers/my_ac.ac.json',
'RP/entity/my_entity.entity.json',
'RP/textures/texture_list.json',
'RP/textures/blocks/my_block.png'
]"
> </FolderView>
## Automatizing the process
The `contents.json` file can be generated automatically by the game itself, it is very recommended to decrease the risks of making mistakes. However, the file must be prepared first. Create a new empty file called `contents.json` in the root directory of your add-on, and add empty brackets.
<CodeHeader>BP|RP/contents.json</CodeHeader>
```json
{}
```
The file content will be automatically written next time the game is launched.
## Additional information
- The automatic process can be achieved no matter what is the location of the pack (Development folders or normal folders).
- Do not make multiple `contents.json` for subpacks, the file at the root of the pack is sufficient.
- This file is not required for the addon to work properly.

View File

@@ -0,0 +1,289 @@
---
title: Emojis & Symbols
mentions:
- SirLich
- Joelant05
- sovledDev
- stirante
- Dreamedc2015
- MedicalJewel105
- JaylyDev
- RealBashy21
- ColinTimBarndt
- Citicx
- TheItsNameless
- ThomasOrs
---
:::warning
Modifying texture of vanilla emojis and symbols on this page are incompatible with Nintendo Switch platform!
:::
Minecraft has a bunch of hard-coded [Private Use Unicode symbols](https://en.wikipedia.org/wiki/Private_Use_Areas) that it automatically converts to Emoji-like symbols.
These can be used anywhere where normal letters can - signs, books, item names, chat, etc.
Below you can find platform specific Emoji's, as well as general symbols. Copy/paste the "box" character under the Letter colum directly into Minecraft.
There will be instructions for creating custom emoji at the bottom.
### HUD
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ----------------- | ------------------------ | ------- | ------------------------------------------------- |
| Food |  | U+E100 | ![](/assets/images/concepts/emojis/hud/food.png) |
| Armor |  | U+E101 | ![](/assets/images/concepts/emojis/hud/armor.png) |
| Heart |  | U+E10C | ![](/assets/images/concepts/emojis/hud/heart.png) |
### Items & Blocks
| Name | Letter (Copy/Paste This) | Unicode | Image |
| -------------- | ------------------------ | ------- | ------------------------------------------------------------ |
| Wooden Pickaxe |  | U+E108 | ![](/assets/images/concepts/emojis/items/wooden_pickaxe.png) |
| Wooden Sword |  | U+E109 | ![](/assets/images/concepts/emojis/items/wooden_sword.png) |
| Crafting Table |  | U+E10A | ![](/assets/images/concepts/emojis/items/crafting_table.png) |
| Furnace |  | U+E10B | ![](/assets/images/concepts/emojis/items/furnace.png) |
### Marketplace
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ---------------- | ------------------------ | ------- | ------------------------------------------------------------ |
| Minecoin |  | U+E102 | ![](/assets/images/concepts/emojis/marketplace/minecoin.png) |
| Token |  | U+E105 | ![](/assets/images/concepts/emojis/marketplace/token.png) |
### Inventory
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ---------------- | ------------------------ | ------- | ------------------------------------------------------------------ |
| Craft Toggle On |  | U+E0A0 | ![](/assets/images/concepts/emojis/inventory/craft_toggle_on.png) |
| Craft Toggle Off |  | U+E0A1 | ![](/assets/images/concepts/emojis/inventory/craft_toggle_off.png) |
### New Touch
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ----------------- | ------------------------ | ------- | ---------------------------------------------------------- |
| Jump |  | U+E014 | ![](/assets/images/concepts/emojis/new_touch/jump.png) |
| Attack |  | U+E015 | ![](/assets/images/concepts/emojis/new_touch/attack.png) |
| Joy Stick |  | U+E016 | ![](/assets/images/concepts/emojis/new_touch/joystick.png) |
| Place |  | U+E018 | ![](/assets/images/concepts/emojis/new_touch/place.png) |
| Sneak |  | U+E019 | ![](/assets/images/concepts/emojis/new_touch/sneak.png) |
| Sprint |  | U+E01A | ![](/assets/images/concepts/emojis/new_touch/sprint.png) |
| Fly Up |  | U+E01B | ![](/assets/images/concepts/emojis/new_touch/fly_up.png) |
| Fly Down |  | U+E01C | ![](/assets/images/concepts/emojis/new_touch/fly_down.png) |
| Dismount |  | U+E01D | ![](/assets/images/concepts/emojis/new_touch/dismount.png) |
### Touch
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ----------------- | ------------------------ | ------- | ------------------------------------------------------------- |
| Jump |  | U+E084 | ![](/assets/images/concepts/emojis/touch/jump.png) |
| Crouch |  | U+E085 | ![](/assets/images/concepts/emojis/touch/crouch.png) |
| Fly Up |  | U+E086 | ![](/assets/images/concepts/emojis/touch/fly_up.png) |
| Fly Down |  | U+E087 | ![](/assets/images/concepts/emojis/touch/fly_down.png) |
| Stop Flying |  | U+E088 | ![](/assets/images/concepts/emojis/touch/stop_flying.png) |
| Left Arrow |  | U+E081 | ![](/assets/images/concepts/emojis/touch/left_arrow.png) |
| Right Arrow |  | U+E083 | ![](/assets/images/concepts/emojis/touch/right_arrow.png) |
| Up Arrow |  | U+E080 | ![](/assets/images/concepts/emojis/touch/up_arrow.png) |
| Down Arrow |  | U+E082 | ![](/assets/images/concepts/emojis/touch/down_arrow.png) |
| Small Jump |  | U+E059 | ![](/assets/images/concepts/emojis/touch/smalljump.png) |
| Small Crouch |  | U+E05A | ![](/assets/images/concepts/emojis/touch/smallcrouch.png) |
| Small Fly Up |  | U+E05C | ![](/assets/images/concepts/emojis/touch/smallflyup.png) |
| Small Fly Down |  | U+E05D | ![](/assets/images/concepts/emojis/touch/smallflydown.png) |
| Small Left Arrow |  | U+E056 | ![](/assets/images/concepts/emojis/touch/smallleftarrow.png) |
| Small Right Arrow |  | U+E058 | ![](/assets/images/concepts/emojis/touch/smallrightarrow.png) |
| Small Up Arrow |  | U+E055 | ![](/assets/images/concepts/emojis/touch/smalluparrow.png) |
| Small Down Arrow |  | U+E057 | ![](/assets/images/concepts/emojis/touch/smalldownarrow.png) |
| Small Inventory |  | U+E05B | ![](/assets/images/concepts/emojis/touch/smallinventory.png) |
### Keyboard & Mouse
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ------------------ | ------------------------ | ------- | ------------------------------------------------------------------- |
| Left Click |  | U+E060 | ![](/assets/images/concepts/emojis/keyboard/left_click.png) |
| Right Click |  | U+E061 | ![](/assets/images/concepts/emojis/keyboard/right_click.png) |
| Middle Click |  | U+E062 | ![](/assets/images/concepts/emojis/keyboard/middle_click.png) |
| Small Left Click |  | U+E070 | ![](/assets/images/concepts/emojis/keyboard/small_left_click.png) |
| Small Right Click |  | U+E071 | ![](/assets/images/concepts/emojis/keyboard/small_right_click.png) |
| Small Middle Click |  | U+E072 | ![](/assets/images/concepts/emojis/keyboard/small_middle_click.png) |
| Small Mouse |  | U+E073 | ![](/assets/images/concepts/emojis/keyboard/small_mouse.png) |
### Xbox
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ------------------ | ------------------------ | ------- | ---------------------------------------------------------- |
| Y |  | U+E003 | ![](/assets/images/concepts/emojis/xbox/y_button.png) |
| B |  | U+E001 | ![](/assets/images/concepts/emojis/xbox/b_button.png) |
| A |  | U+E000 | ![](/assets/images/concepts/emojis/xbox/a_button.png) |
| X |  | U+E002 | ![](/assets/images/concepts/emojis/xbox/x_button.png) |
| Back |  | U+E008 | ![](/assets/images/concepts/emojis/xbox/back.png) |
| Start |  | U+E009 | ![](/assets/images/concepts/emojis/xbox/start.png) |
| LB (Left Bumper) |  | U+E004 | ![](/assets/images/concepts/emojis/xbox/left_bumper.png) |
| RB (Right Bumper) |  | U+E005 | ![](/assets/images/concepts/emojis/xbox/right_bumper.png) |
| LT (Left Trigger) |  | U+E006 | ![](/assets/images/concepts/emojis/xbox/left_trigger.png) |
| RT (Right Trigger) |  | U+E007 | ![](/assets/images/concepts/emojis/xbox/right_trigger.png) |
| LS (Left Stick) |  | U+E00A | ![](/assets/images/concepts/emojis/xbox/left_stick.png) |
| RS (Right Stick) |  | U+E00B | ![](/assets/images/concepts/emojis/xbox/right_stick.png) |
| D-pad Up |  | U+E00C | ![](/assets/images/concepts/emojis/xbox/dpad_up.png) |
| D-pad Right |  | U+E00F | ![](/assets/images/concepts/emojis/xbox/dpad_right.png) |
| D-pad Down |  | U+E00E | ![](/assets/images/concepts/emojis/xbox/dpad_down.png) |
| D-pad Left |  | U+E00D | ![](/assets/images/concepts/emojis/xbox/dpad_left.png) |
### Nintendo Switch
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ------------------ | ------------------------ | ------- | ------------------------------------------------------------ |
| X |  | U+E042 | ![](/assets/images/concepts/emojis/switch/x_button.png) |
| A |  | U+E040 | ![](/assets/images/concepts/emojis/switch/a_button.png) |
| B |  | U+E041 | ![](/assets/images/concepts/emojis/switch/b_button.png) |
| Y |  | U+E043 | ![](/assets/images/concepts/emojis/switch/y_button.png) |
| + |  | U+E049 | ![](/assets/images/concepts/emojis/switch/plus.png) |
| - |  | U+E048 | ![](/assets/images/concepts/emojis/switch/minus.png) |
| L (Left Bumper) |  | U+E044 | ![](/assets/images/concepts/emojis/switch/left_bumper.png) |
| R (Right Bumper) |  | U+E045 | ![](/assets/images/concepts/emojis/switch/right_bumper.png) |
| ZL (Left Trigger) |  | U+E046 | ![](/assets/images/concepts/emojis/switch/left_trigger.png) |
| RL (Right Trigger) |  | U+E047 | ![](/assets/images/concepts/emojis/switch/right_trigger.png) |
| L (Left Stick) |  | U+E04A | ![](/assets/images/concepts/emojis/switch/left_stick.png) |
| R (Right Stick) |  | U+E04B | ![](/assets/images/concepts/emojis/switch/right_stick.png) |
| D-pad Up |  | U+E04C | ![](/assets/images/concepts/emojis/switch/dpad_up.png) |
| D-pad Right |  | U+E04F | ![](/assets/images/concepts/emojis/switch/dpad_right.png) |
| D-pad Down |  | U+E04E | ![](/assets/images/concepts/emojis/switch/dpad_down.png) |
| D-pad Left |  | U+E04D | ![](/assets/images/concepts/emojis/switch/dpad_left.png) |
### PlayStation (4/5)
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ------------------ | ------------------------ | ------- | ----------------------------------------------------------------- |
| Triangle |  | U+E023 | ![](/assets/images/concepts/emojis/playstation/triangle.png) |
| Circle |  | U+E021 | ![](/assets/images/concepts/emojis/playstation/circle.png) |
| Cross |  | U+E020 | ![](/assets/images/concepts/emojis/playstation/cross.png) |
| Square |  | U+E022 | ![](/assets/images/concepts/emojis/playstation/square.png) |
| Options/Share |  | U+E029 | ![](/assets/images/concepts/emojis/playstation/options_share.png) |
| Touch Pad |  | U+E028 | ![](/assets/images/concepts/emojis/playstation/touch_pad.png) |
| L1 (Left Bumper) |  | U+E024 | ![](/assets/images/concepts/emojis/playstation/left_bumper.png) |
| R1 (Right Bumper) |  | U+E025 | ![](/assets/images/concepts/emojis/playstation/right_bumper.png) |
| L2 (Left Trigger) |  | U+E026 | ![](/assets/images/concepts/emojis/playstation/left_trigger.png) |
| R2 (Right Trigger) |  | U+E027 | ![](/assets/images/concepts/emojis/playstation/right_trigger.png) |
| L3 (Left Stick) |  | U+E02A | ![](/assets/images/concepts/emojis/playstation/left_stick.png) |
| R3 (Right Stick) |  | U+E02B | ![](/assets/images/concepts/emojis/playstation/right_stick.png) |
| D-pad Up |  | U+E02C | ![](/assets/images/concepts/emojis/playstation/dpad_up.png) |
| D-pad Right |  | U+E02F | ![](/assets/images/concepts/emojis/playstation/dpad_right.png) |
| D-pad Down |  | U+E02E | ![](/assets/images/concepts/emojis/playstation/dpad_down.png) |
| D-pad Left |  | U+E02D | ![](/assets/images/concepts/emojis/playstation/dpad_left.png) |
### Oculus (Rift/Rift S)
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ------------------ | ------------------------ | ------- | ------------------------------------------------------------ |
| 0 |  | U+E0E0 | ![](/assets/images/concepts/emojis/oculus/0_button.png) |
| B |  | U+E0E2 | ![](/assets/images/concepts/emojis/oculus/b_button.png) |
| A |  | U+E0E1 | ![](/assets/images/concepts/emojis/oculus/a_button.png) |
| Y |  | U+E0EA | ![](/assets/images/concepts/emojis/oculus/y_button.png) |
| X |  | U+E0E9 | ![](/assets/images/concepts/emojis/oculus/x_button.png) |
| LG (Left Grip) |  | U+E0E3 | ![](/assets/images/concepts/emojis/oculus/left_grip.png) |
| RG (Right Grip) |  | U+E0E4 | ![](/assets/images/concepts/emojis/oculus/right_grip.png) |
| LT (Left Trigger) |  | U+E0E7 | ![](/assets/images/concepts/emojis/oculus/left_trigger.png) |
| RT (Right Trigger) |  | U+E0E8 | ![](/assets/images/concepts/emojis/oculus/right_trigger.png) |
| LS (Left Stick) |  | U+E0E5 | ![](/assets/images/concepts/emojis/oculus/left_stick.png) |
| RS (Right Stick) |  | U+E0E6 | ![](/assets/images/concepts/emojis/oculus/right_stick.png) |
### Windows MR (Mixed Reality)
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ------------------------- | ------------------------ | ------- | --------------------------------------------------------------------------- |
| Menu |  | U+E0C2 | ![](/assets/images/concepts/emojis/windowsMR/menu.png) |
| Windows |  | U+E0CD | ![](/assets/images/concepts/emojis/windowsMR/windows.png) |
| Left Touchpad |  | U+E0C5 | ![](/assets/images/concepts/emojis/windowsMR/left_touchpad.png) |
| Left Horizontal Touchpad |  | U+E0C6 | ![](/assets/images/concepts/emojis/windowsMR/left_touchpad_horizontal.png) |
| Left Vertical Touchpad |  | U+E0C7 | ![](/assets/images/concepts/emojis/windowsMR/left_touchpad_vertical.png) |
| Right Touchpad |  | U+E0C8 | ![](/assets/images/concepts/emojis/windowsMR/right_touchpad.png) |
| Right Horizontal Touchpad |  | U+E0C9 | ![](/assets/images/concepts/emojis/windowsMR/right_touchpad_horizontal.png) |
| Right Vertical Touchpad |  | U+E0CA | ![](/assets/images/concepts/emojis/windowsMR/right_touchpad_vertical.png) |
| LT (Left Trigger) |  | U+E0CB | ![](/assets/images/concepts/emojis/windowsMR/left_trigger.png) |
| RT (Right Trigger) |  | U+E0CC | ![](/assets/images/concepts/emojis/windowsMR/right_trigger.png) |
| LG (Left Grab) |  | U+E0C0 | ![](/assets/images/concepts/emojis/windowsMR/left_grab.png) |
| RG (Right Grab) |  | U+E0C1 | ![](/assets/images/concepts/emojis/windowsMR/right_grab.png) |
| LS (Left Stick) |  | U+E0C3 | ![](/assets/images/concepts/emojis/windowsMR/left_stick.png) |
| RS (Right Stick) |  | U+E0C4 | ![](/assets/images/concepts/emojis/windowsMR/right_stick.png) |
### Other
| Name | Letter (Copy/Paste This) | Unicode | Image |
| ---------------- | ------------------------ | ------- | -------------------------------------------------------------- |
| Crosshair |  | U+E017 | ![](/assets/images/concepts/emojis/other/crosshair.png) |
| Agent |  | U+E103 | ![](/assets/images/concepts/emojis/other/agent.png) |
| Immersive Reader |  | U+E104 | ![](/assets/images/concepts/emojis/other/immersive_reader.png) |
| Hollow Star |  | U+E106 | ![](/assets/images/concepts/emojis/other/hollow_star.png) |
| Solid Star |  | U+E107 | ![](/assets/images/concepts/emojis/other/solid_star.png) |
## Custom Emoji
::: warning
This method is not officially supported. Use with caution on the Marketplace!
:::
To make a custom emoji, we use a very similar method to the pre-built emoji, except instead of using the Microsoft sprite-sheets, we overwrite them with our own! Some _character-slots_ are already used up with the emoji above, but there are blank slots we can use.
Please note that the following files have been annotated with slot information: If you use them directly, existing Emoji will have numbers added on top of them. If you need the original sprite-sheets, you can get them from the Vanilla Resources on your system (not included in the Vanilla Resource Pack downloads).
To get started, you should download the sprite-sheets, and move them into the fonts folder.
Two sprite-sheets are provided for each glyph-target: One that accurately reflects vanilla, and a second version which has been annotated with hex information, for easily finding the correct character.
### RP/font/glyph_E0.png
![](/assets/images/concepts/emojis/custom/annotated/glyph_E0.png)
![](/assets/images/concepts/emojis/custom/glyph_E0.png)
### RP/font/glyph_E1.png
![](/assets/images/concepts/emojis/custom/annotated/glyph_E1.png)
![](/assets/images/concepts/emojis/custom/glyph_E1.png)
Your filepath should look like this:
<FolderView
:paths="[
'RP',
'RP/font',
'RP/font/glyph_E0.png',
'RP/font/glyph_E1.png'
]"
></FolderView>
### Finding the correct hex.
Once you have emojis inside the `glyph_E0.png` or `glyph_E1.png` you need to find your character "code" so it can be converted.
The first two characters are always `0x`.
The next two characters are either `E0` or `E1`, depending on which file you added emojis to.
The next two characters are the position inside the image like `<row><column>`, where each character is a number in hexadecimal numeral system. You can find this number by referencing the images above. For example, the top-right square in `E0` is `0F`, and the bottom right is `FF`.
So after you are done, it might look like `0xE102` (`0x` + `E1` + `02`).
Copy this code into the following field, and press <kbd>Convert</kbd>. The symbol on the right-hand side can be copy/pasted into MC.
<div markdown="0">
<form>
<input id="hexValue" placeholder="Hex value" style="padding: 1em;margin: 0.5em;border-radius: 0.4rem; border: solid 1px rgb(38, 38, 38); outline: none;color: blue;"/>
<input id="result" placeholder="Result" readonly style="padding: 1em;margin: 0.5em;border-radius: 0.4rem; border: solid 1px rgb(38, 38, 38); outline: none;color: blue;"/>
<a onclick="document.getElementById('result').value = String.fromCodePoint(parseInt(document.getElementById('hexValue').value, 16))" style="text-decoration: none; color: white; background: rgb(91, 33, 182); padding: 0.5em; border-radius: 0.4em; cursor: pointer;">Convert</a>
</form>
</div>
### Glyph Separation Space
Sometimes, it appears that if you put 2 glyphs near to each other, there will be a couple of empty pixels between them. The only fix for it is to scale the glyph itself.

View File

@@ -0,0 +1,3 @@
---
title: Concepts
---

View File

@@ -0,0 +1,47 @@
---
title: Molang
tags:
- intermediate
mentions:
- yanasakana
- TheDoctor15
- MedicalJewel105
- DoubleShotgun
- Luthorius
- TheItsNameless
---
## Introduction
Pretty much everything evaluates to a number; if something doesn't evaluate to a number, you can use an `operator` to make it into one. You can basically just think of Molang as one big math equation.
An equation evaluates to `true` when any number except `0` is returned. When I reference `returning`, I'm talking about the output of an equation. There is also a `return` statement, but I don't usually use it, and will therefore not be talking about it.
## Accessing Values
There are three main ways to access and use values in Molang (queries, variables and temp variables)
- **Queries** are read only values returned by the game. You cannot set these values, only read them. (`query.example_query` | `q.example_query`)
- **Variables** are read and write values that you can manipulate, these can be set and read through Molang. (`variable.example_variable` | `v.example_variable`)
- There are also hard-coded variables which act practically the same way as queries, but can only be used in certain situations.
- **Temp. Variables** are practically the same as variables, except they only exist in the current scope. (`temp.example_temp` | `t.example_temp`)
- A "scope" can refer to the current `for_each` or `loop` *or* just the current expression, if it's not used within either
## Handling values
- **Logical Operators** can be used to convert non-numbers into 1s or 0s. These include: `==`, `!=`, `<`, `>`, `<=`, `>=`.
- Example.) "`q.get_equipped_item_name == 'stick'`" Will evaluate to `1`/`true` when holding a stick
- There is also a *second* set of *Logical Operators* which can be used to 'group' values into `and/or` statements, often used in cases where you need *multiple* things to evaluate to `true` or just *one out of many*. `&&` represents an `and` statement, and `||` represents an `or` statement.
- Example.) "`q.is_sneaking && q.is_using_item`" Will evaluate to `1`/`true` when sneaking *and* using an item
- Example.) "`q.is_sneaking || q.is_jumping`" // Evaluates to `1`/`true` when either jumping *or* sneaking
- **Parentheses**, `( )`, are also a major help when grouping values or performing math operations.
- Example.) "`q.is_sneaking && (q.get_equipped_item_name == "stick" || q.get_equipped_item_name == "diamond")`" Will evaluate to `1`/`true` when sneaking *and* holding either a stick *or* a diamond
- **Conditional Operators** can be used as `if/else` statements.
- A *binary* conditional operator refers to just using `?`. When this is used, it'll output your value or `0` depending on whether the given input value is `true`.
- Example.) "`q.is_sneaking ? 5`" Will output a `5` when sneaking, otherwise returning a `0`
- A *trinary* conditional operator refers to using `?` and `:`. When this is used, it'll output one of the two given values depending on whether your given input value is `true`.
- Example.) "`q.is_sneaking ? 10 : 3`" Will output a `10` when sneaking, otherwise returning a `3`

View File

@@ -0,0 +1,51 @@
---
title: Namespaces
mentions:
- SirLich
- MedicalJewel105
---
Namespaces are identifiers that mark content ownership. You can think of them as folders. Namespaces are helpful because they keep naming conflicts from happening.
Namespaces in addon creation can essentially be thought of as "the part to the left of the colon". For example, `minecraft` is the namespace of `minecraft:zombie`. The general form is `namespace:name`.
As a concrete example of why namespaces are helpful, let's imagine you create a new Mob. You name it `minecraft:shark`, not aware that you should create your own namespace for custom content. Next year, Mojang decides to add sharks into the game! Now there is a naming conflict since there are two definitions of `minecraft:shark`. Your addon will break.
If you had instead used `your_namespace:shark`, the naming conflict wouldn't have happened.
## Picking a namespace
A suitable namespace is unique to you. Something like `mob` or `cars` or `content` or `custom` would be a **bad** namespace since another developer might come up with the same namespace as you.
A suitable namespace is short. You will be writing your namespace a **LOT**, so the shorter, the better. `george_carlin_the_comedian` would be a lousy namespace for this reason.
For personal projects, I recommend a convenient version of your player name, and for commercial projects, I recommend a suitable version of the company name.
Some good examples:
- `gcarlin`
- `sirlich`
- `cubeworld`
- `bworks`
**DO NOT USE** `minecraft` or `minecon` as a namespace unless editing a vanilla file. Not only is it a terrible idea, but Minecraft reserves these, and it won't even work.
## Where to use namespaces?
In short, you should use namespaces as often as you can.
For starters, you should use a namespace when adding custom entities to the game.
`sirlich:shark` is much better than `shark`.
It would be best if you also used namespaces for components and events. Just like Mojang uses `minecraft:pig_saddled` you should use `namespace:my_mob_event`, and `namespace:my_component_group`.
It would be best if you also used namespaces in animation controllers, render controllers, and animations.
For example: `controller.animation.namespace.entity_name.action` is better than `controller.animation.my_action`.
## Where NOT to use namespaces.
The actual file structure does not need namespaces.
`animations/namespace/my_entity/animation` is more confusing than `animations/my_entity/animation`.

View File

@@ -0,0 +1,120 @@
---
title: Overwriting Assets
tags:
- intermediate
mentions:
- SirLich
- MedicalJewel105
- Luthorius
- SmokeyStack
---
## Addon Layering
The addon system is built layer by layer, where each pack is added _on top_ of the ones before it. Even if you only have a single pack added, there is an implicit _vanilla_ pack which is always added. When you add custom content, this content will have full access to all vanilla files.
### Accessing Vanilla Files
This layered structure is very useful, because it allows us to access the files inside of vanilla, without copy/pasting them into our addon. For example you can access `blocks/stone.png` without moving it into your addon! Just set it as the texture for your custom entity - it will work out of the box. This is particularly useful for things like models, or render controllers, or sounds.
If the vanilla assets change, for example if [JAPPA](https://twitter.com/JasperBoerstra?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor) updates the stone texture, your addon will also receive the update, since you are relying on the actual dynamic, vanilla resources.
You should try to use this system of layering as often as you can. If you don't *need* to copy/paste something into your addon, don't.
:::warning
It is never OK to make an addon inside of a copy of the vanilla resource/behavior pack. This will make the download for your addon incredibly huge, and will reduce performance. Always begin with a blank addon, then copy/paste the files you want to overwrite.
:::
## Overwriting Assets
Pack Layering also allows us to overwrite vanilla assets, by _overwriting_ them with a file that shares the same path, or the same identifier. Our new file will replace the one being used in vanilla, allowing us to change textures, sounds, entity behavior, etc.
:::warning
Different resources have different methods of overwriting, so be careful to use the right method for each type!
:::
### Overwriting by Path
Assets that are referenced by _path_, and do _not have an identifier_ can be overwritten by simply placing a new asset into the same path. The following can be overwritten in this way:
- Functions
- Loot tables
- Textures
- Sounds
- Trade Tables
When you overwrite these files, the overwriting is absolute: The new asset will fully replace the old asset.
:::tip
**Example**: If you would like to replace the redstone ore texture, simply place a new file at `textures/blocks/redstone_ore.png`.
:::
### Overwriting by Identifier
Many assets are defined not by their name, but by their identifier! To overwrite these assets, simply create a new file that shares the same identifier, regardless of file-path. The following can be overwritten in this way:
- BP Entities
- RP Entities
- Animations
- Models
- Animation Controllers
- Spawn Rules
- Recipes
- Particles
- Render Controllers
When you overwrite these files, the overwriting is absolute: The new asset will fully replace the old asset.
:::tip
**Example**: If you would like to make Ghasts have higher health, simply create a new BP entity with the `minecraft:ghast` identifier, and all the behaviors required to make the ghast function.
Remember, entity files do not merge together, so you will first need to copy/paste the entire BP Ghast file, and _then_ edit the health. Simply creating a `minecraft:ghast` with a high health component inside will not work.
:::
### Overwriting via Reference File
Many assets can also be registered into some kind of "registration system" file. These files are interesting, because unlike the other asset types, they are _merged together_ instead of _overwritten_. This means that when you define these files, you do not need to copy from the vanilla resources. You can simply start with a blank file, and then overwrite the specific definitions you want.
The following files work in this way:
- All UI files
- [All language files](/concepts/text-and-translations)
- `item_textures.json`
- `flipbook_textures.json`
- `terrain_textures.json`
- `sounds.json`
- `music_definitions.json`
- `sound_definitions.json`
:::tip
**Example:** Lets say you want to override the `sugar` texture, using the reference files. You can do so by creating a new `item_textures.json`, with the following contents:
<CodeHeader></CodeHeader>
```json
{
"resource_pack_name": "vanilla",
"texture_data": {
"sugar": {
"textures": "textures/path/to/my/sugar"
}
}
}
```
This _definition_ will be merged with the vanilla `item_textures.json`, and will override the short-name `sugar`. When the vanilla item accesses this short-name, it will get a reference to your custom texture path, instead of the actual texture path to sugar.
:::
## Overwriting Dangers
Since addons mostly _overwrite_ each other rather than _merge_, it can be very difficult to get two incompatible addons to work together. For example, if you try to combine two addons that overwrite the creeper behavior (for example, one makes them very fast, and one makes them very large) the addon you have applied _second_ will overwrite the first.
This is mostly a problem with `player.json` (in either the RP or the BP), since this file is often used for gameplay purposes.
## Things that Cannot be Overwritten
Not everything can be overwritten, the following is a list of things that cannot be overwritten using any of the described methods:
- Vanilla items (Not all)
- Vanilla blocks
- Vanilla fogs (create a fog with another namespace and change it everywhere it is used)

View File

@@ -0,0 +1,161 @@
---
title: Shaders
mentions:
- SirLich
- Dreamedc2015
- yanasakana
- MedicalJewel
- SIsilicon
---
:::warning
The shaders on this page are incompatible with [Render Dragon](https://help.minecraft.net/hc/en-us/articles/360052771272-About-the-1-16-200-Update-for-Windows-10-). That means that they will not work on Windows and Console devices past 1.16.200, nor other devices past 1.18.30!
:::
## Overview
Shaders are divided into 2 folders: `glsl` and `hlsl`. For shaders to work on every device,
you need to code shaders in both languages. For testing on Windows, `hlsl` is enough.
When rewriting shaders from one language to another, there are few things to change,
like HLSL `float3` is `vec3` in GLSL. Mapping between those languages can be found [here](https://anteru.net/blog/2016/mapping-between-HLSL-and-GLSL/)
## Materials
Vertex, fragments, and sometimes geometry shaders are combined with some options
as materials and are required for custom shaders. To create new material,
you need to create a file, which matches the name of the .material file in the vanilla resource pack.
For example: `materials/particles.material`. Materials support inheritance by adding parent
material after a colon. For example: `entity_alpha:entity_base`
### Common material definition fields
| **Field name** | **Description** | **Example value** | **Notes** |
| ---------------- | --------------------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `vertexShader` | Path to the shader relative to hlsl/glsl folder | | For HLSL shader, `.hlsl` suffix is added. |
| `fragmentShader` | Path to the shader relative to hlsl/glsl folder | | For HLSL shader, `.hlsl` suffix is added. |
| `vertexFields` | An array of fields passed to vertex shader | | It's better to copy this field from vanilla material. |
| `variants` | An array of objects, which define variants of the material | | It's better to copy this field from vanilla material. |
| `+defines` | An array of `#define` directives to add to the shader source | | Useful for reusing shader, but changing some minor setting. |
| `+states` | An array of states to enable | `["Blending", "DisableAlphaWrite", "DisableDepthWrite"]` | For OpenGL implementation, this is equivalent to [glEnable](https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glEnable.xml) call. |
| `-defines` | An array of `#defines` directives to remove from inherited `+defines` | | |
| `+samplerStates` | An array of objects, defining how texture at certain index is treated | `{ "samplerIndex": 0, "textureFilter": "Point" }` | `textureFilter` specifies how to sample the texture and `textureWrap` specifies the behavior, when accessing outside of the texture dimensions. |
| `msaaSupport` | Multisample anti-aliasing support | `Both` | |
| `blendSrc` | Specifies how the color source blending factors are computed | `One` | For OpenGL implementation, this is equivalent to [glBlendFunc](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBlendFunc.xhtml) call. |
| `blendDst` | Specifies how the color destination blending factors are computed | `One` | For OpenGL implementation, this is equivalent to [glBlendFunc](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBlendFunc.xhtml) call. |
Example:
<CodeHeader></CodeHeader>
```json
{
"materials": {
"version": "1.0.0",
"particle_debug": {
"vertexShader": "shaders/particle_generic.vertex",
"fragmentShader": "shaders/particle_debug.fragment",
"vertexFields": [
{ "field": "Position" },
{ "field": "Color" },
{ "field": "UV0" }
],
"+samplerStates": [
{
"samplerIndex": 0,
"textureFilter": "Point"
}
],
"msaaSupport": "Both"
}
}
}
```
For all the details about material files and possible field values, check [material file JSON schema](https://github.com/stirante/bedrock-shader-schema/blob/master/materials.schema.json).
## Troubleshooting
### Shader doesnt change
Every time there is a change in the shader, you need to restart Minecraft to recompile the shader completely.
### Compilation error
When there is a shader compilation error, a line number is usually specified where the error occurred. You need to check a few lines above the one set in error because Minecraft adds `#define` directives before compilation.
### Couldnt find constant buffer named: $Globals
I couldnt accurately find the actual cause of this error, but it seems to be somehow connected to global variables. Removing them (initializing them in the `main` function or changing them to `#define` directives) seems to fix the problem.
## Tips and tricks
### Passing variables to the shader
You can pass variables to the shader from a particle or an entity by changing entity color.
Input color is clamped to `<0.0, 1.0>`. To pass more significant values, you need to divide by max value (or at least some considerable number).
### Using time in shader
`TIME` variable is a number of seconds as `float` and is global for all shaders. For time-based on particle lifetime, you need to pass this:
<CodeHeader></CodeHeader>
```json
"minecraft:particle_appearance_tinting": {
"color": ["variable.particle_age/variable.particle_lifetime", 0, 0, 1]
}
```
Then in the shader, use `PSInput.color.r` as time, where `0.0` is particle birth and `1.0` is particle death.
### Camera direction towards the entity
For entity shaders, you can make the shader dependent on the camera direction towards the entity.
- Add to `PS_Input` in vertex and fragment shader new field
<CodeHeader></CodeHeader>
```
float3 viewDir: POSITION;
```
- After that, add to vertex shader this line
<CodeHeader></CodeHeader>
```
PSInput.viewDir = normalize((mul(WORLD, mul(BONES[VSInput.boneId], float4(VSInput.position, 1)))).xyz);
```
- In the fragment shader, use `PSInput.viewDir` to make changes depending on camera rotation
### Debugging values
The easiest way to debug a value is to turn it into color and render it like this.
<CodeHeader></CodeHeader>
```
PSOutput.color = float4(PSInput.uv, 0., 1.);
```
This should create a red-green gradient, showing that the values of `uv` are between `<0, 0>` and `<1, 1>`.
You can use the debug shader I wrote [based on this shader](http://mew.cx/drawtext/drawtext).
Right now, this shader will display values of the color passed to the shader. To display another value, change line 70 in hlsl shader to
<CodeHeader></CodeHeader>
```
int ascii = getFloatCharacter( cellIndex, <float4 vector here> );
```
GLSL version of debugging shader may crash Minecraft, use only for debugging.
[Download debug shader](http://files.stirante.com/debugShader.zip)
![](/assets/images/knowledge/shaders/debugShader.gif)

View File

@@ -0,0 +1,331 @@
---
title: Sounds
tags:
- intermediate
mentions:
- SirLich
- solvedDev
- Joelant05
- aexer0e
- MedicalJewel105
- Justash01
- DasEtwas
- TheItsNameless
- ThomasOrs
---
In bedrock, we can add custom sounds without overwriting any vanilla sounds. This is done by adding files to the resource pack.
:::tip
The best way to learn about sounds is by downloading and playing around with the default resource pack.
:::
### Folder Structure
There are two main files that we edit when we want to add sounds. Note how `sound_definition` is nested inside `sounds`.
Sound files themselves are added inside of the `sounds` folder, and can be any of the following formats.
<FolderView :paths="[
'RP/sounds.json',
'RP/sounds/sound_definitions.json',
'RP/sounds/example.wav',
'RP/sounds/example.ogg',
'RP/sounds/example.fsb',
]"></FolderView>
## sound_definitions.json
`sound_definitions.json` is where we define new sound short-names. This should be thought of as typing a `short-name` or `id` to a physical sound path. Here is an example, `sound_definitions.json`, that adds a new trumpet sound called `example.toot`:
<CodeHeader>RP/sounds/sound_definitions.json</CodeHeader>
```json
{
"format_version": "1.14.0",
"sound_definitions": {
"example.toot": {
"category": "neutral",
"sounds": ["sounds/trumpet"]
}
}
}
```
Sounds added in this way can be triggered using `/playsound`. Please note that `playsound` does not auto-correct, so you will need to be careful in your typing.
:::warning
New files referenced by file path, such as sounds, DO need a complete client restart to load. This means that if sounds don't work, you should restart your entire MC client rather than just reloading the world.
:::
### /playsound volume notes
The game will clamp the sound volume to at most 1.0 before multiplying it with the sound definition's volume.
For `/playsound`, the maximum hearable range of a sound is given by `min(max_distance, max(volume * 16, 16))`.
If `"max_distance"`is not given in the sound's definition, it is equivalent to `playsound_volume * 16`.
Approximate sound attenuation by distance. The actual graph might not be linear.
![](/assets/images/concepts/sounds/sound_graph.png)
Shown above is the approximate sound attenuation factor by distance **for playing sounds with a volume parameter greater than or equal to 1**. Notice how the playsound `<volume>` limits the sound's audible range.
The axis `distance` is the distance of the sound listener (player) to the sound source. The corresponding `volume` axis' value is the factor for the playsound volume capped to 1, multiplied by the sound definition's volume to get the final volume of the sound you hear. As an expression this could be written as: `final_volume = min(playsound_volume, 1) * graph_volume * sound_definition_volume`.
**Note:** Attenuation by distance of the hearable sound's volume is not affected by the volume parameter given in the command.
For example, `mob.ghast.affectionate_scream` sets `"min_distance": 100.0`, but can only be heard from at most 16 blocks away when using `/playsound` with volume 1 to play it. Specifying a greater volume value increases the audible range. When using a large enough volume to hear the sound farther away, the sound will get quieter only after a distance of more than 100.0.
To make a sound which can be heard far away but also drops in volume continuously over distance, one can add e.g. `"volume": 0.01`and use large `<volume>` values in the playsound command. The high value for the `/playsound` volume will produce a large audible range (e.g. a volume of 4 is 64 blocks as calculated above), while the low volume will prevent the played sound from capping at 1.0 too soon.
### Top Level Keys
In the example above, I showed two `top-level` fields: `category` and `sounds`. Sounds will be discussed in further detail below, but the other `top-level` keys will be discussed here:
#### Categories
Categories are used internally by the engine to decide how each sound is played. We can utilize different channels to get other effects.
| Category | Note |
| -------- | ----------------------------------------------- |
| weather | |
| block | |
| bucket | |
| bottle | |
| ui | Sounds in this category will ignore range limit |
| player | |
| hostile | |
| music | |
| record | |
| neutral | |
#### min_distance
The distance from the sound source after which sound volume is attenuated. Default value: 0.0. It must be a float (eg. 1.0), or the property will be ignored.
#### max_distance
The distance from the sound source after which the sound volume is the quietest (if in range). It must be a float (eg. 1.0), or the property will be ignored.
### Sound definitions
In the example above, I showed `sounds` as simply a list with a single path. This is good for simple sounds but does not have much power. For starts, I can add multiple sounds to the list. These sounds will be randomized when played:
<CodeHeader>RP/sounds/sound_definitions.json</CodeHeader>
```json
{
"format_version": "1.14.0",
"sound_definitions": {
"example.toot": {
"category": "neutral",
"sounds": [
"sounds/trumpet",
"sounds/trumpet2",
"sounds/trumpet3"
]
}
}
}
```
Additionally, we can define each sound as an object instead of a string. This allows us finer control and unlocks some new settings. The string/object style can be mixed and matched.
#### name
The path to the file, such as: `"sounds/music/game/creative/creative1"`
#### stream
Limits the sound only to be played a limited number of instances at a time. Will cause the game to not load the entire sound data into memory while playing, but rather in smaller parts while playing, thus using less memory. Good for improving performance on sound heavy worlds.
#### volume
How loud the sound should play, from `0.0` to `1.0`. Sounds cannot be made more audible than initially encoded. Set to `1.0` by default.
Sounds in custom resource packs can have working values greater than 1.0.
#### load_on_low_memory
Forces the loading of the sound even when nearing low memory. "load_on_low_memory" is now deprecated as of 1.16.0
#### pitch
The pitch of the sound (how low/high it sounds). Should be a positive value. For example, `2.3` will let the sound play 2.3 times as quickly and thus at higher pitch. Set to `1.0` by default.
#### is3D
`true` makes the sound directional. Set to `true` for all sounds by default. Ignored for `music` and `ui` sounds. Only sounds with `false` will play stereo sound.
#### interruptible
Set to `true` by default.
### weight
If there is more than one sound in the list, the sound to be played is chosen randomly. `"weight"` (integer value like 5) will give the relative chance that this sound is chosen from the list. For example, if there are two sounds in the list, one with `"weight": 10` and the other with `"weight": 2`, the first will be played approximately 5 times more likely than the second (accurately: `10 / (10 + 2) = 83.3%` chance vs. `2 / (10 + 2) = 16.7%` chance) . Set to `1` by default.
### Example
Here is a more realistic example containing these options:
<CodeHeader>RP/sounds/sound_definitions.json#sound_definitions</CodeHeader>
```json
"block.beehive.drip": {
"category": "block",
"max_distance": 8,
"sounds": [
{
"name": "sounds/block/beehive/drip1",
"load_on_low_memory": true
},
"sounds/block/beehive/drip2",
"sounds/block/beehive/drip3",
"sounds/block/beehive/drip4"
]
}
```
## sounds.json
If we want our sounds to run automatically, we can add them into the `sounds.json` file. This will tie the sound definitions directly to game events and cause them to play without needing to trigger with `/playsound`.
Sounds can be added into various categories:
| Category | Note |
| ----------------------- | -------------------------------------------------------------------------------- |
| individual_event_sounds | Contains sounds like beacon activation, chest-close, or explode |
| block_sounds | Contains hit, step, and break sounds for blocks |
| entity_sounds | Contains death, ambient, hurt, etc. sounds for entities (Including custom ones!) |
| interactive_sounds | WIP |
### Adding Entity Sounds
I assume that sounds can be added in other categories, but I personally only have experience adding sounds into the `entities` category. Entity sounds are automatically played at various points in the entities life-cycle.
Common events:
| Events | Note |
| ---------- | -------------------------------------------------------- |
| ambient | Played randomly, such as grunts, clucks, or ghast noises |
| hurt | Played when damaged |
| death | Played when it dies |
| step | Played when the entity moves along the ground |
| fall.big | For hitting the ground from a high height |
| fall.small | For hitting the ground from a low height |
| splash | For splashing in the water |
| attack | For melee attacking |
| shoot | For shooting projectiles |
There are also many sound events, which _most likely_ trigger automatically, but which I don't have details for, such as:
| Unknown Categories |
| ------------------ |
| breathe |
| splash |
| swim |
| ambient.in.water |
| death.in.water |
| jump |
| eat |
| hurt.in.water |
| mad |
| stare |
| sniff |
| sleep |
| spit |
| warn |
| scream |
### Example
<CodeHeader>RP/sounds.json</CodeHeader>
```json
{
"entity_sounds": {
"entities": {
"wiki:elephant": {
"volume": 1,
"pitch": [0.9, 1.0],
"events": {
"step": {
"sound": "elephant.step",
"volume": 0.18,
"pitch": 1.1
},
"ambient": {
"sound": "elephant.trumpet",
"volume": 0.11,
"pitch": 0.9
}
}
}
}
}
}
```
## Adding sounds to Animations
Sounds played in animations function based off of `short-name` definitions in the RP entity file.
This example shows playing a wing-flap sound, synced with an animation.
<CodeHeader>RP/entities/dragon.json#minecraft:client_entity/description</CodeHeader>
```json
"sound_effects": {
"wing_flap": "wiki.dragon.wing_flap" //where wiki.dragon.roar is a sound defined in sound_definitions
}
```
<CodeHeader>RP/animations/dragon.json#animations/animation.dragon.flying</CodeHeader>
```json
"sound_effects": {
"3.16": {
"effect": "wing_flap"
}
}
```
## Adding sounds to Animation Controllers
You can play sounds within animation controllers in a similar way that animations can be.
This example shows playing an explosion sound, synced using an animation controller.
<CodeHeader>RP/entities/custom_tnt.json#minecraft:client_entity/description</CodeHeader>
```json
"sound_effects": {
"explosion": "wiki.custom_tnt.explosion" //where wiki.custom_tnt.explosion is a sound defined in sound_definitions just like animation sounds.
}
```
<CodeHeader>RP/animation_controllers/custom_tnt.animation_controllers.json#controller.animation.custom_tnt</CodeHeader>
```json
"states":{
"default":{
"transitions":[
{
"explode_state":"q.mark_variant == 1"
}
]
},
"explode_state":{
"sound_effects":[
{
"effect":"explosion"
}
],
"transitions":[
{
"default":"q.mark_variant == 0"
}
]
}
}
```

View File

@@ -0,0 +1,95 @@
---
title: Subpacks
mentions:
- SirLich
- solvedDev
- Joelant05
- ChilRx
- SmokeyStack
- MedicalJewel105
- TheItsNameless
---
## What are Subpacks?
Subpacks allow you to select between different addon 'configurations'.
They are intended for texture resolutions to load on different memory capacities, but can also be used to create file variations in behavior and resource packs. These variations can be selected by clicking the gear icon and adjusting the slider.
## How do Subpacks work?
Files placed in you subpack folder will override files placed in your main addon folder, if the subpack is selected. For example, if your addon contains both `RP/textures/entities/ghost.png` and `RP/subpacks/pack_1/textures/ghost.png`, the second image file will replace the first, if subpack `pack_1` is selected.
For more information about how files override each other, please see our page on [overriding vanilla assets](/concepts/overwriting-assets).
## Creating Subpacks
- To start adding a subpack you need to create a `subpacks` folder inside the root of your `BP`/`RP`.
- Then inside the `subpacks` folder add a folder for each subpack you want to have
e.g.
<FolderView :paths="[
'RP/subpacks/subpack_1',
'RP/subpacks/subpack_2'
]"></FolderView>
- Inside each of these folders you can add the content of each subpack.
This can be anything that normally goes in your behavior or resource pack.
e.g.
<FolderView :paths="[
'RP/subpacks/subpack_1/textures/blocks/dirt.png',
'RP/subpacks/subpack_1/textures/items/example_item.png',
'RP/subpacks/subpack_2/textures/blocks/dirt.png',
'RP/subpacks/subpack_2/textures/items/example_item.png'
]"></FolderView>
## Manifest Part
To register the subpacks in the manifest you need to add `subpacks` and this contains an array of subpacks.
Example:
<CodeHeader>RP/manifest.json</CodeHeader>
```json
{
"format_version": 2,
"header": {
"name": "Pack Name",
"description": "Pack Description",
"uuid": "2fc2dd6f-86cb-4370-af70-21490a1ae471",
"version": [1, 0, 0],
"min_engine_version": [1, 13, 0]
},
"modules": [
{
"type": "resources",
"uuid": "f6821b4a-1854-44fc-a8a4-0c2847ffda46",
"version": [1, 0, 0]
}
],
"subpacks": [
{
"folder_name": "subpack_1",
"name": "First Subpack",
"memory_tier": 0
},
{
"folder_name": "subpack_2",
"name": "Second Subpack",
"memory_tier": 1
}
]
}
```
- `name` - name that will show when selecting subpacks.
- `memory_tier`- amount of RAM that device must have to enable this subpack. 1 memory tier = 0.25 GB.
- `folder_name` - name of the folder to be used for this subpack, for example in the examples above this would be `subpack_1` or `subpack_2`.
## Known Things
If you add only one subpack, there will be 2 options at the subpacks selection section, however second resolution (no subpack actually) does **not** make content in the root folder override subpacks.

View File

@@ -0,0 +1,156 @@
---
title: Text and Localization
mentions:
- ThijsHankelMC
- SirLich
- aexer0e
- MedicalJewel105
- Luthorius
- Fabrimat
- TheDoctor15
- Hatchibombotar
- ChibiMango
- SmokeyStack
- Sprunkles
---
Minecraft is a game with fully localized text in languages all over the world. To achieve this, Minecraft employs a system where internal **translation keys** are assigned values on a per-language basis. Minecraft will generate translation keys for custom entities, items, and blocks, and it is up to us to assign them a localized name in our resource pack.
## Language Files
### File Location
Language files typically go within the resource pack in the "texts" folder as files with the `.lang` file extension. These files can be placed in the behavior pack, but the only translatable text it can change is the pack manifest's name and description.
<FolderView :paths="[
'RP/texts/en_US.lang',
'RP/texts/languages.json',
'RP/manifest.json'
]"
></FolderView>
Minecraft supports 29 languages currently, as described in [§ Vanilla Languages](/concepts/text-and-translations#vanilla-languages).
### Format
The format for a language file is rather straightforward. Translations are supplied as key-value pairs separated by an equals sign (`=`), the key being a translation key and the value being a string. Values cannot contain newline characters.
```toml
wiki.example_translation.line_1=The first line!
wiki.example_translation.line_2=Some more information following the first line.
```
Comments may be added with two pound signs (`##`), either as line comments or in-line comments. All text after the pound signs are a comment until the next line.
:::warning
Trailing spaces are not trimmed for in-line comments. If you want to indent a comment, use the Tab character.
:::
```toml
## Translator note: I thought this would be funny to put here.
item.flint_and_steel.name=Flint and Steve ##[sic]
```
A translation can contain substitutions in place of text. Substitutions can either be ordered (`%1`, `%2`, etc.) or not ordered (`%s`). Vanilla translations have their values filled in by the game, while players can manually set the substitutions' values with commands that use the raw JSON text format, like with [`/tellraw`](/commands/tellraw).
```toml
commands.op.success=Opped: %s
immersive_reader.book_page_header=Page %1 of %2
```
### Usage
Localization can be done just about anywhere text can be used, including (but not limited to):
- Pack name and description
- Entity, item, or block names
- Pages in a book
- Lines on a sign
- `/tellraw` and `/titleraw` commands
- Text in dialogue
Some text cannot be translated however, such as for an item renamed in an anvil.
## Localization
:::tip
It is good practice create a copy of your language file for each major language your pack supports. For example, to support full English one should create both an `en_US.lang` and an `en_GB.lang` file, to cover English in both the United States and Great Britain countries, respectively.
:::
When editing language files one must also add a `languages.json` file in the `texts` folder containing an array with each of the languages you plan to change. This lets Minecraft know that it should apply localization for these languages.
<CodeHeader>RP/texts/languages.json</CodeHeader>
```json
[
"en_US",
"en_GB",
"fr_FR"
]
```
### Custom Languages
With a global resource pack, custom languages may be introduced through the `languages.json` and `language_names.json` files. Once the pack is applied globally the language can be changed in the "Language" tab of the in-game settings.
For the following examples, lets assume that we have 2 fully functional language files, one named `xx_XX.lang`, and another named `yy_YY.lang`.
<CodeHeader>RP/texts/languages.json</CodeHeader>
```json
[
"xx_XX",
"yy_YY"
]
```
`language_names.json` is an array as well, but this time to define the names to display for the languages.
<CodeHeader>RP/texts/language_names.json</CodeHeader>
```json
[
[ "xx_XX", "New Language (Custom Language #1)" ],
[ "yy_YY", "Wiki-Speak (Custom Language #2)" ]
]
```
:::warning
Whenever using a custom language, make sure to unequip the language before you disable the Resource Pack which it is stored in, or else Minecraft will crash.
:::
### Vanilla Languages
The following is a table of the 29 languages Minecraft supports by default.
| File ID | Language | Country |
| ---------- | --------------------- | -------------- |
| id_ID | Indonesian | Indonesia |
| da_DK | Danish | Denmark |
| de_DE | German | Germany |
| en_GB | English | Great Britain |
| en_US | English | North America |
| es_ES | Spanish | Spain |
| es_MX | Mexican Spanish | Mexico |
| fr_CA | Canadian French | Canada |
| fr_FR | French | France |
| it_IT | Italian | Italy |
| hu_HU | Hungarian | Hungary |
| nl_NL | Dutch | Netherlands |
| nb_NO | Bokmål | Norway |
| pl_PL | Polish | Poland |
| pt_BR | Brazilian Portuguese | Brazil |
| pt_PT | Portuguese | Portugal |
| sk_SK | Slovak | Slovakia |
| fi_FI | Finnish | Finland |
| sv_SE | Swedish | Sweden |
| tr_TR | Turkish | Turkey |
| cs_CZ | Czech | Czech Republic |
| el_GR | Greek | Greece |
| bg_BG | Bulgarian | Bulgaria |
| ru_RU | Russian | Russia |
| uk_UA | Ukrainian | Ukraine |
| ja_JP | Japanese | Japan |
| zh_CN | Chinese (Simplified) | China |
| zh_TW | Chinese (Traditional) | Taiwan |
| ko_KR | Korean | Korea |

View File

@@ -0,0 +1,43 @@
---
title: textures_list.json
mentions:
- SirLich
- solvedDev
- Joelant05
- AFoxyToast
- TheItsNameless
---
## General Overview
The `textures_list` file is Minecraft's way of *caching* each texture so that it can retrieve it faster than looking through each image in your textures folder. This is especially important when you have an abundance of textures, where Minecraft could potentially mess up and swap textures or even not load them at all. Minecraft tends to throw a content log _warning_ if you don't have the textures listed in the file. You can ignore it if you have a small amount, but it is recommended that you list the textures anyway.
## What textures can be used in the file?
Any texture! Any textures can and _should_ be used in the textures_list.json file for best practice and performance.
## File Structure
The structure is simple. The file itself is in `RP/textures` and is named `textures_list.json`. The file includes the file path to every texture you want in the file:
<CodeHeader>RP/textures/textures_list.json</CodeHeader>
```json
[
"textures/blocks/foo",
"textures/blocks/bar",
"textures/items/foo",
"textures/items/bar",
"textures/models/foo",
"textures/models/bar",
"textures/entity/foo",
"textures/entity/bar"
]
```
## Automating
If you have a lot of textures, this could obviously be tedious to go and list all the texture paths. In this case you can start to use [Regolith](https://bedrock-oss.github.io/regolith/) with its wonderful filters.