How can I place blocks with a delay?

Started by Sinpernene on

Topic category: Help with modding (Java Edition)

Last seen on 18:05, 26. Dec 2023
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I place blocks with a delay?

I'm trying to make an object that simulates the Jujutsu Kaisen domain expansions when you right click on it. The thing is that I have already figured out how to make the dome, but to make it look good and give the feeling that it wraps around you, I would like to make the blocks to be placed a little slower and not instantaneously. I have tried to put "wait ticks then on server side" and pass the positions of the blocks to global variables and it didn't work, I have also tried to make a loop that "entertain" the procedure but it crashes when I do it. I am very new in this moding thing so I am sorry if this is something very silly, if someone can think of a possible solution I would appreciate it a lot.

Last seen on 20:08, 17. Apr 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Triggering things with delay…
Mon, 12/11/2023 - 12:44

Triggering things with delay can be difficult, but not impossible. Minecraft doesn't like having one procedure do things with delay, and for basically anything other than cosmetic stuff, I've found the delay function to be kind of unhelpful. 

What you can do, however, is make a separate procedure for each component of the structure. Then, using the 'call procedure' function in the advanced tab, and a 'wait ticks' bracket, you can wait a couple of ticks, and then execute the procedure, which should effectively solve the problem. (Though you still need to be careful you only run this once, not over the course of multiple ticks- if it calls them multiple times, you'll suddenly have hundreds of procedures waiting to be executed, which is a surefire way to lag out the game.) I do something very similar to generate super large structures in smaller chunks over the course of multiple ticks to avoid lagspikes.

But yeah, make a separate procedure for each component of the structure, then call the procedures with the corresponding delays so that you don't have to incorporate delay into the actual block placement.