Custom assets

Didn't find what you were looking for? Try custom assets. They allow you to add any file to any directory in the virtual pack.

data/resources.customAsset(<Path/File object pointing to the original file>, "<internal file name>", "<subdir 1>", "<subdir 2>", "<subdir 3>"...);
Example
// This code copies the test.png file in the game instance directory and registers it as "funnymod:funny/veryfunny/test.png"
VirtualDataPack data = new VirtualDataPack("funnymod");
data.customAsset(FMLPaths.GAMEDIR.get().resolve("test.png"), "test.png", "funny", "veryfunny");

Note: The first argument can also be an object, the api will automatically convert it into a stringified json.

Last updated