Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16] How to run code on world tick?
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
kiou.23

[1.16] How to run code on world tick?

By kiou.23, December 4, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

kiou.23    5

kiou.23

kiou.23    5

  • Creeper Killer
  • kiou.23
  • Members
  • 5
  • 158 posts
Posted December 4, 2020

I have some values attached to chunks through capabilities, and I would like to update this values on every tick (if there is a more commom, stantard, efficient way of doing this I'd like to know).

I've tried subscribing to the TickEvent, but the event doesn't have a reference to the world, I could use Minecraft.getInstance().world, but I heard that that can break the server.

So how should go about implementing this

 

  • Quote

Share this post


Link to post
Share on other sites

poopoodice    113

poopoodice

poopoodice    113

  • Dragon Slayer
  • poopoodice
  • Members
  • 113
  • 896 posts
Posted December 4, 2020

TickEvent has multiple sub events, in this case you should use WorldTickEvent which provides the world instance.

  • Quote

Share this post


Link to post
Share on other sites

kiou.23    5

kiou.23

kiou.23    5

  • Creeper Killer
  • kiou.23
  • Members
  • 5
  • 158 posts
Posted December 4, 2020
9 minutes ago, poopoodice said:

TickEvent has multiple sub events, in this case you should use WorldTickEvent which provides the world instance.

ohh Okay, when I typed TickEvent, intellisense didn't show the other events, only TickEvent.

  • Quote

Share this post


Link to post
Share on other sites

poopoodice    113

poopoodice

poopoodice    113

  • Dragon Slayer
  • poopoodice
  • Members
  • 113
  • 896 posts
Posted December 4, 2020

They are located inside TickEvent.

https://docs.oracle.com/javase/tutorial/java/javaOO/nested.html

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • piglinplayz
      is there a malisis door mod for 1.16.3 or grage door mod for 1.16.3

      By piglinplayz · Posted 34 minutes ago

      i can find the it ij just says no 1.12.2 no 1.16.3
    • loordgek
      is there a malisis door mod for 1.16.3 or grage door mod for 1.16.3

      By loordgek · Posted 35 minutes ago

      no search for your self it is not hard
    • piglinplayz
      is there a malisis door mod for 1.16.3 or grage door mod for 1.16.3

      By piglinplayz · Posted 45 minutes ago

      or may i have the link?????????????????????????????????????????????????? Plz i need a respond ASAP because i need it for a moded smp 
    • Silivek
      is there a malisis door mod for 1.16.3 or grage door mod for 1.16.3

      By Silivek · Posted 47 minutes ago

      Macaw's Doors may have one and there is a mod called Little Tiles that you can create one in.
    • piglinplayz
      is there a malisis door mod for 1.16.3 or grage door mod for 1.16.3

      By piglinplayz · Posted 59 minutes ago

      what is then name cuz i cant find one that works 
  • Topics

    • piglinplayz
      7
      is there a malisis door mod for 1.16.3 or grage door mod for 1.16.3

      By piglinplayz
      Started 1 hour ago

    • piglinplayz
      9
      How do update a 1.12.2 mod to 1.16.3

      By piglinplayz
      Started 2 hours ago

    • BeastGamerYo
      1
      Urgent Help Forge Is Crashing!!!

      By BeastGamerYo
      Started 1 hour ago

    • __dwagon
      1
      1.8.9 keeps crashing

      By __dwagon
      Started 2 hours ago

    • Ronshark
      3
      tempête de Neige primal winter

      By Ronshark
      Started 23 hours ago

  • Who's Online (See full list)

    • Luis_ST
    • AubriTheHuman
    • Godis_apan
    • Warsade
    • CookieLukas
    • __dwagon
    • romangraef
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16] How to run code on world tick?
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community