mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-27 14:23:51 +00:00
Initial commit
This commit is contained in:
parent
def8cb4153
commit
b691c43c44
19437 changed files with 4363922 additions and 0 deletions
45
Minecraft.World/ContainerAckPacket.cpp
Normal file
45
Minecraft.World/ContainerAckPacket.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#include "stdafx.h"
|
||||
#include <iostream>
|
||||
#include "InputOutputStream.h"
|
||||
#include "PacketListener.h"
|
||||
#include "ContainerAckPacket.h"
|
||||
|
||||
|
||||
|
||||
ContainerAckPacket::ContainerAckPacket()
|
||||
{
|
||||
containerId = 0;
|
||||
uid = 0;
|
||||
accepted = 0;
|
||||
}
|
||||
|
||||
ContainerAckPacket::ContainerAckPacket(int containerId, short uid, bool accepted)
|
||||
{
|
||||
this->containerId = containerId;
|
||||
this->uid = uid;
|
||||
this->accepted = accepted;
|
||||
}
|
||||
|
||||
void ContainerAckPacket::handle(PacketListener *listener)
|
||||
{
|
||||
listener->handleContainerAck(shared_from_this());
|
||||
}
|
||||
|
||||
void ContainerAckPacket::read(DataInputStream *dis) //throws IOException
|
||||
{
|
||||
containerId = dis->readByte();
|
||||
uid = dis->readShort();
|
||||
accepted = dis->readByte() != 0;
|
||||
}
|
||||
|
||||
void ContainerAckPacket::write(DataOutputStream *dos) //throws IOException
|
||||
{
|
||||
dos->writeByte(containerId);
|
||||
dos->writeShort(uid);
|
||||
dos->writeByte(accepted ? 1 : 0);
|
||||
}
|
||||
|
||||
int ContainerAckPacket::getEstimatedSize()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue