add RegistryAccess for managing registries (#10154)

* add RegistryAccess for managing registries

* add missing types to key data generator

* fix some stuff

* Add RegistryKeys for all other non-server-backed registries

* fix tests

* remove Experimental annotations
This commit is contained in:
Jake Potrebic 2024-05-04 11:22:35 -07:00 committed by GitHub
parent 156675c773
commit 5632210f10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 2842 additions and 207 deletions

View file

@ -513,24 +513,22 @@ index 0000000000000000000000000000000000000000..1e7b53f9bc13dcd5a0a4a40004591e4f
+ }
+}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index a04d279561676e825905f5512c399d14a3d8f828..ac8fe849dfd407bb2beeca16aeda3ebbe5c7a874 100644
index 91117cad12eee0bdaac8e0398a0f7f288ba27a40..43f410326d6d68242113e2fefe31af256889ed9c 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -283,6 +283,17 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -292,6 +292,15 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @see GameEvent
*/
Registry<GameEvent> GAME_EVENT = Objects.requireNonNull(Bukkit.getRegistry(GameEvent.class), "No registry present for GameEvent. This is a bug.");
+
Registry<GameEvent> GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper
+ // Paper start
+ /**
+ * Configured structures.
+ * @see io.papermc.paper.world.structure.ConfiguredStructure
+ * @deprecated use {@link #STRUCTURE}
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#STRUCTURE}
+ */
+ @Deprecated(forRemoval = true)
+ Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = Bukkit.getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class);
+ Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class), "No registry present for ConfiguredStructure. This is a bug.");
+ // Paper end
+
/**
* Get the object by its key.
*