aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/TileEntityDataPacket.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/TileEntityDataPacket.cpp
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.World/TileEntityDataPacket.cpp')
-rw-r--r--Minecraft.World/TileEntityDataPacket.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/Minecraft.World/TileEntityDataPacket.cpp b/Minecraft.World/TileEntityDataPacket.cpp
new file mode 100644
index 00000000..41be4526
--- /dev/null
+++ b/Minecraft.World/TileEntityDataPacket.cpp
@@ -0,0 +1,65 @@
+#include "stdafx.h"
+#include <iostream>
+#include "InputOutputStream.h"
+#include "PacketListener.h"
+#include "TileEntityDataPacket.h"
+
+
+
+void TileEntityDataPacket::_init()
+{
+ x = y = z = 0;
+ type = TYPE_MOB_SPAWNER;
+ tag = NULL;
+}
+
+
+TileEntityDataPacket::TileEntityDataPacket()
+{
+ _init();
+ shouldDelay = true;
+}
+
+TileEntityDataPacket::TileEntityDataPacket(int x, int y, int z, int type, CompoundTag *tag)
+{
+ _init();
+ shouldDelay = true;
+ this->x = x;
+ this->y = y;
+ this->z = z;
+ this->type = type;
+ this->tag = tag;
+}
+
+TileEntityDataPacket::~TileEntityDataPacket()
+{
+ delete tag;
+}
+
+void TileEntityDataPacket::read(DataInputStream *dis)
+{
+ x = dis->readInt();
+ y = dis->readShort();
+ z = dis->readInt();
+ type = dis->readByte();
+ tag = readNbt(dis);
+}
+
+void TileEntityDataPacket::write(DataOutputStream *dos)
+{
+ dos->writeInt(x);
+ dos->writeShort(y);
+ dos->writeInt(z);
+ dos->writeByte((byte) type);
+ writeNbt(tag, dos);
+}
+
+void TileEntityDataPacket::handle(PacketListener *listener)
+{
+ listener->handleTileEntityData(shared_from_this());
+}
+
+int TileEntityDataPacket::getEstimatedSize()
+{
+ return 6 * 4 + 1;
+} \ No newline at end of file