Skip to content

Java API

MattiDragon edited this page Jan 28, 2022 · 4 revisions

Setup

Gradle

Add the following to your buildscript:

repositories {
    maven { url = "https://jitpack.io" }
}

dependecies {
    modImplementation "com.github.LordDeatHunter:FabricaeExNihilo:VERSION"
}

Make sure to replace VERSION with the correct version and refresh gradle so that FEN is available.

Entrypoint

Start by creating a class that implements FENApiModule and implement the method void onInit(FENRegistries). This will be called during mod init before FEN is initialized.

You can technically do anything you want here, but the main use case is registering content through the provided FENRegistries instance. Unless otherwise specified the method in FENRegistries will only register the blocks and item. It will not create assets for you.

After creating an api module you need to register it in you fabric.mod.json under the entrypoint fabricaeexnihilo:api.

Examples

Adding a Wood Type

@Override
public void onInit(FENRegistries registries) {
    registries.registerWood("cherry");
    registries.registerInfestedLeaves("cherry", new Identifier("examplemod:cherry_leaves"));
    registries.registerSeed("cherry", new Identifier("examplemod:cherry_sapling"));
}

Adding a Ore Piece

@Override
public void onInit(FENRegistries registries) {
    registries.registerOrePiece("tin", new Color("E6FFF2"));
}

For more examples check out the build-in modules

Clone this wiki locally