LeviLamina
Loading...
Searching...
No Matches
ContainerManagerModel.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/pub_sub/Publisher.h"
7#include "mc/deps/game_refs/WeakRef.h"
8#include "mc/deps/shared_types/legacy/ContainerType.h"
9#include "mc/world/ContainerID.h"
10#include "mc/world/containers/ContainerEnumName.h"
11#include "mc/world/containers/managers/IContainerManager.h"
12#include "mc/world/inventory/network/ContainerScreenContext.h"
13
14// auto generated forward declare list
15// clang-format off
16class BlockPos;
18class ContainerModel;
20class HashedString;
22class ItemStack;
23class Player;
24struct ActorUniqueID;
27namespace Bedrock::PubSub { class Subscription; }
28namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
29namespace Bedrock::PubSub::ThreadModel { struct SingleThreaded; }
30// clang-format on
31
32class ContainerManagerModel : public ::IContainerManager {
33public:
34 // ContainerManagerModel inner types define
35 using DynamicContainerPublisher =
37
38public:
39 // member variables
40 // NOLINTBEGIN
41 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::PlayerContainerRefresher>>> mContainerRefresher;
42 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::DynamicContainerTracker>>> mDynamicContainerTracker;
43 ::ll::TypedStorage<8, 16, ::WeakRef<::IContainerRegistryAccess>> mRegistryAccess;
44 ::ll::TypedStorage<8, 8, ::Player&> mPlayer;
45 ::ll::TypedStorage<8, 24, ::std::vector<::ItemStack>> mLastSlots;
46 ::ll::TypedStorage<1, 1, ::ContainerID> mContainerId;
47 ::ll::TypedStorage<1, 1, ::SharedTypes::Legacy::ContainerType> mContainerType;
48 ::ll::TypedStorage<
49 8,
50 8,
51 ::std::unique_ptr<::Bedrock::PubSub::Publisher<
52 void(::SharedTypes::Legacy::ContainerType),
54 0>>>
55 mContainerTypeSubscribers;
56 ::ll::TypedStorage<
57 8,
58 64,
59 ::std::unordered_map<::ContainerManagerController const*, ::std::function<void(::ContainerManagerModel&)>>>
60 mInformControllerOfDestructionCallbacks;
61 ::ll::TypedStorage<8, 40, ::ContainerScreenContext> mScreenContext;
62 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::shared_ptr<::ContainerModel>>> mContainers;
64 mOnDynamicContainerChangePublisher;
65 // NOLINTEND
66
67public:
68 // prevent constructor by default
69 ContainerManagerModel& operator=(ContainerManagerModel const&);
70 ContainerManagerModel(ContainerManagerModel const&);
71 ContainerManagerModel();
72
73public:
74 // virtual functions
75 // NOLINTBEGIN
76 virtual ~ContainerManagerModel() /*override*/;
77
78 virtual bool tick();
79
80 virtual ::ContainerID getContainerId() const /*override*/;
81
82 virtual void setContainerId(::ContainerID id) /*override*/;
83
84 virtual ::SharedTypes::Legacy::ContainerType getContainerType() const /*override*/;
85
86 virtual void setContainerType(::SharedTypes::Legacy::ContainerType type) /*override*/;
87
88 virtual ::Bedrock::PubSub::Subscription
89 registerContainerTypeListener(::std::function<void(::SharedTypes::Legacy::ContainerType)> callback) const
90 /*override*/;
91
92 virtual void debitPlayerLevels(int levels);
93
94 virtual bool isCreativeMode() const;
95
96 virtual bool isClientSide() const;
97
98 virtual bool isServerAuthoritative() const;
99
100 virtual bool isValid(float pickRange);
101
102 virtual void serverInitItemStackIds() /*override*/;
103
104 virtual void
105 setFullContainerSlot(int slot, ::FullContainerName const& name, ::ItemStack const& item, bool) /*override*/;
106
107 virtual ::ItemStack const& getFullContainerSlot(int slot, ::FullContainerName const& name) const /*override*/;
108
109 virtual void broadcastChanges() /*override*/;
110
111 virtual ::ContainerScreenContext _postInit() = 0;
112 // NOLINTEND
113
114public:
115 // member functions
116 // NOLINTBEGIN
117 MCAPI ContainerManagerModel(::ContainerID containerId, ::Player& player);
118
119 MCAPI void _addContainer(::std::shared_ptr<::ContainerModel> containerModel);
120
121 MCAPI ::std::shared_ptr<::ContainerModel> _getContainer(::ContainerEnumName collectionEnumName) const;
122
123 MCAPI bool _isPlayerInRangeOfPosition(::BlockPos const& blockPos, float pickRange) const;
124
125 MCAPI void addDynamicContainer(::std::shared_ptr<::ContainerModel> model);
126
127 MCAPI_C bool blockHasCustomName(::BlockPos const& blockPos) const;
128
129 MCAPI_C ::std::string getBlockDisplayName(::BlockPos const& blockPos) const;
130
131 MCAPI_C ::HashedString getBlockLocName(::BlockPos const& blockPos) const;
132
133 MCAPI_C ::std::shared_ptr<::ContainerModel> getDynamicContainer(::FullContainerName const& name);
134
135 MCAPI_C ::HashedString getEntityLocName(::ActorUniqueID const& actorUniqueID) const;
136
137 MCAPI_C ::std::string getEntityName(::ActorUniqueID const& actorUniqueID) const;
138
139 MCAPI_C int getPlayerLevels() const;
140
141 MCAPI_C void grantExperience(int amount);
142
143 MCAPI void postInit();
144 // NOLINTEND
145
146public:
147 // constructor thunks
148 // NOLINTBEGIN
149 MCAPI void* $ctor(::ContainerID containerId, ::Player& player);
150 // NOLINTEND
151
152public:
153 // destructor thunk
154 // NOLINTBEGIN
155 MCAPI void $dtor();
156 // NOLINTEND
157
158public:
159 // virtual function thunks
160 // NOLINTBEGIN
161 MCFOLD bool $tick();
162
163 MCFOLD ::ContainerID $getContainerId() const;
164
165 MCFOLD void $setContainerId(::ContainerID id);
166
167 MCFOLD ::SharedTypes::Legacy::ContainerType $getContainerType() const;
168
169 MCAPI void $setContainerType(::SharedTypes::Legacy::ContainerType type);
170
171 MCAPI ::Bedrock::PubSub::Subscription
172 $registerContainerTypeListener(::std::function<void(::SharedTypes::Legacy::ContainerType)> callback) const;
173
174 MCAPI void $debitPlayerLevels(int levels);
175
176 MCAPI bool $isCreativeMode() const;
177
178 MCAPI bool $isClientSide() const;
179
180 MCAPI bool $isServerAuthoritative() const;
181
182 MCAPI bool $isValid(float pickRange);
183
184 MCAPI void $serverInitItemStackIds();
185
186 MCAPI void $setFullContainerSlot(int slot, ::FullContainerName const& name, ::ItemStack const& item, bool);
187
188 MCAPI ::ItemStack const& $getFullContainerSlot(int slot, ::FullContainerName const& name) const;
189
190 MCAPI void $broadcastChanges();
191
192
193 // NOLINTEND
194
195public:
196 // vftables
197 // NOLINTBEGIN
198 MCAPI static void** $vftable();
199 // NOLINTEND
200};
Definition Publisher.h:8
Definition Subscription.h:10
Definition BlockPos.h:19
Definition ContainerManagerController.h:47
Definition ContainerModel.h:27
Definition DynamicContainerTracker.h:20
Definition HashedString.h:5
Definition IContainerManager.h:16
static MCAPI void ** $vftable()
MCAPI void $dtor()
Definition IContainerRegistryAccess.h:14
Definition ItemStack.h:26
Definition Player.h:125
Definition ActorUniqueID.h:5
Definition FullContainerName.h:8
Definition PlayerContainerRefresher.h:13