dev.polymodloader.api.resource
이 페이지는 소스의 Javadoc에서 ./gradlew apiReference로 만든 것입니다. 설명은 코드에 적힌 영어 그대로입니다. 직접 고치지 말고 소스의 주석을 고친 뒤 다시 만드세요.
| 형식 | 종류 | 설명 |
|---|---|---|
BinaryReloadListener | 함수형 인터페이스 | Like ResourceReloadListener, for files of any kind: their bytes as stored in the pack. |
ResourceId | 레코드 | A namespaced identifier such as minecraft:stone or my_mod:copper_bricks. |
ResourceRegistrar | 인터페이스 | Lets mods read their own kinds of JSON files from data packs and resource packs, like the game reads recipes or models. |
ResourceReloadListener | 함수형 인터페이스 | Receives a mod's own data or asset files each time the game (re)loads its packs. |
BinaryReloadListener
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface BinaryReloadListener
Like ResourceReloadListener, for files of any kind: their bytes as stored in the pack.
onReload(Map<ResourceId,byte[]>)
void onReload(Map<ResourceId,byte[]> files)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Files by ID (<namespace>:<path without the suffix>); the arrays are the listener's own.
| 인자 | 타입 | 설명 |
|---|---|---|
files | Map<ResourceId,byte[]> | — |
ResourceId
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record ResourceId(String namespace, String path) implements Comparable<ResourceId>
A namespaced identifier such as minecraft:stone or my_mod:copper_bricks. Names use Minecraft's rules: the namespace may contain a-z 0-9 _ - ., the path additionally /. Invalid names are rejected when the identifier is created, not when the game uses it.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
namespace | String | mod ID or minecraft |
path | String | name inside the namespace |
of(String, String)
public static ResourceId of(String namespace, String path)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Creates namespace:path.
| 인자 | 타입 | 설명 |
|---|---|---|
namespace | String | — |
path | String | — |
반환 ResourceId
minecraft(String)
public static ResourceId minecraft(String path)
추가된 버전 0.1.0-alpha.4 또는 그 이전
An identifier in the minecraft namespace.
| 인자 | 타입 | 설명 |
|---|---|---|
path | String | — |
반환 ResourceId
parse(String)
public static ResourceId parse(String text)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Parses namespace:path; text without a colon is in the minecraft namespace, as in the game's commands and data files.
| 인자 | 타입 | 설명 |
|---|---|---|
text | String | — |
반환 ResourceId
ResourceRegistrar
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ResourceRegistrar
Lets mods read their own kinds of JSON files from data packs and resource packs, like the game reads recipes or models. Register in entrypoints.
onDataReload(String, ResourceReloadListener)
void onDataReload(String directory, ResourceReloadListener listener)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Reads data/<namespace>/<directory>/**.json from all enabled data packs (including mod jars) when the server starts and on /reload; the listener runs on the server thread after the game's own data has loaded.
| 인자 | 타입 | 설명 |
|---|---|---|
directory | String | for example my_mod/spells; a-z 0-9 _ / . - |
listener | ResourceReloadListener | — |
예외 IllegalArgumentException — for an invalid directory (POLY-RESOURCE-001)
예외 IllegalStateException — after registration closed (POLY-RESOURCE-002)
onAssetReload(String, ResourceReloadListener)
void onAssetReload(String directory, ResourceReloadListener listener)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Reads assets/<namespace>/<directory>/**.json from the enabled resource packs when the client starts and on F3+T; the listener runs on the client thread. Client only; on a dedicated server it is never called.
| 인자 | 타입 | 설명 |
|---|---|---|
directory | String | — |
listener | ResourceReloadListener | — |
onDataFiles(String, String, BinaryReloadListener)
void onDataFiles(String directory, String suffix, BinaryReloadListener listener)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Like onDataReload, for files ending in suffix (for example .png or .txt), handed over as bytes.
| 인자 | 타입 | 설명 |
|---|---|---|
directory | String | — |
suffix | String | — |
listener | BinaryReloadListener | — |
onAssetFiles(String, String, BinaryReloadListener)
void onAssetFiles(String directory, String suffix, BinaryReloadListener listener)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Like onAssetReload, for files ending in suffix, as bytes.
| 인자 | 타입 | 설명 |
|---|---|---|
directory | String | — |
suffix | String | — |
listener | BinaryReloadListener | — |
ResourceReloadListener
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ResourceReloadListener
Receives a mod's own data or asset files each time the game (re)loads its packs.
onReload(Map<ResourceId,String>)
void onReload(Map<ResourceId,String> files)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The JSON files found, by ID: data/<namespace>/<directory>/<path>.json becomes <namespace>:<path>; contents are UTF-8 text. Higher-priority packs replace lower ones.
| 인자 | 타입 | 설명 |
|---|---|---|
files | Map<ResourceId,String> | — |