8#if PROTOCOL_VERSION > 451
19#if PROTOCOL_VERSION < 755
20 enum class TransactionState
30 std::shared_ptr<ProtocolCraft::ServerboundContainerClickPacket>
packet;
33#if PROTOCOL_VERSION < 755 || PROTOCOL_VERSION > 769
47 std::shared_ptr<Window>
GetWindow(
const short window_id)
const;
56#if PROTOCOL_VERSION < 755
57 TransactionState GetTransactionState(
const short window_id,
const int transaction_id)
const;
65#if PROTOCOL_VERSION > 451
76#if PROTOCOL_VERSION > 754
79#if PROTOCOL_VERSION > 755
80 void SetStateId(
const short window_id,
const int state_id);
83#if PROTOCOL_VERSION < 755
99#if PROTOCOL_VERSION < 768
100 virtual void Handle(ProtocolCraft::ClientboundSetCarriedItemPacket& packet)
override;
104#if PROTOCOL_VERSION < 755
105 virtual void Handle(ProtocolCraft::ClientboundContainerAckPacket& packet)
override;
107#if PROTOCOL_VERSION > 451
111#if PROTOCOL_VERSION > 767
125#if PROTOCOL_VERSION < 755
128 std::map<short, std::map<short, InventoryTransaction > > pending_transactions;
130 std::map<short, std::map<short, TransactionState> > transaction_states;
132#if PROTOCOL_VERSION > 451
ProtocolCraft::Slot GetOffHand() const
void SetStateId(const short window_id, const int state_id)
void AddInventory(const short window_id, const InventoryType window_type)
std::map< short, std::shared_ptr< Window > > inventories
void SynchronizeContainerPlayerInventory(const short window_id)
void SetSlot(const short window_id, const short index, const ProtocolCraft::Slot &slot)
std::vector< ProtocolCraft::MerchantOffer > available_trades
int SendInventoryTransaction(const std::shared_ptr< ProtocolCraft::ServerboundContainerClickPacket > &transaction)
virtual void Handle(ProtocolCraft::ClientboundContainerSetSlotPacket &packet) override
std::vector< ProtocolCraft::MerchantOffer > GetAvailableMerchantOffers() const
std::shared_mutex inventory_manager_mutex
InventoryTransaction PrepareTransaction(const std::shared_ptr< ProtocolCraft::ServerboundContainerClickPacket > &transaction)
"think" about the changes made by this transaction, filling in the necessary values in the packet
void ApplyTransaction(const InventoryTransaction &transaction)
Apply a given transaction to a container.
short GetIndexHotbarSelected() const
std::shared_ptr< Window > GetWindow(const short window_id) const
ProtocolCraft::Slot GetHotbarSelected() const
std::shared_ptr< NetworkManager > network_manager
void SetCursor(const ProtocolCraft::Slot &c)
void ApplyTransactionImpl(const InventoryTransaction &transaction)
void EraseInventory(const short window_id)
short GetFirstOpenedWindowId() const
ProtocolCraft::Slot GetCursor() const
ProtocolCraft::Slot cursor
std::shared_ptr< Window > GetPlayerInventory() const
short index_hotbar_selected
void SetIndexHotbarSelectedLocal(const short index)
void SetIndexHotbarSelected(const short index)
void IncrementMerchantOfferUse(const int index)
std::shared_ptr< ProtocolCraft::ServerboundContainerClickPacket > packet
std::map< short, ProtocolCraft::Slot > changed_slots
ProtocolCraft::Slot carried_item