diff options
author | 12xx12 <44411062+12xx12@users.noreply.github.com> | 2020-09-20 03:24:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-20 03:24:58 +0200 |
commit | 6a0669fb98278200ba69f2f25bf508cb2b220314 (patch) | |
tree | a2f7afe60a5e0aa083c7d952bd50d32dfb79b98e /src/Blocks/BlockCauldron.h | |
parent | Added end portal and enchanting table block entities (diff) | |
download | cuberite-6a0669fb98278200ba69f2f25bf508cb2b220314.tar cuberite-6a0669fb98278200ba69f2f25bf508cb2b220314.tar.gz cuberite-6a0669fb98278200ba69f2f25bf508cb2b220314.tar.bz2 cuberite-6a0669fb98278200ba69f2f25bf508cb2b220314.tar.lz cuberite-6a0669fb98278200ba69f2f25bf508cb2b220314.tar.xz cuberite-6a0669fb98278200ba69f2f25bf508cb2b220314.tar.zst cuberite-6a0669fb98278200ba69f2f25bf508cb2b220314.zip |
Diffstat (limited to 'src/Blocks/BlockCauldron.h')
-rw-r--r-- | src/Blocks/BlockCauldron.h | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/src/Blocks/BlockCauldron.h b/src/Blocks/BlockCauldron.h index 263f539a7..be9b8d64f 100644 --- a/src/Blocks/BlockCauldron.h +++ b/src/Blocks/BlockCauldron.h @@ -2,7 +2,8 @@ #pragma once #include "BlockHandler.h" - +#include "../Entities/Player.h" +#include "../ClientHandle.h" @@ -54,7 +55,6 @@ public: if (!a_Player.IsGameModeCreative()) { a_Player.ReplaceOneEquippedItemTossRest(cItem(E_ITEM_WATER_BUCKET)); - a_Player.GetStatManager().AddValue(Statistic::UseCauldron); } } break; @@ -83,6 +83,7 @@ public: { a_Player.ReplaceOneEquippedItemTossRest(cItem(E_ITEM_POTION)); } + a_Player.GetStatManager().AddValue(Statistic::UseCauldron); } break; } @@ -98,6 +99,60 @@ public: a_Player.ReplaceOneEquippedItemTossRest(cItem(E_ITEM_GLASS_BOTTLE)); } } + 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: + { + if ((Meta > 0) && ((EquippedItem.m_ItemColor.GetRed() != 255) || (EquippedItem.m_ItemColor.GetBlue() != 255) || (EquippedItem.m_ItemColor.GetGreen() != 255))) + { + a_ChunkInterface.SetBlockMeta(a_BlockPos, --Meta); + auto NewItem = cItem(EquippedItem); + NewItem.m_ItemColor.Clear(); + a_Player.ReplaceOneEquippedItemTossRest(NewItem); + } + break; + } + // Resets shulker box color: + case E_BLOCK_BLACK_SHULKER_BOX: + case E_BLOCK_BLUE_SHULKER_BOX: + case E_BLOCK_BROWN_SHULKER_BOX: + case E_BLOCK_CYAN_SHULKER_BOX: + case E_BLOCK_GRAY_SHULKER_BOX: + case E_BLOCK_GREEN_SHULKER_BOX: + case E_BLOCK_LIGHT_BLUE_SHULKER_BOX: + case E_BLOCK_LIGHT_GRAY_SHULKER_BOX: + case E_BLOCK_LIME_SHULKER_BOX: + case E_BLOCK_MAGENTA_SHULKER_BOX: + case E_BLOCK_ORANGE_SHULKER_BOX: + case E_BLOCK_PINK_SHULKER_BOX: + case E_BLOCK_RED_SHULKER_BOX: + case E_BLOCK_YELLOW_SHULKER_BOX: + { + // TODO: When there is an actual default shulker box add the appropriate changes here! - 19.09.2020 - 12xx12 + if (Meta == 0) + { + // The cauldron is empty: + 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; } } return true; |