diff --git a/doc/en/assets-preload.md b/doc/en/assets-preload.md index e40403298..8591c4402 100644 --- a/doc/en/assets-preload.md +++ b/doc/en/assets-preload.md @@ -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 diff --git a/doc/ru/assets-preload.md b/doc/ru/assets-preload.md index 1d39d76aa..cfc3a1832 100644 --- a/doc/ru/assets-preload.md +++ b/doc/ru/assets-preload.md @@ -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 {