|
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Go to the documentation of this file.
11 #include "../Inventory.h"
184 virtual void DistributeStack(
cItem & a_ItemStack,
cPlayer & a_Player,
bool a_ShouldApply,
bool a_KeepEmptySlots,
bool a_BackFill)
override;
245 using cItemMap = std::map<UInt32, std::vector<cItem> >;
274 virtual void DistributeStack(
cItem & a_ItemStack,
cPlayer & a_Player,
bool a_ShouldApply,
bool a_KeepEmptySlots,
bool a_BackFill)
override;
285 typedef std::list<std::pair<UInt32, cCraftingRecipe> >
cRecipeMap;
327 virtual void DistributeStack(
cItem & a_ItemStack,
cPlayer & a_Player,
bool a_ShouldApply,
bool a_KeepEmptySlots,
bool a_BackFill)
override;
367 virtual void DistributeStack(
cItem & a_ItemStack,
cPlayer & a_Player,
bool a_ShouldApply,
bool a_KeepEmptySlots,
bool a_BackFill)
override;
393 virtual void DistributeStack(
cItem & a_ItemStack,
cPlayer & a_Player,
bool a_ShouldApply,
bool a_KeepEmptySlots,
bool a_BackFill)
override;
485 virtual void DistributeStack(
cItem & a_ItemStack,
cPlayer & a_Player,
bool a_ShouldApply,
bool a_KeepEmptySlots,
bool a_BackFill)
override;
516 virtual void DistributeStack(
cItem & a_ItemStack,
cPlayer & a_Player,
bool a_ShouldApply,
bool a_KeepEmptySlots,
bool a_BackFill)
override;
565 virtual void DistributeStack(
cItem & a_ItemStack,
cPlayer & a_Player,
bool a_ShouldApply,
bool a_KeepEmptySlots,
bool a_BackFill)
override;
cMinecartWithChest * m_Chest
cBrewingstandEntity * m_Brewingstand
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
virtual void OnSlotChanged(cItemGrid *a_ItemGrid, int a_SlotNum) override
Called whenever a slot changes.
virtual void DistributeStack(cItem &a_ItemStack, cPlayer &a_Player, bool a_ShouldApply, bool a_KeepEmptySlots, bool a_BackFill) override
Called to store as much of a_ItemStack in the area as possible.
void UpdateResult(cPlayer &a_Player)
Handles a click in the item slot.
virtual void DblClicked(cPlayer &a_Player, int a_SlotNum)
Called from Clicked when the action is a caDblClick.
cSlotAreaInventoryBase(int a_NumSlots, int a_SlotOffset, cWindow &a_ParentWindow)
eClickAction
Individual actions sent in the WindowClick packet.
void ClearCraftingGrid(cPlayer &a_Player)
Clear the crafting grid.
virtual void Clicked(cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem) override
Called when a player clicks in the window.
char m_StackSizeToBeUsedInRepair
The stack size of the second item where was used for repair.
cSlotAreaArmor(cWindow &a_ParentWindow)
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const override
Called to retrieve an item in the specified slot for the specified player.
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const override
Called to retrieve an item in the specified slot for the specified player.
virtual void OnSlotChanged(cItemGrid *a_ItemGrid, int a_SlotNum) override
Called whenever a slot changes.
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
This class represents the player's inventory The slots are divided into three areas:
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
virtual void MiddleClicked(cPlayer &a_Player, int a_SlotNum)
Called from Clicked when the action is a middleclick.
cFurnaceEntity * m_Furnace
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const override
Called to retrieve an item in the specified slot for the specified player.
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
cSlotArea(int a_NumSlots, cWindow &a_ParentWindow)
This class is used as a callback for when a slot changes.
virtual void Clicked(cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem) override
Called when a player clicks in the window.
int GetNumSlots(void) const
virtual void ShiftClicked(cPlayer &a_Player, int a_SlotNum, const cItem &a_ClickedItem)
Called from Clicked when the action is a shiftclick (left or right)
cSlotAreaEnderChest(cEnderChestEntity *a_EnderChest, cWindow &a_ParentWindow)
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
cSlotAreaHotBar(cWindow &a_ParentWindow)
virtual void OnPlayerAdded(cPlayer &a_Player)
Called when a new player opens the same parent window.
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item)=0
Called to set an item in the specified slot for the specified player.
virtual ~cSlotAreaItemGrid() override
virtual void OnSlotChanged(cItemGrid *a_ItemGrid, int a_SlotNum) override
Called whenever a slot changes.
cSlotAreaFurnace(cFurnaceEntity *a_Furnace, cWindow &a_ParentWindow)
Handles the hotbar of each player.
void UpdateResult(cPlayer &a_Player)
Handles a click in the item slot.
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const override
Called to retrieve an item in the specified slot for the specified player.
virtual void OnPlayerRemoved(cPlayer &a_Player) override
Called when one of the players closes the parent window.
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
virtual void DistributeStack(cItem &a_ItemStack, cPlayer &a_Player, bool a_ShouldApply, bool a_KeepEmptySlots, bool a_BackFill) override
Called to store as much of a_ItemStack in the area as possible.
cChestEntity * m_BottomChest
cItem * GetPlayerSlots(cPlayer &a_Player)
Returns the pointer to the slot array for the player specified.
virtual void DblClicked(cPlayer &a_Player, int a_SlotNum) override
Called from Clicked when the action is a caDblClick.
cSlotAreaDoubleChest(cChestEntity *a_TopChest, cChestEntity *a_BottomChest, cWindow &a_ParentWindow)
virtual void Clicked(cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem) override
Called when a player clicks in the window.
std::list< std::pair< UInt32, cCraftingRecipe > > cRecipeMap
Maps player's EntityID -> current recipe.
virtual bool CollectItemsToHand(cItem &a_Dragging, cPlayer &a_Player, bool a_CollectFullStacks)
Called on DblClicking to collect all stackable items into hand.
virtual void ShiftClicked(cPlayer &a_Player, int a_SlotNum, const cItem &a_ClickedItem) override
Called from Clicked when the action is a shiftclick (left or right)
cSlotAreaBrewingstand(cBrewingstandEntity *a_Brewingstand, cWindow &a_ParentWindow)
virtual void NumberClicked(cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction)
Called from Clicked when the action is a number click.
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
void ClickedResult(cPlayer &a_Player)
Handles a click in the result slot.
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const override
Called to retrieve an item in the specified slot for the specified player.
virtual void DistributeStack(cItem &a_ItemStack, cPlayer &a_Player, bool a_ShouldApply, bool a_KeepEmptySlots, bool a_BackFill) override
Called to store as much of a_ItemStack in the area as possible.
virtual void Clicked(cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem) override
Called when a player clicks in the window.
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
virtual void DropClicked(cPlayer &a_Player, int a_SlotNum, bool a_DropStack)
Called from Clicked when the action is a drop click.
void LoadRecipe(cPlayer &a_Player, UInt32 a_RecipeId)
Loads the given Recipe into the crafting grid.
cCraftingRecipe & GetRecipeForPlayer(cPlayer &a_Player)
Retrieves the recipe for the specified player from the map, or creates one if not found.
cSlotAreaShield(cWindow &a_ParentWindow)
virtual void Clicked(cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem) override
Called when a player clicks in the window.
virtual ~cSlotAreaBeacon() override
static bool CanPlaceArmorInSlot(int a_SlotNum, const cItem &a_Item)
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const override
Called to retrieve an item in the specified slot for the specified player.
unsigned GetBookshelvesCount(cWorld &a_World)
virtual void DistributeStack(cItem &a_ItemStack, cPlayer &a_Player, bool a_ShouldApply, bool a_KeepEmptySlots, bool a_BackFill) override
Called to store as much of a_ItemStack in the area as possible.
cSlotAreaBeacon(cBeaconEntity *a_Beacon, cWindow &a_ParentWindow)
Handles the armor area of the player's inventory.
std::array< cItem, 3 > m_EnchantedItemOptions
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
virtual ~cSlotAreaBrewingstand() override
virtual void OnPlayerAdded(cPlayer &a_Player) override
Called when a new player opens the same parent window.
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const override
Called to retrieve an item in the specified slot for the specified player.
cSlotAreaInventory(cWindow &a_ParentWindow)
virtual void Clicked(cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem) override
Called when a player clicks in the window.
virtual void Clicked(cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem) override
Called when a player clicks in the window.
virtual void DistributeStack(cItem &a_ItemStack, cPlayer &a_Player, bool a_ShouldApply, bool a_KeepEmptySlots, bool a_BackFill) override
Distributing the stack is allowed only for compatible items (helmets into helmet slot etc....
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const override
Called to retrieve an item in the specified slot for the specified player.
virtual void DistributeStack(cItem &a_ItemStack, cPlayer &a_Player, bool a_ShouldApply, bool a_KeepEmptySlots, bool a_BackFill) override
Called to store as much of a_ItemStack in the area as possible.
cSlotAreaHorse(cHorse &a_Horse, cWindow &a_ParentWindow)
A cSlotArea with items layout that is private to each player and is temporary, such as a crafting gri...
cSlotAreaTemporary(int a_NumSlots, cWindow &a_ParentWindow)
void OnTakeResult(cPlayer &a_Player)
This function will call, when the player take the item from the slot.
Handles the shield of each player.
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const override
Called to retrieve an item in the specified slot for the specified player.
void HandleCraftItem(const cItem &a_Result, cPlayer &a_Player)
Called after an item has been crafted to handle statistics e.t.c.
std::map< UInt32, std::vector< cItem > > cItemMap
void ShiftClickedResult(cPlayer &a_Player)
Handles a shift-click in the result slot.
virtual void OnPlayerRemoved(cPlayer &a_Player)
Called when one of the players closes the parent window.
Slot area holding horse saddle and armor.
cSlotAreaMinecartWithChest(cMinecartWithChest *a_ChestCart, cWindow &a_ParentWindow)
Handles the main inventory of each player, excluding the armor and hotbar.
void DropClickedResult(cPlayer &a_Player)
Handles a drop-click in the result slot.
cSlotAreaEnchanting(cWindow &a_ParentWindow, Vector3i a_BlockPos)
virtual void DistributeStack(cItem &a_ItemStack, cPlayer &a_Player, bool a_ShouldApply, bool a_KeepEmptySlots, bool a_BackFill) override
Called to store as much of a_ItemStack in the area as possible.
virtual void OnPlayerRemoved(cPlayer &a_Player) override
Called when one of the players closes the parent window.
cSlotAreaAnvil(cWindow &a_ParentWindow)
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const override
Called to retrieve an item in the specified slot for the specified player.
Handles any slot area that is representing a cItemGrid; same items for all the players.
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const =0
Called to retrieve an item in the specified slot for the specified player.
virtual void SetSlot(int a_SlotNum, cPlayer &a_Player, const cItem &a_Item) override
Called to set an item in the specified slot for the specified player.
virtual void Clicked(cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem) override
Called when a player clicks in the window.
void TossItems(cPlayer &a_Player, int a_Begin, int a_End)
Tosses the player's items in slots [a_Begin, a_End) (ie.
virtual void OnPlayerAdded(cPlayer &a_Player) override
Called when a new player opens the same parent window.
void UpdateRecipe(cPlayer &a_Player)
Updates the current recipe and result slot based on the ingredients currently in the crafting grid of...
cItem SelectEnchantedOption(size_t a_EnchantOption)
cSlotAreaItemGrid(cItemGrid &a_ItemGrid, cWindow &a_ParentWindow)
cSlotAreaChest(cChestEntity *a_Chest, cWindow &a_ParentWindow)
cEnderChestEntity * m_EnderChest
virtual ~cSlotAreaFurnace() override
virtual void OnPlayerRemoved(cPlayer &a_Player) override
Called when one of the players closes the parent window.
static bool IsPlaceableItem(short a_ItemType)
virtual void DistributeStack(cItem &a_ItemStack, cPlayer &a_Player, bool a_ShouldApply, bool a_KeepEmptySlots, bool a_BackFill)
Called to store as much of a_ItemStack in the area as possible.
Handles any part of the inventory, using parameters in constructor to distinguish between the parts.
virtual void Clicked(cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem) override
Called when a player clicks in the window.
virtual void OnSlotChanged(cItemGrid *a_ItemGrid, int a_SlotNum) override
Called whenever a slot changes.
cChestEntity * m_TopChest
virtual void OnPlayerRemoved(cPlayer &a_Player) override
Called when one of the players closes the parent window.
virtual void Clicked(cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem &a_ClickedItem)
Called when a player clicks in the window.
void HandleSmeltItem(const cItem &a_Result, cPlayer &a_Player)
Called after an item has been smelted to handle statistics etc.
virtual const cItem * GetSlot(int a_SlotNum, cPlayer &a_Player) const override
Called to retrieve an item in the specified slot for the specified player.
cSlotAreaCrafting(int a_GridSize, cWindow &a_ParentWindow)
a_GridSize is allowed to be only 2 or 3
bool CanTakeResultItem(cPlayer &a_Player)
Can the player take the item from the slot?
int m_MaximumCost
The maximum cost of repairing / renaming in the anvil.
void HandleBrewedItem(cPlayer &a_Player, const cItem &a_ClickedItem)
Called after an item has been brewed to handle statistics etc.
virtual void DistributeStack(cItem &a_ItemStack, cPlayer &a_Player, bool a_ShouldApply, bool a_KeepEmptySlots, bool a_BackFill) override
Called to store as much of a_ItemStack in the area as possible.