Blocktypes in Minecraft are marked as ticking if they can be activated by the random growth algorithm.
Examples would be crops, grass or fire.
However, several other blocks have no ticking-functionality but are still marked as ticking. An example would be the Cake or the Button-Blocks.
This causes problems with the growth-algorithm and chunk-indexing on chunk-loads. Each time a chunk is loaded it will count all ticking blocks. If the count is == 0 the specific chunk has no tickable blocks and will not need to be randomly checked every tick and try to grow something.
Unfortunately this benefit never really occurs if so many blocks are marked as ticking when in fact they cannot tick.
Maybe some additional information as I have some optimizations running for some time now:
- A large amount of ChunkSections will always need to tick as they contain growable blocks like grass or leaves so the optimizations here are limited
- Currently only the ChunkSections contain a counter that indicates if it needs to be ticked, a Chunk itself could contain this too and reduce the lookups at runtime
Based on 20w07a code using Mojang names.
For the blocks in question randomTicks() is called on the builder when constructing the constants in net.minecraft.world.level.block.Blocks.
List might be incomplete, last updated for 20w07a
|Block (Mojang name)||Comment|
|SoulFireBlock||Does nothing when ticked|
|RedStoneOreBlock||Could be solved by scheduling a block event with random delay|
|CampfireBlock||Does nothing when ticked|