From 781d6485719a0122133db9b6f1e6a50aa82360b6 Mon Sep 17 00:00:00 2001 From: 12xx12 <44411062+12xx12@users.noreply.github.com> Date: Tue, 4 Aug 2020 20:01:36 +0200 Subject: Code cleanup in cChunk.PlaceBlock() for checking if BlockEntity should be spawned (#4812) * Changed switch for call in cChunk for call to function cBlockEntity to remove unnecessary confusions while implementing new BlockEntities --- src/Chunk.cpp | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 25af8d6fb..17c41acec 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -1278,33 +1278,10 @@ void cChunk::SetBlock(Vector3i a_RelPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_Blo } // If the new block is a block entity, create the entity object: - switch (a_BlockType) - { - case E_BLOCK_BEACON: - case E_BLOCK_BED: - case E_BLOCK_TRAPPED_CHEST: - case E_BLOCK_CHEST: - case E_BLOCK_COMMAND_BLOCK: - case E_BLOCK_DISPENSER: - case E_BLOCK_DROPPER: - case E_BLOCK_ENDER_CHEST: - case E_BLOCK_LIT_FURNACE: - case E_BLOCK_FURNACE: - case E_BLOCK_HOPPER: - case E_BLOCK_SIGN_POST: - case E_BLOCK_WALLSIGN: - case E_BLOCK_HEAD: - case E_BLOCK_NOTE_BLOCK: - case E_BLOCK_JUKEBOX: - case E_BLOCK_FLOWER_POT: - case E_BLOCK_MOB_SPAWNER: - case E_BLOCK_BREWING_STAND: - { - // Fast set block has already marked dirty - AddBlockEntityClean(cBlockEntity::CreateByBlockType(a_BlockType, a_BlockMeta, RelativeToAbsolute(a_RelPos), m_World)); - break; - } - } // switch (a_BlockType) + if (cBlockEntity::IsBlockEntityBlockType(a_BlockType)) + { + AddBlockEntityClean(cBlockEntity::CreateByBlockType(a_BlockType, a_BlockMeta, RelativeToAbsolute(a_RelPos), m_World)); + } } -- cgit v1.2.3