the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 61 lines 1.6 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.entity.player.h" 3#include "..\Minecraft.Client\ServerPlayer.h" 4#include "..\Minecraft.Client\PlayerConnection.h" 5#include <qnet.h> 6#include "PacketListener.h" 7#include "InputOutputStream.h" 8#include "PlayerInfoPacket.h" 9 10 11 12PlayerInfoPacket::PlayerInfoPacket() 13{ 14 m_networkSmallId = 0; 15 m_playerColourIndex = -1; 16 m_playerPrivileges = 0; 17 m_entityId = -1; 18} 19 20PlayerInfoPacket::PlayerInfoPacket(BYTE networkSmallId, short playerColourIndex, unsigned int playerPrivileges) 21{ 22 m_networkSmallId = networkSmallId; 23 m_playerColourIndex = playerColourIndex; 24 m_playerPrivileges = playerPrivileges; 25 m_entityId = -1; 26} 27 28PlayerInfoPacket::PlayerInfoPacket(shared_ptr<ServerPlayer> player) 29{ 30 m_networkSmallId = 0; 31 if(player->connection != NULL && player->connection->getNetworkPlayer() != NULL) m_networkSmallId = player->connection->getNetworkPlayer()->GetSmallId(); 32 m_playerColourIndex = player->getPlayerIndex(); 33 m_playerPrivileges = player->getAllPlayerGamePrivileges(); 34 m_entityId = player->entityId; 35} 36 37void PlayerInfoPacket::read(DataInputStream *dis) 38{ 39 m_networkSmallId = dis->readByte(); 40 m_playerColourIndex = dis->readShort(); 41 m_playerPrivileges = dis->readInt(); 42 m_entityId = dis->readInt(); 43} 44 45void PlayerInfoPacket::write(DataOutputStream *dos) 46{ 47 dos->writeByte(m_networkSmallId); 48 dos->writeShort(m_playerColourIndex); 49 dos->writeInt(m_playerPrivileges); 50 dos->writeInt(m_entityId); 51} 52 53void PlayerInfoPacket::handle(PacketListener *listener) 54{ 55 listener->handlePlayerInfo(shared_from_this()); 56} 57 58int PlayerInfoPacket::getEstimatedSize() 59{ 60 return 2 + 2 + 4 + 4; 61}