Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | List of all members
cSlotAreaEnchanting Class Referencefinal

#include <SlotArea.h>

Inheritance diagram for cSlotAreaEnchanting:
Inheritance graph
[legend]
Collaboration diagram for cSlotAreaEnchanting:
Collaboration graph
[legend]

Public Member Functions

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. More...
 
 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. More...
 
unsigned GetBookshelvesCount (cWorld &a_World)
 
virtual void OnPlayerAdded (cPlayer &a_Player) override
 Called when a new player opens the same parent window. More...
 
virtual void OnPlayerRemoved (cPlayer &a_Player) override
 Called when one of the players closes the parent window. More...
 
cItem SelectEnchantedOption (size_t a_EnchantOption)
 
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. More...
 
- Public Member Functions inherited from cSlotAreaTemporary
 cSlotAreaTemporary (int a_NumSlots, cWindow &a_ParentWindow)
 
virtual const cItemGetSlot (int a_SlotNum, cPlayer &a_Player) const override
 Called to retrieve an item in the specified slot for the specified player. More...
 
void TossItems (cPlayer &a_Player, int a_Begin, int a_End)
 Tosses the player's items in slots [a_Begin, a_End) (ie. More...
 
- Public Member Functions inherited from cSlotArea
virtual bool CollectItemsToHand (cItem &a_Dragging, cPlayer &a_Player, bool a_CollectFullStacks)
 Called on DblClicking to collect all stackable items into hand. More...
 
 cSlotArea (int a_NumSlots, cWindow &a_ParentWindow)
 
virtual void DblClicked (cPlayer &a_Player, int a_SlotNum)
 Called from Clicked when the action is a caDblClick. More...
 
virtual void DropClicked (cPlayer &a_Player, int a_SlotNum, bool a_DropStack)
 Called from Clicked when the action is a drop click. More...
 
int GetNumSlots (void) const
 
virtual void MiddleClicked (cPlayer &a_Player, int a_SlotNum)
 Called from Clicked when the action is a middleclick. More...
 
virtual void NumberClicked (cPlayer &a_Player, int a_SlotNum, eClickAction a_ClickAction)
 Called from Clicked when the action is a number click. More...
 
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) More...
 
virtual ~cSlotArea ()
 

Protected Member Functions

void UpdateResult (cPlayer &a_Player)
 Handles a click in the item slot. More...
 
- Protected Member Functions inherited from cSlotAreaTemporary
cItemGetPlayerSlots (cPlayer &a_Player)
 Returns the pointer to the slot array for the player specified. More...
 

Protected Attributes

Vector3i m_BlockPos
 
std::array< cItem, 3 > m_EnchantedItemOptions
 
- Protected Attributes inherited from cSlotAreaTemporary
cItemMap m_Items
 
- Protected Attributes inherited from cSlotArea
int m_NumSlots
 
cWindowm_ParentWindow
 

Private Types

using Super = cSlotAreaTemporary
 

Additional Inherited Members

- Protected Types inherited from cSlotAreaTemporary
using cItemMap = std::map< UInt32, std::vector< cItem > >
 

Detailed Description

Definition at line 382 of file SlotArea.h.

Member Typedef Documentation

◆ Super

Definition at line 385 of file SlotArea.h.

Constructor & Destructor Documentation

◆ cSlotAreaEnchanting()

cSlotAreaEnchanting::cSlotAreaEnchanting ( cWindow a_ParentWindow,
Vector3i  a_BlockPos 
)

Definition at line 1490 of file SlotArea.cpp.

Member Function Documentation

◆ Clicked()

void cSlotAreaEnchanting::Clicked ( cPlayer a_Player,
int  a_SlotNum,
eClickAction  a_ClickAction,
const cItem a_ClickedItem 
)
overridevirtual

Called when a player clicks in the window.

Parameters taken from the click packet.

Reimplemented from cSlotArea.

Definition at line 1500 of file SlotArea.cpp.

◆ DistributeStack()

void cSlotAreaEnchanting::DistributeStack ( cItem a_ItemStack,
cPlayer a_Player,
bool  a_ShouldApply,
bool  a_KeepEmptySlots,
bool  a_BackFill 
)
overridevirtual

Called to store as much of a_ItemStack in the area as possible.

a_ItemStack is modified to reflect the change. The default implementation searches each slot for available space and distributes the stack there. if a_ShouldApply is true, the changes are written into the slots; if a_ShouldApply is false, only a_ItemStack is modified to reflect the number of fits (for fit-testing purposes) If a_KeepEmptySlots is true, empty slots will be skipped and won't be filled

Reimplemented from cSlotArea.

Definition at line 1614 of file SlotArea.cpp.

◆ GetBookshelvesCount()

unsigned cSlotAreaEnchanting::GetBookshelvesCount ( cWorld a_World)

Definition at line 1755 of file SlotArea.cpp.

◆ OnPlayerAdded()

void cSlotAreaEnchanting::OnPlayerAdded ( cPlayer a_Player)
overridevirtual

Called when a new player opens the same parent window.

The window already tracks the player. CS-locked.

Reimplemented from cSlotAreaTemporary.

Definition at line 1659 of file SlotArea.cpp.

◆ OnPlayerRemoved()

void cSlotAreaEnchanting::OnPlayerRemoved ( cPlayer a_Player)
overridevirtual

Called when one of the players closes the parent window.

The window already doesn't track the player. CS-locked.

Reimplemented from cSlotAreaTemporary.

Definition at line 1669 of file SlotArea.cpp.

◆ SelectEnchantedOption()

cItem cSlotAreaEnchanting::SelectEnchantedOption ( size_t  a_EnchantOption)

Definition at line 1821 of file SlotArea.cpp.

◆ SetSlot()

void cSlotAreaEnchanting::SetSlot ( int  a_SlotNum,
cPlayer a_Player,
const cItem a_Item 
)
overridevirtual

Called to set an item in the specified slot for the specified player.

Reimplemented from cSlotAreaTemporary.

Definition at line 1681 of file SlotArea.cpp.

◆ UpdateResult()

void cSlotAreaEnchanting::UpdateResult ( cPlayer a_Player)
protected

Handles a click in the item slot.

Definition at line 1691 of file SlotArea.cpp.

Member Data Documentation

◆ m_BlockPos

Vector3i cSlotAreaEnchanting::m_BlockPos
protected

Definition at line 412 of file SlotArea.h.

◆ m_EnchantedItemOptions

std::array<cItem, 3> cSlotAreaEnchanting::m_EnchantedItemOptions
protected

Definition at line 413 of file SlotArea.h.


The documentation for this class was generated from the following files: