Jump to content

[1.10.2] Using Ticks on methods?


Cerandior

Recommended Posts

I would like to have some "special effects" before spawning an item in the world, and for that i need some sort of timer. E.G for 5 seconds spawn particles, after that spawn the item. I know minecraft uses Tick as it's time unit but how do i utilize ticks in methods? For example onItemRightClick method? I was thinking of using Java TimerTasks but i would like to know if there's a better way using minecraft Ticks

Link to comment
Share on other sites

I like the new forgeDocumentation. It's pretty neat. Actually i am not sure if it is that new since i haven't been active for months. As for the main point, I do know how to set-up events, i just wanted an example of someone using it. Anyway i just remembered. Blocks and Items have a "onUpdate" method right? I can use that and a variable to work something out. I am not very sure how you would get if the player is right clicking a block through events though, never tried something like that.

Thank you for the time

Link to comment
Share on other sites

I like the new forgeDocumentation. It's pretty neat. Actually i am not sure if it is that new since i haven't been active for months. As for the main point, I do know how to set-up events, i just wanted an example of someone using it. Anyway i just remembered. Blocks and Items have a "onUpdate" method right? I can use that and a variable to work something out. I am not very sure how you would get if the player is right clicking a block through events though, never tried something like that.

Thank you for the time

Note a variable on an Item is shared between all in game instances.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Also note that onUpdate will only be called while an Item is in the player's inventory. And for Blocks you would need a

TileEntity

.

 

And TileEntities onUpdate will only be called if it exists in the world? Then i don't really need any "fancy" way since these restriction don't really prevent anything of what i am planing to do.

Link to comment
Share on other sites

Last time i worked on forge there was something like IUpdatePlayerListBox that you had to implement into your tile-entity to get "onUpdate"

Is that gone now?

Yes you use ITickable and not the client one.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.