diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-09-20 16:39:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-20 16:39:17 +0200 |
commit | 5a1662032227d706d00fa3994301f98667703655 (patch) | |
tree | f68f9d94ff48b3fcd2a3cf8e6d968ee750d7b963 /src/Blocks | |
parent | BlockHandler initialisation is a constant expression (#4891) (diff) | |
download | cuberite-5a1662032227d706d00fa3994301f98667703655.tar cuberite-5a1662032227d706d00fa3994301f98667703655.tar.gz cuberite-5a1662032227d706d00fa3994301f98667703655.tar.bz2 cuberite-5a1662032227d706d00fa3994301f98667703655.tar.lz cuberite-5a1662032227d706d00fa3994301f98667703655.tar.xz cuberite-5a1662032227d706d00fa3994301f98667703655.tar.zst cuberite-5a1662032227d706d00fa3994301f98667703655.zip |
Diffstat (limited to 'src/Blocks')
-rw-r--r-- | src/Blocks/BlockCauldron.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/Blocks/BlockCauldron.h b/src/Blocks/BlockCauldron.h index 9f2d0c82e..b8cd9081c 100644 --- a/src/Blocks/BlockCauldron.h +++ b/src/Blocks/BlockCauldron.h @@ -39,6 +39,7 @@ private: { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockPos); auto EquippedItem = a_Player.GetEquippedItem(); + switch (EquippedItem.m_ItemType) { case E_ITEM_BUCKET: @@ -96,12 +97,12 @@ private: } break; } - // Resets any color to default: case E_ITEM_LEATHER_BOOTS: case E_ITEM_LEATHER_CAP: case E_ITEM_LEATHER_PANTS: case E_ITEM_LEATHER_TUNIC: { + // Resets any color to default: if ((Meta > 0) && ((EquippedItem.m_ItemColor.GetRed() != 255) || (EquippedItem.m_ItemColor.GetBlue() != 255) || (EquippedItem.m_ItemColor.GetGreen() != 255))) { a_ChunkInterface.SetBlockMeta(a_BlockPos, --Meta); @@ -111,7 +112,6 @@ private: } break; } - // Resets shulker box color: case E_BLOCK_BLACK_SHULKER_BOX: case E_BLOCK_BLUE_SHULKER_BOX: case E_BLOCK_BROWN_SHULKER_BOX: @@ -127,6 +127,8 @@ private: case E_BLOCK_RED_SHULKER_BOX: case E_BLOCK_YELLOW_SHULKER_BOX: { + // Resets shulker box color. + // TODO: When there is an actual default shulker box add the appropriate changes here! - 19.09.2020 - 12xx12 if (Meta == 0) { @@ -134,22 +136,30 @@ private: break; } - // This is a workaround for version < 1.13. They client thinks a player placed a shulker and display that to the player - // The shulker cleaning was added in 1.13. - const auto ResendPosition = AddFaceDirection(a_BlockPos, a_BlockFace); - a_Player.GetClientHandle()->SendBlockChange( - ResendPosition.x, ResendPosition.y, ResendPosition.z, - a_ChunkInterface.GetBlock(ResendPosition), a_ChunkInterface.GetBlockMeta(ResendPosition) - ); - // Proceed with normal cleaning: a_ChunkInterface.SetBlockMeta(a_BlockPos, --Meta); auto NewShulker = cItem(EquippedItem); NewShulker.m_ItemType = E_BLOCK_PURPLE_SHULKER_BOX; a_Player.ReplaceOneEquippedItemTossRest(NewShulker); + break; } } + + if (!ItemHandler(EquippedItem.m_ItemType)->IsPlaceable()) + { + // Item not placeable in the first place, our work is done: + return true; + } + + // This is a workaround for versions < 1.13, where rclking a cauldron with a block, places a block. + // Using cauldrons with blocks was added in 1.13 as part of shulker cleaning. + const auto ResendPosition = AddFaceDirection(a_BlockPos, a_BlockFace); + a_Player.GetClientHandle()->SendBlockChange( + ResendPosition.x, ResendPosition.y, ResendPosition.z, + a_ChunkInterface.GetBlock(ResendPosition), a_ChunkInterface.GetBlockMeta(ResendPosition) + ); + return true; } |