aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/SetCarriedItemPacket.cpp
blob: f9fd8b08f6b78f494f461144965fb29abbd39686 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "stdafx.h"
#include <iostream>
#include "InputOutputStream.h"
#include "PacketListener.h"
#include "SetCarriedItemPacket.h"



SetCarriedItemPacket::SetCarriedItemPacket()
{
	slot = 0;
}

SetCarriedItemPacket::SetCarriedItemPacket(int slot)
{
	this->slot = slot;
}

void SetCarriedItemPacket::read(DataInputStream *dis) //throws IOException
{
	slot = dis->readShort();
}

void SetCarriedItemPacket::write(DataOutputStream *dos) //throws IOException
{
	dos->writeShort(slot);
}

void SetCarriedItemPacket::handle(PacketListener *listener)
{
	listener->handleSetCarriedItem(shared_from_this());
}

int SetCarriedItemPacket::getEstimatedSize()
{
	return 2;
}

bool SetCarriedItemPacket::canBeInvalidated()
{
	return true;
}

bool SetCarriedItemPacket::isInvalidatedBy(std::shared_ptr<Packet> packet)
{
	return true;
}