Skip to content
Merged
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
23 changes: 19 additions & 4 deletions patches/api/0004-Code-Generation.patch
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ index 0000000000000000000000000000000000000000..80e3e64f47ac55a4978c9e5b430e2f2d
+}
diff --git a/src/main/java/io/papermc/paper/registry/TypedKey.java b/src/main/java/io/papermc/paper/registry/TypedKey.java
new file mode 100644
index 0000000000000000000000000000000000000000..cb2e1a4a6d583787573eeefab24e3188c43d148f
index 0000000000000000000000000000000000000000..81bee5224196008662ddda528b5dcb8dd7cb9f21
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/TypedKey.java
@@ -0,0 +1,45 @@
Expand All @@ -337,7 +337,7 @@ index 0000000000000000000000000000000000000000..cb2e1a4a6d583787573eeefab24e3188
+ */
[email protected]
+@NullMarked
+public sealed interface TypedKey<T> extends Keyed permits TypedKeyImpl {
+public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
+
+ /**
+ * Gets the key for the value in the registry.
Expand Down Expand Up @@ -370,17 +370,32 @@ index 0000000000000000000000000000000000000000..cb2e1a4a6d583787573eeefab24e3188
+}
diff --git a/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..99375deaa6b90b33cd6a77e0df651236d304874e
index 0000000000000000000000000000000000000000..3e29f7007500582cdc3f84b91f11ebeb58f68bbf
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
@@ -0,0 +1,8 @@
@@ -0,0 +1,23 @@
+package io.papermc.paper.registry;
+
+import net.kyori.adventure.key.Key;
+import org.jspecify.annotations.NullMarked;
+
+@NullMarked
+record TypedKeyImpl<T>(Key key, RegistryKey<T> registryKey) implements TypedKey<T> {
+ // Wrap key methods to make this easier to use
+ @Override
+ public String namespace() {
+ return this.key.namespace();
+ }
+
+ @Override
+ public String value() {
+ return this.key.value();
+ }
+
+ @Override
+ public String asString() {
+ return this.key.asString();
+ }
+}
diff --git a/src/main/java/org/bukkit/MinecraftExperimental.java b/src/main/java/org/bukkit/MinecraftExperimental.java
index b7845523e8587e13b86516c0012fe097d904846c..d92a75f610cb2a95203b3f22dc67bdbfb5c3405a 100644
Expand Down
Loading