From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic 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 798aab0d644ca383ff4391685d854af65925fb0c..41363490b1e72d53ab3f1f26fe464858bb7b8f72 100644 --- a/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java @@ -214,6 +214,25 @@ public interface Registry extends Iterable { return Arrays.stream(org.bukkit.potion.PotionEffectType.values()).iterator(); } }; + + /** + * Structure types. + * + * @see StructureType + */ + Registry STRUCTURE_TYPE = new Registry() { + + @Override + public @Nullable StructureType get(@NotNull NamespacedKey key) { + return StructureType.getStructureTypes().get(key.getKey()); + } + + @NotNull + @Override + public Iterator iterator() { + return StructureType.getStructureTypes().values().iterator(); + } + }; // Paper end /**