the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 65 lines 1.2 kB view raw
1#include "stdafx.h" 2#include <exception> 3#include <iostream> 4#include "InputOutputStream.h" 5#include "net.minecraft.world.entity.h" 6#include "net.minecraft.world.entity.global.h" 7#include "PacketListener.h" 8#include "AddGlobalEntityPacket.h" 9 10 11 12const int AddGlobalEntityPacket::LIGHTNING = 1; 13 14AddGlobalEntityPacket::AddGlobalEntityPacket() 15{ 16 id = -1; 17 x = 0; 18 y = 0; 19 x = 0; 20 type = 0; 21} 22 23AddGlobalEntityPacket::AddGlobalEntityPacket(shared_ptr<Entity> e) 24{ 25 id = e->entityId; 26 x = Mth::floor(e->x * 32); 27 y = Mth::floor(e->y * 32); 28 z = Mth::floor(e->z * 32); 29 if ( e->instanceof(eTYPE_LIGHTNINGBOLT) ) 30 { 31 type = LIGHTNING; 32 } 33 else 34 { 35 type = 0; 36 } 37} 38 39void AddGlobalEntityPacket::read(DataInputStream *dis) // throws IOException 40{ 41 id = dis->readInt(); 42 type = dis->readByte(); 43 x = dis->readInt(); 44 y = dis->readInt(); 45 z = dis->readInt(); 46} 47 48void AddGlobalEntityPacket::write(DataOutputStream *dos) // throws IOException 49{ 50 dos->writeInt(id); 51 dos->writeByte(type); 52 dos->writeInt(x); 53 dos->writeInt(y); 54 dos->writeInt(z); 55} 56 57void AddGlobalEntityPacket::handle(PacketListener *listener) 58{ 59 listener->handleAddGlobalEntity(shared_from_this()); 60} 61 62int AddGlobalEntityPacket::getEstimatedSize() 63{ 64 return 17; 65}