the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 66 lines 1.4 kB view raw
1#include "stdafx.h" 2#include <iostream> 3#include "InputOutputStream.h" 4#include "PacketListener.h" 5#include "SetHealthPacket.h" 6 7 8 9SetHealthPacket::SetHealthPacket() 10{ 11 this->health = 0.0f; 12 this->food = 0; 13 this->saturation = 0; 14 15 this->damageSource = eTelemetryChallenges_Unknown; 16} 17 18SetHealthPacket::SetHealthPacket(float health, int food, float saturation, ETelemetryChallenges damageSource) 19{ 20 this->health = health; 21 this->food = food; 22 this->saturation = saturation; 23 // this.exhaustion = exhaustion; // 4J - Original comment 24 25 this->damageSource = damageSource; 26} 27 28void SetHealthPacket::read(DataInputStream *dis) //throws IOException 29{ 30 health = dis->readFloat(); 31 food = dis->readShort(); 32 saturation = dis->readFloat(); 33 // exhaustion = dis.readFloat(); 34 35 damageSource = (ETelemetryChallenges)dis->readByte(); 36} 37 38void SetHealthPacket::write(DataOutputStream *dos) //throws IOException 39{ 40 dos->writeFloat(health); 41 dos->writeShort(food); 42 dos->writeFloat(saturation); 43 // dos.writeFloat(exhaustion); 44 45 dos->writeByte(damageSource); 46} 47 48void SetHealthPacket::handle(PacketListener *listener) 49{ 50 listener->handleSetHealth(shared_from_this()); 51} 52 53int SetHealthPacket::getEstimatedSize() 54{ 55 return 11; 56} 57 58bool SetHealthPacket::canBeInvalidated() 59{ 60 return true; 61} 62 63bool SetHealthPacket::isInvalidatedBy(shared_ptr<Packet> packet) 64{ 65 return true; 66}