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/Entities/Player.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/Entities/Player.cpp') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 9ceded8b2..3bfcb4039 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -2910,22 +2910,20 @@ bool cPlayer::PlaceBlocks(const sSetBlockVector & a_Blocks) } } // for blk - a_Blocks[] - // Set the blocks: - m_World->SetBlocks(a_Blocks); - - // Notify the blockhandlers: cChunkInterface ChunkInterface(m_World->GetChunkMap()); for (auto blk: a_Blocks) { + // Set the blocks: + m_World->PlaceBlock(blk.GetAbsolutePos(), blk.m_BlockType, blk.m_BlockMeta); + + // Notify the blockhandlers: cBlockHandler * newBlock = BlockHandler(blk.m_BlockType); newBlock->OnPlacedByPlayer(ChunkInterface, *m_World, *this, blk); - } - // Call the "placed" hooks: - for (auto blk: a_Blocks) - { + // Call the "placed" hooks: pm->CallHookPlayerPlacedBlock(*this, blk); } + return true; } -- cgit v1.2.3