aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/DispenserTileEntity.h
blob: 8519ad5445dea4d3c2c046b63a92d8f4a8e1be4d (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
#pragma once

using namespace std;

#include "com.mojang.nbt.h"
#include "TileEntity.h"
#include "Container.h"

class Player;
class Random;
class Level;
class CompoundTag;

class DispenserTileEntity: public TileEntity, public Container
{
public:
	eINSTANCEOF GetType() { return eTYPE_DISPENSERTILEENTITY; }
	static TileEntity *create() { return new DispenserTileEntity(); }


using TileEntity::setChanged;

private:
	ItemInstanceArray *items;
	Random *random;

public:
	DispenserTileEntity();
	virtual ~DispenserTileEntity();

	virtual unsigned int getContainerSize();
	virtual shared_ptr<ItemInstance> getItem(unsigned int slot);
	virtual shared_ptr<ItemInstance> removeItem(unsigned int slot, int count);
	shared_ptr<ItemInstance> removeItemNoUpdate(int slot);
	bool removeProjectile(int itemId);
	int getRandomSlot();
	virtual void setItem(unsigned int slot, shared_ptr<ItemInstance> item);
	virtual int addItem(shared_ptr<ItemInstance> item);
	virtual int getName();
	virtual void load(CompoundTag *base);
	virtual void save(CompoundTag *base);
	virtual int getMaxStackSize();
	virtual bool stillValid(shared_ptr<Player> player);
	virtual void setChanged();

    void startOpen();
    void stopOpen();

	// 4J Added
	virtual shared_ptr<TileEntity> clone();
	void AddItemBack(shared_ptr<ItemInstance>item, unsigned int slot); 
};