update doc/*/assets-preload.md

This commit is contained in:
MihailRis 2026-10-26 12:38:30 +03:00
parent 07568e6ae8
commit 65b40d7f5f
2 changed files with 85 additions and 0 deletions

View file

@ -38,6 +38,48 @@ Additional load settings example:
]
}
```
## Patterns
An asset name may contain `*` to include multiple assets at once. The `*` matches any sequence of characters within a single path segment.
Pattern matching is performed within the pack containing `preload.json`, specifically within the folder corresponding to the asset type (e.g., `textures/`, `sounds/`, etc.).
The resulting asset names are the same as if each discovered asset had been specified explicitly.
```json
{
"textures": [
"gui/*",
"mobs/*/skin-*"
],
"sounds": [
"steps/*"
]
}
```
> [!NOTE]
> Sound variations (such as `grass_0.ogg`, `grass_1.ogg`, etc.) are added as a single sound entry (e.g., `steps/grass`).
A pattern ending in `/` matches directories rather than individual files. This is used for atlases:
```json
{
"atlases": [
"smth/*/other-*/*/"
]
}
```
Entry parameters apply to all matched assets. The `path` parameter cannot be used in conjunction with a pattern:
```json
{
"sounds": [
{
"name": "ambient/*",
"keep-pcm": true
}
]
}
```
*preload.json* example from `core:` package (`res/preload.json`):
```json

View file

@ -39,6 +39,49 @@
```
## Шаблоны
Имя ассета может содержать `*` для добавления сразу нескольких ассетов. `*` соответствует любой последовательности символов в пределах одного сегмента пути.
Поиск по шаблону производится в паке, содержащем `preload.json`, в папке типа ассетов (`textures/`, `sounds/`, ...).
Имена ассетов получаются такими же, как если бы каждый найденный ассет был указан явно.
```json
{
"textures": [
"gui/*",
"mobs/*/skin-*"
],
"sounds": [
"steps/*"
]
}
```
> [!NOTE]
> Вариации звука (`grass_0.ogg`, `grass_1.ogg`, ...) добавляются как один звук (`steps/grass`).
Шаблон, оканчивающийся на `/`, соответствует папкам, а не файлам. Используется для атласов:
```json
{
"atlases": [
"smth/*/other-*/*/"
]
}
```
Параметры записи применяются ко всем найденным ассетам. Параметр `path` нельзя использовать вместе с шаблоном:
```json
{
"sounds": [
{
"name": "ambient/*",
"keep-pcm": true
}
]
}
```
Пример файла из пакета `core:` (`res/preload.json`):
```json
{