diff options
author | Mattes D <github@xoft.cz> | 2014-07-06 14:42:28 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-07-06 14:42:28 +0200 |
commit | 562d14e8ecd058b029a248ab42ff60e36f7e2e62 (patch) | |
tree | d1ba385b1084b6a1392959d1fbdd5ea57739c7f6 /src/UI/SlotArea.cpp | |
parent | Fixed slime handling in cMonster::StringToMobType(). (diff) | |
download | cuberite-562d14e8ecd058b029a248ab42ff60e36f7e2e62.tar cuberite-562d14e8ecd058b029a248ab42ff60e36f7e2e62.tar.gz cuberite-562d14e8ecd058b029a248ab42ff60e36f7e2e62.tar.bz2 cuberite-562d14e8ecd058b029a248ab42ff60e36f7e2e62.tar.lz cuberite-562d14e8ecd058b029a248ab42ff60e36f7e2e62.tar.xz cuberite-562d14e8ecd058b029a248ab42ff60e36f7e2e62.tar.zst cuberite-562d14e8ecd058b029a248ab42ff60e36f7e2e62.zip |
Diffstat (limited to 'src/UI/SlotArea.cpp')
-rw-r--r-- | src/UI/SlotArea.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index 48ebf489b..4df04c9e2 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -468,6 +468,20 @@ void cSlotAreaCrafting::OnPlayerRemoved(cPlayer & a_Player) +void cSlotAreaCrafting::SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) +{ + // Update the recipe after setting the slot, if the slot is not the result slot: + super::SetSlot(a_SlotNum, a_Player, a_Item); + if (a_SlotNum != 0) + { + UpdateRecipe(a_Player); + } +} + + + + + void cSlotAreaCrafting::DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots) { UNUSED(a_ItemStack); @@ -545,16 +559,20 @@ void cSlotAreaCrafting::ShiftClickedResult(cPlayer & a_Player) // Distribute the result, this time for real: ResultCopy = Result; m_ParentWindow.DistributeStack(ResultCopy, a_Player, this, true); - + // Remove the ingredients from the crafting grid and update the recipe: cCraftingRecipe & Recipe = GetRecipeForPlayer(a_Player); cCraftingGrid Grid(PlayerSlots, m_GridSize, m_GridSize); Recipe.ConsumeIngredients(Grid); Grid.CopyToItems(PlayerSlots); UpdateRecipe(a_Player); + + // Broadcast the window, we sometimes move items to different locations than Vanilla, causing needless desyncs: + m_ParentWindow.BroadcastWholeWindow(); + + // If the recipe has changed, bail out: if (!Recipe.GetResult().IsEqual(Result)) { - // The recipe has changed, bail out return; } } |