Class BuiltInJavaRegistries
JavaRegistrys holding built-in Java content, for example, blocks and items. This content is static and will be the same across all sessions.
These registries are initialised and populated early within Geyser's start-up process (see Registries.load(), which calls bootstrap()).
Should you need access to these registries, you can access a registry directly using its static field. Note that whilst these registries are exposed as MutableJavaRegistrys,
they can only be registered to early in the start-up process. They will be frozen after freeze() is called.
You should never call MutableJavaRegistry.clear() on any of these registries.
MutableJavaRegistry extends JavaRegistry and JavaRegistryLookup, which will provide plenty of utility methods to access registry content in all sorts of ways.
They also implement Iterable, allowing easy for-loops over them.
In some cases you might need a JavaRegistryProvider, in which case you can use PROVIDER. Note however that this provider will not support tags
or networked registries, so you should prefer to use GeyserSession.javaRegistries() when possible.
Built-in registries are registered at a root registry. To register new built-in registries, simply create a new static field and call register(JavaRegistryKey).
Please maintain the same order as in JavaRegistries. Make sure to not forget to add a call to a bootstrap method in bootstrap(),
so that the registry will be populated at the right time.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MutableJavaRegistry<Block> Holds all Java blocks.static final MutableJavaRegistry<EntityTypeDefinition<?>> Holds all Java entity types, as aEntityTypeDefinition.static final MutableJavaRegistry<Item> Holds all Java items.static final JavaRegistryProviderThisJavaRegistryProviderwill throw when trying to access networked registries or tags. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voidfreeze()static <T> @Nullable JavaRegistry<T> get(JavaRegistryKey<T> registryKey) Gets a built-in registry by itsJavaRegistryKey, or returnsnullif that registry is not built-in.
-
Field Details
-
BLOCK
Holds all Java blocks. Can be expanded with non-vanilla blocks by API users. -
ITEM
Holds all Java items. Can be expanded with non-vanilla items by API users. -
ENTITY_TYPE
Holds all Java entity types, as aEntityTypeDefinition. -
PROVIDER
ThisJavaRegistryProviderwill throw when trying to access networked registries or tags.
-
-
Method Details
-
get
Gets a built-in registry by itsJavaRegistryKey, or returnsnullif that registry is not built-in.- Type Parameters:
T- the type of the registry- Parameters:
registryKey- theJavaRegistryKey- Returns:
- the built-in registry as a
JavaRegistry, ornullif that registry is not built-in
-
bootstrap
public static void bootstrap() -
freeze
public static void freeze()
-