mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-07 19:12:22 +01:00
e1c0033552
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 2b4b6d14 PR-1023: Convert InventoryView to interface CraftBukkit Changes: 68603b1c1 Use expanded interaction ranges for traced interact events eae9f760c PR-1414: Convert InventoryView to interface ee9eafe67 Fix Implementation for DamageSource#isIndirect for internal custom causing entity
62 lines
2.3 KiB
Diff
62 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
|
Date: Sat, 15 Jun 2024 21:42:19 -0400
|
|
Subject: [PATCH] WIP Tag API
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/registry/tag/TagKey.java b/src/main/java/io/papermc/paper/registry/tag/TagKey.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..a49d328e95f7fda6567ee6c4f5f1878a2c187277
|
|
--- /dev/null
|
|
+++ b/src/main/java/io/papermc/paper/registry/tag/TagKey.java
|
|
@@ -0,0 +1,32 @@
|
|
+package io.papermc.paper.registry.tag;
|
|
+
|
|
+import io.papermc.paper.registry.RegistryKey;
|
|
+import net.kyori.adventure.key.Key;
|
|
+import net.kyori.adventure.key.Keyed;
|
|
+import org.checkerframework.checker.nullness.qual.NonNull;
|
|
+import org.jetbrains.annotations.ApiStatus;
|
|
+import org.jetbrains.annotations.Contract;
|
|
+
|
|
+@ApiStatus.Experimental
|
|
+public sealed interface TagKey<T> extends Keyed permits TagKeyImpl {
|
|
+
|
|
+ /**
|
|
+ * Creates a new tag key for a registry.
|
|
+ *
|
|
+ * @param registryKey the registry for the tag
|
|
+ * @param key the specific key for the tag
|
|
+ * @return a new tag key
|
|
+ * @param <T> the registry value type
|
|
+ */
|
|
+ @Contract(value = "_, _ -> new", pure = true)
|
|
+ static <T> @NonNull TagKey<T> create(final @NonNull RegistryKey<T> registryKey, final @NonNull Key key) {
|
|
+ return new TagKeyImpl<>(registryKey, key);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Get the registry key for this tag key.
|
|
+ *
|
|
+ * @return the registry key
|
|
+ */
|
|
+ @NonNull RegistryKey<T> registryKey();
|
|
+}
|
|
diff --git a/src/main/java/io/papermc/paper/registry/tag/TagKeyImpl.java b/src/main/java/io/papermc/paper/registry/tag/TagKeyImpl.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..11d19e339c7c62f2eb4467277552c27e4e83069c
|
|
--- /dev/null
|
|
+++ b/src/main/java/io/papermc/paper/registry/tag/TagKeyImpl.java
|
|
@@ -0,0 +1,12 @@
|
|
+package io.papermc.paper.registry.tag;
|
|
+
|
|
+import io.papermc.paper.registry.RegistryKey;
|
|
+import net.kyori.adventure.key.Key;
|
|
+import org.checkerframework.checker.nullness.qual.NonNull;
|
|
+import org.checkerframework.framework.qual.DefaultQualifier;
|
|
+import org.jetbrains.annotations.ApiStatus;
|
|
+
|
|
+@ApiStatus.Internal
|
|
+@DefaultQualifier(NonNull.class)
|
|
+record TagKeyImpl<T>(RegistryKey<T> registryKey, Key key) implements TagKey<T> {
|
|
+}
|