![]() |
Botcraft 1.21.4
|
#include <Window.hpp>
Public Member Functions | |
Window (const InventoryType type_=InventoryType::Default) | |
void | Init () |
ProtocolCraft::Slot | GetSlot (const short index) const |
std::map< short, ProtocolCraft::Slot > | GetSlots () const |
Utilities::ScopeLockedWrapper< const std::map< short, ProtocolCraft::Slot >, std::shared_mutex, std::shared_lock > | GetLockedSlots () const |
Get a read-only locked version of all the slots. | |
InventoryType | GetType () const |
void | SetSlot (const short index, const ProtocolCraft::Slot &slot) |
void | SetContent (const std::vector< ProtocolCraft::Slot > &slots_) |
int | GetStateId () const |
void | SetStateId (const int state_id_) |
short | GetFirstPlayerInventorySlot () const |
Static Public Attributes | |
static constexpr short | PLAYER_INVENTORY_INDEX = 0 |
static constexpr short | INVENTORY_CRAFTING_OUTPUT_INDEX = 0 |
static constexpr short | INVENTORY_CRAFTING_INPUT_START = 1 |
static constexpr short | INVENTORY_ARMOR_START = 5 |
static constexpr short | INVENTORY_HEAD_ARMOR = INVENTORY_ARMOR_START + 0 |
static constexpr short | INVENTORY_CHEST_ARMOR = INVENTORY_ARMOR_START + 1 |
static constexpr short | INVENTORY_LEGS_ARMOR = INVENTORY_ARMOR_START + 2 |
static constexpr short | INVENTORY_FEET_ARMOR = INVENTORY_ARMOR_START + 3 |
static constexpr short | INVENTORY_STORAGE_START = 9 |
static constexpr short | INVENTORY_HOTBAR_START = 36 |
static constexpr short | INVENTORY_OFFHAND_INDEX = 45 |
Private Attributes | |
std::shared_mutex | window_mutex |
std::map< short, ProtocolCraft::Slot > | slots |
const InventoryType | type |
int | state_id |
Definition at line 13 of file Window.hpp.
Botcraft::Window::Window | ( | const InventoryType | type_ = InventoryType::Default | ) |
Definition at line 8 of file Window.cpp.
References Init().
short Botcraft::Window::GetFirstPlayerInventorySlot | ( | ) | const |
Definition at line 87 of file Window.cpp.
References Botcraft::Anvil, Botcraft::Beacon, Botcraft::BlastFurnace, Botcraft::BrewingStand, Botcraft::CartographyTable, Botcraft::Crafter3x3, Botcraft::Crafting, Botcraft::Default, Botcraft::Enchantment, Botcraft::Furnace, Botcraft::Generic3x3, Botcraft::Generic9x1, Botcraft::Generic9x2, Botcraft::Generic9x3, Botcraft::Generic9x4, Botcraft::Generic9x5, Botcraft::Generic9x6, Botcraft::Grindstone, Botcraft::Hopper, Botcraft::Lectern, LOG_WARNING, Botcraft::Loom, Botcraft::Merchant, Botcraft::PlayerInventory, Botcraft::ShulkerBox, Botcraft::Smithing, Botcraft::Smoker, Botcraft::StoneCutter, and type.
Utilities::ScopeLockedWrapper< const std::map< short, ProtocolCraft::Slot >, std::shared_mutex, std::shared_lock > Botcraft::Window::GetLockedSlots | ( | ) | const |
Get a read-only locked version of all the slots.
Definition at line 41 of file Window.cpp.
References slots, and window_mutex.
Slot Botcraft::Window::GetSlot | ( | const short | index | ) | const |
Definition at line 24 of file Window.cpp.
References slots, and window_mutex.
std::map< short, Slot > Botcraft::Window::GetSlots | ( | ) | const |
Definition at line 35 of file Window.cpp.
References slots, and window_mutex.
int Botcraft::Window::GetStateId | ( | ) | const |
Definition at line 74 of file Window.cpp.
References state_id, and window_mutex.
InventoryType Botcraft::Window::GetType | ( | ) | const |
Definition at line 46 of file Window.cpp.
References type, and window_mutex.
void Botcraft::Window::Init | ( | ) |
Definition at line 13 of file Window.cpp.
References slots, state_id, and window_mutex.
Referenced by Window().
void Botcraft::Window::SetContent | ( | const std::vector< ProtocolCraft::Slot > & | slots_ | ) |
Definition at line 58 of file Window.cpp.
References slots, and window_mutex.
void Botcraft::Window::SetSlot | ( | const short | index, |
const ProtocolCraft::Slot & | slot | ||
) |
Definition at line 52 of file Window.cpp.
References slots, and window_mutex.
void Botcraft::Window::SetStateId | ( | const int | state_id_ | ) |
Definition at line 80 of file Window.cpp.
References state_id, and window_mutex.
|
staticconstexpr |
Definition at line 20 of file Window.hpp.
Referenced by Botcraft::Renderer::RenderingManager::Run().
|
staticconstexpr |
Definition at line 22 of file Window.hpp.
Referenced by Botcraft::PhysicsManager::InputsToFly().
|
staticconstexpr |
Definition at line 19 of file Window.hpp.
Referenced by Botcraft::Renderer::RenderingManager::Run().
|
staticconstexpr |
Definition at line 18 of file Window.hpp.
Referenced by Botcraft::Renderer::RenderingManager::Run().
|
staticconstexpr |
Definition at line 24 of file Window.hpp.
Referenced by Botcraft::PhysicsManager::ApplyMovement(), and Botcraft::PhysicsManager::MovePlayer().
|
staticconstexpr |
Definition at line 21 of file Window.hpp.
Referenced by Botcraft::DigImpl().
|
staticconstexpr |
Definition at line 26 of file Window.hpp.
Referenced by Botcraft::InventoryManager::GetHotbarSelected(), Botcraft::InventoryManager::Handle(), Botcraft::InventoryManager::Handle(), Botcraft::PlaceBlockImpl(), Botcraft::Renderer::RenderingManager::Run(), Botcraft::SetItemInHandImpl(), and Botcraft::InventoryManager::SynchronizeContainerPlayerInventory().
|
staticconstexpr |
Definition at line 23 of file Window.hpp.
Referenced by Botcraft::PhysicsManager::InputsToCrouch().
|
staticconstexpr |
Definition at line 27 of file Window.hpp.
Referenced by Botcraft::InventoryManager::GetOffHand(), Botcraft::InventoryManager::Handle(), Botcraft::Renderer::RenderingManager::Run(), Botcraft::SetItemInHandImpl(), and Botcraft::SortInventory().
|
staticconstexpr |
Definition at line 25 of file Window.hpp.
Referenced by Botcraft::CraftImpl(), Botcraft::HasItemInInventoryImpl(), Botcraft::Renderer::RenderingManager::Run(), Botcraft::SetItemInHandImpl(), Botcraft::SortInventory(), and Botcraft::InventoryManager::SynchronizeContainerPlayerInventory().
|
staticconstexpr |
Definition at line 16 of file Window.hpp.
Referenced by Botcraft::CraftImpl(), Botcraft::InventoryManager::EraseInventory(), Botcraft::InventoryManager::GetFirstOpenedWindowId(), Botcraft::InventoryManager::GetPlayerInventory(), Botcraft::InventoryManager::Handle(), Botcraft::InventoryManager::Handle(), Botcraft::InventoryManager::Handle(), Botcraft::InventoryManager::InventoryManager(), Botcraft::SetItemInHandImpl(), Botcraft::SortInventory(), and Botcraft::InventoryManager::SynchronizeContainerPlayerInventory().
|
private |
Definition at line 56 of file Window.hpp.
Referenced by GetLockedSlots(), GetSlot(), GetSlots(), Init(), SetContent(), and SetSlot().
|
private |
Definition at line 63 of file Window.hpp.
Referenced by GetStateId(), Init(), and SetStateId().
|
private |
Definition at line 57 of file Window.hpp.
Referenced by GetFirstPlayerInventorySlot(), and GetType().
|
mutableprivate |
Definition at line 54 of file Window.hpp.
Referenced by GetLockedSlots(), GetSlot(), GetSlots(), GetStateId(), GetType(), Init(), SetContent(), SetSlot(), and SetStateId().