搬运一批Bedrock wiki内容,完善翻译
This commit is contained in:
70
docs/wiki/documentation/advanced-molang.md
Normal file
70
docs/wiki/documentation/advanced-molang.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
title: Advanced Molang
|
||||
toc_max_level: 2
|
||||
mentions:
|
||||
- Ciosciaa
|
||||
- TheItsNameless
|
||||
---
|
||||
|
||||
## Values
|
||||
|
||||
- All expressions in Molang return a value for the sake of checks against equality. Most expressions return `0`. Notably, assignments return the value assigned and loops return the resolved value of the looping statements, if one would exist.
|
||||
- All values in Molang are effectively single-precision floats.
|
||||
- `this` is used to refer to the field's current value as it accumulated during evaluation. It is only observed to be usable in animations, but it may be usable elsewhere. As an example, if the accumulated transformations on the `x` `scale` of a bone would yield `62`, a final animation with a `x` `scale` of `-this` would resolve to `-62`, unsetting the prior transformations. This is used in vanilla animations in a number of places. Outside of animation contexts, `this` appears to always resolve to `0`.
|
||||
|
||||
### Booleans
|
||||
|
||||
- Booleans are usable in Molang. `true` resolves to `1`, and `false` resolves to `0`.
|
||||
|
||||
### Numbers
|
||||
|
||||
- You can use leading `0`s in front of numbers, for example, to line them up better in your code.
|
||||
- Numbers can use exponential notation, such as `2.5e2`, which would be equal to 250. `e` can be suffixed with `+` or `-` to direct the power.
|
||||
- Numbers may be suffixed with a single `f`, often used to denote a floating point value. This can be found across vanilla code, but it is not believed to have any functionality.
|
||||
|
||||
### Strings
|
||||
|
||||
- Strings use `\` (`\\` in escaped JSON) as some sort of escape or perhaps something else. It is unknown what functionality this has. It is known that the subsequent 2 characters are handed off to their own sub-parser, which does not exit correctly on a closing `'`; this means the Molang string `"v.type = '\\x';"` is invalid. `'`, which is normally disallowed on its own as it would represent the end of the string, is allowed in the 2 characters following a `\`.
|
||||
- String values are (mostly) incremental as they are represented against floats. It is possible to compare 2 individual character strings using equality or comparison operators or even to effectively "adjust" the contents of a single-character string. Multi-character behavior of such is unknown.
|
||||
|
||||
## Operators
|
||||
|
||||
The complete precedence list, from first to last evaluated:
|
||||
|
||||
1. `()` and `[]`
|
||||
2. `->`
|
||||
3. `!` and `-` (unary negation)
|
||||
4. `*` and `/`
|
||||
5. `+` and `-` (binary subtraction)
|
||||
6. `<`, `<=`, `>`, and `>=`
|
||||
7. `==` and `!=`
|
||||
8. `&&`
|
||||
9. `||`
|
||||
10. `?` and `? :`
|
||||
11. `??`
|
||||
12. `=`
|
||||
13. `return`
|
||||
|
||||
- Operators are considered from left to right for all operators except the conditionals.
|
||||
- Multiple `->` cannot be used in the same statement.
|
||||
- Logical operators short-circuit.
|
||||
|
||||
## Statements
|
||||
|
||||
- Assignments return the value assigned. You can therefore chain assignments if you need separate variables to work with from a single value, such as with `v.iterator_x = (v.iterator_z = math.random_integer(16, 32));`.
|
||||
- The last statement inside a brace scope does not need to end with a `;`.
|
||||
- Brace scopes can be used anywhere an expression can be used. `v.spawn_point ?? {v.target = false;};`, for example, would set `v.target` to `false` if `v.spawn_point` were not defined.
|
||||
|
||||
## Collections
|
||||
|
||||
- Entity iterables (such as the result of `q.get_nearby_entities`) are their own "type". They are not compatible with subscripts.
|
||||
- Arrays, likewise, are not compatible with entity iterable operations, such as `q.count`.
|
||||
- The result of array subscripts cannot directly be an argument to `+`, `-`, `*`, or `/` but may still be used directly as function parameters (even math functions) or with other operators.
|
||||
|
||||
## Evaluation
|
||||
|
||||
- `initialize` and `pre_animation` are lazily concatenated. Molang strings in these arrays must be syntactically valid independently, but the basic concatenation of all independent strings must also be a valid Molang input.
|
||||
|
||||
## Limits
|
||||
|
||||
- Molang showed no reasonable limits to any language functionality, aside from numeric size. Loop counts, string lengths, Molang input length, collection size, etc., were observed to hold in very unreasonable situations.
|
||||
180
docs/wiki/documentation/creative-categories.md
Normal file
180
docs/wiki/documentation/creative-categories.md
Normal file
@@ -0,0 +1,180 @@
|
||||
---
|
||||
title: Menu Categories
|
||||
mentions:
|
||||
- Warhead51707
|
||||
- yanasakana
|
||||
- SirLich
|
||||
- SmokeyStack
|
||||
- MedicalJewel105
|
||||
- Chikorita-Lover
|
||||
- MiemieMethod
|
||||
- retr0cube
|
||||
- TheItsNameless
|
||||
- QuazChick
|
||||
---
|
||||
|
||||
Menu categories determine where items and blocks appear inside of the creative inventory and recipe book.
|
||||
|
||||
- A `category` can be defined to place the item under a tab (such as construction). Click [here](#list-of-categories) for a list of valid categories.
|
||||
|
||||
- A `group` specifies which expandable group the item is placed into. If you use a custom value, a new expandable group won't be created, however items with the group will be placed next to each other in the creative inventory. Click [here](#list-of-groups) for a list of expandable groups.
|
||||
|
||||
- You can also set `is_hidden_in_commands` to true to remove this block/item from commands, such as `/give` and `/setblock`.
|
||||
|
||||
If `menu_category` is omitted, the item will only be accessible through commands and won't appear in the creative inventory or recipe book.
|
||||
|
||||
**NOTE:** The menu category of custom spawn eggs cannot be modified. You must instead create a custom item with the `minecraft:entity_placer` component.
|
||||
|
||||
<CodeHeader></CodeHeader>
|
||||
|
||||
```json
|
||||
"menu_category": {
|
||||
"category": "construction", // Tab the item is placed under
|
||||
"group": "itemGroup.name.door", // Optional - Group the item is placed into
|
||||
"is_hidden_in_commands": false // Optional - default is false (item is usable in commands)
|
||||
}
|
||||
```
|
||||
|
||||
:::danger HIDDEN ITEMS INACCESSIBLE IN COMMANDS ([MCPE-177866](https://bugs.mojang.com/browse/MCPE-177866))
|
||||
Currently, setting the category to "none" in a custom item (not block) prevents the item from being used in commands, overriding the "is_hidden_in_commands" option. This issue doesn't affect blocks.
|
||||
:::
|
||||
|
||||
## Block Example
|
||||
|
||||
<CodeHeader>BP/blocks/balsa_wood.json</CodeHeader>
|
||||
|
||||
```json
|
||||
{
|
||||
"format_version": "1.20.50",
|
||||
"minecraft:block": {
|
||||
"description": {
|
||||
"identifier": "wiki:balsa_wood",
|
||||
"menu_category": {
|
||||
"category": "nature",
|
||||
"group": "itemGroup.name.wood" // Placed into an expandable group
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Item Example
|
||||
|
||||
<CodeHeader>BP/items/dagger.json</CodeHeader>
|
||||
|
||||
```json
|
||||
{
|
||||
"format_version": "1.20.50",
|
||||
"minecraft:item": {
|
||||
"description": {
|
||||
"identifier": "wiki:dagger",
|
||||
"menu_category": {
|
||||
"category": "equipment",
|
||||
"is_hidden_in_commands": true // Item cannot be used in commands
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## List of Categories
|
||||
|
||||
_For use with `menu_category` parameter, `category`._
|
||||
|
||||
| Category | Description |
|
||||
| ------------ | -------------------------------------------------------- |
|
||||
| construction | Added to the "Contruction" tab. |
|
||||
| equipment | Added to the "Equipment" tab. |
|
||||
| items | Added to the "Items" tab. |
|
||||
| nature | Added to the "Nature" tab. |
|
||||
| none | Not added to a tab and only accessible through commands. |
|
||||
|
||||
## List of Groups
|
||||
|
||||
_For use with the `menu_category` parameter, `group`._
|
||||
|
||||
<!-- page_dumper_start -->
|
||||
| Creative Categories: |
|
||||
| --------------------------------- |
|
||||
| itemGroup.name.anvil |
|
||||
| itemGroup.name.arrow |
|
||||
| itemGroup.name.axe |
|
||||
| itemGroup.name.banner |
|
||||
| itemGroup.name.banner_pattern |
|
||||
| itemGroup.name.bed |
|
||||
| itemGroup.name.boat |
|
||||
| itemGroup.name.boots |
|
||||
| itemGroup.name.buttons |
|
||||
| itemGroup.name.candles |
|
||||
| itemGroup.name.chalkboard |
|
||||
| itemGroup.name.chest |
|
||||
| itemGroup.name.chestboat |
|
||||
| itemGroup.name.chestplate |
|
||||
| itemGroup.name.concrete |
|
||||
| itemGroup.name.concretePowder |
|
||||
| itemGroup.name.cookedFood |
|
||||
| itemGroup.name.copper |
|
||||
| itemGroup.name.coral |
|
||||
| itemGroup.name.coral_decorations |
|
||||
| itemGroup.name.crop |
|
||||
| itemGroup.name.door |
|
||||
| itemGroup.name.dye |
|
||||
| itemGroup.name.enchantedBook |
|
||||
| itemGroup.name.fence |
|
||||
| itemGroup.name.fenceGate |
|
||||
| itemGroup.name.firework |
|
||||
| itemGroup.name.fireworkStars |
|
||||
| itemGroup.name.flower |
|
||||
| itemGroup.name.glass |
|
||||
| itemGroup.name.glassPane |
|
||||
| itemGroup.name.glazedTerracotta |
|
||||
| itemGroup.name.goatHorn |
|
||||
| itemGroup.name.grass |
|
||||
| itemGroup.name.hanging_sign |
|
||||
| itemGroup.name.helmet |
|
||||
| itemGroup.name.hoe |
|
||||
| itemGroup.name.horseArmor |
|
||||
| itemGroup.name.leaves |
|
||||
| itemGroup.name.leggings |
|
||||
| itemGroup.name.lingeringPotion |
|
||||
| itemGroup.name.log |
|
||||
| itemGroup.name.minecart |
|
||||
| itemGroup.name.miscFood |
|
||||
| itemGroup.name.mobEgg |
|
||||
| itemGroup.name.monsterStoneEgg |
|
||||
| itemGroup.name.mushroom |
|
||||
| itemGroup.name.netherWartBlock |
|
||||
| itemGroup.name.ore |
|
||||
| itemGroup.name.permission |
|
||||
| itemGroup.name.pickaxe |
|
||||
| itemGroup.name.planks |
|
||||
| itemGroup.name.potion |
|
||||
| itemGroup.name.potterySherds |
|
||||
| itemGroup.name.pressurePlate |
|
||||
| itemGroup.name.rail |
|
||||
| itemGroup.name.rawFood |
|
||||
| itemGroup.name.record |
|
||||
| itemGroup.name.sandstone |
|
||||
| itemGroup.name.sapling |
|
||||
| itemGroup.name.sculk |
|
||||
| itemGroup.name.seed |
|
||||
| itemGroup.name.shovel |
|
||||
| itemGroup.name.shulkerBox |
|
||||
| itemGroup.name.sign |
|
||||
| itemGroup.name.skull |
|
||||
| itemGroup.name.slab |
|
||||
| itemGroup.name.smithing_templates |
|
||||
| itemGroup.name.splashPotion |
|
||||
| itemGroup.name.stainedClay |
|
||||
| itemGroup.name.stairs |
|
||||
| itemGroup.name.stone |
|
||||
| itemGroup.name.stoneBrick |
|
||||
| itemGroup.name.sword |
|
||||
| itemGroup.name.trapdoor |
|
||||
| itemGroup.name.walls |
|
||||
| itemGroup.name.wood |
|
||||
| itemGroup.name.wool |
|
||||
| itemGroup.name.woolCarpet |
|
||||
|
||||
*Last updated for 1.20.10*
|
||||
<!-- page_dumper_end -->
|
||||
106
docs/wiki/documentation/file-types.md
Normal file
106
docs/wiki/documentation/file-types.md
Normal file
@@ -0,0 +1,106 @@
|
||||
---
|
||||
title: File Types
|
||||
max_toc_level : 3
|
||||
mentions:
|
||||
- Ciosciaa
|
||||
- SirLich
|
||||
---
|
||||
|
||||
A number of file types exist for *Minecraft*, all for importing content. All *Minecraft* files are ZIP archives renamed to use a `mc…` extension. These archives can currently be divided into three sets:
|
||||
|
||||
- **Levels (`mcworld` and `mcproject`)**: level data and associated resources for worlds and projects
|
||||
- **Assets (`mcpack` and `mctemplate`)**: cosmetics or supporting assets for worlds
|
||||
- **Composites (`mcaddon` and `mceditoraddon)`**: used to import up to one world or project and any number of asset types
|
||||
|
||||
All file types for Minecraft can be opened as any file, launching Minecraft and importing the content. When packages are imported, they are automatically unpacked into their constituent files and directories. If it was not already open, most file types will launch Minecraft in normal mode; `mcproject` and `mceditoraddon` will instead launch Minecraft into Editor mode.
|
||||
|
||||
# Levels
|
||||
Levels represent save data and resources for regular worlds and Editor projects. All levels, regardless of mode, are imported to `minecraftWorlds` in the `com.mojang` directory.
|
||||
|
||||
Importing an exact duplicate of an existing saved level will create a duplicate saved level. Composite archives will only import one level if multiple are included, including across nested composite archives.
|
||||
|
||||
## Worlds
|
||||
`mcworld`
|
||||
Archive encapsulating an individual world
|
||||
|
||||
World archives can be created a few different ways:
|
||||
- Zipping the *contents* of a world directory and renaming the extension from `zip` to `mcworld`
|
||||
- Using the "Export World" button on the Game settings screen for a world
|
||||
- In Editor mode, exporting the world from the File → Export as → Playable world menu option. The world will be saved to the `projectbackups` directory in the `com.mojang` folder.
|
||||
- In Editor mode, running the `/project export world` command. The world will be saved to the `projectbackups` directory in the `com.mojang` folder.
|
||||
|
||||
Importing a world package while *Minecraft* is launched in Editor mode will import the world as a project. The imported world will then be inaccessible outside Editor mode and will need to be re-exported as a world for playing. Editor extension packs bundled in a world archive will be retained on import outside Editor mode.
|
||||
|
||||
## Projects
|
||||
`mcproject`
|
||||
Archive encapsulating an individual Editor project
|
||||
|
||||
Project archives can be created two different ways:
|
||||
- Zipping the *contents* of a project directory and renaming the extension from `zip` to `mcproject`.
|
||||
- Using the "Export Project" button on the Game settings screen for a world
|
||||
- In Editor mode, running the `/project export project` command. The world will be saved to the `projectbackups` directory in the `com.mojang` folder.
|
||||
|
||||
If *Minecraft* is not open, launching a `mcproject` file will open Editor mode. Importing a `mcproject` will fail if *Minecraft* is open but not in Editor mode.
|
||||
|
||||
# Assets
|
||||
Asset archives represent a singular instance of a number of non-level contents:
|
||||
|
||||
- Behavior packs
|
||||
- Resource packs
|
||||
- Skin packs
|
||||
- World templates
|
||||
|
||||
All asset archives include a manifest describing their contents. An asset archive will fail to import if its manifest UUID and version exactly matches an existing asset archive of the same type. Note that behavior and resource packs share the same UUID/version space. Behavior and resource packs self-contained within a world, project, or template will not count as duplicates for the sake of importing.
|
||||
|
||||
Both asset extensions, `mcpack` and `mctemplate`, appear to functionally behave the same. It's best practice to use `mcpack` for behavior, resource, and skin packs and `mctemplate` for world templates to make it more clear what's being installed. Any number of asset archives may be included in a composite archive.
|
||||
|
||||
## Packs
|
||||
`mcpack`
|
||||
Package representing an individual behavior pack, resource pack, skin pack, or world template. It's recommended only to use `mctemplate` for behavior packs, resource packs, or skin packs.
|
||||
|
||||
Packs are only created manually, by zipping the contents of a behavior pack, resource pack, or skin pack directory and renaming the extension from `zip` to `mcpack`. Behavior and resource packs are installed globally and do not conflict with matching behavior or resource packs installed in worlds, projects, or templates.
|
||||
|
||||
### Behavior Packs
|
||||
Behavior packs are attached to servers to change or extend gameplay. Behavior packs are installed to the `behavior_packs` directory in the `com.mojang` folder.
|
||||
|
||||
Development behavior packs must be placed in the `development_behavior_packs` directory under `com.mojang` manually.
|
||||
|
||||
### Resource Packs
|
||||
Resource packs are attached to clients to affect sounds, visuals, etc. Resource packs are installed to the `resource_packs` directory in the `com.mojang` folder.
|
||||
|
||||
Development resource packs must be placed in the `development_resource_packs` directory under `com.mojang` manually.
|
||||
|
||||
### Skin Packs
|
||||
Skin packs are client-only packs for custom skins. Skin packs are installed to the `skin_packs` directory in the `com.mojang` folder.
|
||||
|
||||
Development skin packs must be placed in the `development_skin_packs` directory under `com.mojang` manually, but this feature appears non-functional.
|
||||
|
||||
## World Templates
|
||||
`mctemplate`
|
||||
Package representing an individual behavior pack, resource pack, skin pack, or world template. It's recommended only to use `mctemplate` for world templates.
|
||||
|
||||
World templates are installed to the `world_templates` directory under `com.mojang`. World templates can be constructed in a few different ways:
|
||||
- Zipping the *contents* of a world directory, adding a world template manifest, and renaming the extension from `zip` to `mctemplate`
|
||||
- In Editor mode, using the "Export Template" button on the Game settings screen for a world
|
||||
- In Editor mode, running the `/project export template` command. The world will be saved to the `projectbackups` directory in the `com.mojang` folder.
|
||||
|
||||
# Composites
|
||||
Composite archives are used to import up to *one* level archive and any number or combination of asset archives in a single import action. In general, contents to a composite must be packaged. Directories can also be given *on the top level* of a composite archive for importing asset types (behavior packs, resource packs, skin packs, and world templates) without needing to pre-package them. Nested sub-directories for organization may not be used.
|
||||
|
||||
Composite contents are treated as usual. For example, importing a `mcaddon` contianing a `mcworld` while in Editor mode will import the world as a project.
|
||||
|
||||
Composite archives may also contain any number or nesting of other composite archives, even across *Minecraft* modes. Nested composite archives cannot be used to get around the singular world import restriction.
|
||||
|
||||
Composites can only be constructed manually by zipping archives and asset types.
|
||||
|
||||
## Add-Ons
|
||||
`mcaddon`
|
||||
Generic composite content archive
|
||||
|
||||
Importing a `mcaddon` package while *Minecraft* is launched in Editor mode will import any contained world as a project. The imported world will then be inaccessible outside Editor mode and will need to be re-exported as a world for playing. Asset types are imported as usual.
|
||||
|
||||
## Editor Add-Ons
|
||||
`mceditoraddon`
|
||||
Composite content archive for Editor mode
|
||||
|
||||
If *Minecraft* is not open, launching a `mcproject` file will open Editor mode. Importing a `mcproject` will fail if *Minecraft* is open but not in Editor mode.
|
||||
163
docs/wiki/documentation/fog-ids.md
Normal file
163
docs/wiki/documentation/fog-ids.md
Normal file
@@ -0,0 +1,163 @@
|
||||
---
|
||||
title: Fog IDs
|
||||
mentions:
|
||||
- SirLich
|
||||
- MedicalJewel105
|
||||
- TheItsNameless
|
||||
---
|
||||
|
||||
## By Element X
|
||||
|
||||
| ID | Note |
|
||||
| ---------------------------------------------- | -------------------------------------------------------------------------------- |
|
||||
| minecraft:fog_bamboo_jungle | Fog used in the bamboo jungle. |
|
||||
| minecraft:fog_bamboo_jungle_hills | Fog used in the bamboo jungle hills. |
|
||||
| minecraft:fog_basalt_deltas | Fog used in the basalt deltas. Adds a gray-red tint to the edge of the sky |
|
||||
| minecraft:fog_beach | Fog used in the beach biome. |
|
||||
| minecraft:fog_birch_forest | Fog used in the birch forest |
|
||||
| minecraft:fog_birch_forest_hills | Fog used in the birch forest hills biome. |
|
||||
| minecraft:fog_cold_beach | Fog used in the cold beach biome. |
|
||||
| minecraft:fog_cold_ocean | Fog used in the cold ocean biome. |
|
||||
| minecraft:fog_cold_taiga | Fog used in the cold taiga biome. |
|
||||
| minecraft:fog_cold_taiga_hills | Fog used in the cold taiga hills biome. |
|
||||
| minecraft:fog_cold_taiga_mutated | Fog used in the mutated cold taiga biome. |
|
||||
| minecraft:fog_crimson_forest | Fog used in the crimson forest biome. Adds a red tint to the edge of the sky |
|
||||
| minecraft:fog_deep_cold_ocean | Fog used in the deep cold ocean biome. |
|
||||
| minecraft:fog_deep_frozen_ocean | Fog used in the deep frozen ocean biome. |
|
||||
| minecraft:fog_deep_lukewarm_ocean | Fog used in the deep lukewarm ocean biome. |
|
||||
| minecraft:fog_deep_ocean | Fog used in the deep ocean biome. |
|
||||
| minecraft:fog_deep_warm_ocean | Fog used in the deep warm ocean biome. |
|
||||
| minecraft:fog_default | Default fog used in the game. |
|
||||
| minecraft:fog_desert | Fog used in the desert biome. |
|
||||
| minecraft:fog_desert_hills | Fog used in the desert hills biome. |
|
||||
| minecraft:fog_extreme_hills | Fog used in the extreme hills biome. |
|
||||
| minecraft:fog_extreme_hills_edge | Fog used in the extreme hills edge biome. |
|
||||
| minecraft:fog_extreme_hills_mutated | Fog used in the mutated extreme hills biome. |
|
||||
| minecraft:fog_extreme_hills_plus_trees | Fog used in the extreme hills with trees biome. |
|
||||
| minecraft:fog_extreme_hills_plus_trees_mutated | Fog used in the mutated extreme hills with trees biome. |
|
||||
| minecraft:fog_flower_forest | Fog used in the flower forest biome. |
|
||||
| minecraft:fog_forest | Fog used in the forest biome. |
|
||||
| minecraft:fog_forest_hills | Fog used in the forest hills biome. |
|
||||
| minecraft:fog_frozen_ocean | Fog used in the frozen ocean biome. |
|
||||
| minecraft:fog_frozen_river | Fog used in the frozen river biome. |
|
||||
| minecraft:fog_hell | Fog used in the nether wastes biome. Adds a red tint to the edge of the sky |
|
||||
| minecraft:fog_ice_mountains | Fog used in the ice mountains biome. |
|
||||
| minecraft:fog_ice_plains | Fog used in the ice plains biome. |
|
||||
| minecraft:fog_ice_plains_spikes | Fog used in the ice spikes biome. |
|
||||
| minecraft:fog_jungle | Fog used in the jungle biome. |
|
||||
| minecraft:fog_jungle_edge | Fog used in the jungle edge biome. |
|
||||
| minecraft:fog_jungle_hills | Fog used in the jungle hills biome. |
|
||||
| minecraft:fog_jungle_mutated | Fog used in the mutated jungle biome. |
|
||||
| minecraft:fog_lukewarm_ocean | Fog used in the lukewarm ocean biome. |
|
||||
| minecraft:fog_mega_spruce_taiga | Fog used in the mega spruce taiga biome. |
|
||||
| minecraft:fog_mega_spruce_taiga_mutated | Fog used in the mega spruce mutated taiga biome. |
|
||||
| minecraft:fog_mega_taiga | Fog used in the mega taiga biome. |
|
||||
| minecraft:fog_mega_taiga_hills | Fog used in the mega taiga hills biome. |
|
||||
| minecraft:fog_mega_taiga_mutated | Fog used in the mega mutated taiga biome. |
|
||||
| minecraft:fog_mesa | Fog used in the mesa biome. |
|
||||
| minecraft:fog_mesa_bryce | Fog used in the mesa bryce biome. |
|
||||
| minecraft:fog_mesa_mutated | Fog used in the mutated mesa biome. |
|
||||
| minecraft:fog_mesa_plateau | Fog used in the mesa plateau biome. |
|
||||
| minecraft:fog_mesa_plateau_stone | Fog used in the stone mesa plateau biome. |
|
||||
| minecraft:fog_mushroom_island | Fog used in the mushroom island biome. |
|
||||
| minecraft:fog_mushroom_island_shore | Fog used in the mushroom island shore biome. |
|
||||
| minecraft:fog_ocean | Fog used in the ocean biome. |
|
||||
| minecraft:fog_plains | Fog used in the plains biome. |
|
||||
| minecraft:fog_river | Fog used in the river biome. |
|
||||
| minecraft:fog_roofed_forest | Fog used in the roofed forest biome. |
|
||||
| minecraft:fog_savanna | Fog used in the savanna biome. |
|
||||
| minecraft:fog_savanna_mutated | Fog used in the mutated savanna biome. |
|
||||
| minecraft:fog_savanna_plateau | Fog used in the savanna plateau biome. |
|
||||
| minecraft:fog_soulsand_valley | Fog used in the soulsand valley biome. Adds a dark green tint to the sky |
|
||||
| minecraft:fog_stone_beach | Fog used in the stone beach biome. |
|
||||
| minecraft:fog_sunflower_plains | Fog used in the sunflower plains biome. |
|
||||
| minecraft:fog_swampland | Fog used in the swamp biome. |
|
||||
| minecraft:fog_swampland_mutated | Fog used in the mutated swamp biome. |
|
||||
| minecraft:fog_taiga | Fog used in the taiga biome. |
|
||||
| minecraft:fog_taiga_hills | Fog used in the taiga hills biome. |
|
||||
| minecraft:fog_taiga_mutated | Fog used in the mutated taiga hills biome. |
|
||||
| minecraft:fog_the_end | Fog used in the end biome. Adds a black tint to the edge of the sky |
|
||||
| minecraft:fog_warm_ocean | Fog used in the warm ocean biome. |
|
||||
| minecraft:fog_warped_forest | Fog used in the warped forest biome. Adds a dark red tint to the edge of the sky |
|
||||
|
||||
[Original Credit](https://www.youtube.com/watch?time_continue=52&v=SA79ulIgypg&feature=emb_logo)
|
||||
|
||||
|
||||
## Auto-generated
|
||||
|
||||
<!-- page_dumper_start -->
|
||||
| ID | Biome used in |
|
||||
| ---------------------------------------------- | -------------------------------- |
|
||||
| minecraft:fog_bamboo_jungle | bamboo_jungle |
|
||||
| minecraft:fog_bamboo_jungle_hills | bamboo_jungle_hills |
|
||||
| minecraft:fog_basalt_deltas | basalt_deltas |
|
||||
| minecraft:fog_beach | beach |
|
||||
| minecraft:fog_birch_forest | birch_forest |
|
||||
| minecraft:fog_birch_forest_hills | birch_forest_hills |
|
||||
| minecraft:fog_cherry_grove | cherry_grove |
|
||||
| minecraft:fog_cold_beach | cold_beach |
|
||||
| minecraft:fog_cold_ocean | cold_ocean |
|
||||
| minecraft:fog_cold_taiga | cold_taiga |
|
||||
| minecraft:fog_cold_taiga_hills | cold_taiga_hills |
|
||||
| minecraft:fog_cold_taiga_mutated | cold_taiga_mutated |
|
||||
| minecraft:fog_crimson_forest | crimson_forest |
|
||||
| minecraft:fog_deep_cold_ocean | deep_cold_ocean |
|
||||
| minecraft:fog_deep_frozen_ocean | deep_frozen_ocean |
|
||||
| minecraft:fog_deep_lukewarm_ocean | deep_lukewarm_ocean |
|
||||
| minecraft:fog_deep_ocean | deep_ocean |
|
||||
| minecraft:fog_deep_warm_ocean | deep_warm_ocean |
|
||||
| minecraft:fog_default | default |
|
||||
| minecraft:fog_desert | desert |
|
||||
| minecraft:fog_desert_hills | desert_hills |
|
||||
| minecraft:fog_extreme_hills | extreme_hills |
|
||||
| minecraft:fog_extreme_hills_edge | extreme_hills_edge |
|
||||
| minecraft:fog_extreme_hills_mutated | extreme_hills_mutated |
|
||||
| minecraft:fog_extreme_hills_plus_trees | extreme_hills_plus_trees |
|
||||
| minecraft:fog_extreme_hills_plus_trees_mutated | extreme_hills_plus_trees_mutated |
|
||||
| minecraft:fog_flower_forest | flower_forest |
|
||||
| minecraft:fog_forest | forest |
|
||||
| minecraft:fog_forest_hills | forest_hills |
|
||||
| minecraft:fog_frozen_ocean | frozen_ocean |
|
||||
| minecraft:fog_frozen_river | frozen_river |
|
||||
| minecraft:fog_hell | hell |
|
||||
| minecraft:fog_ice_mountains | ice_mountains |
|
||||
| minecraft:fog_ice_plains | ice_plains |
|
||||
| minecraft:fog_ice_plains_spikes | ice_plains_spikes |
|
||||
| minecraft:fog_jungle | jungle |
|
||||
| minecraft:fog_jungle_edge | jungle_edge |
|
||||
| minecraft:fog_jungle_hills | jungle_hills |
|
||||
| minecraft:fog_jungle_mutated | jungle_mutated |
|
||||
| minecraft:fog_lukewarm_ocean | lukewarm_ocean |
|
||||
| minecraft:fog_mangrove_swamp | mangrove_swamp |
|
||||
| minecraft:fog_mega_spruce_taiga | mega_spruce_taiga |
|
||||
| minecraft:fog_mega_spruce_taiga_mutated | mega_spruce_taiga_mutated |
|
||||
| minecraft:fog_mega_taiga | mega_taiga |
|
||||
| minecraft:fog_mega_taiga_hills | mega_taiga_hills |
|
||||
| minecraft:fog_mega_taiga_mutated | mega_taiga_mutated |
|
||||
| minecraft:fog_mesa | mesa |
|
||||
| minecraft:fog_mesa_bryce | mesa_bryce |
|
||||
| minecraft:fog_mesa_mutated | mesa_mutated |
|
||||
| minecraft:fog_mesa_plateau | mesa_plateau |
|
||||
| minecraft:fog_mesa_plateau_stone | mesa_plateau_stone |
|
||||
| minecraft:fog_mushroom_island | mushroom_island |
|
||||
| minecraft:fog_mushroom_island_shore | mushroom_island_shore |
|
||||
| minecraft:fog_ocean | ocean |
|
||||
| minecraft:fog_plains | plains |
|
||||
| minecraft:fog_river | river |
|
||||
| minecraft:fog_roofed_forest | roofed_forest |
|
||||
| minecraft:fog_savanna | savanna |
|
||||
| minecraft:fog_savanna_mutated | savanna_mutated |
|
||||
| minecraft:fog_savanna_plateau | savanna_plateau |
|
||||
| minecraft:fog_soulsand_valley | soulsand_valley |
|
||||
| minecraft:fog_stone_beach | stone_beach |
|
||||
| minecraft:fog_sunflower_plains | sunflower_plains |
|
||||
| minecraft:fog_swampland | swampland |
|
||||
| minecraft:fog_swampland_mutated | swampland_mutated |
|
||||
| minecraft:fog_taiga | taiga |
|
||||
| minecraft:fog_taiga_hills | taiga_hills |
|
||||
| minecraft:fog_taiga_mutated | taiga_mutated |
|
||||
| minecraft:fog_the_end | the_end |
|
||||
| minecraft:fog_warm_ocean | warm_ocean |
|
||||
| minecraft:fog_warped_forest | warped_forest |
|
||||
*Last updated for 1.20.10*
|
||||
<!-- page_dumper_end -->
|
||||
3
docs/wiki/documentation/index.md
Normal file
3
docs/wiki/documentation/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
title: Documentation
|
||||
---
|
||||
618
docs/wiki/documentation/material-config-description.md
Normal file
618
docs/wiki/documentation/material-config-description.md
Normal file
@@ -0,0 +1,618 @@
|
||||
---
|
||||
title: Material Configuration Description
|
||||
tags:
|
||||
- expert
|
||||
mentions:
|
||||
- MedicalJewel105
|
||||
- SmokeyStack
|
||||
---
|
||||
|
||||
:::warning
|
||||
Materials are not for the faint of heart. Be prepared for potential crashes, content log errors, and long loading times.
|
||||
:::
|
||||
|
||||
## Foreword
|
||||
|
||||
This article is translated from https://mc.163.com/dev/mcmanual/mc-dev/mcguide/ - It is provided by Netease, the developers of china edition. The article will introduce the structure and configuration of the material file in detail.
|
||||
|
||||
## Material files
|
||||
|
||||
We will explain the material files of native Microsoft. First of all, the files under the directory are basically files with the suffix ".material". In addition, there are three important json files, namely common. json, fancy.json, sad.json.
|
||||
|
||||
Let's take a look at sad.json and fancy.json first. They are used to control the image quality performance. Each of them defines a list of material files. fancy.json usually defines several more material files than sad.json and may Some additional macros have been added to some material files, and the shader can do special processing by judging these macros:
|
||||
|
||||
<CodeHeader>sad.json</CodeHeader>
|
||||
|
||||
```json
|
||||
[
|
||||
{"path":"materials/sad.material"},
|
||||
{"path":"materials/entity.material"},
|
||||
{"path":"materials/terrain.material"},
|
||||
{"path":"materials/portal.material"},
|
||||
{"path":"materials/barrier.material"},
|
||||
{"path":"materials/wireframe.material"}
|
||||
]
|
||||
```
|
||||
|
||||
<CodeHeader>fancy.json</CodeHeader>
|
||||
|
||||
```json
|
||||
[
|
||||
{"path":"materials/fancy.material", "+defines":["FANCY"]},
|
||||
{"path":"materials/entity.material", "+defines":["FANCY"]},
|
||||
{"path":"materials/terrain.material", "+defines":["FANCY"]},
|
||||
{"path":"materials/hologram.material"},
|
||||
{"path":"materials/portal.material", "+defines":["FANCY"]},
|
||||
{"path":"materials/barrier.material"},
|
||||
{"path":"materials/wireframe.material"}
|
||||
]
|
||||
```
|
||||
|
||||
It can be seen that fancy.json defines more fancy.material and hologram.material material files than sad.json, and also defines FANCY macros for multiple material files. The switch of in-game settings/video/exquisite texture is to control the switch between sad and fancy. When the fancy texture switch is turned on, the material file in fancy.json will take effect, and when it is turned off, the material file in sad.json will take effect.
|
||||
|
||||
In order to achieve better performance, the material files in fancy.json usually have more complex operations, while the materials in sad.json usually sacrifice a little rendering performance in exchange for better performance. If developers need to write more complex shaders, it is recommended to write a low-cost version at the same time, and then define them in fancy and sad respectively. Let the player control whether to turn on the corresponding effect through the exquisite texture option in the game.
|
||||
|
||||
<CodeHeader>common.json</CodeHeader>
|
||||
|
||||
```json
|
||||
[
|
||||
{"path":"materials/particles.material"},
|
||||
{"path":"materials/shadows.material"},
|
||||
{"path":"materials/sky.material"},
|
||||
{"path":"materials/ui.material"},
|
||||
{"path":"materials/ui3D.material"},
|
||||
{"path":"materials/portal.material"},
|
||||
{"path":"materials/barrier.material"},
|
||||
{"path":"materials/wireframe.material"}
|
||||
]
|
||||
```
|
||||
|
||||
Compared with sad and fancy, they can be switched between each other. The material files defined in common.json will be loaded after entering the game. Material files are not loaded except those declared in common.json, sad.json, fancy.json.
|
||||
|
||||
## Material syntax
|
||||
|
||||
We use one of the material files entity.material to explain, open the file, we can see that the file starts with materials, and then defines the version number version as 1.0.0, these are fixed formats, which identify the parsing of this material file way, we can temporarily ignore it and not modify it.
|
||||
|
||||
You can see that the definition of each field in the material is in the form of a key-value pair, for example:
|
||||
|
||||
```json
|
||||
[
|
||||
"vertexShader": "shaders/entity.vertex",
|
||||
]
|
||||
```
|
||||
|
||||
The left side of the colon represents the key as vertexShader, and the right side represents the value shaders/entity.vertex;
|
||||
|
||||
There are also definitions in list form:
|
||||
|
||||
```json
|
||||
[
|
||||
"vertexFields": [
|
||||
{ "field": "Position" },
|
||||
{ "field": "Normal" },
|
||||
{ "field": "UV0" }
|
||||
],
|
||||
]
|
||||
```
|
||||
|
||||
The declaration with the symbol [ ] is a list, and then inside is the json definition of each child element.
|
||||
|
||||
## Overview of all property fields of the material
|
||||
|
||||
### Render state
|
||||
|
||||
#### `states`
|
||||
|
||||
Configure the rendering environment, which can have the following values:
|
||||
|
||||
- `EnableAlphaToCoverage`:An order-independent rendering method for translucent objects. This switch is only useful in environments that support MSAA. When enabled, the edges of objects will be more accurately softened and transitioned according to the transparency. It can also be used for some complex scenes with a large number of meshes overlapping.
|
||||
|
||||
- `Wireframe`: Draw wireframe mode
|
||||
|
||||
- `Blending`: Enables color blending mode, often used to render translucent objects. After declaring this, it is usually necessary to declare the blending factor blendSrc, blendDst
|
||||
|
||||
- `DisableColorWrite`: Do not write color values to the color buffer, none of the RGBA channels are written
|
||||
|
||||
- `DisableAlphaWrite`: Do not write transparency alpha values to the color buffer, allow RGB values to be written
|
||||
|
||||
- `DisableRGBWrite`: Do not write transparency RGB values to the color buffer, allow writing alpha values
|
||||
|
||||
- `DisableDepthTest`: Turn off depth testing
|
||||
|
||||
- `DisableDepthWrite`: Turn off depth writing
|
||||
|
||||
- `DisableCulling`: Render front and back simultaneously
|
||||
|
||||
- `InvertCulling`:Use front cropping. The default is back cropping. After declaring this, the back side is rendered and the front side is cropped.
|
||||
|
||||
- `StencilWrite`: Enable stencil mask writing
|
||||
|
||||
- `EnableStencilTest`: Enable stencil mask testing
|
||||
|
||||
|
||||
### Shader path
|
||||
|
||||
#### `vertexShader`
|
||||
|
||||
The path to the vertex shader, usually shaders/XXX.vertex.
|
||||
|
||||
#### `vrGeometryShader` or `geometryShader`
|
||||
|
||||
The path of the geometry shader, usually shaders/XXX.geometry, is not used on the mobile side, and does not need to be modified.
|
||||
|
||||
#### `fragmentShader`
|
||||
|
||||
The path to the fragment shader, usually shaders/XXX.fragment.
|
||||
|
||||
### Shader macro definition
|
||||
|
||||
#### `defines`
|
||||
|
||||
Define macros for the shaders used. For code reuse, we use the same shader for many different materials. At this time, if you want to execute different logic somewhere in the shader according to the current material, you can judge it through the macro declared by the material defines. We can use the material entity_for_skeleton as an illustration. Here we can see that three macros USE_SKINNING, USE_OVERLAY, and NETEASE_SKINNING are defined.
|
||||
|
||||
```json
|
||||
"entity_for_skeleton": {
|
||||
"vertexShader": "shaders/entity.vertex",
|
||||
"vrGeometryShader": "shaders/entity.geometry",
|
||||
"fragmentShader": "shaders/entity.fragment",
|
||||
"+defines": [ "USE_SKINNING", "USE_OVERLAY", "NETEASE_SKINNING" ],
|
||||
"vertexFields": [
|
||||
{ "field": "Position" },
|
||||
{ "field": "Normal" },
|
||||
{ "field": "BoneId0" },
|
||||
{ "field": "UV0" }
|
||||
],
|
||||
"msaaSupport": "Both",
|
||||
"+samplerStates": [
|
||||
{
|
||||
"samplerIndex": 0,
|
||||
"textureFilter": "Point"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Looking at the vertex shader entity.vertex, there will be #ifdef, #else, #endif to judge the macro and execute different logic branches. These judgment statements of the macro are processed at compile time, unlike the if in the traditional shader. Else, the logic branch processed at compile time will not be generated in actual operation, and the performance will not be degraded due to the branch. In addition, it can be seen below that macros can also make multi-layer judgments. First, judge the NETEASE_SKINNING macro, and then judge the LARGE_VERTEX_SHADER_UNIFORMS macro in the internal execution logic:
|
||||
|
||||
```glsl
|
||||
#ifdef NETEASE_SKINNING
|
||||
MAT4 boneMat = transpose(mat3x4ToMat4(BONES_70[int(BONEID_0)]));
|
||||
entitySpacePosition = boneMat * POSITION;
|
||||
entitySpaceNormal = boneMat * NORMAL;
|
||||
#else
|
||||
#if defined(LARGE_VERTEX_SHADER_UNIFORMS)
|
||||
entitySpacePosition = BONES[int(BONEID_0)] * POSITION;
|
||||
entitySpaceNormal = BONES[int(BONEID_0)] * NORMAL;
|
||||
#else
|
||||
entitySpacePosition = BONE * POSITION;
|
||||
entitySpaceNormal = BONE * NORMAL;
|
||||
#endif
|
||||
#endif
|
||||
```
|
||||
|
||||
### Runtime state
|
||||
|
||||
#### Depth test
|
||||
|
||||
##### `depthFunc`
|
||||
|
||||
The depth detection pass function can use the following values:
|
||||
|
||||
- `Always`: Always pass
|
||||
|
||||
- `Equal`: Passed when the depth value is equal to the buffer value
|
||||
|
||||
- `NotEqual`:Passed when the depth value is not equal to the buffer value
|
||||
|
||||
- `Less`:Passed when the depth value is less than the buffer value
|
||||
|
||||
- `Greater`:Passed when the depth value is greater than the buffer value
|
||||
|
||||
- `GreaterEqual`:Pass when the depth value is greater than or equal to the buffer value
|
||||
|
||||
- `LessEqual`:Pass when the depth value is less than or equal to the buffer value
|
||||
|
||||
Associated states rendering environment configuration:
|
||||
|
||||
- `DisableDepthTest`: Turn off depth testing
|
||||
|
||||
- `DisableDepthWrite`: Turn off depth writing
|
||||
|
||||
#### Stencil Mask Test
|
||||
|
||||
##### `stencilRef`
|
||||
|
||||
Value to compare with or to be written to the mask buffer
|
||||
|
||||
##### `stencilRefOverride`
|
||||
|
||||
Whether to use the buffer's current value as stencilRef, 0 or 1 is supported:
|
||||
|
||||
- `1`: Use the configured stencilRef. If stencilRef is configured, stencilRefOverride will automatically take 1
|
||||
|
||||
- `0`: Use the current value of the buffer as stencilRef, in this case do not configure stencilRef
|
||||
|
||||
##### `stencilReadMask`
|
||||
|
||||
The mask buffer value and the stencilRef value are bit-ANDed with stencilReadMask before being compared
|
||||
|
||||
##### `stencilWriteMask`
|
||||
|
||||
The stencilRef value is bit-ANDed with stencilWriteMask before being written to the mask buffer
|
||||
|
||||
##### `frontFace` and `backFace`
|
||||
|
||||
Configure which mask test function to use on the front or back of the grid. In addition, the order of judgment is mask detection first, then depth detection. You need to configure the following operations:
|
||||
|
||||
<!-- Test if this looks ok -->
|
||||
|
||||
- `stencilFunc`: The method used when stencilRef is compared with the mask buffer, the following values are supported:
|
||||
- `Always`: Always pass
|
||||
- `Equal`: Passed when stencilRef is equal to the buffer value
|
||||
- `NotEqual` :Passed when stencilRef is not equal to the buffer value
|
||||
- `Less`:Passed when stencilRef is less than the buffer value
|
||||
- `Greater`:Passed when stencilRef is greater than the buffer value
|
||||
- `GreaterEqual`:Passed when stencilRef is greater than or equal to the buffer value
|
||||
- `LessEqual`:Passed when stencilRef is less than or equal to the buffer value
|
||||
|
||||
- `stencilFailOp`:The processing performed when the stencilFunc comparison function fails to return, supports the following values:
|
||||
- `Keep`: Keep the original value of the buffer
|
||||
- `Replace`: Writes the stencilRef bit and the value of stencilWriteMask to the buffer
|
||||
|
||||
- `stencilDepthFailOp` : The stencilFunc comparison function returns success, but the processing performed when the depth test fails, supports the following values:
|
||||
- `Keep`: Keep the original value of the buffer
|
||||
- `Replace`: Writes the stencilRef bit and the value of stencilWriteMask to the buffer
|
||||
|
||||
- `stencilPassOp`: The stencilFunc comparison function returns successfully, and the processing executed when the depth test is successful, supports the following values:
|
||||
- `Keep`: Keep the original value of the buffer
|
||||
- `Replace`: Writes the stencilRef bit and the value of stencilWriteMask to the buffer
|
||||
|
||||
Associated states rendering environment configuration:
|
||||
|
||||
- `StencilWrite`:Enable mask writing
|
||||
|
||||
- `EnableStencilTest`: Enable mask testing
|
||||
|
||||
Finally, let's look at an example:
|
||||
|
||||
```json
|
||||
"shadow_back": {
|
||||
"+states": [
|
||||
"StencilWrite",
|
||||
"DisableColorWrite",
|
||||
"DisableDepthWrite",
|
||||
"InvertCulling",
|
||||
"EnableStencilTest"
|
||||
],
|
||||
|
||||
"vertexShader": "shaders/position.vertex",
|
||||
"vrGeometryShader": "shaders/position.geometry",
|
||||
"fragmentShader": "shaders/flat_white.fragment",
|
||||
|
||||
"frontFace": {
|
||||
"stencilFunc": "Always",
|
||||
"stencilFailOp": "Keep",
|
||||
"stencilDepthFailOp": "Keep",
|
||||
"stencilPassOp": "Replace"
|
||||
},
|
||||
|
||||
"backFace": {
|
||||
"stencilFunc": "Always",
|
||||
"stencilFailOp": "Keep",
|
||||
"stencilDepthFailOp": "Keep",
|
||||
"stencilPassOp": "Replace"
|
||||
},
|
||||
|
||||
"stencilRef": 1,
|
||||
"stencilReadMask": 255,
|
||||
"stencilWriteMask": 1,
|
||||
|
||||
"vertexFields": [
|
||||
{ "field": "Position" }
|
||||
],
|
||||
"msaaSupport": "Both"
|
||||
}
|
||||
```
|
||||
|
||||
In the example, StencilWrite represents the support for writing to the mask buffer, EnableStencilTest represents the opening of the mask test, and the configuration of frontFace represents that the mask test always passes when the front face is rendered. If the depth test fails, the buffer value remains unchanged. If it also passes, the stencil bit and the value of stencilWriteMask will be written to the buffer, that is, 1 & 1 = 1 value. The configuration of backFace is also similar.
|
||||
|
||||
#### Blend translucent object color blend
|
||||
|
||||
The rendering of translucent objects needs to configure the blending factor. The final output rgb color value = current color value * source blending factor + color value in buffer * destination blending factor
|
||||
|
||||
##### `blendSrc`
|
||||
|
||||
source mix factor
|
||||
|
||||
##### `blendDst`
|
||||
|
||||
target blending factor
|
||||
|
||||
##### `alphaSrc`
|
||||
|
||||
The source blending factor when calculating alpha, usually not configured to take the default value
|
||||
|
||||
##### `alphaDst`
|
||||
|
||||
The target blending factor when calculating alpha, usually not configured to take the default value
|
||||
|
||||
In total, the blending factor can take on the following values:
|
||||
|
||||
- `DestColor`: Buffer color value
|
||||
|
||||
- `SourceColor`: Current color value
|
||||
|
||||
- `Zero`: (0,0,0)
|
||||
|
||||
- `One`: (1,1,1)
|
||||
|
||||
- `OneMinusDestColor`: (1,1,1) - buffer color value
|
||||
|
||||
- `OneMinusSrcColor`: (1,1,1) - current color value
|
||||
|
||||
- `SourceAlpha`: The alpha value in the current color
|
||||
|
||||
- `DestAlpha`: Alpha value in buffer color
|
||||
|
||||
- `OneMinusSrcAlpha`: 1 - alpha value in the current color value
|
||||
|
||||
In the engine, the default is:
|
||||
|
||||
- `blendSrc`:SourceAlpha
|
||||
|
||||
- `blendDst`:OneMinusSrcAlpha
|
||||
|
||||
- `alphaSrc`:One
|
||||
|
||||
- `alphaDst`:OneMinusSrcAlpha
|
||||
|
||||
Associated states rendering environment configuration:
|
||||
|
||||
- `Blending`: Enables color blending mode, often used to render translucent objects. After declaring this, it is usually necessary - to declare the blending factor blendSrc, blendDst
|
||||
|
||||
- `DisableColorWrite`: Do not write color values to the color buffer, none of the RGBA channels are written
|
||||
|
||||
- `DisableAlphaWrite`: Do not write transparency alpha values to the color buffer, allow RGB values to be written
|
||||
|
||||
- `DisableRGBWrite`: Do not write transparency RGB values to the color buffer, allow writing alpha values
|
||||
|
||||
#### Sample texture sample
|
||||
|
||||
##### `samplerStates`
|
||||
|
||||
Configure the sampling state, the value is a list, and configure each texture according to the number of textures to be sampled. Usually, if UV0 and UV1 are declared in the vertex attribute, it means that two textures need to be sampled, and two elements need to be configured here. Let's look at the definition of child elements:
|
||||
|
||||
```json
|
||||
{
|
||||
"samplerIndex": 0,
|
||||
"textureFilter": "Point",
|
||||
"textureWrap": "Repeat"
|
||||
}
|
||||
```
|
||||
|
||||
Each property is defined as follows:
|
||||
|
||||
##### `samplerIndex`
|
||||
|
||||
Number, representing the attribute of the texture that is currently being set, starting from 0
|
||||
|
||||
##### `textureFilter`
|
||||
|
||||
Texture filtering mode (default is Point), when the actual displayed texture map is enlarged or reduced compared to the original image, the mapping relationship between the new resolution map and the pixels on the original resolution map can have the following values:
|
||||
|
||||
|
||||
- `Point`: Point sampling
|
||||
|
||||
- `Bilinear`: Bilinear sampling
|
||||
|
||||
- `Trilinear`: Trilinear sampling
|
||||
|
||||
- `MipMapBilinear`: MipMap bilinear sampling
|
||||
|
||||
- `TexelAA`:Texel antialiasing (not supported on all devices, not recommended)
|
||||
|
||||
- `PCF`:Sampling by comparison function (not supported on all devices, not recommended)
|
||||
|
||||
##### `textureWrap`
|
||||
|
||||
Texture wrapping mode, which controls what kind of texture should be sampled when uv is outside [0,1]. It can have the following values:
|
||||
|
||||
- `Repeat`: Repeat, that is, modulo the value to [0, 1] for sampling
|
||||
|
||||
- `Clamp`: Edge sampling, sampling the value of the closest edge, that is, if 1.1 is closer to 1, then take 1; if -0.1 is closer to 0, then take 0.
|
||||
|
||||
|
||||
#### Vertex
|
||||
|
||||
##### `vertexFields`
|
||||
|
||||
Vertex attributes, which are used to declare what attributes each vertex of the mesh that is rendered using this material holds. It is determined when the art is producing resources. The following values may be used:
|
||||
|
||||
- `Position`: Model space coordinates
|
||||
|
||||
- `Color`: Color
|
||||
|
||||
- `Normal`: Normal
|
||||
|
||||
- `UV0`: Texture sample coordinates
|
||||
|
||||
- `UV1`:Texture sample coordinates
|
||||
|
||||
- `UV2`:Texture sample coordinates
|
||||
|
||||
- `BoneId0`: Bone ID, used in the bone model
|
||||
|
||||
#### Rasterizer environment configuration
|
||||
|
||||
##### `msaaSupport`
|
||||
|
||||
Configure MSAA (Multi-Sample Anti-Aliasing) support (the default in the engine is NonMSAA)
|
||||
|
||||
- `NonMSAA`: Materials are allowed when MSAA is not enabled
|
||||
|
||||
- `MSAA`: Materials are allowed when MSAA is enabled
|
||||
|
||||
- `Both`:Materials are allowed with or without MSAA enabled. Usually just use this value.
|
||||
|
||||
|
||||
##### `depth offset`
|
||||
|
||||
Depth offset is mainly used to solve the z-fighting problem, that is, when two objects have similar depths, some frames may display this object and some frames display another object when rendering. The principle of depth offset is to offset one of the objects in the direction of large or small depth, so that their depths are no longer the same. The following four variables can be configured:
|
||||
|
||||
- depthBias
|
||||
|
||||
- slopeScaledDepthBias
|
||||
|
||||
- depthBiasOGL
|
||||
|
||||
- slopeScaledDepthBiasOGL
|
||||
|
||||
The specific offset depth is:
|
||||
|
||||
`offset = (slopeScaledDepthBias * m) + (depthBias * r)`
|
||||
|
||||
On the OGL platform it is:
|
||||
|
||||
`offset = (slopeScaledDepthBiasOGL * m) + (depthBiasOGL * r)`
|
||||
|
||||
m is the maximum value in the slope of the depth of the polygon (computed at the rasterization stage). The more parallel a polygon is to the near clipping plane, the closer m is to 0. r is the smallest value that produces a discernible difference in depth values in the window coordinate system, and r is a constant specified by the platform that implements OpenGL.
|
||||
|
||||
Associated states rendering environment configuration:
|
||||
|
||||
- `Wireframe`: Draw wireframe mode
|
||||
|
||||
- `DisableCulling`: Render front and back simultaneously
|
||||
|
||||
- `InvertCulling`:Use front cropping. The default is back cropping. After declaring this, the back side is rendered and the front - side is cropped.
|
||||
|
||||
#### Primitive
|
||||
|
||||
##### `primitiveMode`
|
||||
|
||||
Primitive rendering mode (the default in the engine is TriangleList):
|
||||
|
||||
- `None`: Do not render, normally not used
|
||||
|
||||
- `QuadList`:Quadrilateral pattern
|
||||
|
||||
- `TriangleList`: A pattern of drawing a triangle every three vertices, for example the first triangle uses vertices v0, v1, v2, and the second uses v3, v4, v5
|
||||
|
||||
- `TriangleStrip`: Each vertex will form a triangle with the first two vertices, the structure is a bit more complicated, but it - will save the amount of data
|
||||
|
||||
- `LineList`: Draw a line segment every two vertices
|
||||
|
||||
- `Line`: Each vertex forms a line segment with a vertex that appears before it.
|
||||
|
||||
### Material variant
|
||||
|
||||
#### `variants`
|
||||
|
||||
Useful for quickly implementing multiple sub-materials based on most of the same definitions. See the actual example of entity_static below:
|
||||
|
||||
```json
|
||||
"entity_static": {
|
||||
"vertexShader": "shaders/entity.vertex",
|
||||
"vrGeometryShader": "shaders/entity.geometry",
|
||||
"fragmentShader": "shaders/entity.fragment",
|
||||
"vertexFields": [
|
||||
{ "field": "Position" },
|
||||
{ "field": "Normal" },
|
||||
{ "field": "UV0" }
|
||||
],
|
||||
"variants": [
|
||||
{
|
||||
"skinning": {
|
||||
"+defines": [ "USE_SKINNING" ],
|
||||
"vertexFields": [
|
||||
{ "field": "Position" },
|
||||
{ "field": "BoneId0" },
|
||||
{ "field": "Normal" },
|
||||
{ "field": "UV0" }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"skinning_color": {
|
||||
"+defines": [ "USE_SKINNING", "USE_OVERLAY" ],
|
||||
"+states": [ "Blending" ],
|
||||
"vertexFields": [
|
||||
{ "field": "Position" },
|
||||
{ "field": "BoneId0" },
|
||||
{ "field": "Color" },
|
||||
{ "field": "Normal" },
|
||||
{ "field": "UV0" }
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"msaaSupport": "Both",
|
||||
"+samplerStates": [
|
||||
{
|
||||
"samplerIndex": 0,
|
||||
"textureFilter": "Point"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Variants are declarations of material variants. The above declarations declare two sub-variants, skinning and skinning_color. Some external fields are rewritten in the sub-variants. In actual use, it is equivalent to quickly defining two materials. The body and the variant are connected with a dot ".". The two materials are entity_static.skinning and entity_static.skinning_color.
|
||||
|
||||
In addition, if there are other materials that inherit from entity_static, such as entity_dynamic, this material will also inherit these two variants, entity_dynamic.skinning and entity_dynamic.skinning_color.
|
||||
|
||||
## Material Merge Rules
|
||||
|
||||
When the same material is declared in different directory files, it will be merged according to the following rules after loading: 1. Normally, the material fields of the files loaded later will overwrite the previously loaded ones. 2. The following fields are special. Operations to add attributes with "+" and delete attributes with "-" are supported:
|
||||
|
||||
- defines
|
||||
- states
|
||||
- samplerStates
|
||||
|
||||
As an example, for example, such a material is declared in the package body file (irrelevant code is omitted), and three macros are defined:
|
||||
|
||||
```json
|
||||
"testMat": {
|
||||
"defines": [ "MACRO_1", "MACRO_2", "MACRO_3" ],
|
||||
}
|
||||
```
|
||||
|
||||
At this point, a mod also declares this material, defining another three macros:
|
||||
|
||||
```json
|
||||
"testMat": {
|
||||
"defines": [ "MACRO_4", "MACRO_5", "MACRO_6" ],
|
||||
}
|
||||
```
|
||||
|
||||
In the above case, the final runtime is equivalent to the defines field being overwritten, and the macros that take effect at the actual runtime are only: MACRO_4, MACRO_5, MACRO_6
|
||||
|
||||
If the "+" symbol is used when defining in the MOD:
|
||||
|
||||
```json
|
||||
"testMat": {
|
||||
"+defines": [ "MACRO_4", "MACRO_5", "MACRO_6" ],
|
||||
}
|
||||
```
|
||||
|
||||
Equivalent to adding definitions on the original basis, the macros that take effect at actual runtime are: MACRO_1, MACRO_2, MACRO_3, MACRO_4, MACRO_5, MACRO_6
|
||||
|
||||
If the "-" symbol is used when defining in the MOD:
|
||||
|
||||
```json
|
||||
"testMat": {
|
||||
"-defines": [ "MACRO_3"],
|
||||
}
|
||||
```
|
||||
|
||||
It is equivalent to deleting some definitions on the original basis, the only macros that take effect at runtime are: MACRO_1, MACRO_2
|
||||
|
||||
If multiple files define the same material, and they involve overlay, add, and delete operations, the order in which they will take effect is: first perform all overlay operations, then perform all add operations, and finally perform all delete operations .
|
||||
|
||||
i.e. if one of the material files declares a delete MACRO_3 action:
|
||||
|
||||
```json
|
||||
"testMat": {
|
||||
"-defines": [ "MACRO_3"],
|
||||
}
|
||||
```
|
||||
|
||||
Then no matter how other files are covered, add MACRO_3, and this material must not have MACRO_3 macro after the final synthesis.
|
||||
419
docs/wiki/documentation/materials.md
Normal file
419
docs/wiki/documentation/materials.md
Normal file
@@ -0,0 +1,419 @@
|
||||
---
|
||||
title: Vanilla Materials
|
||||
show_toc: false
|
||||
tags:
|
||||
- expert
|
||||
mentions:
|
||||
- SirLich
|
||||
- Luthorius
|
||||
- MedicalJewel105
|
||||
- SmokeyStack
|
||||
- ThomasOrs
|
||||
---
|
||||
|
||||
:::warning
|
||||
Materials are not for the faint of heart. Be prepared for potential crashes, content log errors, and long loading times.
|
||||
:::
|
||||
|
||||
Materials are extremely useful for making entities more unique. You can make new ones for your addons, or use pre-existing vanilla materials.
|
||||
|
||||
You can learn more about creating materials [here](/visuals/materials).
|
||||
|
||||
## List of Vanilla Materials
|
||||
|
||||
| Vanilla_Material |
|
||||
| --------------------------------------------------------------------------------------- |
|
||||
| [alpha_block](#alpha-block) |
|
||||
| [alpha_block_color](#alpha-block-color) |
|
||||
| [banner](#banner) |
|
||||
| [banner_pole](#banner-pole) |
|
||||
| [beacon_beam](#beacon-beam) |
|
||||
| [beacon_beam_transparent](#beacon-beam-transparent) |
|
||||
| [charged_creeper](#charged-creeper) |
|
||||
| [conduit_wind](#conduit-wind) |
|
||||
| [entity](#entity) |
|
||||
| [entity_alphablend](#entity-alphablend) |
|
||||
| [entity_alphablend_nocolorentity_static](#entity-alphablend-nocolorentity-static) |
|
||||
| [entity_alphatest](#entity-alphatest) |
|
||||
| [entity_alphatest_change_color](#entity-alphatest-change-color) |
|
||||
| [entity_alphatest_change_color_glint](#entity-alphatest-change-color-glint) |
|
||||
| [entity_alphatest_glint](#entity-alphatest-glint) |
|
||||
| [entity_alphatest_glint_item](#entity-alphatest-glint-item) |
|
||||
| [entity_alphatest_multicolor_tint](#entity-alphatest-multicolor-tint) |
|
||||
| [entity_beam](#entity-beam) |
|
||||
| [entity_beam_additive](#entity-beam-additive) |
|
||||
| [entity_change_color](#entity-change-color) |
|
||||
| [entity_change_color_glint](#entity-change-color-glint) |
|
||||
| [entity_custom](#entity-custom) |
|
||||
| [entity_dissolve_layer0](#entity-dissolve-layer0) |
|
||||
| [entity_dissolve_layer1](#entity-dissolve-layer1) |
|
||||
| [entity_emissive](#entity-emissive) |
|
||||
| [entity_emissive_alpha](#entity-emissive-alpha) |
|
||||
| [entity_emissive_alpha_one_sided](#entity-emissive-alpha-one-sided) |
|
||||
| [entity_flat_color_line](#entity-flat-color-line) |
|
||||
| [entity_glint](#entity-glint) |
|
||||
| [entity_lead_base](#entity-lead-base) |
|
||||
| [entity_loyalty_rope](#entity-loyalty-rope) |
|
||||
| [entity_multitexture](#entity-multitexture) |
|
||||
| [entity_multitexture_alpha_test](#entity-multitexture-alpha-test) |
|
||||
| [entity_multitexture_alpha_test_color_mask](#entity-multitexture-alpha-test-color-mask) |
|
||||
| [entity_multitexture_color_mask](#entity-multitexture-color-mask) |
|
||||
| [entity_multitexture_masked](#entity-multitexture-masked) |
|
||||
| [entity_multitexture_multiplicative_blend](#entity-multitexture-multiplicative-blend) |
|
||||
| [entity_nocull](#entity-nocull) |
|
||||
| [guardian_ghost](#guardian-ghost) |
|
||||
| [item_in_hand](#item-in-hand) |
|
||||
| [item_in_hand_entity_alphatest](#item-in-hand-entity-alphatest) |
|
||||
| [item_in_hand_entity_alphatest_color](#item-in-hand-entity-alphatest-color) |
|
||||
| [item_in_hand_glint](#item-in-hand-glint) |
|
||||
| [item_in_hand_multicolor_tint](#item-in-hand-multicolor-tint) |
|
||||
| [map](#map) |
|
||||
| [map_decoration](#map-decoration) |
|
||||
| [map_marker](#map-marker) |
|
||||
| [moving_block](#moving-block) |
|
||||
| [moving_block_alpha](#moving-block-alpha) |
|
||||
| [moving_block_alpha_seasons](#moving-block-alpha-seasons) |
|
||||
| [moving_block_alpha_single_side](#moving-block-alpha-single-side) |
|
||||
| [moving_block_blend](#moving-block-blend) |
|
||||
| [moving_block_double_side](#moving-block-double-side) |
|
||||
| [moving_block_seasons](#moving-block-seasons) |
|
||||
| [opaque_block](#opaque-block) |
|
||||
| [opaque_block_color](#opaque-block-color) |
|
||||
| [opaque_block_color_uv2](#opaque-block-color-uv2) |
|
||||
|
||||
## Properties
|
||||
|
||||
Materials can have a range of different properties which affect their appearance, including:
|
||||
|
||||
### Backface-Culling
|
||||
|
||||
This makes the inside faces of models **not** render.
|
||||
|
||||
### Alpha Channel
|
||||
|
||||
Enables analogue translucency, usage of the alpha channel of textures.
|
||||
|
||||
### Emissive
|
||||
|
||||
Causes the texture to not be affected by dim lighting, and appear to glow. If there is usage of the alpha channel, the emissivity is in direct proportion to how transparent each individual pixel is.
|
||||
|
||||
### Set Translucency
|
||||
|
||||
Regardless of other properties, is always completely rendered at a pre-determined translucency.
|
||||
|
||||
### Texture Blending
|
||||
|
||||
When multiple textures are present, may use a filter of sorts to change the entities appearance, based on the textures.
|
||||
|
||||
## Details on the Materials
|
||||
|
||||
The following is a last of each material, along with general known properties. The names are vague pointers to what each will do, some may act rather unpredictably, or have undocumented usages, so this only is what's certain for each:
|
||||
|
||||
:::warning
|
||||
The following section has currently **only** been tested for with single textures. Take it all with a pinch of salt. It is highly recommended to experiment with the materials yourself.
|
||||
:::
|
||||
|
||||
### alpha_block
|
||||
|
||||
- Backface-culling
|
||||
- Completely Opaque
|
||||
|
||||
### alpha_block_color
|
||||
|
||||
- Backface-Culling
|
||||
- Translucencies as Transparent
|
||||
|
||||
### banner
|
||||
|
||||
Inconsistently renders objects with transparency behind.
|
||||
|
||||
- N/A
|
||||
|
||||
### banner_pole
|
||||
|
||||
Inconsistently renders objects with transparency behind.
|
||||
|
||||
- Backface-Culling
|
||||
- Transparency
|
||||
|
||||
### beacon_beam
|
||||
|
||||
- Completely Opaque
|
||||
|
||||
### beacon_beam_transparent
|
||||
|
||||
This one is rather different. Particles that are behind it are rendered in front, and it appears to have "Frontface-Culling".
|
||||
|
||||
- Alpha Channel
|
||||
|
||||
### charged_creeper
|
||||
|
||||
Inconsistently renders objects with transparency behind.
|
||||
|
||||
- Emissive
|
||||
- Set Translucency
|
||||
|
||||
### conduit_wind
|
||||
|
||||
- Transparency
|
||||
- Translucency as Transparency
|
||||
|
||||
### entity
|
||||
|
||||
- Completely Opaque
|
||||
- Backface Culling
|
||||
|
||||
### entity_alphablend
|
||||
|
||||
Inconsistently renders objects with transparency behind.
|
||||
|
||||
- Backface-Culling
|
||||
- Alpha Channel
|
||||
|
||||
### entity_alphablend_nocolorentity_static
|
||||
|
||||
- Unknown
|
||||
- Potential Crash
|
||||
|
||||
### entity_alphatest
|
||||
|
||||
- Transparency
|
||||
- Translucency as Transparency
|
||||
|
||||
### entity_alphatest_change_color
|
||||
|
||||
- Transparency
|
||||
- Translucency as Opaque
|
||||
|
||||
### entity_alphatest_change_color_glint
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_alphatest_glint
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_alphatest_glint_item
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_alphatest_multicolor_tint
|
||||
|
||||
- Greyscale
|
||||
- Backface-Culling
|
||||
- Transparency
|
||||
- Translucency as Opaque
|
||||
|
||||
### entity_beam
|
||||
|
||||
- Transparency
|
||||
- Translucency as Transparency
|
||||
|
||||
### entity_beam_additive
|
||||
|
||||
Particles always render on top
|
||||
|
||||
- Transparency
|
||||
- Emissive
|
||||
- Backface-Culling
|
||||
- Set Translucency
|
||||
|
||||
### entity_change_color
|
||||
|
||||
- Completely Opaque
|
||||
|
||||
### entity_change_color_glint
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_custom
|
||||
|
||||
Inconsistently renders objects with transparency behind.
|
||||
|
||||
- Backface-Culling
|
||||
- Alpha Channel
|
||||
|
||||
### entity_dissolve_layer0
|
||||
|
||||
Inconsistently renders objects with transparency behind.
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_dissolve_layer1
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_emissive
|
||||
|
||||
- Emissive
|
||||
- Completely Opaque
|
||||
- Backface-Culling
|
||||
|
||||
### entity_emissive_alpha
|
||||
|
||||
- Emissive
|
||||
- Alpha Channel
|
||||
- Transparency
|
||||
|
||||
### entity_emissive_alpha_one_sided
|
||||
|
||||
- Emissive
|
||||
- Alpha Channel
|
||||
- Transparency
|
||||
- Backface-Culling
|
||||
|
||||
### entity_flat_color_line
|
||||
|
||||
- Backface-Culling
|
||||
- Completely Opaque
|
||||
|
||||
### entity_glint
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_lead_base
|
||||
|
||||
Inconsistently renders objects with transparency behind.
|
||||
|
||||
- Alpha Channel
|
||||
|
||||
### entity_loyalty_rope
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_multitexture
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_multitexture_alpha_test
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_multitexture_alpha_test_color_mask
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_multitexture_color_mask
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_multitexture_masked
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_multitexture_multiplicative_blend
|
||||
|
||||
- Unknown
|
||||
|
||||
### entity_nocull
|
||||
|
||||
- Completely Opaque
|
||||
|
||||
### guardian_ghost
|
||||
|
||||
Inconsistently renders objects with transparency behind.
|
||||
|
||||
- Backface-Culling
|
||||
- Alpha Channel
|
||||
|
||||
### item_in_hand
|
||||
|
||||
- Completely Opaque
|
||||
- Backface-Culling
|
||||
|
||||
### item_in_hand_entity_alphatest
|
||||
|
||||
- Transparency
|
||||
- Translucency into either Opaque or Transparent depends on level.
|
||||
|
||||
### item_in_hand_entity_alphatest_color
|
||||
|
||||
- Transparency
|
||||
- Translucency into either Opaque or Transparent depends on level.
|
||||
|
||||
### item_in_hand_glint
|
||||
|
||||
- Unknown
|
||||
|
||||
### item_in_hand_multicolor_tint
|
||||
|
||||
- Greyscale
|
||||
- Completely Opaque
|
||||
- Backface-Culling
|
||||
|
||||
### map
|
||||
|
||||
- Transparency
|
||||
- Translucency into either Opaque or Transparent depends on level.
|
||||
|
||||
### map_decoration
|
||||
|
||||
- Backface-Culling
|
||||
- Transparency
|
||||
- Translucency into either Opaque or Transparent depends on level.
|
||||
|
||||
### map_marker
|
||||
|
||||
- Backface-Culling
|
||||
- Transparency
|
||||
- Translucency into either Opaque or Transparent depends on level.
|
||||
- Potential Crash
|
||||
|
||||
### moving_block
|
||||
|
||||
- Completely Opaque
|
||||
- Backface-Culling
|
||||
|
||||
### moving_block_alpha
|
||||
|
||||
- Backface-Culling
|
||||
- Transparency
|
||||
- Translucency into either Opaque or Transparent depends on level.
|
||||
|
||||
### moving_block_alpha_seasons
|
||||
|
||||
- Translucency into either Opaque or Transparent depends on level.
|
||||
- Transparency
|
||||
|
||||
### moving_block_alpha_single_side
|
||||
|
||||
- Backface-Culling
|
||||
- Transparency
|
||||
- Translucency into either Opaque or Transparent depends on level.
|
||||
|
||||
### moving_block_blend
|
||||
|
||||
Inconsistently renders objects with transparency behind.
|
||||
|
||||
- Backface-Culling
|
||||
- Alpha Channel
|
||||
|
||||
### moving_block_double_side
|
||||
|
||||
- Completely Opaque
|
||||
|
||||
### moving_block_seasons
|
||||
|
||||
- Completely Opaque
|
||||
- Backface-Culling
|
||||
|
||||
### opaque_block
|
||||
|
||||
- Completely Opaque
|
||||
- Backface-Culling
|
||||
|
||||
### opaque_block_color
|
||||
|
||||
- Completely Opaque
|
||||
- Backface-Culling
|
||||
|
||||
### opaque_block_color_uv2
|
||||
|
||||
- Completely Opaque
|
||||
- Backface-Culling
|
||||
|
||||
|
||||
:::warning
|
||||
Please note, that these have also only been tested using a RenderDragon platform. Non-RenderDragon visuals may differ.
|
||||
:::
|
||||
|
||||
113
docs/wiki/documentation/pack-structure.md
Normal file
113
docs/wiki/documentation/pack-structure.md
Normal file
@@ -0,0 +1,113 @@
|
||||
---
|
||||
title: Pack Folder Structure
|
||||
show_toc: false
|
||||
mentions:
|
||||
- SirLich
|
||||
- ThijsHankelMC
|
||||
- MedicalJewel105
|
||||
- Esatz77
|
||||
- ChibiMango
|
||||
- TheItsNameless
|
||||
- JaylyDev
|
||||
- SmokeyStack
|
||||
---
|
||||
|
||||
<FolderView :paths="[
|
||||
'BP/manifest.json',
|
||||
'BP/pack_icon.png',
|
||||
'BP/animations/example.animation.json',
|
||||
'BP/animation_controllers/example.ac.json',
|
||||
'BP/blocks/example.block.json',
|
||||
'BP/biomes/example.biome.json',
|
||||
'BP/entities/example.se.json',
|
||||
'BP/features/example.feature.json',
|
||||
'BP/feature_rules/example.rule.json',
|
||||
'BP/functions/example.mcfunction',
|
||||
'BP/functions/tick.json',
|
||||
'BP/items/example.item.json',
|
||||
'BP/loot_tables/example.loot.json',
|
||||
'BP/recipes/example.recipe.json',
|
||||
'BP/scripts/client/exampleClient.js',
|
||||
'BP/scripts/server/exampleServer.js',
|
||||
'BP/scripts/exampleScript.js',
|
||||
'BP/spawn_rules/example.spawn.json',
|
||||
'BP/texts/languages.json',
|
||||
'BP/texts/\*.lang',
|
||||
'BP/trading/example.trade.json',
|
||||
'BP/trading/economy_trades/example.trade.json',
|
||||
'BP/structures/example.mcstructure',
|
||||
'RP/manifest.json',
|
||||
'RP/pack_icon.png',
|
||||
'RP/biomes_client.json',
|
||||
'RP/blocks.json',
|
||||
'RP/sounds.json',
|
||||
'RP/contents.json',
|
||||
'RP/animation_controllers/example.ac.json',
|
||||
'RP/animations/example.animation.json',
|
||||
'RP/attachables/example.attachable.json',
|
||||
'RP/entity/example.ce.json',
|
||||
'RP/fogs/example_fog_setting.json',
|
||||
'RP/items/example.item.json',
|
||||
'RP/materials/example.material',
|
||||
'RP/models/entity/example.geo.json',
|
||||
'RP/models/blocks/example.geo.json',
|
||||
'RP/particles/example.particle.json',
|
||||
'RP/render_controllers/example.rc.json',
|
||||
'RP/sounds/example.wav',
|
||||
'RP/sounds/example.ogg',
|
||||
'RP/sounds/example.mp3',
|
||||
'RP/sounds/example.fsb',
|
||||
'RP/sounds/sound_definitions.json',
|
||||
'RP/sounds/music_definitions.json',
|
||||
'RP/texts/languages.json',
|
||||
'RP/texts/language_names.json',
|
||||
'RP/texts/bg_BG.lang',
|
||||
'RP/texts/cs_CZ.lang',
|
||||
'RP/texts/da_DK.lang',
|
||||
'RP/texts/de_DE.lang',
|
||||
'RP/texts/el_GR.lang',
|
||||
'RP/texts/en_GB.lang',
|
||||
'RP/texts/en_US.lang',
|
||||
'RP/texts/es_ES.lang',
|
||||
'RP/texts/es_MX.lang',
|
||||
'RP/texts/fi_FI.lang',
|
||||
'RP/texts/fr_CA.lang',
|
||||
'RP/texts/fr_FR.lang',
|
||||
'RP/texts/hu_HU.lang',
|
||||
'RP/texts/id_ID.lang',
|
||||
'RP/texts/it_IT.lang',
|
||||
'RP/texts/ja_JP.lang',
|
||||
'RP/texts/ko_KR.lang',
|
||||
'RP/texts/nb_NO.lang',
|
||||
'RP/texts/nl_NL.lang',
|
||||
'RP/texts/pl_PL.lang',
|
||||
'RP/texts/pt_BR.lang',
|
||||
'RP/texts/pt_PR.lang',
|
||||
'RP/texts/ru_RU.lang',
|
||||
'RP/texts/sk_SK.lang',
|
||||
'RP/texts/sv_SE.lang',
|
||||
'RP/texts/tr_TR.lang',
|
||||
'RP/texts/uk_UA.lang',
|
||||
'RP/texts/zh_CN.lang',
|
||||
'RP/texts/zh_TW.lang',
|
||||
'RP/texts/zh_TW.lang',
|
||||
'RP/texts/ja_JP/font/glyph_2E.png',
|
||||
'RP/texts/ja_JP/font/\*.png',
|
||||
'RP/texts/zh_TW/font/glyph_2E.png',
|
||||
'RP/texts/zh_TW/font/\*.png',
|
||||
'RP/textures/item_texture.json',
|
||||
'RP/textures/terrain_texture.json',
|
||||
'RP/textures/flipbook_textures.json',
|
||||
'RP/textures/texture_list.json',
|
||||
'RP/textures/environment/overworld_cubemap/cubemap_0.png',
|
||||
'RP/textures/environment/overworld_cubemap/cubemap_1.png',
|
||||
'RP/textures/environment/overworld_cubemap/cubemap_2.png',
|
||||
'RP/textures/environment/overworld_cubemap/cubemap_3.png',
|
||||
'RP/textures/environment/overworld_cubemap/cubemap_4.png',
|
||||
'RP/textures/environment/overworld_cubemap/cubemap_5.png',
|
||||
'RP/textures/blocks/example.png',
|
||||
'RP/textures/entity/example.png',
|
||||
'RP/textures/items/example.png',
|
||||
'RP/textures/particle/example.png',
|
||||
'RP/ui/\*.json'
|
||||
]"></FolderView>
|
||||
256
docs/wiki/documentation/projectiles.md
Normal file
256
docs/wiki/documentation/projectiles.md
Normal file
@@ -0,0 +1,256 @@
|
||||
---
|
||||
title: Projectiles
|
||||
mentions:
|
||||
- SirLich
|
||||
- stirante
|
||||
- retr0cube
|
||||
- SmokeyStack
|
||||
- Luthorius
|
||||
- ThomasOrs
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This page intends to document all different fields you can use inside `minecraft:projectile` entity behavior component.
|
||||
|
||||
:::warning
|
||||
_Disclaimer: this component has been mostly documented based on projectiles found in the game or reverse engineering the game._
|
||||
_This information was last tested on **1.18.2**._
|
||||
:::
|
||||
|
||||
| Name | Type | Default Value | Description |
|
||||
| ------------------------- | ---------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| anchor | Integer | | |
|
||||
| angle_offset | Decimal | 0 | Determines the angle at which the projectile is thrown |
|
||||
| catch_fire | Boolean | false | If true, the entity hit will be set on fire |
|
||||
| crit_particle_on_hurt | Boolean | false | If true, the projectile will produce critical hit particles when it happens |
|
||||
| destroy_on_hurt | Boolean | false | If true, this entity will be destroyed when hit |
|
||||
| filter | String | | Entity Definitions defined here can't be hurt by the projectile |
|
||||
| fire_affected_by_griefing | Boolean | false | If true, whether the projectile causes fire is affected by the mob griefing game rule |
|
||||
| gravity | Decimal | 0.05 | The gravity applied to this entity when thrown. The higher the value, the faster the entity falls |
|
||||
| hit_ground_sound | String | | The sound that plays when the projectile hits ground |
|
||||
| hit_sound | String | | The sound that plays when the projectile hits an entity |
|
||||
| homing | Boolean | false | If true, the projectile homes in to the nearest. **Does not work on 1.18.2** entity |
|
||||
| inertia | Decimal | 0.99 | The fraction of the projectile's speed maintained every frame while traveling in air |
|
||||
| is_dangerous | Boolean | false | If true, the projectile will be treated as dangerous to the players |
|
||||
| knockback | Boolean | true | If true, the projectile will knock back the entity it hits |
|
||||
| lightning | Boolean | false | If true, the entity hit will be struck by lightning |
|
||||
| liquid_inertia | Decimal | 0.6 | The fraction of the projectile's speed maintained every frame while traveling in water |
|
||||
| multiple_targets | Boolean | true | If true, the projectile can hit multiple entities per flight |
|
||||
| offset | Vector [a, b, c] | [0, 0.5, 0] | The offset from the entity's anchor where the projectile will spawn |
|
||||
| on_fire_time | Decimal | 5 | Time in seconds that the entity hit will be on fire for |
|
||||
| on_hit | Object | | Projectile's behavior on hit. More info [below](#on_hit) |
|
||||
| particle | String | iconcrack | Particle to use upon collision |
|
||||
| potion_effect | Integer | -1 | Defines the effect the arrow will apply to the entity it hits |
|
||||
| power | Decimal | 1.3 | Determines the velocity of the projectile |
|
||||
| reflect_on_hurt | Boolean | false | If true, this entity will be reflected back when hit |
|
||||
| semi_random_diff_damage | Boolean | false | If true, damage will be randomized based on damage and speed |
|
||||
| shoot_sound | String | | The sound that plays when the projectile is shot |
|
||||
| shoot_target | Boolean | true | If true, the projectile will be shot towards the target of the entity firing it |
|
||||
| should_bounce | Boolean | false | If true, the projectile will bounce upon hit |
|
||||
| splash_potion | Boolean | false | If true, the projectile will be treated like a splash potion |
|
||||
| splash_range | Decimal | 4 | Radius in blocks of the 'splash' effect |
|
||||
| stop_on_hurt | Boolean | | |
|
||||
| uncertainty_base | Decimal | 0 | The base accuracy. Accuracy is determined by the formula uncertaintyBase - difficultyLevel \* uncertaintyMultiplier |
|
||||
| uncertainty_multiplier | Decimal | 0 | Determines how much difficulty affects accuracy. Accuracy is determined by the formula uncertaintyBase - difficultyLevel \* uncertaintyMultiplier |
|
||||
| hit_water | Boolean | false | If true, liquid blocks will be treated as solid. **Requires "Education Edition" toggle active** |
|
||||
|
||||
## on_hit
|
||||
|
||||
This object contains all behaviors, that can be executed, when projectile hits something.
|
||||
|
||||
### arrow_effect
|
||||
|
||||
_Exact behavior unknown_
|
||||
|
||||
### teleport_owner
|
||||
|
||||
Teleports shooter to the hit location.
|
||||
|
||||
### catch_fire
|
||||
|
||||
_Exact behavior unknown_
|
||||
|
||||
Sets target on fire
|
||||
|
||||
### ignite
|
||||
|
||||
_Exact behavior unknown_
|
||||
|
||||
Sets target on fire
|
||||
|
||||
### remove_on_hit
|
||||
|
||||
Removes the projectile when it hits something.
|
||||
|
||||
### douse_fire
|
||||
|
||||
_Exact behavior unknown_
|
||||
|
||||
### impact_damage
|
||||
|
||||
Deals damage on hit.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------------------------ | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| damage | Integer/Integer Array [min, max] | Damage dealt to entity on hit |
|
||||
| semi_random_diff_damage | Boolean | |
|
||||
| max_critical_damage | Decimal | |
|
||||
| min_critical_damage | Decimal | |
|
||||
| power_multiplier | Decimal | |
|
||||
| channeling | Boolean | |
|
||||
| set_last_hurt_requires_damage | Boolean | |
|
||||
| destroy_on_hit_requires_damage | Boolean | |
|
||||
| filter | String | Entity to affect. Much more primitive than filters used elsewhere, as it cannot "test" for anything other than an identifier |
|
||||
| destroy_on_hit | Boolean | |
|
||||
| knockback | Boolean | |
|
||||
| catch_fire | Boolean | Dictates wether or not targets will be engulfed in flames |
|
||||
|
||||
### definition_event
|
||||
|
||||
Calls an event on hit.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------------ | ------- | --------------------------------------------------- |
|
||||
| affect_projectile | Boolean | Event will be triggered for projectile entity |
|
||||
| affect_shooter | Boolean | Event will be triggered for shooter entity |
|
||||
| affect_target | Boolean | Event will be triggered for hit entity |
|
||||
| affect_splash_area | Boolean | Event will be triggered for all entities in an area |
|
||||
| splash_area | Decimal | Area of entities |
|
||||
| event_trigger | Object | Event to trigger. Structure below. |
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------- | ------ | ------------------------------------- |
|
||||
| event | String | Event to trigger |
|
||||
| target | String | Target of the event |
|
||||
| filters | Object | Criteria required in order to trigger |
|
||||
|
||||
### stick_in_ground
|
||||
|
||||
Sticks the projectile into the ground.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---------- | ------- | ----------- |
|
||||
| shake_time | Decimal | |
|
||||
|
||||
### spawn_aoe_cloud
|
||||
|
||||
Spawns an area of effect cloud of potion effect.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| radius | Decimal | Radius of the cloud |
|
||||
| radius_on_use | Decimal | |
|
||||
| potion | Integer | Lingering Potion ID |
|
||||
| particle | String | [Vanilla Particles](/particles/vanilla-particles) emitter of the cloud. Only accepts Vanilla Particles. **dragonbreath** enables the usage of Bottles to obtain Dragon's Breath. |
|
||||
| duration | Integer | Duration of the cloud in seconds |
|
||||
| color | Integer array [r, g, b] | Color of the particles |
|
||||
| affect_owner | Boolean | Is potion effect affecting the shooter. Does not appear to apply to the player |
|
||||
| reapplication_delay | Integer | Delay in ticks between application of the potion effect |
|
||||
|
||||
#### Potion IDs
|
||||
|
||||
| Potion | Regular | Extended | Enhanced (Level II) |
|
||||
| ------------------------- | ------- | -------- | ------------------- |
|
||||
| Water Bottle | 0 | | |
|
||||
| Mundane Potion | 1 | 2 | |
|
||||
| Thick Potion | 3 | | |
|
||||
| Awkward Potion | 4 | | |
|
||||
| Potion of Night Vision | 5 | 6 | |
|
||||
| Potion of Invisibility | 7 | 8 | |
|
||||
| Potion of Leaping | 9 | 10 | 11 |
|
||||
| Potion of Fire Resistance | 12 | 13 | |
|
||||
| Potion of Swiftness | 14 | 15 | 16 |
|
||||
| Potion of Slowness | 17 | 18 | |
|
||||
| Potion of Water Breathing | 19 | 20 | |
|
||||
| Potion of Healing | 21 | | 22 |
|
||||
| Potion of Harming | 23 | | 24 |
|
||||
| Potion of Poison | 25 | 26 | 27 |
|
||||
| Potion of Regeneration | 28 | 29 | 30 |
|
||||
| Potion of Strength | 31 | 32 | 33 |
|
||||
| Potion of Weakness | 34 | 35 | |
|
||||
| Potion of Decay | 36 | | |
|
||||
| Potion of Turtle Master | 37 | 38 | 39 |
|
||||
| Potion of Slow Falling | 40 | 41 | |
|
||||
| Potion of Slowness IV | 42 | | |
|
||||
| Potion of Crashing | 43+ | | |
|
||||
|
||||
### spawn_chance
|
||||
|
||||
Spawns an entity on hit.
|
||||
|
||||
| Name | Type | Description |
|
||||
| --------------------------- | ------- | ------------------------------------------- |
|
||||
| first_spawn_percent_chance | Decimal | |
|
||||
| second_spawn_percent_chance | Decimal | |
|
||||
| first_spawn_count | Integer | |
|
||||
| second_spawn_count | Integer | |
|
||||
| spawn_definition | String | ID of the entity to spawn |
|
||||
| spawn_baby | Boolean | Whether the spawned entity should be a baby |
|
||||
|
||||
### particle_on_hit
|
||||
|
||||
Spawns particles on hit.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------- | ------- | -------------------------------------------------------- |
|
||||
| particle_type | String | [Vanilla Particles](/particles/vanilla-particles) to use |
|
||||
| num_particles | Integer | Number of particles |
|
||||
| on_entity_hit | Boolean | Whether it should spawn particles on entity hit |
|
||||
| on_other_hit | Boolean | Whether it should spawn particles on other hit |
|
||||
|
||||
|
||||
### mob_effect
|
||||
|
||||
Applies a mob effect to the target.
|
||||
|
||||
| Name | Type | Description |
|
||||
| -------------- | ------- | ------------------------------------------- |
|
||||
| effect | String | Effect |
|
||||
| duration | Integer | Duration of the effect |
|
||||
| durationeasy | Integer | Duration of the effect on easy difficulty |
|
||||
| durationnormal | Integer | Duration of the effect on normal difficulty |
|
||||
| durationhard | Integer | Duration of the effect on hard difficulty |
|
||||
| amplifier | Integer | Effect amplifier |
|
||||
| ambient | Boolean | |
|
||||
| visible | Boolean | |
|
||||
|
||||
### grant_xp
|
||||
|
||||
Despite the name, this actually spawns a number of experience orbs, being worth the amount stated.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ----- | ------- | ----------------------------------------------------------------------------------------------- |
|
||||
| minXP | Integer | Minimum amount of experience to give |
|
||||
| maxXP | Integer | Maximum amount of experience to give |
|
||||
| xp | Integer | Constant amount of experience to give. When set, it will be used instead of min and max values. |
|
||||
|
||||
### freeze_on_hit
|
||||
|
||||
_Exact behavior unknown_
|
||||
|
||||
_Requires Education Edition toggle to be enabled._
|
||||
Freezes water on hit.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------- | ------- | ----------------------------- |
|
||||
| shape | String | "sphere" or "cube" |
|
||||
| snap_to_block | Boolean | |
|
||||
| size | Integer | The size of the freeze effect |
|
||||
|
||||
### hurt_owner
|
||||
|
||||
_Exact behavior unknown. Right now it crashes minecraft probably because of wrong parameters_
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------ | ------- | ----------- |
|
||||
| owner_damage | Integer | |
|
||||
| knockback | Boolean | |
|
||||
| ignite | Boolean | |
|
||||
|
||||
### thrown_potion_effect
|
||||
|
||||
_Exact behavior unknown. Right now it crashes minecraft probably because it's only valid for thrown potions_
|
||||
|
||||
## Additional Information
|
||||
When it comes to creating a custom projectile, such as an arrow or trident variant, or something entirely your own, you may want to consider defining a [runtime identifier](/entities/runtime-identifier) to ensure that it acts as intended. Not doing so may result in unintended behaviour, from odd visuals to incorrect knockback direction and arrows that you can kill with your bare hands.
|
||||
567
docs/wiki/documentation/queries.md
Normal file
567
docs/wiki/documentation/queries.md
Normal file
@@ -0,0 +1,567 @@
|
||||
---
|
||||
title: Molang Queries
|
||||
toc_max_level: 2
|
||||
mentions:
|
||||
- SirLich
|
||||
- solvedDev
|
||||
- stirante
|
||||
- SmokeyStack
|
||||
- Dreamedc2015
|
||||
- Ultr4Anubis
|
||||
- MedicalJewel105
|
||||
- TreaBeane
|
||||
- r4isen1920
|
||||
- ChillRx
|
||||
- Luthorius
|
||||
- TheItsNameless
|
||||
- ThomasOrs
|
||||
---
|
||||
|
||||
The bedrock documentation for Molang is notoriously bad. This page will attempt to remedy this by providing additional details for individual queries, _where possible_. This page is intended to be searched, not read in full. Use the side-bar, or use `ctrl-f` to navigate.
|
||||
|
||||
:::tip
|
||||
This page is not an exhaustive list list! It only contains queries we've written extra information for. The full list of queries can be found [here](https://bedrock.dev/docs/stable/Molang#List%20of%20Entity%20Queries)!
|
||||
:::
|
||||
|
||||
## query.armor_texture_slot
|
||||
|
||||
Formatted like: `query.armor_texture_slot(x) = y`.
|
||||
|
||||
Where `x` and `y` are both integer arguments, from the following table:
|
||||
|
||||
### X
|
||||
|
||||
| Argument | Slot |
|
||||
| -------- | ---------- |
|
||||
| 0 | Helmet |
|
||||
| 1 | Chestplace |
|
||||
| 2 | Leggings |
|
||||
| 3 | Boots |
|
||||
|
||||
### Y
|
||||
|
||||
| Argument | Type |
|
||||
| -------- | --------------------- |
|
||||
| -1 | none |
|
||||
| 0 | Leather armor piece |
|
||||
| 1 | Chain armor piece |
|
||||
| 2 | Iron armor piece |
|
||||
| 3 | Diamond armor piece |
|
||||
| 4 | Gold armor piece |
|
||||
| 5 | Elytra |
|
||||
| 6 | Turtle helmet |
|
||||
| 7 | Netherite armor piece |
|
||||
|
||||
### Y for horses
|
||||
|
||||
| Argument | Type |
|
||||
| -------- | --------------------- |
|
||||
| 1 | Leather armor piece |
|
||||
| 2 | Iron armor piece |
|
||||
| 3 | Gold armor piece |
|
||||
| 4 | Diamond armor piece |
|
||||
|
||||
### Example
|
||||
|
||||
`query.armor_texture_slot(3) == 1`: queries for Iron Boots.
|
||||
|
||||
## query.armor_material_slot
|
||||
|
||||
Formatted like: `query.armor_material_slot(x) = y`.
|
||||
|
||||
Where `x` and `y` are both integer arguments, from the following table:
|
||||
|
||||
### X
|
||||
|
||||
| Argument | Slot |
|
||||
| -------- | ---------- |
|
||||
| 0 | Helmet |
|
||||
| 1 | Chestplace |
|
||||
| 2 | Leggings |
|
||||
| 3 | Boots |
|
||||
|
||||
### Y
|
||||
|
||||
Unknown, possibly:
|
||||
|
||||
| Argument | Slot |
|
||||
| -------- | -------------------------- |
|
||||
| 0 | Default armor material |
|
||||
| 1 | Enchanted armor material |
|
||||
| 2 | Leather armor material |
|
||||
| 3 | Leather enchanted material |
|
||||
|
||||
## query.armor_color_slot
|
||||
|
||||
_Notice: As of version `1.16.100.51`, this query is crashing minecraft. It might be fixed in later versions._
|
||||
|
||||
Formatted like: `color = query.armor_color_slot(slot, channel)`.
|
||||
|
||||
Where `slot` and `channel` are both integer arguments, from the following tables:
|
||||
|
||||
### Slot
|
||||
|
||||
| Argument | Slot |
|
||||
| -------- | ---------- |
|
||||
| 0 | Helmet |
|
||||
| 1 | Chestplace |
|
||||
| 2 | Leggings |
|
||||
| 3 | Boots |
|
||||
|
||||
### Channel
|
||||
|
||||
| Argument | Slot |
|
||||
| -------- | ------------- |
|
||||
| 0 | Red channel |
|
||||
| 1 | Green channel |
|
||||
| 2 | Blue channel |
|
||||
| 3 | Alpha channel |
|
||||
|
||||
### Color
|
||||
|
||||
Query returns color value in specified channel.
|
||||
|
||||
## query.get_equipped_item_name
|
||||
|
||||
:::warning
|
||||
**DEPRECATED QUERY:** It is recommended to use the new query (`query.is_item_name_any`) if possible as it is more of an updated version of this query. However, this query will still continue to work in the future for backwards compatibility.
|
||||
:::
|
||||
|
||||
Formatted like: `query.get_equipped_item_name('main_hand') = 'item_name'`
|
||||
|
||||
Takes one optional hand slot as a parameter (0 or 'main_hand' for main hand, 1 or 'off_hand' for off hand), and a second parameter (0=default) if you would like the equipped item or any non-zero number for the currently rendered item, and returns the name of the item in the requested slot (defaulting to the main hand if no parameter is supplied) if there is one, otherwise returns ''.
|
||||
|
||||
Where `item_name` is the item you want to test for. No namespace, and please notice the quotes.
|
||||
|
||||
Example: `"query.get_equipped_item_name == 'diamond'"`
|
||||
|
||||
**Can you test for items in the inventory? Yes! Using the new query `query.is_item_name_any`.**
|
||||
|
||||
## query.get_name
|
||||
|
||||
:::warning
|
||||
**DEPRECATED QUERY:** It is recommended to use the new query (`query.is_name_any`) if possible as it is more of an updated version of this query. However, this query will still continue to work in the future for backwards compatibility.
|
||||
:::
|
||||
|
||||
Formatted like: `query.get_name == 'Name'`
|
||||
|
||||
Turns true if actual in-game displayed name matches name (use OnixClient to see names in third view).
|
||||
Needs to be used in special conditions.
|
||||
|
||||
<Spoiler title="Show">
|
||||
|
||||
<CodeHeader>animation_controllers/ac.json</CodeHeader>
|
||||
|
||||
```json
|
||||
{
|
||||
"format_version": "1.10.0",
|
||||
"animation_controllers": {
|
||||
"controller.animation.ac": {
|
||||
"initial_state": "default",
|
||||
"states": {
|
||||
"default": {
|
||||
"transitions": [
|
||||
{
|
||||
"active": "query.is_alive"
|
||||
}
|
||||
]
|
||||
},
|
||||
"active": {
|
||||
"transitions": [
|
||||
{
|
||||
"default": "(1.0)"
|
||||
}
|
||||
],
|
||||
"animations": [
|
||||
{
|
||||
"anim": "query.get_name == '...'" // You can use it only here!
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</Spoiler>
|
||||
|
||||
## query.is_name_any
|
||||
|
||||
Formatted like: `query.get_name('Name1', 'Name2')`.
|
||||
Takes one or more arguments.
|
||||
Turns true if actual in-game displayed name matches one of the given names.
|
||||
Needs to be used in special conditions.
|
||||
|
||||
<Spoiler title="Show">
|
||||
|
||||
<CodeHeader>animation_controllers/ac.json</CodeHeader>
|
||||
|
||||
```json
|
||||
{
|
||||
"format_version": "1.10.0",
|
||||
"animation_controllers": {
|
||||
"controller.animation.ac": {
|
||||
"initial_state": "default",
|
||||
"states": {
|
||||
"default": {
|
||||
"transitions": [
|
||||
{
|
||||
"active": "query.is_alive"
|
||||
}
|
||||
]
|
||||
},
|
||||
"active": {
|
||||
"transitions": [
|
||||
{
|
||||
"default": "(1.0)"
|
||||
}
|
||||
],
|
||||
"animations": [
|
||||
{
|
||||
"anim": "query.is_name_any(...)" // You can use it only here!
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</Spoiler>
|
||||
|
||||
## query.is_item_name_any
|
||||
|
||||
Formatted like: `query.is_item_name_any('slot.weapon.mainhand', 0, 'namespace:item_name')`
|
||||
|
||||
Takes the equipment slot name first, followed by the slot index value, and then the list of item names with namespaces after it.
|
||||
|
||||
Possible equipment slot are as follows:
|
||||
| Slot Name | Slot Counts | Description |
|
||||
| ---------------------- | ----------- | ----------------------------------------------------------------------------------- |
|
||||
| `slot.weapon.mainhand` | 0 | Usually any held items are in here |
|
||||
| `slot.weapon.offhand` | 0 | Offhand slot for things like `Shield`, `Totem of Undying` or a `Map` |
|
||||
| `slot.armor.head` | 0 | Head armor piece |
|
||||
| `slot.armor.chest` | 0 | Chestplate armor piece |
|
||||
| `slot.armor.legs` | 0 | Leggings armor piece |
|
||||
| `slot.armor.feet` | 0 | Boots armor piece |
|
||||
| `slot.armor` | 0 | Horse armor |
|
||||
| `slot.saddle` | 0 | Saddle slot |
|
||||
| `slot.hotbar` | 0 to 8 | Player hotbar slots |
|
||||
| `slot.inventory` | 0+ (varies) | Entities that has an inventory, like the player, minecart with chests, donkey, etc. |
|
||||
| `slot.enderchest` | 0 to 26 | Ender chest inventory for players only |
|
||||
|
||||
### Test for items within the player's inventory
|
||||
|
||||
Formatted like: `t.val = 0; t.i = 0; loop(27, {t.val = q.is_item_name_any('slot.inventory', t.i, 'namespace:item_name'); t.val ? {return t.val;}; t.i = t.i+1;});`
|
||||
|
||||
Replace `namespace:item_name` with any item you wish to check for. This simply loops through all 27 slots of the inventory and returns `1.0` if it has found any slot that has the specified item provided. Note that the hotbar is in a different slot from the main inventory slot so you will have to check that separately.
|
||||
|
||||
## query.is_enchanted
|
||||
|
||||
Formatted like: `is_enchanted = query.is_enchanted`.
|
||||
|
||||
Return 1.0 or 0.0 based on whether the entity is enchanted.
|
||||
|
||||
_Currently, can be only used in materials._
|
||||
|
||||
## query.is_eating
|
||||
|
||||
This query tracks when certain entities are 'eating'. It's not used for the player. To trigger, use one of the following components:
|
||||
- `minecraft:behavior.eat_carried_item`
|
||||
- `minecraft:behavior.snacking`
|
||||
|
||||
## query.is_ghost
|
||||
|
||||
Formatted like: `is_ghost = query.is_ghost`.
|
||||
|
||||
Return 1.0 or 0.0 based on whether the entity is a ghost.
|
||||
|
||||
_Currently, only returns 1.0 for a guardian ghost and is used by its renderer._
|
||||
|
||||
## query.is_grazing
|
||||
|
||||
Formatted like: `is_grazing = query.is_grazing`.
|
||||
|
||||
Return 1.0 or 0.0 based on whether the entity is eating a block.
|
||||
|
||||
_Currently, only returns 1.0 for a sheep and entities using runtime identifier of a sheep._
|
||||
|
||||
## query.is_jumping
|
||||
|
||||
Formatted like: `is_jumping = query.is_jumping`.
|
||||
|
||||
Return 1.0 or 0.0 based on whether the entity is jumping.
|
||||
|
||||
For the player, conditions for its activation are:
|
||||
|
||||
- the jump button is pressed (includes being in water and climbing a scaffolding)
|
||||
- OR auto-jump is triggered
|
||||
- OR swimming with auto-jump
|
||||
- OR charging the jump of a ridable entity
|
||||
|
||||
## query.modified_move_speed
|
||||
|
||||
Formatted like: `modified_move_speed = query.modified_move_speed`.
|
||||
|
||||
Returns the current walk speed of the entity modified by status flags such as is_baby or on_fire
|
||||
|
||||
Value example:
|
||||
|
||||
- Player is walking: around 0.86
|
||||
- Player is sprinting: 1.0
|
||||
- Player is sprinting and jumping: 0.35
|
||||
- Player is walking on fire: 1.0
|
||||
- Player is sprinting on fire: 1.0
|
||||
- Player is sprinting and jumping on fire: 0.525
|
||||
|
||||
## query.log
|
||||
|
||||
Content log is NOT debug log, they're different files. `query.log` outputs to the debug log only.
|
||||
|
||||
## query.on_fire_time
|
||||
|
||||
Formatted like: `on_fire_time = query.on_fire_time`.
|
||||
|
||||
Returns the time in ticks since the entity started or stopped being on fire, else it returns 0.0
|
||||
|
||||
Value example:
|
||||
|
||||
- Entity is summoned: value is 0
|
||||
- Entity is ignited: value is 0 and starts counting up 1 every tick
|
||||
- Entity is on fire for 2 seconds already: value is 40 and still counts up 1 every tick
|
||||
- Entity stops being on fire: value resets to 0 and continues to count up 1 every tick despite not being on fire
|
||||
- Entity is ignited second time: value resets to 0 and continues counting up 1 every tick
|
||||
- Entity stops being on fire the second time: value resets to 0 and continues to count up 1 every tick despite not being on fire
|
||||
|
||||
Basically it's tick timer that starts after entity is first ignited and resets every time it changes from/to being on fire.
|
||||
|
||||
## query.scoreboard
|
||||
|
||||
Formatted like: `query.scoreboard('objective_name') > 0`
|
||||
|
||||
Returns 1.0 or 0.0 if the queried value is within the specified range provided. Or based on score count, molang operator and number.
|
||||
|
||||
Note that sometimes it might not work because of unknown reasons. One of which is that this cannot query scoreboard objective names with uppercase letters. In this case, for example, objective `testfoo` will work but **not** `testFoo`.
|
||||
|
||||
## query.structural_integrity
|
||||
|
||||
Formatted like: `structural_integrity = query.structural_integrity`.
|
||||
|
||||
Used by boats and minecarts for destroying it. It will decrease when attacking the entity and will recover with time.
|
||||
Probably unusable by anything other than boats and minecarts.
|
||||
|
||||
## variable.attack_time
|
||||
|
||||
### Explanation
|
||||
|
||||
This variable is setup as IF it was a query. In other words, it can be used on any entity, both on the client and server, regardless of whether you setup/define the variable correctly.
|
||||
|
||||
### For entities
|
||||
|
||||
The variable tracks when the entity is swinging to attack. When not attacking, it will return 0.0, when attacking it will range from 0.0 to the total attack time, which may be around 0.3 or something similar. For players, this value ranges from 0.0 to 1.0. The variable returns a percentage, in the form of a decimal, for how far into the attack the entity is. For example, if an entity is halfway into its attack swing, then the variable will return 0.5. It increments linearly.
|
||||
|
||||
### For the Player
|
||||
|
||||
For the player, the variable will track whenever the arm bones are swinging, this includes:
|
||||
|
||||
- placing blocks
|
||||
- placing entities
|
||||
- interacting (when swing is enabled)
|
||||
- melee attack
|
||||
|
||||
## query.is_roaring
|
||||
|
||||
Evaluates to true when a `knockback_roar` attack is happening.
|
||||
|
||||
## query.head_x_rotation
|
||||
|
||||
Formatted like: `query.head_x_rotation(x)`
|
||||
|
||||
Where `x` specifies the head of the entity. It is not really relevant for any entity but the wither.
|
||||
|
||||
Returns head pitch. looking up returns `-89.9`, looking all the way down returns `89.9`.
|
||||
|
||||
## query.head_y_rotation
|
||||
|
||||
Formatted like: `query.head_y_rotation(x)`
|
||||
|
||||
Where `x` specifies the head of the entity. It is not really relevant for any entity but the wither.
|
||||
|
||||
Returns yaw of the head from `-179.9` to `179.9`. the values wrap around so like if you are at `-179.9` and you turn just a little bit, it instantly goes to `179.9`.
|
||||
|
||||
## query.target_x_rotation and query.target_y_rotation
|
||||
|
||||
Identical to the respective `query.head_*_rotation`, however has no optional argument for selecting head.
|
||||
|
||||
## query.time_of_day
|
||||
|
||||
Returns the time of day (midnight=0.0, sunrise=0.25, noon=0.5, sunset=0.75) of the dimension the entity is in.
|
||||
Day time is calculated via this formula:
|
||||
|
||||
`f(x) = (x*0.25/2400)mod 1`
|
||||
|
||||
query.time_of_day - day time table
|
||||
|
||||
<Spoiler title="Show">
|
||||
|
||||
| `query.time_of_day` | Day Time |
|
||||
| ------------------- | -------- |
|
||||
| 0.00 | 18000 |
|
||||
| 0.01 | 18240 |
|
||||
| 0.02 | 18480 |
|
||||
| 0.03 | 18720 |
|
||||
| 0.04 | 18960 |
|
||||
| 0.05 | 19200 |
|
||||
| 0.06 | 19440 |
|
||||
| 0.07 | 19680 |
|
||||
| 0.08 | 19920 |
|
||||
| 0.09 | 20162 |
|
||||
| 0.10 | 20400 |
|
||||
| 0.11 | 20640 |
|
||||
| 0.12 | 20880 |
|
||||
| 0.13 | 21120 |
|
||||
| 0.14 | 21360 |
|
||||
| 0.15 | 21602 |
|
||||
| 0.16 | 21840 |
|
||||
| 0.17 | 22080 |
|
||||
| 0.18 | 22322 |
|
||||
| 0.19 | 22560 |
|
||||
| 0.20 | 22800 |
|
||||
| 0.21 | 23040 |
|
||||
| 0.22 | 23280 |
|
||||
| 0.23 | 23520 |
|
||||
| 0.24 | 23760 |
|
||||
| 0.25 | 0 |
|
||||
| 0.26 | 240 |
|
||||
| 0.27 | 480 |
|
||||
| 0.28 | 720 |
|
||||
| 0.29 | 960 |
|
||||
| 0.30 | 1202 |
|
||||
| 0.31 | 1440 |
|
||||
| 0.32 | 1680 |
|
||||
| 0.33 | 1922 |
|
||||
| 0.34 | 2160 |
|
||||
| 0.35 | 2400 |
|
||||
| 0.36 | 2642 |
|
||||
| 0.37 | 2880 |
|
||||
| 0.38 | 3120 |
|
||||
| 0.39 | 3360 |
|
||||
| 0.40 | 3600 |
|
||||
| 0.41 | 3840 |
|
||||
| 0.42 | 4080 |
|
||||
| 0.43 | 4320 |
|
||||
| 0.44 | 4560 |
|
||||
| 0.45 | 4800 |
|
||||
| 0.46 | 5040 |
|
||||
| 0.47 | 5280 |
|
||||
| 0.48 | 5520 |
|
||||
| 0.49 | 5760 |
|
||||
| 0.50 | 6000 |
|
||||
| 0.51 | 6240 |
|
||||
| 0.52 | 6480 |
|
||||
| 0.53 | 6720 |
|
||||
| 0.54 | 6960 |
|
||||
| 0.55 | 7200 |
|
||||
| 0.56 | 7440 |
|
||||
| 0.57 | 7680 |
|
||||
| 0.58 | 7920 |
|
||||
| 0.59 | 8160 |
|
||||
| 0.60 | 8402 |
|
||||
| 0.61 | 8640 |
|
||||
| 0.62 | 8880 |
|
||||
| 0.63 | 9120 |
|
||||
| 0.64 | 9360 |
|
||||
| 0.65 | 9600 |
|
||||
| 0.66 | 9842 |
|
||||
| 0.67 | 10080 |
|
||||
| 0.68 | 10320 |
|
||||
| 0.69 | 10560 |
|
||||
| 0.70 | 10800 |
|
||||
| 0.71 | 11040 |
|
||||
| 0.72 | 11282 |
|
||||
| 0.73 | 11520 |
|
||||
| 0.74 | 11760 |
|
||||
| 0.75 | 12000 |
|
||||
| 0.76 | 12240 |
|
||||
| 0.77 | 12480 |
|
||||
| 0.78 | 12720 |
|
||||
| 0.79 | 12962 |
|
||||
| 0.80 | 13200 |
|
||||
| 0.81 | 13440 |
|
||||
| 0.82 | 13680 |
|
||||
| 0.83 | 13920 |
|
||||
| 0.84 | 14160 |
|
||||
| 0.85 | 14402 |
|
||||
| 0.86 | 14640 |
|
||||
| 0.87 | 14880 |
|
||||
| 0.88 | 15120 |
|
||||
| 0.89 | 15360 |
|
||||
| 0.90 | 15600 |
|
||||
| 0.91 | 15842 |
|
||||
| 0.92 | 16080 |
|
||||
| 0.93 | 16320 |
|
||||
| 0.94 | 16560 |
|
||||
| 0.95 | 16800 |
|
||||
| 0.96 | 17040 |
|
||||
| 0.97 | 17282 |
|
||||
| 0.98 | 17520 |
|
||||
| 0.99 | 17760 |
|
||||
| 1.00 | 18000 |
|
||||
|
||||
Credit: [Analysis of query.time_of_day](https://gist.github.com/DoubleF3lix/a03afde0a979dfa41e8525ee92f12ca5)
|
||||
|
||||
</Spoiler>
|
||||
|
||||
## query.eye_target_x_rotation and query.eye_target_y_rotation
|
||||
|
||||
Not valid for player. not really sure what its good for.
|
||||
|
||||
## variable.short_arm_offset_right
|
||||
|
||||
Returns the offset factor for the player's rightarm bone compared to the default skin geometry. Slim-armed (3 pixel wide) skins will return `0.5` when equipped on the player. Normal (4 pixel wide) skins will return `0.0` when equipped on the player. Note: the player must go into 1st person perspective at least once for this variable to be initialized and usable elsewhere on the entity.
|
||||
|
||||
## variable.short_arm_offset_left
|
||||
|
||||
Identical behavior to `variable.short_arm_offset_right` except it references the player leftarm bone.
|
||||
|
||||
## query.movement_direction
|
||||
|
||||
Returns one of the 3 components from the normalized vector of the entity movement meaning the magnitude/modulus/length of the vector is between 0 and 1.
|
||||
|
||||
**Note**: As of writing the documentation, the value returned from any of the axis will change depending on the speed of the entity (If the entity is on the ground the value will be less than the value of the entity if it were in the air even if it is moving in the same direction).
|
||||
|
||||
To get the actual normalized velocity vector of the entity movement you will have to normalize the values. Here is the Molang setup:
|
||||
|
||||
```
|
||||
variable.mag = math.sqrt( math.pow( query.movement_direction(0), 2 ) + math.pow( query.movement_direction(1), 2) + math.pow( query.movement_direction(2), 2));
|
||||
variable.xNorm = query.movement_direction(0) / variable.mag;
|
||||
variable.yNorm = query.movement_direction(1) / variable.mag;
|
||||
variable.zNorm = query.movement_direction(2) / variable.mag;
|
||||
```
|
||||
|
||||
For more information on normalized vectors you can play around with this <a href=https://www.desmos.com/calculator/hhoamwgve2>Desmos graph</a>
|
||||
|
||||
| Argument | Axis |
|
||||
| -------- | ---- |
|
||||
| 0 | X |
|
||||
| 1 | Y |
|
||||
| 2 | Z |
|
||||
|
||||
## query.block_neighbor_has_any_tag and query.relative_block_has_any_tag
|
||||
|
||||
Requires `Experimental Molang Features` to use. From the docs `Takes a relative position and one or more tag names, and returns either 0 or 1 based on if the block at that position has any of the tags provided`. This is useful for using connecting blocks or detecting entities.
|
||||
|
||||
`query.block_neighbor_has_any_tag` - Takes block position
|
||||
`query.relative_block_has_any_tag` - Takes entity position
|
||||
|
||||
The syntax for it is `q.block_neighbor_has_any_tag(x,y,z,'tag_name')` and `q.relative_block_has_any_tag(x,y,z,'tag_name')`.
|
||||
|
||||
Example:
|
||||
- `q.relative_block_has_any_tag(0,-1,0,'grass')` would try to detect a block with the grass tag one block under the entity.
|
||||
- `q.block_neighbor_has_any_tag(0,-1,0,'grass')` would try to detect a block with the grass tag one block under the block.
|
||||
|
||||
To do multiple tags you would use `q.correct_query(0,-1,0,'grass', 'plant')` with `correct_query` being replaced by the right query.
|
||||
|
||||
Note that this can also detect custom tags and [vanilla tags](/blocks/block-tags)
|
||||
40
docs/wiki/documentation/shared-constructs.md
Normal file
40
docs/wiki/documentation/shared-constructs.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: Shared Constructs
|
||||
nav_order: 1
|
||||
tags:
|
||||
- Stable
|
||||
- Last updated for Version 1.18.10
|
||||
mentions:
|
||||
- Ciosciaa
|
||||
- ThomasOrs
|
||||
---
|
||||
|
||||
A few JSON constructs are expressible in multiple locations in the add-ons system.
|
||||
|
||||
## Range Objects
|
||||
Range objects define a spread between two numbers.
|
||||
|
||||
<CodeHeader>Range Object Example</CodeHeader>
|
||||
|
||||
```json
|
||||
{
|
||||
"min": 2,
|
||||
"max": 4
|
||||
}
|
||||
```
|
||||
|
||||
When provided, a random value will be selected inclusively between the minimum and maximum. Rolls are not retained; a new random value will be rolled each instance the range object would be used. The maximum must not be less than the minimum, but they may be equal to affix rolls to a specific value.
|
||||
|
||||
## Fraction Objects
|
||||
Fraction objects define a fraction using a numerator and denominator.
|
||||
|
||||
<CodeHeader>Fraction Object Example</CodeHeader>
|
||||
|
||||
```json
|
||||
{
|
||||
"numerator": 3,
|
||||
"denominator": 5
|
||||
}
|
||||
```
|
||||
|
||||
The value used in place of the object will be the computed division, `numerator` ÷ `denominator`. Both the numerator and denominator must be at least `1`, and the denominator cannot be equal to the numerator.
|
||||
2712
docs/wiki/documentation/sound-definitions.md
Normal file
2712
docs/wiki/documentation/sound-definitions.md
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user