Registed
Project Integration
To add Registed to your project using Gradle, follow these steps:
Using Groovy
build.gradle
repositories {
maven { url "https://api.modrinth.com/maven" }
}
dependencies {
modApi "maven.modrinth:registed:$project.registed_version"
}
gradle.properties
registed_version=?
Replace
?with the latest version of Registed from the releases page.
Using Kotlin
build.gradle.kts
repositories {
maven("https://api.modrinth.com/maven")
}
dependencies {
modApi("maven.modrinth:registed:${property("registedVersion")}")
}
gradle.properties
registedVersion=?
Replace
?with the latest version of Registed from the releases page.
Then add the Registed dependency to your fabric.mod.json file:
fabric.mod.json
{
// Other settings
"depends": {
"registed": "*"
},
// Other settings
}
Important: Registed should be used as a standalone mod and not embedded directly into your project.
Library Usage
To register objects, use the following approach:
full.path.to.ClassName.java
@RegistryId("modid")
public class ClassName {
@ho.artisan.registed.annotation.registries.Item
public static final Item ITEM = ...;
}
The class containing registered elements must be marked with the @RegistryID[^@RegistryID_classpath] annotation, which defines the namespace for your objects.
Also remember to reference this class in your configuration file:
fabric.mod.json
{
// Other settings
"entrypoints": {
"registed": [
"full.path.to.ClassName"
]
},
// Other settings
}
Registed supports all Registry<?> types from the Registries class1. To find the required annotation, convert the registry type name from UPPER_SNAKE_CASE to CamelCase. For example, for Registries.LOOT_NBT_PROVIDER_TYPE the corresponding annotation is @LootNBTProviderType.
All available annotations for registered objects are located in the
ho.artisan.registed.annotation.registriespackage.
These annotations can only be applied to fields, which must be declared as
staticandfinal.
By default, registered objects receive in-game identifiers based on field names in snake_case format. For example, the field MY_EXAMPLE_ITEM will get the identifier my_example_item. It's recommended to use UPPER_SNAKE_CASE for field names to preserve underscores in identifiers.
To customize the in-game identifier of an object, you can apply the @RegistryID[^@RegistryID_classpath] annotation directly to the field:
@RegistryID("my_item")
@ho.artisan.registed.annotation.registries.Item
public static final Item ITEM = ...;
The identifier specified in
@RegistryID[@^RegistryID_classpath] is used as-is without additional processing.
-
net.minecraft.registry.Registries↩