the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include <iostream>
3#include "InputOutputStream.h"
4#include "net.minecraft.world.item.h"
5#include "PacketListener.h"
6#include "ContainerSetSlotPacket.h"
7
8
9
10const int ContainerSetSlotPacket::CONTAINER = 0;
11const int ContainerSetSlotPacket::WORKBENCH = 1;
12const int ContainerSetSlotPacket::FURNACE = 2;
13
14ContainerSetSlotPacket::ContainerSetSlotPacket()
15{
16 containerId = 0;
17 slot = 0;
18 item = nullptr;
19}
20
21ContainerSetSlotPacket::ContainerSetSlotPacket(int containerId, int slot, shared_ptr<ItemInstance> item)
22{
23 this->containerId = containerId;
24 this->slot = slot;
25 this->item = item == NULL ? item : item->copy();
26}
27
28void ContainerSetSlotPacket::handle(PacketListener *listener)
29{
30 listener->handleContainerSetSlot(shared_from_this());
31}
32
33void ContainerSetSlotPacket::read(DataInputStream *dis) //throws IOException
34{
35 // 4J Stu - TU-1 hotfix
36 // Fix for #13142 - Holding down the A button on the furnace ingredient slot causes the UI to display incorrect item counts
37 BYTE byteId = dis->readByte();
38 containerId = *(char *)&byteId;
39 slot = dis->readShort();
40 item = readItem(dis);
41}
42
43void ContainerSetSlotPacket::write(DataOutputStream *dos) //throws IOException
44{
45 dos->writeByte(containerId);
46 dos->writeShort(slot);
47 writeItem(item, dos);
48}
49
50int ContainerSetSlotPacket::getEstimatedSize()
51{
52 return 3 + 5;
53}