summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockCauldron.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks/BlockCauldron.h')
-rw-r--r--src/Blocks/BlockCauldron.h59
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;