Changes

290 bytes added ,  18:44, 12 June 2022
Add notice about non-vanilla registries for keys and names with DeferredRegister
Line 15: Line 15:  
=== DeferredRegister ===
 
=== DeferredRegister ===
   −
<code>DeferredRegister</code> is an abstraction layer over the registry event used to register objects. It maintains a map of "registry name" to their associated suppliers and resolves those suppliers during <code>RegisterEvent</code> for the associated registry. This method is the currently recommended, and documented, way to handle these objects as it provides convenience and safety for those who want to statically initialize objects while avoiding some issues associated with it.  
+
<code>DeferredRegister</code> is an abstraction layer over the registry event used to register objects. It maintains a map of "registry name" to their associated suppliers and resolves those suppliers during <code>RegisterEvent</code> for the associated registry. This method is the currently recommended, and documented, way to handle these objects as it provides convenience and safety for those who want to statically initialize objects while avoiding some issues associated with it.
 +
 
 +
{{Tip/Important|When using <code>DeferredRegister</code>s with non-vanilla registries, the registry key or the registry name should be supplied instead. These include registries for entity data serializers, global loot modifier serializers, world presets, and biome modifier serializers.}}
    
An example of a mod registering a custom block:
 
An example of a mod registering a custom block: