Cuberite Forum
Hook Question - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Hook Question (/thread-669.html)

Pages: 1 2 3 4 5


RE: Hook Question - tonibm19 - 02-03-2014

Yes but it's probably very expensive because server loops for all players


RE: Hook Question - xoft - 02-03-2014

It would be even more expensive to call a hook that many times. Trust me, this is the best way to go.


RE: Hook Question - NiLSPACE - 08-17-2014

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?


RE: Hook Question - ThuGie - 08-17-2014

That might actually be nice,
For future plugins, like auto harvest or something like that.


RE: Hook Question - xoft - 08-18-2014

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.


RE: Hook Question - NiLSPACE - 08-18-2014

All I could think of was crops and cactuses. Maybe vines as well, but that is already done on the OnBlockSpread hook.


RE: Hook Question - xoft - 08-18-2014

Nether warts, melon and pumpkin stems, saplings.


RE: Hook Question - NiLSPACE - 08-18-2014

I consider nether wart and melon/pumpkin stems as crops. I didn't think of saplings though.


RE: Hook Question - NiLSPACE - 12-04-2014

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.


RE: Hook Question - xoft - 12-04-2014

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.