-
Notifications
You must be signed in to change notification settings - Fork 27
Adding Resources
Assets and data are both resources, these are the things you put in your (guess where) assets and data folder!
adding a resource
INSTANCE.addXXX();
the RuntimeResourcePack has all the methods you need for creating assets on the fly, all the methods there are documented, but I will provide a few examples
ARRP has builders for many of the jsons in minecraft, there are static methods to make your code a bit less verbose, but you can use the constructors directly
Animation mcmeta: import static net.devtech.arrp.json.animation.JAnimation.*
BlockState jsons: import static net.devtech.arrp.json.blockstate.JState.*
Lang Jsons: import static net.devtech.arrp.json.lang.JLang.*
Loot table jsons: import static net.devtech.arrp.json.loot.JLootTable.*
Block/ItemModels: import static net.devtech.arrp.json.models.JModel.*
Tag jsons: import static net.devtech.arrp.json.tags.JTags.*
public MyMod implements ModInitializer {
public static final RuntimeResourcePack RESOURCE_PACK = RuntimeResourcePack.create("mymod:test");
@Override
public void onInitialize() {
Identifier itemId = new Identifier("my_mod", "test_item");
Registry.register(ITEM, itemId, new Item(new Item.Settings().group(ItemGroup.MISC)));
// static imports help alot with this
// import static net.devtech.rrp.api.RuntimeResourcePack.id;
// import static net.devtech.rrp.json.loot.JLootTable.*;
RESOURCE_PACK.addLootTable(id("minecraft:blocks/acacia_fence"),
loot("minecraft:block")
.pool(pool()
.rolls(1)
.entry(entry()
.type("minecraft:item")
.name("minecraft:diamond"))
.condition(condition("minecraft:survives_explosion")))
);
RRPCallback.EVENT.register(a -> a.add(0, RESOURCE_PACK));
}
}
RRP works in conjunction with regular old resource packs of course, so you can choose to autogenerate some resources, and make the rest normal resources, you don't have to generate that texture, you just have to make sure it's in the right directory.
RRP doesn't support every possible json yet, there are builders to help with a few, but the rest you can use templates, or raw strings if you want, the methods you should look at are RuntimeResourcePack#addResource, and RuntimeResourcePack#addRawStringResource, and their Async counterparts