How to replace all blocks of some type in the world.

Started by Hejejej on

Topic category: Help with modding (Java Edition)

Last seen on 21:34, 22. Mar 2023
Joined Sep 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to replace all blocks of some type in the world.

I'm making a mod that adds seasons, and i want to replace all leaves and grass with their autumn versions when it's autumn. I don't know how to check every grass and leaves block in the world.

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
...There really isn't any…
Sun, 03/12/2023 - 00:50

...There really isn't any good way to do this without immediately crashing the game, at least not that I can think of off the top of my head.

...Of course, if you did this more gradually, it might just work, and suite the purposes of seasons. The problem is having that many blocks replaced at once, particulaly if they need to be ticking to keep track of time; so instead, you could make modded grass/leaf blocks that gradually spread the blocks of their respective season when randomly ticked, until there aren't any more places to spread to. ...Of course, you'd have to make a lot of custom blocks, and there would probably be conflicts with biome colormaps and whatnot, but it's the best way that comes to mind. I did something similar to make foliage grow back gradually: instead of ticking every single grass block, I just made a custom grass block that regrows foliage when there isn't any nearby, and then spreads somewhere else. You could do this with a similar system.