Skip to content

danielkrafft/RegistryTemplates

Repository files navigation

RegistryTemplates Maven Central

This mod provides configurable templates to register modded content in a few lines or less.

IMPORTANT

This is a development preview. Not recommended for production use

Table of Contents

  1. Quick Setup Guide
  2. Usage

Quick Setup Guide

Neoforge:

Add the following dependency to your build script:

implementation "com.danielkkrafft.registrytemplates:registrytemplates-neoforge:1.0.3-alpha"

Add the following to your mod's main class constructor:

public Main(IEventBus eventBus) {
    new RegistryTemplates("com.danielkkrafft.examplemod", Constants.MOD_ID, eventBus).load(); // use your own base package and modid
}

Add the following to your mods.toml:

[[dependencies.${mod_id}]]
modId = "registrytemplates"
type="required"
versionRange = "[1.0.3-alpha,)"
ordering = "BEFORE"
side = "BOTH"

Fabric

Add the following dependency to your build script:

implementation "com.danielkkrafft.registrytemplates:registrytemplates-fabric:1.0.3-alpha"

Add the following to your mod's main initialization hook:

@Override
public void onInitialize() {
    new RegistryTemplates("com.danielkkrafft.examplemod", Constants.MOD_ID).load(); // use your own base package and modid
}

Add the following entrypoint to your fabric.mod.json:

"entrypoints": {
    "fabric-datagen": [
        "com.danielkkrafft.registrytemplates.DataGenerators"
    ]
}

Add the following dependency to your fabric.mod.json:

"depends": {
        "registrytemplates": "*"
}

Multiloader

Follow the Neoforge and Fabric steps for their respective modules, then add the following dependency to your common module's build script:

implementation "com.danielkkrafft.registrytemplates:registrytemplates-common:1.0.3-alpha"

Usage

You can declare a RegistryTemplate anywhere in your project:

@ModContent // make sure to include this annotation so the class will load automatically
public class Example {
    public static final RTAbstractItem<Item, ?> ITEM = new RTAbstractItem<>("example_item", Item::new).flatModel().setLocalEN(() -> "Example Item");
}

The above example generates an item called "example_item" with a flat item model and English localization. That's all you need!

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages