Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documented available RegistryEvents #114

Merged
merged 5 commits into from Jul 23, 2017
Merged

Documented available RegistryEvents #114

merged 5 commits into from Jul 23, 2017

Conversation

Drakmyth
Copy link
Contributor

@Drakmyth Drakmyth commented Jul 2, 2017

Given that it is now "recommended and HIGHLY encouraged" to use RegistryEvents over registering during loading events, I thought it might be helpful to list which objects can be registered using RegistryEvents. I also added a link to the Loading Stages page to encourage modders not to continue doing their registrations there. In response to #85, I also included a bit of information around why RegistryEvents should be preferred.

Not having an in-depth knowledge of the inner-workings or direction motivations of Forge itself, if anything I've added is incorrect I'm happy to make changes.

@@ -23,6 +23,8 @@ public void registerBlocks(RegistryEvent.Register<Block> event) {

The order in which `RegistryEvent.Register` events fire is arbitrary, with the exception that `Block` will *always* fire first, and `Item` will *always* fire second, right after `Block`. After the `Register<Block>` event has fired, all [`ObjectHolder`][ObjectHolder] annotations are refreshed, and after `Register<Item>` has fired they are refreshed again. They are refreshed for a third time after *all* of the other `Register` events have fired.

`RegistryEvent`s are currently supported for the following types: `Block`, `Item`, `Potion`, `Biome`, `SoundEvent`, `PotionType`, `Enchantment`, `IRecipe`, `VillagerProfession`, `Entity`
Copy link
Contributor Author

@Drakmyth Drakmyth Jul 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got this list by looking at net.minecraftforge.registries.GameData. I'm not 100% certain Entity is supported, but it seemed like that was the intent so I included it here. I don't have time to test it right now, but I intend to at some point over the next few days. If that is not accurate, it can certainly be removed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the raw <Entity> event does not seem to work, I believe you still need to go through the old methods.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no Entity registry. There is a EntityEntry registry.

!!! important

Many objects that were previously registered in loading stage event handlers (Blocks, Items, Recipes, etc.) should now be registered via [RegistryEvents][registering].
This is to pave the way to being able to reload mods dyanamically at runtime, which can't be done using loading stages (as they are fired once upon application startup).
Copy link

@0f-0b 0f-0b Jul 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dyanamically -> dynamically

@tterrag1098 tterrag1098 added the Page Improvement Improves an existing page label Jul 3, 2017
@tterrag1098 tterrag1098 merged commit acabee5 into MinecraftForge:master Jul 23, 2017
@Drakmyth Drakmyth deleted the supported_registryevents branch July 24, 2017 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Page Improvement Improves an existing page
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants