the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 53 lines 1.1 kB view raw
1#include "stdafx.h" 2#include <iostream> 3#include "InputOutputStream.h" 4#include "PacketListener.h" 5#include "net.minecraft.world.entity.h" 6#include "SetRidingPacket.h" 7 8 9 10SetRidingPacket::SetRidingPacket() 11{ 12 riderId = -1; 13 riddenId = -1; 14} 15 16SetRidingPacket::SetRidingPacket(shared_ptr<Entity> rider, shared_ptr<Entity> riding) 17{ 18 this->riderId = rider->entityId; 19 this->riddenId = riding != NULL ? riding->entityId : -1; 20} 21 22int SetRidingPacket::getEstimatedSize() 23{ 24 return 8; 25} 26 27void SetRidingPacket::read(DataInputStream *dis) //throws IOException 28{ 29 riderId = dis->readInt(); 30 riddenId = dis->readInt(); 31} 32 33void SetRidingPacket::write(DataOutputStream *dos) //throws IOException 34{ 35 dos->writeInt(riderId); 36 dos->writeInt(riddenId); 37} 38 39void SetRidingPacket::handle(PacketListener *listener) 40{ 41 listener->handleRidePacket(shared_from_this()); 42} 43 44bool SetRidingPacket::canBeInvalidated() 45{ 46 return true; 47} 48 49bool SetRidingPacket::isInvalidatedBy(shared_ptr<Packet> packet) 50{ 51 shared_ptr<SetRidingPacket> target = dynamic_pointer_cast<SetRidingPacket>(packet); 52 return target->riderId == riderId; 53}