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#ifdef LL_PLAT_C
126 MCAPI void addDynamicContainer(::std::shared_ptr<::ContainerModel> model);
127
128 MCAPI ::std::string getBlockDisplayName(::BlockPos const& blockPos) const;
129
130 MCAPI ::HashedString getBlockLocName(::BlockPos const& blockPos) const;
131
132 MCAPI ::HashedString getEntityLocName(::ActorUniqueID const& actorUniqueID) const;
133
134 MCAPI ::std::string getEntityName(::ActorUniqueID const& actorUniqueID) const;
135#endif
136
137 MCAPI void postInit();
138 // NOLINTEND
139
140public:
141 // constructor thunks
142 // NOLINTBEGIN
143 MCAPI void* $ctor(::ContainerID containerId, ::Player& player);
144 // NOLINTEND
145
146public:
147 // destructor thunk
148 // NOLINTBEGIN
149 MCAPI void $dtor();
150 // NOLINTEND
151
152public:
153 // virtual function thunks
154 // NOLINTBEGIN
155 MCFOLD bool $tick();
156
157 MCFOLD ::ContainerID $getContainerId() const;
158
159 MCAPI void $setContainerId(::ContainerID id);
160
161 MCAPI ::SharedTypes::Legacy::ContainerType $getContainerType() const;
162
163 MCAPI void $setContainerType(::SharedTypes::Legacy::ContainerType type);
164
165 MCAPI ::Bedrock::PubSub::Subscription
166 $registerContainerTypeListener(::std::function<void(::SharedTypes::Legacy::ContainerType)> callback) const;
167
168 MCAPI void $debitPlayerLevels(int levels);
169
170 MCAPI bool $isCreativeMode() const;
171
172 MCAPI bool $isClientSide() const;
173
174 MCAPI bool $isServerAuthoritative() const;
175
176 MCAPI bool $isValid(float pickRange);
177
178 MCAPI void $serverInitItemStackIds();
179
180 MCAPI void $setFullContainerSlot(int slot, ::FullContainerName const& name, ::ItemStack const& item, bool);
181
182 MCAPI ::ItemStack const& $getFullContainerSlot(int slot, ::FullContainerName const& name) const;
183
184 MCAPI void $broadcastChanges();
185
186 MCFOLD void $_onDynamicContainerContentsChanged();
187
188
189 // NOLINTEND
190};
Definition Publisher.h:25
Definition Subscription.h:10
Definition BlockPos.h:21
Definition ContainerManagerController.h:45
Definition ContainerModel.h:24
Definition DynamicContainerTracker.h:20
Definition HashedString.h:5
Definition IContainerManager.h:16
Definition IContainerRegistryAccess.h:14
Definition ItemStack.h:24
Definition Player.h:128
Definition ActorUniqueID.h:5
Definition FullContainerName.h:8
Definition PlayerContainerRefresher.h:13