본문으로 건너뛰기
버전: Minecraft 26.2

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.

인자타입설명
filesMap<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.

구성 요소타입설명
namespaceStringmod ID or minecraft
pathStringname inside the namespace

of(String, String)​

public static ResourceId of(String namespace, String path)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Creates namespace:path.

인자타입설명
namespaceString—
pathString—

반환 ResourceId

minecraft(String)​

public static ResourceId minecraft(String path)

추가된 버전 0.1.0-alpha.4 또는 그 이전

An identifier in the minecraft namespace.

인자타입설명
pathString—

반환 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.

인자타입설명
textString—

반환 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.

인자타입설명
directoryStringfor example my_mod/spells; a-z 0-9 _ / . -
listenerResourceReloadListener—

예외 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.

인자타입설명
directoryString—
listenerResourceReloadListener—

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.

인자타입설명
directoryString—
suffixString—
listenerBinaryReloadListener—

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.

인자타입설명
directoryString—
suffixString—
listenerBinaryReloadListener—

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.

인자타입설명
filesMap<ResourceId,String>—
Buy me a coffee