ASync Tasks

Discussion in 'Plugin Development' started by davidclue, Apr 6, 2021.

  1. Offline

    davidclue

    Hi, I just have a question so I know that async tasks can't be used to change blocks, but could I use one to teleport entities? What exactly are the limits to async tasks like what can I and can't I do. I've heard of people just using them for calculations but could I use it to teleport entities around or is that overstepping.
     
  2. Online

    Newdel

    No one said you couldn't do it. You just shouldn't do it. You can put basically everything in an async method. You just have to keep in mind what problems multithreading or async tasks on one thread create
     
  3. Online

    timtower Administrator Administrator Moderator

  4. Offline

    davidclue

    Because I run a repeating task that does lots of heavy calculations and teleports entities, it causes a lot of lag.
     
  5. Online

    timtower Administrator Administrator Moderator

    Then do the calculations async but the teleports sync?
     
  6. Offline

    davidclue

    It's sorta individual calculations for each entity so can I really pull stuff from the async task to the main thread task?
     
  7. Online

    timtower Administrator Administrator Moderator

Share This Page