Manage your elements with ElementsInitializer
The MModding Library provide the ElementsInitializer
interface. This interface is used to initialize mod elements, and register them.
Create an Element Initializer
public class MyMModdingModBlocks implements ElementsInitializer {
// Creation of a Simple Block
public static final CustomBlock MMODDING_BLOCK = new CustomBlock(
QuiltBlockSettings.of(Material.METAL)
)
@Override
public void register() {
// And we register it
MMODDING_BLOCK.register(
new Identifier("mmodding_exemple_mod", "mmodding_block")
);
}
}
Put an Elements Initializer in the Main Class
public class MyMModdingMod implements MModdingModInitializer {
// ...
@Override
public List<ElementsInitializer> getElementsInitializers() {
List<ElementsInitializer> elementsInitializers = new ArrayList<>();
// Add the Element Initializer in the List
elementsInitializers.add(new MyMModdingModBlocks());
return elementsInitializers;
}
// ...
}
By doing this, the MModdingModInitializer interface will directly run your ElementsInitializer objects before the execution of the MModdingModInitializer#onInitialize
method.
PreviousCreate the Main Class of Your ModNextClient-Side and Server-Side Main Clases and their Elements Managment
Last updated