Hook Question
#41
Yes but it's probably very expensive because server loops for all players
Reply
Thanks given by:
#42
It would be even more expensive to call a hook that many times. Trust me, this is the best way to go.
Reply
Thanks given by:
#43
I was thinking of adding a new hook called "OnBlockGrow" (or something like that). It will be called when for example crops or a cactus grow. Any thoughts?
Reply
Thanks given by:
#44
That might actually be nice,
For future plugins, like auto harvest or something like that.
Reply
Thanks given by:
#45
There is a similar hook already, OnBlockSpread, so it makes sense to have a growth hook, too.

You should, however, define very precisely what is and what isn't growth. There are 50 blocks that are "updated" each tick in each active chunk. You don't want to call the hook for each of those.
Reply
Thanks given by:
#46
All I could think of was crops and cactuses. Maybe vines as well, but that is already done on the OnBlockSpread hook.
Reply
Thanks given by:
#47
Nether warts, melon and pumpkin stems, saplings.
Reply
Thanks given by:
#48
I consider nether wart and melon/pumpkin stems as crops. I didn't think of saplings though.
Reply
Thanks given by:
#49
Maybe we should also create different hooks for generating stuff?
OnGeneratingBiomes
OnGeneratingShape
OnGeneratingComposition
OnGeneratingFinishers

This way plugins can add tiny things as well like biome filters. It should make a plugin for AntherusCraft's fade-in/out effect allot easier.
Reply
Thanks given by:
#50
I'm afraid a hook won't work too well, because the generators are called from several places. Even the existing OnChunkGenerating doesn't work too great if you want to change only something - it's not called when the Trees finisher is asking for neighbors, so the trees are completely wrong then.

We first need to change the generator that all the generating calls go through a predefined path. Then we could add hooks into that path so that the plugins are called at all times.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)