Files
MinecraftConsoles/Minecraft.World/TileEntityDataPacket.cpp
Loki Rautio 087b7e7abf Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.

This reverts commit a9be52c41a.
2026-03-07 21:12:22 -06:00

65 lines
1.1 KiB
C++

#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;
}