Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dm-earth/deferredregistries
[Fabric/Quilt Mod] Register things in ease
https://github.com/dm-earth/deferredregistries
api fabric fabricmc fabricmc-mod minecraft minecraft-mod quilt quiltmc quiltmc-mod
Last synced: about 1 month ago
JSON representation
[Fabric/Quilt Mod] Register things in ease
- Host: GitHub
- URL: https://github.com/dm-earth/deferredregistries
- Owner: DM-Earth
- License: mit
- Created: 2022-10-04T06:14:50.000Z (about 2 years ago)
- Default Branch: 1.18
- Last Pushed: 2022-10-15T14:53:31.000Z (about 2 years ago)
- Last Synced: 2023-03-02T05:30:17.206Z (almost 2 years ago)
- Topics: api, fabric, fabricmc, fabricmc-mod, minecraft, minecraft-mod, quilt, quiltmc, quiltmc-mod
- Language: Java
- Homepage:
- Size: 74.2 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Deferred Registries
This Minecraft mod provides a way to register things that are not available at the time of registration, which is similar to how Minecraft Forge's `DeferredRegister` works.
### Setup
```gradle
repositories {
// [...]
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}dependencies {
// [...]
modImplementation include("maven.modrinth:deferred-registries:")
}
```### Usage
First, create a `DeferredRegistries` object, here we use `Item` as example:
```java
private static final DeferredRegistries ITEMS = DeferredRegistries.create(Registry.ITEM, "example_mod");
```Then, register things to it:
```java
public static final DeferredObject EXAMPLE_ITEM = ITEMS.register("example_item", () -> new Item(new Item.Settings()));
public static final DeferredObject SIMPLE_ITEM = ITEMS.register("simple_item", new Item(new Item.Settings()));
```Finally, register the DeferredRegistries object when initializing your mod:
```java
@Override
public void onInitialize() {
ITEMS.register();
}
```