LeviLamina
Loading...
Searching...
No Matches
ItemStackRequestActionHandler.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/world/actor/player/Player.h"
5
6// auto generated inclusion list
7#include "mc/deps/game_refs/WeakRef.h"
8#include "mc/world/TypedRuntimeId.h"
9#include "mc/world/containers/ContainerEnumName.h"
10#include "mc/world/inventory/network/ItemStackNetResult.h"
11#include "mc/world/inventory/network/TypedClientNetId.h"
12#include "mc/world/inventory/network/TypedServerNetId.h"
13
14// auto generated forward declare list
15// clang-format off
16class Container;
19class EntityContext;
20class ItemInstance;
21class ItemStack;
27class Player;
39// clang-format on
40
42public:
43 // ItemStackRequestActionHandler inner types declare
44 // clang-format off
48 struct ScreenData;
49 // clang-format on
50
51 // ItemStackRequestActionHandler inner types define
52 enum class RemoveType : int {
53 Drop = 0,
54 DropRandomly = 1,
55 Destroy = 2,
56 Consume = 3,
57 };
58
60 public:
61 // member variables
62 // NOLINTBEGIN
63 ::ll::TypedStorage<1, 1, uchar> mSlot;
64 ::ll::TypedStorage<4, 4, ::ItemStackNetId> mServerNetId;
65 // NOLINTEND
66 };
67
69 public:
70 // member variables
71 // NOLINTBEGIN
72 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mExpireTime;
73 ::ll::TypedStorage<
74 8,
75 64,
76 ::std::unordered_map<
78 ::std::unordered_map<uchar, ::ItemStackRequestActionHandler::RequestSlotIdAssignment>>>
79 mContainers;
80 // NOLINTEND
81 };
82
84 public:
85 // member variables
86 // NOLINTBEGIN
87 ::ll::TypedStorage<1, 1, ::ContainerEnumName const> mContainerName;
88 ::ll::TypedStorage<4, 4, ::ContainerRuntimeId const> mContainerRuntimeId;
89 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<::ItemStackLegacyRequestId, ::ItemStackNetId>>> mSlots;
90 // NOLINTEND
91
92 public:
93 // prevent constructor by default
95
96 public:
97 // member functions
98 // NOLINTBEGIN
99 MCNAPI PlayerLegacyRequestSlotIdAssignment(::ContainerEnumName containerName, ::Container& container);
100
102 // NOLINTEND
103
104 public:
105 // constructor thunks
106 // NOLINTBEGIN
107 MCNAPI void* $ctor(::ContainerEnumName containerName, ::Container& container);
108 // NOLINTEND
109
110 public:
111 // destructor thunk
112 // NOLINTBEGIN
113 MCNAPI void $dtor();
114 // NOLINTEND
115 };
116
117 struct ScreenData {
118 public:
119 // member variables
120 // NOLINTBEGIN
121 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ItemStackRequestActionCraftHandler>> mCraftRequestHandler;
122 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScreenHandlerBase>> mScreenHandler;
123 ::ll::
124 TypedStorage<8, 64, ::std::unordered_map<::ContainerRuntimeId, ::std::shared_ptr<::SimpleSparseContainer>>>
125 mRuntimeIdSparseContainerMap;
126 ::ll::TypedStorage<
127 8,
128 64,
129 ::std::unordered_map<::ItemStackRequestId, ::ItemStackRequestActionHandler::RequestIdAssignments>>
130 mRecentRequests;
131 // NOLINTEND
132
133 public:
134 // prevent constructor by default
135 ScreenData& operator=(ScreenData const&);
136 ScreenData(ScreenData const&);
137 ScreenData();
138
139 public:
140 // member functions
141 // NOLINTBEGIN
143
144 MCNAPI ::ItemStackRequestActionHandler::ScreenData& operator=(::ItemStackRequestActionHandler::ScreenData&&);
145
146 MCNAPI ~ScreenData();
147 // NOLINTEND
148
149 public:
150 // constructor thunks
151 // NOLINTBEGIN
153 // NOLINTEND
154
155 public:
156 // destructor thunk
157 // NOLINTBEGIN
158 MCNAPI void $dtor();
159 // NOLINTEND
160 };
161
162public:
163 // member variables
164 // NOLINTBEGIN
165 ::ll::TypedStorage<8, 8, ::Player&> mPlayer;
166 ::ll::TypedStorage<8, 8, ::ItemStackNetManagerServer&> mItemStackNetManager;
167 ::ll::TypedStorage<4, 4, ::ContainerRuntimeId const> mPlayerArmorContainerRuntimeId;
168 ::ll::TypedStorage<4, 4, ::ContainerRuntimeId const> mPlayerHandContainerRuntimeId;
169 ::ll::TypedStorage<4, 4, ::ContainerRuntimeId const> mPlayerUIContainerRuntimeId;
170 ::ll::TypedStorage<8, 96, ::std::array<::ItemStackRequestActionHandler::PlayerLegacyRequestSlotIdAssignment, 3>>
171 mPlayerLegacyRequests;
172 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastTime;
173 ::ll::TypedStorage<8, 24, ::WeakRef<::EntityContext>> mCurrentRequestScreen;
174 ::ll::TypedStorage<4, 16, ::ItemStackRequestId> mClientRequestId;
175 ::ll::TypedStorage<8, 24, ::std::vector<::ItemStackResponseContainerInfo>> mResponseContainerInfos;
176 ::ll::TypedStorage<8, 16, ::std::map<::std::string, ::std::vector<::std::string>>> mFilteredStrings;
177 ::ll::TypedStorage<8, 16, ::std::map<::std::string, ::std::vector<::std::string>>> mStrings;
178 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ContainerScreenValidation>> mScreenValidation;
179 // NOLINTEND
180
181public:
182 // prevent constructor by default
186
187public:
188 // member functions
189 // NOLINTBEGIN
190 MCAPI ItemStackRequestActionHandler(::ItemStackNetManagerServer& itemStackNetManager, ::Player& player);
191
192 MCAPI void _addResponseSlotInfo(::ItemStackRequestHandlerSlotInfo const& slotInfo, ::ItemStack const& item);
193
194 MCAPI void _cacheLegacySlotIdAssignment(
195 ::ContainerEnumName containerName,
196 uchar slot,
197 ::ItemStackLegacyRequestId const& legacyClientRequestId,
198 ::ItemStackNetId const& serverNetId
199 );
200
201 MCAPI void _cacheSlotIdAssigment(
202 ::ContainerRuntimeId const& containerRuntimeId,
203 uchar requestSlot,
204 uchar slot,
205 ::ItemStackNetId const& serverNetId
206 );
207
208 MCAPI ::std::unique_ptr<::ScreenHandlerBase> _createScreenHandler(::ContainerScreenContext const& screenContext);
209
210 MCAPI ::std::shared_ptr<::SimpleSparseContainer>
211 _getOrInitSparseContainer(::FullContainerName const& openContainerId);
212
213 MCAPI ::ItemStackNetResult _handleRemove(
214 ::ItemStackRequestActionTransferBase const& requestAction,
215 ::ItemStack& removedItem,
216 ::ItemStackRequestActionHandler::RemoveType removeType
217 );
218
219 MCAPI ::ItemStackNetResult _handleTransfer(
220 ::ItemStackRequestActionTransferBase const& requestAction,
221 bool isSrcHintSlot,
222 bool isDstHintSlot,
223 bool isSwap
224 );
225
226 MCAPI void _initScreen(::ItemStackNetManagerScreen& screen);
227
228 MCAPI ::std::optional<::ItemStackRequestActionHandler::RequestSlotIdAssignment> _resolveSlotIdAssignment(
229 ::ItemStackRequestSlotInfo const& requestSlotInfo,
230 ::ContainerRuntimeId const& containerRuntimeId
231 );
232
233 MCAPI ::ItemStackRequestActionHandler::ScreenData* _tryGetCurrentScreenData() const;
234
235 MCAPI ::ItemStackRequestHandlerSlotInfo
236 _validateRequestSlot(::ItemStackRequestSlotInfo const& requestSlotInfo, bool isItemRequired, bool isHintSlot);
237
238 MCAPI void addStrings(::ItemStackRequestId requestId, ::std::vector<::std::string> strings);
239
240 MCAPI void beginRequest(::ItemStackRequestId const& clientRequestId, ::ItemStackNetManagerScreen& screen);
241
242 MCAPI ::std::tuple<::ItemStackNetResult, ::std::vector<::ItemStackResponseContainerInfo>>
243 endRequest(::ItemStackNetResult currentResult);
244
245 MCAPI ::std::vector<::std::string> const& getFilteredStrings(::ItemStackRequestId requestId) const;
246
247 MCAPI ::ContainerScreenContext const& getScreenContext() const;
248
249 MCAPI ::std::vector<::std::string> const& getStrings(::ItemStackRequestId requestId) const;
250
251 MCAPI ::ItemStackNetResult handleRequestAction(::ItemStackRequestAction const& requestAction);
252
253 MCAPI bool hasFilteredStrings(::ItemStackRequestId requestId) const;
254
255 MCAPI void normalTick();
256
257 MCAPI ::std::vector<::ItemInstance>
258 tryCraft(::std::unique_ptr<::ContainerValidationCraftInputs> craftInputs, uchar numCrafts);
259 // NOLINTEND
260
261public:
262 // constructor thunks
263 // NOLINTBEGIN
264 MCAPI void* $ctor(::ItemStackNetManagerServer& itemStackNetManager, ::Player& player);
265 // NOLINTEND
266};
Definition ContainerScreenContext.h:17
Definition ContainerScreenValidation.h:27
Definition Container.h:30
Definition EntityContext.h:16
Definition ItemInstance.h:16
Definition ItemStackNetManagerScreen.h:5
Definition ItemStackNetManagerServer.h:24
Definition ItemStackRequestActionCraftHandler.h:18
Definition ItemStackRequestActionHandler.h:41
Definition ItemStackRequestActionTransferBase.h:16
Definition ItemStackRequestAction.h:18
Definition ItemStack.h:25
Definition Player.h:119
Definition ScreenHandlerBase.h:13
Definition SimpleSparseContainer.h:18
Definition TypedClientNetId.h:6
Definition TypedServerNetId.h:6
Definition ContainerRuntimeIdTag.h:5
Definition ContainerValidationCraftInputs.h:5
Definition FullContainerName.h:8
Definition ItemStackLegacyRequestIdTag.h:5
Definition ItemStackNetIdTag.h:5
Definition ItemStackRequestActionHandler.h:83
MCAPI void * $ctor(::ContainerEnumName containerName, ::Container &container)
MCAPI PlayerLegacyRequestSlotIdAssignment(::ContainerEnumName containerName, ::Container &container)
Definition ItemStackRequestActionHandler.h:68
Definition ItemStackRequestActionHandler.h:59
Definition ItemStackRequestActionHandler.h:117
MCAPI ScreenData(::ItemStackRequestActionHandler::ScreenData &&)
MCAPI::ItemStackRequestActionHandler::ScreenData & operator=(::ItemStackRequestActionHandler::ScreenData &&)
MCAPI void * $ctor(::ItemStackRequestActionHandler::ScreenData &&)
Definition ItemStackRequestHandlerSlotInfo.h:5
Definition ItemStackRequestIdTag.h:5
Definition ItemStackRequestSlotInfo.h:11
Definition ItemStackResponseContainerInfo.h:13