Jump to content

Forge's equivalent of bukkit's Delayed Events


Scribblon

Recommended Posts

Hey Everybody,

 

The following is background, if you would like to go direct to the question, just skip it.

 

>Background<

Old Bukkit plugin-dev here trying out new more advanced and exiting modding waters. I suddenly had the itch to revamp an old plugin after some long nights messing with mystcraft: riftcraf. Now the plugin was not initially mine, nor did it became mine after the original author abandoned it. But I contributed to it a while back.

 

When you are a fan of pvp and get to the point where everyone has a following book from mystcraft, escaping is quite easy. Riftcraft tries to combat that by making teleporting not impossible, but delayed.

In context: After long study you are starting to figure out how Enderman and mobs use The Ether to get around. However, unlike an enderman you need to stabilize (focus) a rift before you can step through it. Until it is stabilized you are not allowed to move or you will lose your focus. On top of that, each jump requires 'rift-energy'.

On the other end you may facilitate a rift by placing down a rift-stone, these help 'stabilize' the rift and make them require less energy to form.

In reverse you may place down a disruption stone to prevent others of rifting in, handy to keep unwanted guests out your base. Even stealing the rift energy when they attempt to open a rift inside its range.

>/Background<

 

In bukkit you could register an event on a delay, EventManager.register(Eventable/Runnable, delay). Now, I searched high and low for a Forge equivalent,  through the wiki and through the forums. It is highly likely that I might be overlooking something or looking at the wrong packages for all that matter. But what I have seen so far of the EventBus and the event packages left me wondering if this functionality I seek is available?

"I guess as this is pretty much WIP, I can just 'borrow' the sounds from that game without problem. They are just 'placeholders' anyway." -Me, while extracting the Tear sounds of Bioshock Infinite.

Link to comment
Share on other sites

I appreciate the response. I hope you can help me a bit to understand the following inner workings of forge.

 

In bukkit you had this option (register delayed events) because you are not allowed to sleep a thread as everything is synchronized, thus sleeping would stop the whole server. Now I assumed this is also the case in forge as multiple mods can modify the same event in the same manner (set canceled, modify world/player). Or am I wrong and is forge a-synchronous?

 

(Now, I am aware that a-synchronous runables could be registered in bukkit, but these were not allowed to mutate anything inside the world and were only to be used to get info out of the world or do tasks outside the tick-clock like update your mysql database with the latest information.)

 

Now I have done some further research on this and I am afraid I have to code my own event manager which have to catch every tick and compare it to my own queue. Although this would probably leave me with more flexibility, it will also increase the load for a mod with such a simple premise: pvp friendly teleportation.

 

 

"I guess as this is pretty much WIP, I can just 'borrow' the sounds from that game without problem. They are just 'placeholders' anyway." -Me, while extracting the Tear sounds of Bioshock Infinite.

Link to comment
Share on other sites

Thank you for the nudge in the right direction.

 

I was too focused on the term 'events' that I experienced some tunnel vision towards the subject. For future reference:

The ITickHandler brought me to the IScheduledTickHandler, which is actually pretty much what I searched for.

Both require a TickType defining on what kind of tick you want your mod to trigger upon.

In the end these handlers need to be registered in the TickRegistry.

"I guess as this is pretty much WIP, I can just 'borrow' the sounds from that game without problem. They are just 'placeholders' anyway." -Me, while extracting the Tear sounds of Bioshock Infinite.

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.