Jump to content

[1.10.2] Questions about implementing custom events


horsewithnoname

Recommended Posts

Hello there!

 

I've got few questions about implementing my own Forge events for making public API for my mods.

 

How do you control cancel-able events? Do you simply post an event and check if post(Event event) method of EventBus returns true, then it was canceled?

 

if (MinecraftForge.EVENT_BUS.post(event))
{
    return false;
}

/* Event wasn't canceled */

 

Do I understand it right?

 

Second question is should I use MinecraftForge.EVENT_BUS or create a new event bus for my own mod and post it there? I don't know about penalties of posting my events on EVENT_BUS, however I do know that his bus is responsible for a lot of things like tick events and many much more. Just to clarify, my events aren't something that fire frequently, but depending on how frequent users will be using the features, it might turn out to be quite frequent.

 

Thanks for attention!  :)

Blockbuster – simple machinimas and cinematics for Minecraft
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.