Skip to content

Resource Helpers

MehVahdJukaar edited this page Jul 25, 2026 · 1 revision

Resource Helpers

The odds and ends used when generating or reading resources.

Mostly companions to Runtime Resource Packs, but they work on their own too.

Class
StaticResource A resource read once and kept around, so you can transform it repeatedly without hitting the resource manager again. StaticResource.getOrThrow(manager, path)
ResType The resource kinds (block models, item models, blockstates, textures, tags, recipes...) with their folders and extensions, so you don't hand-build paths
RPUtils Digging things out of the loaded packs: find a block's or item's first texture, find resource references inside a json recursively, read and write recipes, make a similar recipe for another block type
LangBuilder Build a lang file in code. Also has getReadableName, which turns some_block_name into Some Block Name
SimpleModelBuilder Build a block or item model json without writing json
SimpleTagBuilder Build a tag json, including appending to an existing tag
RecipeTemplate / RecipeConverter Take an existing recipe and produce a variant of it
BlockTypeResTransformer The heavy one: takes a resource and rewrites it for another block type, replacing ids, textures and paths. This is what turns one oak model into a model for every wood
BlockTypeSwapIngredient An ingredient that matches the equivalent item of another block type
McMetaFile Read and write .mcmeta, mostly for animated textures

Example

StaticResource oakModel = StaticResource.getOrThrow(manager,
        ResourceLocation.parse("models/block/oak_shelf.json"));

// one transformer, applied to every wood type: rewrites ids and textures from "oak" to the target
var transformer = BlockTypeResTransformer.wood(MyMod.MOD_ID, manager)
        .IDReplaceType("oak")
        .replaceBlockType("oak")
        .replaceWithTextureFromChild("minecraft:block/oak_planks", "planks");

See the Runtime Resource Packs page for how these get used in a generator.

Clone this wiki locally