summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
authordaniel0916 <theschokolps@gmail.com>2014-01-24 20:01:21 +0100
committerdaniel0916 <theschokolps@gmail.com>2014-01-24 20:01:21 +0100
commitbfac00f2807a6740e876adebd689cc3ae6e075ed (patch)
treeb1492533d127d49d92b7667eabc404f33c36fc65 /src/Protocol
parentfirst changes for enchanting (not finished) (diff)
downloadcuberite-bfac00f2807a6740e876adebd689cc3ae6e075ed.tar
cuberite-bfac00f2807a6740e876adebd689cc3ae6e075ed.tar.gz
cuberite-bfac00f2807a6740e876adebd689cc3ae6e075ed.tar.bz2
cuberite-bfac00f2807a6740e876adebd689cc3ae6e075ed.tar.lz
cuberite-bfac00f2807a6740e876adebd689cc3ae6e075ed.tar.xz
cuberite-bfac00f2807a6740e876adebd689cc3ae6e075ed.tar.zst
cuberite-bfac00f2807a6740e876adebd689cc3ae6e075ed.zip
Diffstat (limited to '')
-rw-r--r--src/Protocol/Protocol17x.cpp14
-rw-r--r--src/Protocol/Protocol17x.h2
2 files changed, 12 insertions, 4 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index d120d8d91..f302da2ad 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -1143,7 +1143,7 @@ bool cProtocol172::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType)
case 0x0e: HandlePacketWindowClick (a_ByteBuffer); return true;
case 0x0f: // Confirm transaction - not used in MCS
case 0x10: HandlePacketCreativeInventoryAction(a_ByteBuffer); return true;
- case 0x11: HandlePacketEnchanting (a_ByteBuffer); return true;
+ case 0x11: HandlePacketEnchanting (a_ByteBuffer); return true;
case 0x12: HandlePacketUpdateSign (a_ByteBuffer); return true;
case 0x13: HandlePacketPlayerAbilities (a_ByteBuffer); return true;
case 0x14: HandlePacketTabComplete (a_ByteBuffer); return true;
@@ -1551,11 +1551,19 @@ void cProtocol172::HandlePacketEnchanting(cByteBuffer & a_ByteBuffer)
HANDLE_READ(a_ByteBuffer, ReadByte, Byte, WindowID);
HANDLE_READ(a_ByteBuffer, ReadByte, Byte, Enchantment);
- //TODO: EnchantItem (getWindow, getItem, Enchant)
+ LOGWARN("Enchantment Packet received!");
+ //Get Item from Window Slot
+ cItem EnchantItem = *m_Client->GetPlayer()->GetWindow()->GetSlot(*m_Client->GetPlayer(), 0);
+ //Enchant item with Sharpness 5
+ EnchantItem.m_Enchantments.SetLevel(cEnchantments::enchSharpness, 5);
- LOG("Enchantment Paket empfangen!");
+ //Set Enchanted Item to Window Slot
+ m_Client->GetPlayer()->GetWindow()->SetSlot(*m_Client->GetPlayer(), 0, EnchantItem);
+
+ LOGWARN("Item enchanted!");
+
}
diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h
index 04d65910c..7877e783a 100644
--- a/src/Protocol/Protocol17x.h
+++ b/src/Protocol/Protocol17x.h
@@ -258,7 +258,7 @@ protected:
void HandlePacketTabComplete (cByteBuffer & a_ByteBuffer);
void HandlePacketUpdateSign (cByteBuffer & a_ByteBuffer);
void HandlePacketUseEntity (cByteBuffer & a_ByteBuffer);
- void HandlePacketEnchanting (cByteBuffer & a_ByteBuffer);
+ void HandlePacketEnchanting (cByteBuffer & a_ByteBuffer);
void HandlePacketWindowClick (cByteBuffer & a_ByteBuffer);
void HandlePacketWindowClose (cByteBuffer & a_ByteBuffer);