Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,11 @@ def setUpModule(project) {
} else if (project.hasProperty('entrypoint_server_init')) {
entrypoint 'server-init', project.entrypoint_server_init
}
if (library.hasProperty('entrypoint_registry_init')) {
entrypoint 'registry-init', library.entrypoint_registry_init
} else if (project.hasProperty('entrypoint_registry_init')) {
entrypoint 'registry-init', project.entrypoint_registry_init
}

if (ctfile.exists()) {
accessWidener = ctfile.getName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0+mc1.8.2-pre5-mc15w51b",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.biomes.impl.BiomeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0+mc13w36a-mc1.8.2-pre4",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.biomes.impl.BiomeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0+mc16w02a-mc18w05a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.biomes.impl.BiomeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0+mc18w06a-mc18w31a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.biomes.impl.BiomeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0+mc18w43a-mc1.14.4",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.biomes.impl.BiomeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0+mcb1.8-pre1-mc1.6.4",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.biomes.impl.BiomeRegistryImpl::init"
]
},
Expand Down
2 changes: 1 addition & 1 deletion libraries/biomes/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ library_name = Biomes
library_description = Biomes API and events.
library_version = 0.1.0

entrypoint_init = net.ornithemc.osl.biomes.impl.BiomeRegistryImpl::init
entrypoint_registry_init = net.ornithemc.osl.biomes.impl.BiomeRegistryImpl::init
osl_dependencies = core:0.9.0,entrypoints:0.5.0,registries:0.1.0,localization:0.1.2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0+mc1.13-pre5-mc18w31a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blockentities.impl.BlockEntityTypeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0+mc1.14.1-pre1-mc1.14.4",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blockentities.impl.BlockEntityTypeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0+mc16w32a-mc18w01a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blockentities.impl.BlockEntityTypeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0+mc18w32a-mc1.14",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blockentities.impl.BlockEntityTypeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0+mca1.0.1_01-mc1.10.2",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blockentities.impl.BlockEntityTypeRegistryImpl::init"
]
},
Expand Down
2 changes: 1 addition & 1 deletion libraries/blockentities/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ library_name = Block Entities
library_description = Block Entities API and events.
library_version = 0.1.0

entrypoint_init = net.ornithemc.osl.blockentities.impl.BlockEntityTypeRegistryImpl::init
entrypoint_registry_init = net.ornithemc.osl.blockentities.impl.BlockEntityTypeRegistryImpl::init
osl_dependencies = core:0.9.0,entrypoints:0.5.0,registries:0.2.0
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.0+mc13w36a-mc14w26c",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blocks.impl.BlockRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.0+mc14w27a-mc15w35a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blocks.impl.BlockRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.0+mc15w36a-mc17w46a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blocks.impl.BlockRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.0+mc17w47a-mc18w31a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blocks.impl.BlockRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.0+mc18w32a-mc1.13.2",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blocks.impl.BlockRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.0+mc18w43a-mc1.14.4",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blocks.impl.BlockRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.0+mca1.0.1_01-mc1.6.4",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.blocks.impl.BlockRegistryImpl::init"
]
},
Expand Down
2 changes: 1 addition & 1 deletion libraries/blocks/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ library_name = Blocks
library_description = Blocks API and events.
library_version = 0.3.0

entrypoint_init = net.ornithemc.osl.blocks.impl.BlockRegistryImpl::init
entrypoint_registry_init = net.ornithemc.osl.blocks.impl.BlockRegistryImpl::init
osl_dependencies = core:0.10.0,entrypoints:0.5.0,blockstates:0.1.0,registries:0.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.2+mc1.8.2-pre5-mc1.10.2",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.entities.impl.EntityTypeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.2+mc12w01a-mc1.8.2-pre4",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.entities.impl.EntityTypeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.2+mc16w32a-mc18w01a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.entities.impl.EntityTypeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.2+mc18w19a-mc18w31a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.entities.impl.EntityTypeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.2+mc18w32a-mc19w04b",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.entities.impl.EntityTypeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.2+mc19w08a-mc1.14.4",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.entities.impl.EntityTypeRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.2+mca1.0.1_01-mc11w48a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.entities.impl.EntityTypeRegistryImpl::init"
]
},
Expand Down
2 changes: 1 addition & 1 deletion libraries/entities/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ library_name = Entities
library_description = Entities API and events.
library_version = 0.1.2

entrypoint_init = net.ornithemc.osl.entities.impl.EntityTypeRegistryImpl::init
entrypoint_registry_init = net.ornithemc.osl.entities.impl.EntityTypeRegistryImpl::init
osl_dependencies = core:0.9.0,entrypoints:0.5.0,registries:0.2.0
2 changes: 1 addition & 1 deletion libraries/items/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ library_name = Items
library_description = Items API and events.
library_version = 0.3.1

entrypoint_init = net.ornithemc.osl.items.impl.ItemRegistryImpl::init
entrypoint_registry_init = net.ornithemc.osl.items.impl.ItemRegistryImpl::init
osl_dependencies = core:0.9.0,entrypoints:0.5.0,registries:0.2.0,blocks:0.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.1+mc13w36a-mc14w25b",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.items.impl.ItemRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.1+mc14w26a-mc17w46a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.items.impl.ItemRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.1+mc17w47a-mc18w31a",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.items.impl.ItemRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.1+mc18w32a-mc1.13.2",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.items.impl.ItemRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.1+mc18w43a-mc1.14.4",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.items.impl.ItemRegistryImpl::init"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.3.1+mca1.0.1_01-mc1.6.4",
"environment": "*",
"entrypoints": {
"init": [
"registry-init": [
"net.ornithemc.osl.items.impl.ItemRegistryImpl::init"
]
},
Expand Down
8 changes: 5 additions & 3 deletions libraries/registries/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Block COOKIE = Registry.register(BlockRegistry.REGISTRY, COOKIE_KEY, new CookieB

## Creating Registries

Registries should be created in a `RegistryInitializer`. You can define this entrypoint in your `mod.json` with the `registry-init` key.

Just like with other resources, you must create a `ResourceKey` that uniquely identifies your registry. The `RegistryKeys` class provides some factory methods for creating resource keys for registries.

```java
Expand Down Expand Up @@ -74,12 +76,12 @@ public class CookieRecipes {
```java
package com.example;

import net.ornithemc.osl.entrypoints.api.ModInitializer;
import net.ornithemc.osl.registries.api.RegistryInitializer;

public class ExampleInitializer implements ModInitializer {
public class ExampleInitializer implements RegistryInitializer {

@Override
public void init() {
public void initRegistries() {
ExampleRegistries.init();
}
}
Expand Down
3 changes: 2 additions & 1 deletion libraries/registries/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
setUpLibrary(project)

dependencies {
implementation 'it.unimi.dsi:fastutil:8.5.9'
compileOnly 'it.unimi.dsi:fastutil:8.5.9'
compileOnly 'com.google.guava:guava:17.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public static void init() {
if (!initialized) {
initialized = true;

RegistryEntrypoints.invoke();

RegistriesImpl.init();
SyncedRegistriesImpl.init();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import net.minecraft.Bootstrap;

import net.ornithemc.osl.registries.impl.RegistryEntrypoints;
import net.ornithemc.osl.registries.impl.registry.RegistriesImpl;
import net.ornithemc.osl.registries.impl.registry.SyncedRegistriesImpl;

Expand All @@ -21,6 +22,10 @@ public class BootstrapMixin {
private static void osl$registries$initAndLockRegistries(Operation<Void> op) {
boolean wasInitialized = initialized;

if (!wasInitialized) {
RegistryEntrypoints.invoke();
}

// we could skip the call if initialized is already true
// but let's not mess with the bootstrap too much, eh
op.call();
Expand Down
Loading
Loading