Skip to main content
Version: Minecraft 26.2

Resources and data

Packs in the mod jar​

assets/ in the mod jar is added automatically as a client resource pack, and data/ as a server data pack.

  • The pack ID is poly/<mod id>.
  • It is a required pack and sits on top of vanilla.
  • The format is the same as vanilla 26.2.
PathPurpose
assets/<mod>/blockstates/<block>.json, models/block/…, textures/block/…Block appearance
assets/<mod>/items/<item>.json, models/item/…, textures/item/…Item appearance
assets/<mod>/lang/en_us.json, ko_kr.jsonblock.<mod>.<id>, item.<mod>.<id>, key.<mod>.<id>, key.category.<mod>.keybinds
assets/<mod>/textures/entity/…Mob textures
assets/<mod>/sounds.jsonSound events
assets/<mod>/particles/<path>.json, textures/particle/…Particle sprites
assets/<mod>/post_effect/<path>.json, shaders/post/…Post-processing shaders
data/<mod>/loot_table/blocks/<block>.jsonBlock drops (nothing drops if missing)
data/<mod>/recipe/*.jsonRecipes
data/<mod>/advancement/*.jsonAdvancements
data/<mod>/worldgen/…, dimension/…, dimension_type/…, damage_type/…World generation, dimensions, damage types
data/minecraft/tags/block/mineable/pickaxe.json ("replace": false)Tool tags
data/my_mod/loot_table/blocks/glow_block.json
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"conditions": [{"condition": "minecraft:survives_explosion"}],
"entries": [{"type": "minecraft:item", "name": "my_mod:glow_block"}]
}
]
}

Reload listeners​

Use these when your mod reads data files in its own format.

mod.resources().onDataReload("my_mod/spells", files -> { /* … */ }); // data/<ns>/my_mod/spells/**.json
mod.resources().onAssetReload("my_mod/tips", files -> { /* … */ }); // assets/… (client)
mod.resources().onDataFiles("my_mod/banners", ".txt", files -> { /* … */ }); // received as bytes; onAssetFiles exists too
  • onDataReload and onAssetReload give you JSON files as a Map<ResourceId, String>. onDataFiles and onAssetFiles give you files with the extension you specify as a Map<ResourceId, byte[]>.
  • A file ID is <namespace>:<path under the directory>, and the pack with the higher priority wins.
  • Server data: read at startup and on /reload, after the game data. It is called on the main thread at startup and on the server thread on /reload.
  • Client assets: read on the client thread at startup and on F3+T.
  • If a file cannot be read or a listener fails, Poly Mod Loader logs POLY-RESOURCE-003 and continues.

If you read the result from another thread, publish it by replacing a volatile field as a whole.

static volatile Map<ResourceId, String> messages = Map.of();

mod.resources().onDataReload("my_mod_messages", files -> messages = files);

Error codes​

CodeMeaning
POLY-RESOURCE-001Invalid reload directory
POLY-RESOURCE-002Declared after registration closed
POLY-RESOURCE-003File could not be read or listener failed (logged, then continues)
POLY-CONTENT-004Unknown pack type
Buy me a coffee