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 - xoft - 08-08-2013

No, but we could make a new hook for this packet, I guess.


RE: Hook Question - NiLSPACE - 08-08-2013

That would be realy usefull Wink


RE: Hook Question - NiLSPACE - 08-08-2013

Should I put it in the bugtracker?


RE: Hook Question - xoft - 08-09-2013

yea, why not. Why, you can even implement it Smile


RE: Hook Question - NiLSPACE - 08-09-2013

Here is my first try:
.patch   OnPlayerSwingLeftArm.patch (Size: 5.25 KB / Downloads: 206) . Github just doesn't seem to like me very much ;( All I need now is that the hook only gets called when the left arm is swinging.


RE: Hook Question - xoft - 08-10-2013

Almost. The hook is called for actions other than arm-swinging as well. Either the cClientHandle::HandleAnimation() should check the param, and call the hook only for arm swinging, or the hook should be renamed to OnPlayerAnimation and it should get the parameter as well.

As for GitHub, what git client are you using? If commandline git, then just execute "git checkout -b SwingArmHook", this will create a new branch and switch to it; then you commit normally, and finally after you push to the server (preferably using "git gui"), the GitHub web will provide you with the link to create a pull request.


RE: Hook Question - xoft - 08-11-2013

I adapted your patch and committed it to master.


RE: Hook Question - NiLSPACE - 11-22-2013

Maybe an OnRandomBlockTick hook could be usefull for some people. It gets called when a block gets randomy updated (for example with crops growth)
Parameters:
  • World - The world where the tick is occurring
  • Coordinates - BlockX, BlockY and BlockZ
With this hook people could create for example an plugin that makes mossy cobblestone grow.


RE: Hook Question - xoft - 11-22-2013

I fear that such a hook would seriously affect the server performance - it would be called several thousand times per tick (there are about 50 ticked blocks per loaded chunk per tick; a player normally loads 19*19 chunks -> 18k hook calls per player). We might have to accept that *some* kinds of plugins are just unreachable with current architecture.


RE: Hook Question - NiLSPACE - 11-22-2013

Wow several thousands times per tick ;O i gues you're right ;( it's hard to do that without a big performance drop.