aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/CraftItemPacket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.World/CraftItemPacket.cpp')
-rw-r--r--Minecraft.World/CraftItemPacket.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/Minecraft.World/CraftItemPacket.cpp b/Minecraft.World/CraftItemPacket.cpp
new file mode 100644
index 00000000..7c6df6ad
--- /dev/null
+++ b/Minecraft.World/CraftItemPacket.cpp
@@ -0,0 +1,46 @@
+#include "stdafx.h"
+#include <iostream>
+#include "InputOutputStream.h"
+#include "net.minecraft.world.item.h"
+#include "PacketListener.h"
+#include "CraftItemPacket.h"
+
+
+
+CraftItemPacket::~CraftItemPacket()
+{
+}
+
+CraftItemPacket::CraftItemPacket()
+{
+ recipe = -1;
+ uid = 0;
+}
+
+CraftItemPacket::CraftItemPacket(int recipe, short uid)
+{
+ this->recipe = recipe;
+ this->uid = uid;
+}
+
+void CraftItemPacket::handle(PacketListener *listener)
+{
+ listener->handleCraftItem(shared_from_this());
+}
+
+void CraftItemPacket::read(DataInputStream *dis) //throws IOException
+{
+ uid = dis->readShort();
+ recipe = dis->readInt();
+}
+
+void CraftItemPacket::write(DataOutputStream *dos) // throws IOException
+{
+ dos->writeShort(uid);
+ dos->writeInt(recipe);
+}
+
+int CraftItemPacket::getEstimatedSize()
+{
+ return 2 + 4;
+}