aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ResultContainer.cpp
blob: 782c2aa87beef65cd334c82b25bfde68f1ff2e26 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "stdafx.h"
#include "net.minecraft.world.entity.player.h"
#include "ResultContainer.h"

ResultContainer::ResultContainer() : Container()
{
	items = new ItemInstanceArray(1);
}

unsigned int ResultContainer::getContainerSize()
{
	return 1;
}

std::shared_ptr<ItemInstance> ResultContainer::getItem(unsigned int slot)
{
	return (*items)[0];
}

int ResultContainer::getName()
{
	return 0;
}

std::shared_ptr<ItemInstance> ResultContainer::removeItem(unsigned int slot, int count)
{
	if ((*items)[0] != NULL)
	{
		std::shared_ptr<ItemInstance> item = (*items)[0];
		(*items)[0] = nullptr;
		return item;
	}
	return nullptr;
}

std::shared_ptr<ItemInstance> ResultContainer::removeItemNoUpdate(int slot)
{
	if ((*items)[0] != NULL)
	{
		std::shared_ptr<ItemInstance> item = (*items)[0];
		(*items)[0] = nullptr;
		return item;
	}
	return nullptr;
}

void ResultContainer::setItem(unsigned int slot, std::shared_ptr<ItemInstance> item)
{
	(*items)[0] = item;
}

int ResultContainer::getMaxStackSize()
{
	return Container::LARGE_MAX_STACK_SIZE;
}

void ResultContainer::setChanged()
{
}

bool ResultContainer::stillValid(std::shared_ptr<Player> player)
{
	return true;
}