User Tools

Site Tools


documentation:entrypoint

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
documentation:entrypoint [2020/02/22 00:25]
jamieswhiteshirt [Basic usage]
documentation:entrypoint [2020/06/14 05:42] (current)
i509vcb Specify Entrypoint containers as preferred method
Line 55: Line 55:
 Mods can call each others'​ entrypoints for integration purposes. An entrypoint is loaded lazily when entrypoints for a specific entrypoint prototype are requested, which makes an entrypoint an excellent tool for optional mod integrations. A mod may become an entrypoint prototype provider by declaring that other mods should provide entrypoints based on an entrypoint prototype, often using a class or interface that the mod provides in its API. Mods can safely use this class or interface even if the provider is not installed (rendering the class or interface inaccessible) because entrypoints are loaded only on request. When the provider is not present, the entrypoint will simply be ignored. Mods can call each others'​ entrypoints for integration purposes. An entrypoint is loaded lazily when entrypoints for a specific entrypoint prototype are requested, which makes an entrypoint an excellent tool for optional mod integrations. A mod may become an entrypoint prototype provider by declaring that other mods should provide entrypoints based on an entrypoint prototype, often using a class or interface that the mod provides in its API. Mods can safely use this class or interface even if the provider is not installed (rendering the class or interface inaccessible) because entrypoints are loaded only on request. When the provider is not present, the entrypoint will simply be ignored.
  
-Entrypoints ​can be accessed by calling ''​FabricLoader#​getEntrypoints(name, type)''​. Entrypoint instances are memoized by their name and also their type. Using the same code reference for multiple entrypoints will result in multiple instances. Though highly absurd in practice, if ''​getEntrypoints''​ is called multiple times with the same name but different types, instances are constructed and memoized per type.+Entrypoint instances ​can be accessed by calling ''​FabricLoader#​getEntrypointContainers(name, type)''​. ​This returns a list of entrypoint containers. These containers contain the entrypoint instance and the mod container of the mod which provided the instance. This can be used by a mod to determine which mods have registered an entrypoint. 
 + 
 +Entrypoint instances are memoized by their name and also their type. Using the same code reference for multiple entrypoints will result in multiple instances. Though highly absurd in practice, if ''​getEntrypoints''​ is called multiple times with the same name but different types, instances are constructed and memoized per type.
  
 ==== A note about load order and phases (or a lack thereof) ==== ==== A note about load order and phases (or a lack thereof) ====
documentation/entrypoint.txt · Last modified: 2020/06/14 05:42 by i509vcb