Paper/patches/api/0363-Expand-the-Registry-API.patch
2022-02-28 22:52:35 -07:00

37 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 14 Aug 2021 16:19:03 -0700
Subject: [PATCH] Expand the Registry API
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 6242336de18fdd708cc3d7b745cbbace13140bc0..661d424c609a01ad9bee837b4069d9e4e98d20c0 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -209,6 +209,25 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
return Arrays.stream(org.bukkit.potion.PotionEffectType.values()).iterator();
}
};
+
+ /**
+ * Structure types.
+ *
+ * @see StructureType
+ */
+ Registry<StructureType> STRUCTURE_TYPE = new Registry<StructureType>() {
+
+ @Override
+ public @Nullable StructureType get(@NotNull NamespacedKey key) {
+ return StructureType.getStructureTypes().get(key.getKey());
+ }
+
+ @NotNull
+ @Override
+ public Iterator<StructureType> iterator() {
+ return StructureType.getStructureTypes().values().iterator();
+ }
+ };
// Paper end
/**