Ore Growth

Ore Growth

220k Downloads

[1.19.2-] Random tick mixin checks recipe on every call

embeddedt opened this issue ยท 1 comments

commented

When backporting from 1.20.1 to 1.19.2, it appears the injector that enables random ticking on ore blocks was moved into isRandomlyTicking rather than initCache. In a server profile, I noted that this is 1% of the total tick time, which seems like a lot for such a simple feature.

image

Possibly this could be cached manually on older versions? One approach could be to inject into initCache and store a flag if the block has an ore growth recipe, and then have isRandomlyTicking return true if that flag is set. Checking the flag should be much faster than looking up the recipe.

commented

Whoops, I do vaguely remember it being an issue that there was no isRandomlyTicking flag I could change when porting to 1.19.2, but I guess I just mixed into isRandomlyTicking and forgot about it ๐Ÿ˜…
It checking for a recipe every time a block is random ticked is definitely not ideal.

I have now changed it so it checks once in initCache and then caches the value like you suggested.
Thank you for looking into and reporting the issue, I really appreciate all these improvements you submit for my mods! ๐Ÿ™‚