aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ContainerAckPacket.cpp
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/ContainerAckPacket.cpp
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.World/ContainerAckPacket.cpp')
-rw-r--r--Minecraft.World/ContainerAckPacket.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/Minecraft.World/ContainerAckPacket.cpp b/Minecraft.World/ContainerAckPacket.cpp
new file mode 100644
index 00000000..b416bfa6
--- /dev/null
+++ b/Minecraft.World/ContainerAckPacket.cpp
@@ -0,0 +1,45 @@
+#include "stdafx.h"
+#include <iostream>
+#include "InputOutputStream.h"
+#include "PacketListener.h"
+#include "ContainerAckPacket.h"
+
+
+
+ContainerAckPacket::ContainerAckPacket()
+{
+ containerId = 0;
+ uid = 0;
+ accepted = 0;
+}
+
+ContainerAckPacket::ContainerAckPacket(int containerId, short uid, bool accepted)
+{
+ this->containerId = containerId;
+ this->uid = uid;
+ this->accepted = accepted;
+}
+
+void ContainerAckPacket::handle(PacketListener *listener)
+{
+ listener->handleContainerAck(shared_from_this());
+}
+
+void ContainerAckPacket::read(DataInputStream *dis) //throws IOException
+{
+ containerId = dis->readByte();
+ uid = dis->readShort();
+ accepted = dis->readByte() != 0;
+}
+
+void ContainerAckPacket::write(DataOutputStream *dos) //throws IOException
+{
+ dos->writeByte(containerId);
+ dos->writeShort(uid);
+ dos->writeByte(accepted ? 1 : 0);
+}
+
+int ContainerAckPacket::getEstimatedSize()
+{
+ return 4;
+}