aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/BrewingStandMenu.h
blob: fded12d2bb1fd9249d33512fd5419723f8577f8d (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
65
#pragma once

#include "AbstractContainerMenu.h"
#include "Slot.h"

class BrewingStandTileEntity;
class Inventory;
class Player;
class Container;

class BrewingStandMenu : public AbstractContainerMenu
{
	// 4J Stu - Made public so that we can access these from the XUI menus
public:
	static const int INGREDIENT_SLOT = 3;
	static const int BOTTLE_SLOT_START = 0;
	static const int BOTTLE_SLOT_END = 2;
	static const int INV_SLOT_START = INGREDIENT_SLOT + 1;
	static const int INV_SLOT_END = INV_SLOT_START + 9 * 3;
	static const int USE_ROW_SLOT_START = INV_SLOT_END;
	static const int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9;

private:
	shared_ptr<BrewingStandTileEntity> brewingStand;
	Slot *ingredientSlot;

public:
	BrewingStandMenu(shared_ptr<Inventory> inventory, shared_ptr<BrewingStandTileEntity> brewingStand);

private:
	int tc;

public:
	virtual void addSlotListener(ContainerListener *listener);
	virtual void broadcastChanges();
	virtual void setData(int id, int value);
	virtual bool stillValid(shared_ptr<Player> player);
	virtual shared_ptr<ItemInstance> quickMoveStack(shared_ptr<Player> player, int slotIndex);

private:
	class PotionSlot : public Slot
	{
	private:
		shared_ptr<Player> player;

	public:
		PotionSlot(shared_ptr<Player> player, shared_ptr<Container> container, int slot, int x, int y);

		virtual bool mayPlace(shared_ptr<ItemInstance> item);
		virtual int getMaxStackSize() const;
		virtual void onTake(shared_ptr<Player> player, shared_ptr<ItemInstance> carried);
		static bool mayPlaceItem(shared_ptr<ItemInstance> item);
		virtual bool mayCombine(shared_ptr<ItemInstance> item); // 4J Added
	};

	class IngredientsSlot : public Slot
	{
	public:
		IngredientsSlot(shared_ptr<Container> container, int slot, int x, int y);

		virtual bool mayPlace(shared_ptr<ItemInstance> item);
		virtual int getMaxStackSize() const;
		virtual bool mayCombine(shared_ptr<ItemInstance> item); // 4J Added
	};
};