aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/CraftItemPacket.cpp
blob: 7c6df6add2876546578b755ae6ee774507dcd069 (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
#include "stdafx.h"
#include <iostream>
#include "InputOutputStream.h"
#include "net.minecraft.world.item.h"
#include "PacketListener.h"
#include "CraftItemPacket.h"



CraftItemPacket::~CraftItemPacket()
{
}

CraftItemPacket::CraftItemPacket()
{
	recipe = -1;
	uid = 0;
}

CraftItemPacket::CraftItemPacket(int recipe, short uid)
{
	this->recipe = recipe;
	this->uid = uid;
}

void CraftItemPacket::handle(PacketListener *listener)
{
	listener->handleCraftItem(shared_from_this());
}

void CraftItemPacket::read(DataInputStream *dis) //throws IOException
{
	uid = dis->readShort();
	recipe = dis->readInt();
}

void CraftItemPacket::write(DataOutputStream *dos) // throws IOException
{
	dos->writeShort(uid);
	dos->writeInt(recipe);
}

int CraftItemPacket::getEstimatedSize() 
{
	return 2 + 4;
}