aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ContainerSetDataPacket.cpp
blob: 756d8f58065ff8aeafd491b30c2c36a8209be1dc (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
#include "stdafx.h"
#include <iostream>
#include "InputOutputStream.h"
#include "PacketListener.h"
#include "ContainerSetDataPacket.h"



ContainerSetDataPacket::ContainerSetDataPacket() 
{
	containerId = 0;
	id = -1;
	value = 0;
}

ContainerSetDataPacket::ContainerSetDataPacket(int containerId, int id, int value) 
{
	this->containerId = containerId;
	this->id = id;
	this->value = value;
}

void ContainerSetDataPacket::handle(PacketListener *listener) 
{
	listener->handleContainerSetData(shared_from_this());
}

void ContainerSetDataPacket::read(DataInputStream *dis) //throws IOException 
{
	containerId = dis->readByte();
	id = dis->readShort();
	value = dis->readShort();
}

void ContainerSetDataPacket::write(DataOutputStream *dos) // throws IOException 
{
	dos->writeByte(containerId);
	dos->writeShort(id);
	dos->writeShort(value);
}

int ContainerSetDataPacket::getEstimatedSize()
{
	return 1 + 4;
}