From 6bdd130aab51b630918ed664c4389cf33bcb2e06 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 29 Jul 2020 19:30:38 +0100 Subject: OnBroken/OnPlaced are for entity actions * Call OnPlaced/OnBroken in PlaceBlock/DigBlock - Remove unused Placing/Breaking handlers * Have the blockhandler's Check handle neighbour updating, instead of QueueTickBlockNeighbors --- src/World.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/World.h') diff --git a/src/World.h b/src/World.h index 76c0fa3c9..b6936a9d5 100644 --- a/src/World.h +++ b/src/World.h @@ -661,22 +661,18 @@ public: // tolua_end - /** Performs the specified single-block set operations simultaneously, as if SetBlock() was called for each item. - Is more efficient than calling SetBlock() multiple times. + /** Replaces the specified block with another, and calls the OnPlaced block handler. + Callers MUST ensure the replaced block was destroyed or can handle replacement correctly. Wakes up the simulators. If the chunk for any of the blocks is not loaded, the set operation is ignored silently. */ - void SetBlocks(const sSetBlockVector & a_Blocks); - - /** Replaces world blocks with a_Blocks, if they are of type a_FilterBlockType */ - void ReplaceBlocks(const sSetBlockVector & a_Blocks, BLOCKTYPE a_FilterBlockType); + void PlaceBlock(const Vector3i a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta); /** Retrieves block types of the specified blocks. If a chunk is not loaded, doesn't modify the block. Returns true if all blocks were read. */ bool GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure); // tolua_begin - /** Replaces the specified block with air, and calls the apropriate block handlers (OnBreaking(), OnBroken()). - Wakes up the simulators. - Doesn't produce pickups, use DropBlockAsPickups() for that instead. + /** Replaces the specified block with air, and calls the OnBroken block handler. + Wakes up the simulators. Doesn't produce pickups, use DropBlockAsPickups() for that instead. Returns true on success, false if the chunk is not loaded. */ bool DigBlock(Vector3i a_BlockPos); -- cgit v1.2.3