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
parent 128ea2f10b
commit 4473bf06e0
19 changed files with 2803 additions and 168 deletions

View File

@@ -519,18 +519,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ 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.
*