Packager is a lightweight Java library that lets you build, populate, and write Minecraft resource packs entirely in code. No more copying folders – simply declare textures, models, and JSON declarations, then export a ready-to-use .zip or folder.
-
Fluent Builder API for constructing packs
-
Add textures (PNG) and models (JSON) by code
-
Automatic pack metadata (
pack.mcmeta) generation -
Support for newest Minecraft resourcepack format
-
Write to directory or ZIP archive
<dependency>
<groupId>dev.redcrew</groupId>
<artifactId>packager</artifactId>
<version>1.0.0</version>
</dependency>
implementation("dev.redcrew:packager:1.0.0")public static void main(String[] args) throws IOException {
ItemModel catchnet = new ItemModelReader(new Location(Path.MODELS.extend(Path.ITEM)), "catchnet")
.read(Objects.requireNonNull(Demo.class.getResourceAsStream("qitem_catchnet.json")));
ResourcePack pack = new ResourcePack.Builder("Test Resource Pack", MinecraftVersion.v1_21_5)
.setDescription("A useless Description")
//Adding a custom Apple Texture
.addTexture(new Texture(Path.TEXTURES.extend(Path.ITEM),
"apple",
Objects.requireNonNull(Demo.class.getResourceAsStream("apple.png"))))
//Adding a Catchnet as Model
.addTexture(new Texture(Path.TEXTURES.extend(Path.ITEM),
"catchnet",
Objects.requireNonNull(Demo.class.getResourceAsStream("qitem_catchnet.png"))))
.addModel(catchnet)
.addDeclaration(new BasicDeclaration(catchnet))
//Build
.build();
ResourcePackWriter writer = new ResourcePackWriter(pack);
writer.writeToDirectory(Paths.get("H:/Workspace/Intellij/Packager/Demo"), true);
System.out.println("Done");
}// After building your ResourcePack instance...
ResourcePackWriter writer = new ResourcePackWriter(pack);
// Write as directory (true = overwrite if exists)
writer.writeToDirectory(Paths.get("output/PackagerDemo"), true);
// Or write as ZIP archive
writer.writeToZip(Paths.get("output/PackagerDemo.zip"), true);-
Constructor:
Builder(String packName, MinecraftVersion version) -
.setDescription(String description) -
.addTexture(Texture texture) -
.addModel(ItemModel model) -
.addDeclaration(Declaration decl) -
.build()→ResourcePack
- Constructor:
Texture(Location path, String name, InputStream pngStream)
-
Reads a JSON model from classpath or file
-
Constructor:
ItemModelReader(Location path, String name) -
.read(InputStream jsonStream)→ItemModel
- Convenience implementation of
Declarationfor item models
-
Constructor:
ResourcePackWriter(ResourcePack pack) -
.writeToDirectory(Path destDir, boolean overwrite) -
.writeToZip(Path zipPath, boolean overwrite)
For full Javadoc, see the documentation site.
This project is licensed under the MIT License. See LICENSE for full text.