Slow Spreading

Started by Saiber Rida on

Topic category: Help with modding (Java Edition)

Last seen on 21:08, 17. Feb 2024
Joined Feb 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Slow Spreading

So I made a block that is supposed to spread like grass, it would basically turn any block close to it into that block, think on it as some kind of "corruption", the problem is that making the procedure be triggered by random tick is not a good idea since it spreads way too fast, I need to make it spread reaaaaally slowly (otherwise the whole world would be corrupted in less than an hour)

 

World Random Tick doesn't work because of being too fast, but Update Tick ends up crashing the game, so, what could I do? 

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If it is to fast then why…
Mon, 06/01/2020 - 03:46

If it is to fast then why not create a timer so it ... doesn't tick to fast? 

Last seen on 21:08, 17. Feb 2024
Joined Feb 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The problem is that I don't…
Mon, 06/01/2020 - 04:57

The problem is that I don't know how, and that 5:08 minutes long tutorial about block delay is not being helpful to me

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Minecraft Tick == 20 seconds…
Mon, 06/01/2020 - 13:38

Minecraft Tick == 20 seconds

Well, to put it simply. Create a variable that seems fit (We will call it to tick). Then we add onto tick every, tick. Once the timer hits a certain number we set it back to 0 and do what we need to do. I will include a few examples.

I think this may be possible if you make a variable (for example : tickvar) to 1 higher every tick. 20 ticks are equal to 1 real life second so this is possible with some maths.

 

Apply on every tick update and do

if bomb = item in enities main hand:

tickvar = tickvar + 1 

if tickvar > 60:
clear main hand

set tickvar to 0;

Hope this helped.

Keep in mind the example above is a year old, but if you like reading code here is an example I use in an EntityAI I created,

    private int cooldown;
    private int cooldownsave;


    @Override
    public void tick() {
        this.cooldown += 1;
            if (this.cooldown >= this.cooldownsave) {
                    this.cooldown = 0;

Now the code above I had to remove a lot of parts to highlight what was being done. I made this code a long time ago so some of it I have now learned to become unnecessary, for example, you don't need a "cooldownsave". You can just subtract from the cooldown until you get 0.

That's really it, I don't know what else I can do to help you. Just make sure that whatever method you use (they are all similar). Make sure that method updates every tick (just don't put it in an item click method, unless you want to make a counter which is also cool).

Last seen on 18:10, 6. Mar 2024
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i want to make a block that…
Fri, 05/13/2022 - 19:20

i want to make a block that spreads very fast can you pls give me the procedure of the first one