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 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
113 virtual void _onDynamicContainerContentsChanged();
114 // NOLINTEND
115
116public:
117 // member functions
118 // NOLINTBEGIN
119 MCAPI ContainerManagerModel(::ContainerID containerId, ::Player& player);
120
121 MCAPI void _addContainer(::std::shared_ptr<::ContainerModel> containerModel);
122
123 MCAPI ::std::shared_ptr<::ContainerModel> _getContainer(::ContainerEnumName collectionEnumName) const;
124
125 MCAPI bool _isPlayerInRangeOfPosition(::BlockPos const& blockPos, float pickRange) const;
126
127 MCAPI void addDynamicContainer(::std::shared_ptr<::ContainerModel> model);
128
129#ifdef LL_PLAT_C
130 MCAPI bool blockHasCustomName(::BlockPos const& blockPos) const;
131
132 MCAPI ::std::string getBlockDisplayName(::BlockPos const& blockPos) const;
133
134 MCAPI ::HashedString getBlockLocName(::BlockPos const& blockPos) const;
135
136 MCAPI ::std::shared_ptr<::ContainerModel> getDynamicContainer(::FullContainerName const& name);
137
138 MCAPI ::HashedString getEntityLocName(::ActorUniqueID const& actorUniqueID) const;
139
140 MCAPI ::std::string getEntityName(::ActorUniqueID const& actorUniqueID) const;
141
142 MCAPI int getPlayerLevels() const;
143
144 MCAPI void grantExperience(int amount);
145#endif
146
147 MCAPI void postInit();
148 // NOLINTEND
149
150public:
151 // constructor thunks
152 // NOLINTBEGIN
153 MCAPI void* $ctor(::ContainerID containerId, ::Player& player);
154 // NOLINTEND
155
156public:
157 // destructor thunk
158 // NOLINTBEGIN
159 MCAPI void $dtor();
160 // NOLINTEND
161
162public:
163 // virtual function thunks
164 // NOLINTBEGIN
165 MCFOLD bool $tick();
166
167 MCFOLD ::ContainerID $getContainerId() const;
168
169 MCFOLD void $setContainerId(::ContainerID id);
170
171 MCFOLD ::SharedTypes::Legacy::ContainerType $getContainerType() const;
172
173 MCAPI void $setContainerType(::SharedTypes::Legacy::ContainerType type);
174
175 MCAPI ::Bedrock::PubSub::Subscription
176 $registerContainerTypeListener(::std::function<void(::SharedTypes::Legacy::ContainerType)> callback) const;
177
178 MCAPI void $debitPlayerLevels(int levels);
179
180 MCAPI bool $isCreativeMode() const;
181
182 MCAPI bool $isClientSide() const;
183
184 MCAPI bool $isServerAuthoritative() const;
185
186 MCAPI bool $isValid(float pickRange);
187
188 MCAPI void $serverInitItemStackIds();
189
190 MCAPI void $setFullContainerSlot(int slot, ::FullContainerName const& name, ::ItemStack const& item, bool);
191
192 MCAPI ::ItemStack const& $getFullContainerSlot(int slot, ::FullContainerName const& name) const;
193
194 MCAPI void $broadcastChanges();
195
196 MCFOLD void $_onDynamicContainerContentsChanged();
197
198
199 // NOLINTEND
200
201public:
202 // vftables
203 // NOLINTBEGIN
204 MCAPI static void** $vftable();
205 // NOLINTEND
206};
Definition Publisher.h:8
Definition Subscription.h:10
Definition BlockPos.h:19
Definition ContainerManagerController.h:47
Definition ContainerModel.h:27
Definition DynamicContainerTracker.h:21
Definition HashedString.h:5
Definition IContainerManager.h:16
static MCAPI void ** $vftable()
Definition IContainerRegistryAccess.h:14
Definition ItemStack.h:26
Definition Player.h:129
Definition ActorUniqueID.h:5
Definition MultiThreaded.h:12
Definition FullContainerName.h:8
Definition PlayerContainerRefresher.h:13