Interface RegistrationContext
@NonExtendable
public interface RegistrationContext
Handed to an addon's registration callback. Everything registered through it is owned by
addon(). Only valid while the callback runs; static registries freeze afterwards.-
Method Summary
Modifier and TypeMethodDescription@NotNull AddonIdaddon()default @NotNull WritableRegistry<BehaviorType> default @NotNull WritableRegistry<CapabilityType<?>> default @NotNull WritableRegistry<ResourceComponentType<?>> default @NotNull WritableRegistry<ResourceConverter> <T extends net.kyori.adventure.key.Keyed>
voidcreateRegistry(@NotNull RegistryType<T> type) Creates a new registry owned by this addon (static or reloadable, pertype).@NotNull EventBusevents()The engine's event bus, already usable during registration (e.g.default voiditemTags(@NotNull ReloadableProvider<ItemTagContribution> provider) default @NotNull WritableRegistry<MachineType> default @NotNull WritableRegistry<ModifierType> default @NotNull WritableRegistry<MultiblockType> default @NotNull WritableRegistry<NetworkType> default @NotNull WritableRegistry<PlayerDataKey<?>> Values kept per player (D37).default @NotNull WritableRegistry<PlayerSetting<?>> Per-player values players change themselves (D37).default @NotNull WritableRegistry<PlayerDataStorage.Type> Places player data can be saved, forplayers.storage(D37).default voidrecipes(@NotNull ReloadableProvider<Recipe> provider) default @NotNull WritableRegistry<RecipeType<?>> @NotNull RegistryAccessRead access to everything registered so far, including the content of addons this addon depends on (their callbacks already ran).<T extends net.kyori.adventure.key.Keyed>
@NotNull WritableRegistry<T> registry(@NotNull RegistryType<T> type) <T extends net.kyori.adventure.key.Keyed>
voidreloadable(@NotNull RegistryType<T> type, @NotNull ReloadableProvider<T> provider) Contributes entries to a reloadable registry;providerruns on every (re)load.voidreport(@NotNull Diagnostic diagnostic) Adds a finding to the startup report without failing the registration, e.g.default @NotNull WritableRegistry<ResourceCategory> default voidresourceTags(@NotNull ReloadableProvider<ResourceTagContribution> provider) default @NotNull WritableRegistry<ResourceType> default @NotNull WritableRegistry<TransportType> default @NotNull WritableRegistry<UpgradeType> voidAdds a validator that runs at startup validation and on every reload.
-
Method Details
-
addon
-
registries
Read access to everything registered so far, including the content of addons this addon depends on (their callbacks already ran). -
events
The engine's event bus, already usable during registration (e.g. forEngineEvents.REGISTRIES_FROZEN). Subscribe withaddon()as owner. -
registry
@NotNull <T extends net.kyori.adventure.key.Keyed> @NotNull WritableRegistry<T> registry(@NotNull @NotNull RegistryType<T> type) - Throws:
RegistrationException- iftypedoes not exist or is not a static registry
-
createRegistry
<T extends net.kyori.adventure.key.Keyed> void createRegistry(@NotNull @NotNull RegistryType<T> type) Creates a new registry owned by this addon (static or reloadable, pertype).- Throws:
RegistrationException- if it already exists
-
reloadable
<T extends net.kyori.adventure.key.Keyed> void reloadable(@NotNull @NotNull RegistryType<T> type, @NotNull @NotNull ReloadableProvider<T> provider) Contributes entries to a reloadable registry;providerruns on every (re)load. -
validator
Adds a validator that runs at startup validation and on every reload. -
report
Adds a finding to the startup report without failing the registration, e.g. a data-driven entry that was skipped. Attributed toaddon()if it has no source. -
resourceCategories
-
resourceTypes
-
componentTypes
-
converters
-
resourceTags
-
capabilityTypes
-
machineTypes
-
recipeTypes
-
modifierTypes
-
upgradeTypes
-
networkTypes
-
transportTypes
-
multiblockTypes
-
behaviorTypes
-
playerData
Values kept per player (D37). -
playerSettings
Per-player values players change themselves (D37). -
playerStorages
Places player data can be saved, forplayers.storage(D37). -
recipes
-
itemTags
-