the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 65 lines 1.1 kB view raw
1#include "stdafx.h" 2#include <iostream> 3#include "InputOutputStream.h" 4#include "PacketListener.h" 5#include "TileEntityDataPacket.h" 6 7 8 9void TileEntityDataPacket::_init() 10{ 11 x = y = z = 0; 12 type = TYPE_MOB_SPAWNER; 13 tag = NULL; 14} 15 16 17TileEntityDataPacket::TileEntityDataPacket() 18{ 19 _init(); 20 shouldDelay = true; 21} 22 23TileEntityDataPacket::TileEntityDataPacket(int x, int y, int z, int type, CompoundTag *tag) 24{ 25 _init(); 26 shouldDelay = true; 27 this->x = x; 28 this->y = y; 29 this->z = z; 30 this->type = type; 31 this->tag = tag; 32} 33 34TileEntityDataPacket::~TileEntityDataPacket() 35{ 36 delete tag; 37} 38 39void TileEntityDataPacket::read(DataInputStream *dis) 40{ 41 x = dis->readInt(); 42 y = dis->readShort(); 43 z = dis->readInt(); 44 type = dis->readByte(); 45 tag = readNbt(dis); 46} 47 48void TileEntityDataPacket::write(DataOutputStream *dos) 49{ 50 dos->writeInt(x); 51 dos->writeShort(y); 52 dos->writeInt(z); 53 dos->writeByte((byte) type); 54 writeNbt(tag, dos); 55} 56 57void TileEntityDataPacket::handle(PacketListener *listener) 58{ 59 listener->handleTileEntityData(shared_from_this()); 60} 61 62int TileEntityDataPacket::getEstimatedSize() 63{ 64 return 6 * 4 + 1; 65}