Cuberite Forum
API change: OnPlayerPlacingBlock / OnPlayerPlacedBlock - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: API change: OnPlayerPlacingBlock / OnPlayerPlacedBlock (/thread-1664.html)

Pages: 1 2


RE: API change: OnPlayerPlacingBlock / OnPlayerPlacedBlock - NiLSPACE - 12-08-2014

No I can live with it. Adding the BlockFace parameter does make sense for me, but isn't necessary.


RE: API change: OnPlayerPlacingBlock / OnPlayerPlacedBlock - xoft - 12-13-2014

Oh my, this is a bigger change than I anticipated. I'll have to change quite a few BlockHandlers and ItemHandlers to make things right.

Take the bed item handler, for example. Currently, it only places the "sheets" block and lets the blockhandler for the bed block handle placing the "pillow" block. This is however against the design I'm making here - if the placement of the "pillow" block is refused by the plugins, the "sheets" block should not be placed either. So I need to make the bed item handler place both blocks *at once* (atomically), so that the events are like this:
1. Hook call: OnPlayerPlacingBlock("sheets")
2. Hook call: OnPlayerPlacingBlock("pillow")
3. Set the "sheets" block
4. Set the "pillow" block
5. Hook call: OnPlayerPlacedBlock("sheets")
6. Hook call: OnPlayerPlacedBlock("pillow")
Now, if a plugin refuses step 2, neither of the blocks will be placed.

This means a complete rewrite of the cItemHandler::GetPlacementBlockTypeMeta() into another function, PlayerPlace()


RE: API change: OnPlayerPlacingBlock / OnPlayerPlacedBlock - xoft - 12-17-2014

Why do I always pick the worst tasks to implement? This has grown into such a monster thing again...
Basically I need to rewrite all blocks' OnPlacedByPlayer() handlers. Which means reimplementing from ground up: slabs turning into double-slabs, beds, doors, chests checking against triple-chests, skull placement creating a wither, pumpkin placement creating a snowgolem, etc.


RE: API change: OnPlayerPlacingBlock / OnPlayerPlacedBlock - tigerw - 12-18-2014

Quote:Why do I always pick the worst tasks to implement?

'Cause you're the best qualified to do so, of course.