aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0236-Add-RegistryAccess-for-managing-registries.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/api/0236-Add-RegistryAccess-for-managing-registries.patch')
-rw-r--r--patches/api/0236-Add-RegistryAccess-for-managing-registries.patch44
1 files changed, 27 insertions, 17 deletions
diff --git a/patches/api/0236-Add-RegistryAccess-for-managing-registries.patch b/patches/api/0236-Add-RegistryAccess-for-managing-registries.patch
index f08dfa8fde..275ee68a7c 100644
--- a/patches/api/0236-Add-RegistryAccess-for-managing-registries.patch
+++ b/patches/api/0236-Add-RegistryAccess-for-managing-registries.patch
@@ -207,10 +207,10 @@ index e0f652117e585882693736de8165ae9c689e1d68..fbe14c327ee9c1ac07893853ca7c699e
return server.getRegistry(tClass);
}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
-index fbede496b05c4b9b1ecd12e711a100586776d469..3777f9c92d0c183d0ab5e28bbe73f2125babf61c 100644
+index 4e67b944351ec3743e5eeaba3f5de99e0df15154..39997047be9f3796d8d5d8934eb361e23d273ebd 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
-@@ -88,8 +88,10 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
+@@ -98,8 +98,10 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Server banner patterns.
*
* @see PatternType
@@ -222,7 +222,7 @@ index fbede496b05c4b9b1ecd12e711a100586776d469..3777f9c92d0c183d0ab5e28bbe73f212
/**
* Server biomes.
*
-@@ -103,7 +105,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
+@@ -113,7 +115,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @apiNote BlockType is not ready for public usage yet
*/
@ApiStatus.Internal
@@ -231,7 +231,7 @@ index fbede496b05c4b9b1ecd12e711a100586776d469..3777f9c92d0c183d0ab5e28bbe73f212
/**
* Custom boss bars.
*
-@@ -135,13 +137,15 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
+@@ -155,13 +157,15 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see Cat.Type
*/
@@ -249,7 +249,7 @@ index fbede496b05c4b9b1ecd12e711a100586776d469..3777f9c92d0c183d0ab5e28bbe73f212
/**
* Server entity types.
*
-@@ -153,7 +157,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
+@@ -173,7 +177,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see MusicInstrument
*/
@@ -258,7 +258,7 @@ index fbede496b05c4b9b1ecd12e711a100586776d469..3777f9c92d0c183d0ab5e28bbe73f212
/**
* Server item types.
*
-@@ -161,7 +165,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
+@@ -181,7 +185,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @apiNote ItemType is not ready for public usage yet
*/
@ApiStatus.Internal
@@ -267,7 +267,7 @@ index fbede496b05c4b9b1ecd12e711a100586776d469..3777f9c92d0c183d0ab5e28bbe73f212
/**
* Default server loot tables.
*
-@@ -180,13 +184,13 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
+@@ -200,13 +204,13 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @see MenuType
*/
@ApiStatus.Experimental
@@ -283,13 +283,13 @@ index fbede496b05c4b9b1ecd12e711a100586776d469..3777f9c92d0c183d0ab5e28bbe73f212
/**
* Server particles.
*
-@@ -209,14 +213,16 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
+@@ -229,14 +233,16 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Server structures.
*
* @see Structure
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#STRUCTURE}
*/
-- Registry<Structure> STRUCTURE = Bukkit.getRegistry(Structure.class);
+- Registry<Structure> STRUCTURE = Objects.requireNonNull(Bukkit.getRegistry(Structure.class), "No registry present for Structure. This is a bug.");
+ @Deprecated(since = "1.20.6") // Paper
+ Registry<Structure> STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Structure.class), "No registry present for Structure. This is a bug."); // Paper
/**
@@ -297,18 +297,18 @@ index fbede496b05c4b9b1ecd12e711a100586776d469..3777f9c92d0c183d0ab5e28bbe73f212
*
* @see StructureType
*/
-- Registry<StructureType> STRUCTURE_TYPE = Bukkit.getRegistry(StructureType.class);
-+ Registry<StructureType> STRUCTURE_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.STRUCTURE_TYPE); // Paper
+- Registry<StructureType> STRUCTURE_TYPE = Objects.requireNonNull(Bukkit.getRegistry(StructureType.class), "No registry present for StructureType. This is a bug.");
++ Registry<StructureType> STRUCTURE_TYPE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.STRUCTURE_TYPE), "No registry present for StructureType. This is a bug."); // Paper
/**
* Sound keys.
*
-@@ -227,40 +233,47 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
+@@ -247,40 +253,47 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Trim materials.
*
* @see TrimMaterial
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_MATERIAL}
*/
-- Registry<TrimMaterial> TRIM_MATERIAL = Bukkit.getRegistry(TrimMaterial.class);
+- Registry<TrimMaterial> TRIM_MATERIAL = Objects.requireNonNull(Bukkit.getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug.");
+ @Deprecated(since = "1.20.6") // Paper
+ Registry<TrimMaterial> TRIM_MATERIAL = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug."); // Paper
/**
@@ -317,7 +317,7 @@ index fbede496b05c4b9b1ecd12e711a100586776d469..3777f9c92d0c183d0ab5e28bbe73f212
* @see TrimPattern
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_PATTERN}
*/
-- Registry<TrimPattern> TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class);
+- Registry<TrimPattern> TRIM_PATTERN = Objects.requireNonNull(Bukkit.getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug.");
+ @Deprecated(since = "1.20.6")
+ Registry<TrimPattern> TRIM_PATTERN = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug."); // Paper
/**
@@ -357,7 +357,7 @@ index fbede496b05c4b9b1ecd12e711a100586776d469..3777f9c92d0c183d0ab5e28bbe73f212
/**
* Memory Keys.
*
-@@ -297,25 +310,27 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
+@@ -327,25 +340,27 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see Frog.Variant
*/
@@ -432,10 +432,10 @@ index 0000000000000000000000000000000000000000..f5ece852f97017f71bc129e194cb2129
+ }
+}
diff --git a/src/test/java/org/bukkit/support/TestServer.java b/src/test/java/org/bukkit/support/TestServer.java
-index c79faf4197f9c0a7256cefe2b001182102d2b796..55f1bc7d01e5184172559c43b8327ac86d58041b 100644
+index 2a3ae4afef2716a5fdcefbb6d5e0e011d1db9934..494419922f11e494c9de6f757bb76f0cfe5d7c81 100644
--- a/src/test/java/org/bukkit/support/TestServer.java
+++ b/src/test/java/org/bukkit/support/TestServer.java
-@@ -37,36 +37,11 @@ public final class TestServer {
+@@ -38,46 +38,11 @@ public final class TestServer {
when(instance.getBukkitVersion()).thenReturn("BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion());
@@ -460,6 +460,16 @@ index c79faf4197f9c0a7256cefe2b001182102d2b796..55f1bc7d01e5184172559c43b8327ac8
-
- @NotNull
- @Override
+- public Keyed getOrThrow(@NotNull NamespacedKey key) {
+- Keyed keyed = get(key);
+-
+- Preconditions.checkArgument(keyed != null, "No %s registry entry found for key %s.", aClass, key);
+-
+- return keyed;
+- }
+-
+- @NotNull
+- @Override
- public Stream<Keyed> stream() {
- throw new UnsupportedOperationException("Not supported");
- }