How do I make a naturally-generating block tick?

Started by afk on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make a naturally-generating block tick?

The title says it all; I want to have a light-sensitive block in my mod that checks the light levels of nearby blocks, and if they're above 10, spawns a cluster of small hostile flying mobs. 

This generates naturally through a feature that places a structure.. but it doesn't tick. It's fine if a player places it, but not if it generates naturally. I've tried everything to make it work; giving it a 'tick manually' procedure when it's added to the world, scheduling ticks, etc.. nothing has worked so far.

If anyone has any ideas, I'll gladly hear them.

Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hard problem! well there is…
Thu, 07/04/2024 - 17:31

hard problem!

well there is an option to make the block tick randomly, and this bypasses naturally generated blocks. you could do that.

if you don't want it to tick randomly, then you could add a block that ticks randomly that spawns in your structure, then on that block's tick update, replace it with a new block that ticks normally.