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/containers/managers/controllers/ContainerManagerController.h"
13#include "mc/world/inventory/network/ContainerScreenContext.h"
14
15// auto generated forward declare list
16// clang-format off
17class BlockPos;
18class BlockSource;
19class ContainerModel;
21class HashedString;
23class ItemStack;
25class Player;
26struct ActorUniqueID;
29namespace Bedrock::PubSub { class Subscription; }
30namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
31namespace Bedrock::PubSub::ThreadModel { struct SingleThreaded; }
32// clang-format on
33
34class ContainerManagerModel : public ::IContainerManager {
35public:
36 // ContainerManagerModel inner types define
37 using DynamicContainerPublisher =
39
40public:
41 // member variables
42 // NOLINTBEGIN
43 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::PlayerContainerRefresher>>> mContainerRefresher;
44 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::DynamicContainerTracker>>> mDynamicContainerTracker;
45 ::ll::TypedStorage<8, 16, ::WeakRef<::IContainerRegistryAccess>> mRegistryAccess;
46 ::ll::TypedStorage<8, 8, ::Player&> mPlayer;
47 ::ll::TypedStorage<8, 24, ::std::vector<::ItemStack>> mLastSlots;
48 ::ll::TypedStorage<1, 1, ::ContainerID> mContainerId;
49 ::ll::TypedStorage<1, 1, ::SharedTypes::Legacy::ContainerType> mContainerType;
50 ::ll::TypedStorage<
51 8,
52 8,
53 ::std::unique_ptr<::Bedrock::PubSub::Publisher<
54 void(::SharedTypes::Legacy::ContainerType),
56 0>>>
57 mContainerTypeSubscribers;
58 ::ll::TypedStorage<
59 8,
60 64,
61 ::std::unordered_map<::ContainerManagerController const*, ::std::function<void(::ContainerManagerModel&)>>>
62 mInformControllerOfDestructionCallbacks;
63 ::ll::TypedStorage<8, 40, ::ContainerScreenContext> mScreenContext;
64 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::shared_ptr<::ContainerModel>>> mContainers;
66 mOnDynamicContainerChangePublisher;
67 // NOLINTEND
68
69public:
70 // prevent constructor by default
71 ContainerManagerModel& operator=(ContainerManagerModel const&);
72 ContainerManagerModel(ContainerManagerModel const&);
73 ContainerManagerModel();
74
75public:
76 // virtual functions
77 // NOLINTBEGIN
78 virtual ~ContainerManagerModel() /*override*/;
79
80 virtual bool tick();
81
82 virtual ::ContainerID getContainerId() const /*override*/;
83
84 virtual void setContainerId(::ContainerID id) /*override*/;
85
86 virtual ::SharedTypes::Legacy::ContainerType getContainerType() const /*override*/;
87
88 virtual void setContainerType(::SharedTypes::Legacy::ContainerType type) /*override*/;
89
90 virtual ::Bedrock::PubSub::Subscription
91 registerContainerTypeListener(::std::function<void(::SharedTypes::Legacy::ContainerType)> callback) const
92 /*override*/;
93
94 virtual void debitPlayerLevels(int levels);
95
96 virtual bool isCreativeMode() const;
97
98 virtual bool isClientSide() const;
99
100 virtual bool isServerAuthoritative() const;
101
102 virtual bool isValid(float pickRange);
103
104 virtual void serverInitItemStackIds() /*override*/;
105
106 virtual void
107 setFullContainerSlot(int slot, ::FullContainerName const& name, ::ItemStack const& item, bool) /*override*/;
108
109 virtual ::ItemStack const& getFullContainerSlot(int slot, ::FullContainerName const& name) const /*override*/;
110
111 virtual void broadcastChanges() /*override*/;
112
113 virtual ::ContainerScreenContext _postInit() = 0;
114
115 virtual void _onDynamicContainerContentsChanged();
116 // NOLINTEND
117
118public:
119 // member functions
120 // NOLINTBEGIN
121 MCAPI ContainerManagerModel(::ContainerID containerId, ::Player& player);
122
123 MCAPI void _addContainer(::std::shared_ptr<::ContainerModel> containerModel);
124
125 MCAPI void _addContainerToItemStackNetManager(
126 ::ItemStackNetManagerBase* itemStackNetManager,
127 ::ContainerModel& containerModel,
128 ::BlockSource& region
129 );
130
131 MCAPI ::ContainerScreenContext _containerScreenContext(::ActorUniqueID actorId);
132
133 MCAPI ::ContainerScreenContext _containerScreenContext(::BlockPos const& blockPos);
134
135 MCAPI ::std::shared_ptr<::ContainerModel> _getContainer(::ContainerEnumName collectionEnumName) const;
136
137 MCAPI bool _isPlayerInRangeOfPosition(::BlockPos const& blockPos, float pickRange) const;
138
139 MCAPI void addDynamicContainer(::std::shared_ptr<::ContainerModel> model);
140
141#ifdef LL_PLAT_C
142 MCAPI ::std::string getBlockDisplayName(::BlockPos const& blockPos) const;
143
144 MCAPI ::HashedString getBlockLocName(::BlockPos const& blockPos) const;
145
146 MCFOLD ::std::unordered_map<::std::string, ::std::shared_ptr<::ContainerModel>>& getContainers();
147
148 MCAPI ::std::shared_ptr<::ContainerModel> getDynamicContainer(::FullContainerName const& name);
149
150 MCAPI ::HashedString getEntityLocName(::ActorUniqueID const& actorUniqueID) const;
151
152 MCAPI ::std::string getEntityName(::ActorUniqueID const& actorUniqueID) const;
153#endif
154
155 MCFOLD ::Player& getPlayer() const;
156
157#ifdef LL_PLAT_C
158 MCAPI int getPlayerLevels() const;
159
160 MCAPI void grantExperience(int amount);
161#endif
162
163 MCAPI void postInit();
164
165#ifdef LL_PLAT_C
166 MCAPI void registerInformControllerOfDestructionCallback(
167 ::ContainerManagerController const* owner,
168 ::std::function<void(::ContainerManagerModel&)> callback
169 );
170#endif
171 // NOLINTEND
172
173public:
174 // static functions
175 // NOLINTBEGIN
176 MCAPI static void _appendCopies(::std::vector<::ItemStack>& out, ::std::vector<::ItemStack> const& items);
177 // NOLINTEND
178
179public:
180 // constructor thunks
181 // NOLINTBEGIN
182 MCAPI void* $ctor(::ContainerID containerId, ::Player& player);
183 // NOLINTEND
184
185public:
186 // destructor thunk
187 // NOLINTBEGIN
188 MCAPI void $dtor();
189 // NOLINTEND
190
191public:
192 // virtual function thunks
193 // NOLINTBEGIN
194 MCFOLD bool $tick();
195
196 MCFOLD ::ContainerID $getContainerId() const;
197
198 MCFOLD void $setContainerId(::ContainerID id);
199
200 MCFOLD ::SharedTypes::Legacy::ContainerType $getContainerType() const;
201
202 MCAPI void $setContainerType(::SharedTypes::Legacy::ContainerType type);
203
204 MCAPI ::Bedrock::PubSub::Subscription
205 $registerContainerTypeListener(::std::function<void(::SharedTypes::Legacy::ContainerType)> callback) const;
206
207 MCAPI void $debitPlayerLevels(int levels);
208
209 MCAPI bool $isCreativeMode() const;
210
211 MCAPI bool $isClientSide() const;
212
213 MCAPI bool $isServerAuthoritative() const;
214
215 MCAPI bool $isValid(float pickRange);
216
217 MCAPI void $serverInitItemStackIds();
218
219 MCAPI void $setFullContainerSlot(int slot, ::FullContainerName const& name, ::ItemStack const& item, bool);
220
221 MCAPI ::ItemStack const& $getFullContainerSlot(int slot, ::FullContainerName const& name) const;
222
223 MCAPI void $broadcastChanges();
224
225 MCFOLD void $_onDynamicContainerContentsChanged();
226
227
228 // NOLINTEND
229
230public:
231 // vftables
232 // NOLINTBEGIN
233 MCAPI static void** $vftable();
234 // NOLINTEND
235};
Definition Publisher.h:8
Definition Subscription.h:10
Definition BlockPos.h:21
Definition BlockSource.h:73
Definition ContainerManagerController.h:48
Definition ContainerModel.h:28
Definition DynamicContainerTracker.h:21
Definition HashedString.h:5
Definition IContainerManager.h:16
Definition IContainerRegistryAccess.h:14
Definition ItemStackNetManagerBase.h:28
Definition ItemStack.h:35
Definition Player.h:137
Definition ActorUniqueID.h:10
Definition FullContainerName.h:8
Definition PlayerContainerRefresher.h:13