MinecraftForge / Documentation

Read the docs MinecraftForge documentation
MIT License
460 stars 196 forks source link

DeferredRegister vs RegisterEvent recommendation #492

Closed naxhh closed 1 year ago

naxhh commented 1 year ago

https://github.com/MinecraftForge/Documentation/blob/1.19.x/docs/concepts/registries.md#methods-for-registering

states

DeferredRegister is the recommended way to register objects

to later say

RegisterEvent [...] It is recommended to use this method to avoid unnecessary object creation

For someone new that is trying to learn the direct question is: "which one is the recommended one then?"

DeferredRegister because is easier to setup and says "recommended"

or RegisterEvent because it will not cause as many as object registries and that is really important in this case?

Maybe rewording one of them to make them more clear would help

ChampionAsh5357 commented 1 year ago

DeferredRegister is the recommended method. The reason to use RegisterEvent is if you don't need to refer to the object being created within your source or you are creating an optional entry, typically for mod interoperability.