RegistrySnapshot

public final class RegistrySnapshot

Read-only copies of the Bukkit registries that content loading reads.

Content configs load on a MagmaCore worker thread, but CraftRegistry resolves entries lazily into a plain HashMap. A worker lookup that misses that cache writes to it while the server thread or another plugin may be writing too, which throws ConcurrentModificationException and drops the config file being parsed. On Paper 26.3 that silently emptied every barrel because treasure_barrel_food.yml failed to load.

capture runs on the server thread before the async phase. Workers then read these immutable maps instead of the registry. Iterating each registry also resolves every entry into CraftRegistry's cache, so lookups a worker still makes indirectly, such as ItemStack deserialization, find existing entries instead of inserting new ones.

Functions

Link copied to clipboard
public static Biome biome(String name)
Thread-safe replacement for valueOf: accepts a vanilla biome name such as PLAINS, or a namespaced key, in any case.
Link copied to clipboard
public static void capture()
Copies the registries.
Link copied to clipboard
@Nullable()
public static Enchantment enchantment(NamespacedKey key)