Cauldron: backport "use" behaviour to 1.12 (#4902)
* Cauldron: backport "use" behaviour to 1.12
This commit is contained in:
parent
68cced73af
commit
5a16620322
@ -39,6 +39,7 @@ private:
|
|||||||
{
|
{
|
||||||
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockPos);
|
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockPos);
|
||||||
auto EquippedItem = a_Player.GetEquippedItem();
|
auto EquippedItem = a_Player.GetEquippedItem();
|
||||||
|
|
||||||
switch (EquippedItem.m_ItemType)
|
switch (EquippedItem.m_ItemType)
|
||||||
{
|
{
|
||||||
case E_ITEM_BUCKET:
|
case E_ITEM_BUCKET:
|
||||||
@ -96,12 +97,12 @@ private:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Resets any color to default:
|
|
||||||
case E_ITEM_LEATHER_BOOTS:
|
case E_ITEM_LEATHER_BOOTS:
|
||||||
case E_ITEM_LEATHER_CAP:
|
case E_ITEM_LEATHER_CAP:
|
||||||
case E_ITEM_LEATHER_PANTS:
|
case E_ITEM_LEATHER_PANTS:
|
||||||
case E_ITEM_LEATHER_TUNIC:
|
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)))
|
if ((Meta > 0) && ((EquippedItem.m_ItemColor.GetRed() != 255) || (EquippedItem.m_ItemColor.GetBlue() != 255) || (EquippedItem.m_ItemColor.GetGreen() != 255)))
|
||||||
{
|
{
|
||||||
a_ChunkInterface.SetBlockMeta(a_BlockPos, --Meta);
|
a_ChunkInterface.SetBlockMeta(a_BlockPos, --Meta);
|
||||||
@ -111,7 +112,6 @@ private:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Resets shulker box color:
|
|
||||||
case E_BLOCK_BLACK_SHULKER_BOX:
|
case E_BLOCK_BLACK_SHULKER_BOX:
|
||||||
case E_BLOCK_BLUE_SHULKER_BOX:
|
case E_BLOCK_BLUE_SHULKER_BOX:
|
||||||
case E_BLOCK_BROWN_SHULKER_BOX:
|
case E_BLOCK_BROWN_SHULKER_BOX:
|
||||||
@ -127,6 +127,8 @@ private:
|
|||||||
case E_BLOCK_RED_SHULKER_BOX:
|
case E_BLOCK_RED_SHULKER_BOX:
|
||||||
case E_BLOCK_YELLOW_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
|
// TODO: When there is an actual default shulker box add the appropriate changes here! - 19.09.2020 - 12xx12
|
||||||
if (Meta == 0)
|
if (Meta == 0)
|
||||||
{
|
{
|
||||||
@ -134,22 +136,30 @@ private:
|
|||||||
break;
|
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:
|
// Proceed with normal cleaning:
|
||||||
a_ChunkInterface.SetBlockMeta(a_BlockPos, --Meta);
|
a_ChunkInterface.SetBlockMeta(a_BlockPos, --Meta);
|
||||||
auto NewShulker = cItem(EquippedItem);
|
auto NewShulker = cItem(EquippedItem);
|
||||||
NewShulker.m_ItemType = E_BLOCK_PURPLE_SHULKER_BOX;
|
NewShulker.m_ItemType = E_BLOCK_PURPLE_SHULKER_BOX;
|
||||||
a_Player.ReplaceOneEquippedItemTossRest(NewShulker);
|
a_Player.ReplaceOneEquippedItemTossRest(NewShulker);
|
||||||
|
|
||||||
break;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user