summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorTobias Wilken <TooAngel@TooAngel.de>2020-07-14 18:56:42 +0200
committerGitHub <noreply@github.com>2020-07-14 18:56:42 +0200
commit36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9 (patch)
tree04c224231a800002692a296131af4988dd465845 /src/ClientHandle.cpp
parentCustom command depend is automatic (diff)
downloadcuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.gz
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.bz2
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.lz
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.xz
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.zst
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.zip
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);