Skip to main content

Registry API

Paper provides type-safe access to Minecraft’s data-driven registries, allowing you to work with enchantments, biomes, items, and other game content in a safe, version-independent way.

What are Registries?

Registries are collections of game content defined by Minecraft’s data-driven system. Examples include:
  • Enchantments
  • Biomes
  • Items and blocks
  • Entities
  • Damage types
  • Game events
  • Structures

Registry Access

Basic Registry Access

Registry Keys

Paper provides typed constants for registry entries:

Available Registries

Enchantments

Biomes

Items and Blocks

Entity Types

Damage Types

Game Events

Instruments

Jukebox Songs

Registry Keys

All available registry key classes:

NamespacedKey

All registry entries are identified by NamespacedKeys:

Custom Registry Content

While you can’t add new registry entries at runtime (they’re defined by datapacks), you can:
  1. Use datapacks to add custom content
  2. Check if content exists before using it
  3. Iterate available content from mods/datapacks

Datapack Integration

Manage datapacks that provide registry content:

Registry Best Practices

Use registry keys (e.g., EnchantmentKeys.SHARPNESS) instead of string-based lookups for type safety and better IDE support.
Registry content is loaded from datapacks and cannot be modified at runtime. Use datapacks to add custom content.
Always null-check when getting registry entries by key, especially for custom content that may not be present.

Common Patterns

Safe Registry Access

Registry Iteration

Resources

Next Steps

Datapack Management

Manage datapacks at runtime

Events API

Handle registry-related events