Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello. I am here because I want to know how to execute a void method after few ticks. What do I mean? Here is an example: In a subscribe event(for example BlockRightClick event) when you actually right click the block after the number of ticks you want it will do a void method/action for example spawn particles. Thank you for reading. I hope I was clear enough.

Set a counter field to the amount of ticks you want to wait in your triggering event, decrement the counter in a tick event, once it reaches zero do your action. You may or may not need to store the context you need(block position, triggering player, etc) in fields too.

 

You could also store the time(in ticks) at which you want the code to execute and instead of decrementing the counter compare the current time against the stored one.

  • Author

Thank you void for your amazing reply. I just have a question. How its called the "tick event" you are talking about?

Also does the tick field needs to be int or a double?

5 minutes ago, devdude said:

How its called the "tick event" you are talking about?

Use one of the subclasses of TickEvent. The one you use depends on your circumstances and your mod.

 

7 minutes ago, devdude said:

Also does the tick field needs to be int or a double?

It can be whatever you need it to be. In most cases it would be an int. If you are going with the second approach it would be a long

  • Author

Hello, it`s been a while, and now i am again here, i was really busy. I coded some events but i cant figure out how to connect them. For example I wanna make a method like this:

 

this.tick(123) { //123 are ticks

        //Do my things here after 123 ticks in the RightClickBlock event

}

 

Is a thing like this possible? If yes how can i do it?

 

Thank you for reading.

  • Author

No i didnt. I do not understand how to actually start the counter and how can i initialize the arguments i need for the action.

  • Author

Well, I know that, I dont actually know how to start the tickevent when rightclicking the block. Even making a boolean "started" it cant work because if the player right click on more blocks at one only 1 boolean cant work

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.