aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ContainerSetDataPacket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.World/ContainerSetDataPacket.cpp')
-rw-r--r--Minecraft.World/ContainerSetDataPacket.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/Minecraft.World/ContainerSetDataPacket.cpp b/Minecraft.World/ContainerSetDataPacket.cpp
new file mode 100644
index 00000000..756d8f58
--- /dev/null
+++ b/Minecraft.World/ContainerSetDataPacket.cpp
@@ -0,0 +1,45 @@
+#include "stdafx.h"
+#include <iostream>
+#include "InputOutputStream.h"
+#include "PacketListener.h"
+#include "ContainerSetDataPacket.h"
+
+
+
+ContainerSetDataPacket::ContainerSetDataPacket()
+{
+ containerId = 0;
+ id = -1;
+ value = 0;
+}
+
+ContainerSetDataPacket::ContainerSetDataPacket(int containerId, int id, int value)
+{
+ this->containerId = containerId;
+ this->id = id;
+ this->value = value;
+}
+
+void ContainerSetDataPacket::handle(PacketListener *listener)
+{
+ listener->handleContainerSetData(shared_from_this());
+}
+
+void ContainerSetDataPacket::read(DataInputStream *dis) //throws IOException
+{
+ containerId = dis->readByte();
+ id = dis->readShort();
+ value = dis->readShort();
+}
+
+void ContainerSetDataPacket::write(DataOutputStream *dos) // throws IOException
+{
+ dos->writeByte(containerId);
+ dos->writeShort(id);
+ dos->writeShort(value);
+}
+
+int ContainerSetDataPacket::getEstimatedSize()
+{
+ return 1 + 4;
+}