summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 3cad17849..9fbc9f89d 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -14,6 +14,8 @@
#include "BlockEntities/ChestEntity.h"
#include "BlockEntities/CommandBlockEntity.h"
#include "BlockEntities/SignEntity.h"
+#include "UI/InventoryWindow.h"
+#include "UI/CraftingWindow.h"
#include "UI/Window.h"
#include "UI/AnvilWindow.h"
#include "UI/BeaconWindow.h"
@@ -1692,7 +1694,7 @@ void cClientHandle::HandleWindowClick(UInt8 a_WindowID, Int16 a_SlotNum, eClickA
LOGWARNING("Player \"%s\" clicked in a non-existent window. Ignoring", m_Username.c_str());
return;
}
-
+ m_Player->AddKnownItem(a_HeldItem);
Window->Clicked(*m_Player, a_WindowID, a_SlotNum, a_ClickAction, a_HeldItem);
}
@@ -3129,6 +3131,46 @@ void cClientHandle::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_Blo
+void cClientHandle::SendUnlockRecipe(UInt32 a_RecipeId)
+{
+ m_Protocol->SendUnlockRecipe(a_RecipeId);
+}
+
+
+
+
+
+void cClientHandle::SendInitRecipes(UInt32 a_RecipeId)
+{
+ m_Protocol->SendInitRecipes(a_RecipeId);
+}
+
+
+
+
+
+void cClientHandle::HandleCraftRecipe(UInt32 a_RecipeId)
+{
+ auto * Window = m_Player->GetWindow();
+ if (Window == nullptr)
+ {
+ return;
+ }
+
+ if (Window->GetWindowType() == cWindow::wtInventory)
+ {
+ static_cast<cInventoryWindow *>(Window)->LoadRecipe(*m_Player, a_RecipeId);
+ }
+ else if (Window->GetWindowType() == cWindow::wtWorkbench)
+ {
+ static_cast<cCraftingWindow *>(Window)->LoadRecipe(*m_Player, a_RecipeId);
+ }
+}
+
+
+
+
+
void cClientHandle::SendWeather(eWeather a_Weather)
{
m_Protocol->SendWeather(a_Weather);