Jump to content

[SOLVED] [1.7.10] Nested events


WhichOnesPink

Recommended Posts

How does Forge handle nested Pre/Post events? For example:

 

MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(worldObj, rand, worldX, worldZ));

... lots of code ...

MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(worldObj, rand, worldX, worldZ));

... more code ...

MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(worldObj, rand, worldX, worldZ));

... lots of code ...

MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(worldObj, rand, worldX, worldZ));

 

Does the first DecorateBiomeEvent.Post() cancel both of the Pre()'s? Or are events not bound to each other like that?

 

Is it common to see nested events like this, or is it something that should be triggering alarm bells?

[1.7.10] [1.8.9] RTG — Realistic Terrain Generationhttp://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2524489

Link to comment
Share on other sites

If several or one mod uses same event several times, event handlers will honor:

1. Priority (HIGHEST, HIGH, NORMAL, LOW, LOWEST)

2. Order of adding (registering) (and loading is dependent to mod-loading process, so also mod-dependency order)

In this order.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

The events are not really "nested" in the sense you think. An event is simply an event, meaning a singular point in time/execution of the code. The PRE event is basically saying I'm starting something, and the POST is saying its finishing something, but there is no real relationship except hopefully the code fires each at the right point.  There is nothing weird about starting a bunch of things before finishing the first thing.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.