LeviLamina
Loading...
Searching...
No Matches
ContainerScreenController.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/gui/DirtyFlag.h"
7#include "mc/client/gui/GameEventNotification.h"
8#include "mc/client/gui/ViewRequest.h"
9#include "mc/client/gui/screens/ContainerInteractionStateMachine.h"
10#include "mc/client/gui/screens/controllers/BundleHelper.h"
11#include "mc/client/gui/screens/controllers/ClientInstanceScreenController.h"
12#include "mc/client/gui/screens/controllers/FadeInIconBehavior.h"
13#include "mc/client/gui/screens/controllers/InteractionModel.h"
14#include "mc/client/gui/screens/controllers/ProgressiveTakeBarLocation.h"
15#include "mc/client/gui/screens/controllers/ProgressiveTakeButtonData.h"
16#include "mc/client/gui/screens/controllers/TypeInContainer.h"
17#include "mc/deps/shared_types/legacy/LevelSoundEvent.h"
18#include "mc/legacy/ActorUniqueID.h"
19#include "mc/world/containers/ContainerEnumName.h"
20#include "mc/world/containers/SlotData.h"
21#include "mc/world/item/ItemGroup.h"
22#include "mc/world/item/ItemLockAction.h"
23#include "mc/world/level/BlockPos.h"
24
25// auto generated forward declare list
26// clang-format off
29class ItemStack;
30class ItemStackBase;
31class UIPropertyBag;
32struct AutoPlaceItem;
33struct ItemStateData;
35struct SelectedSlotInfo;
36namespace Json { class Value; }
37// clang-format on
38
40public:
41 // ContainerScreenController inner types define
42 using FadeInIconSlotInfo = ::std::pair<::std::string, int>;
43
44 using FadeInIconTimeAndReadCount = ::std::pair<double, int>;
45
46public:
47 // member variables
48 // NOLINTBEGIN
49 ::ll::TypedStorage<4, 12, ::BlockPos> mBlockPos;
50 ::ll::TypedStorage<8, 8, ::ActorUniqueID> mEntityUniqueID;
51 ::ll::TypedStorage<4, 4, ::TypeInContainer> mTypeInContainer;
52 ::ll::TypedStorage<1, 1, bool> mShowItemCategory;
53 ::ll::TypedStorage<8, 336, ::ContainerInteractionStateMachine> mContainerStateMachine;
54 ::ll::TypedStorage<8, 40, ::SlotData> mLastStateSlot;
55 ::ll::TypedStorage<4, 4, int> mLastPlacedAmount;
56 ::ll::TypedStorage<1, 1, bool> mSingleSplit;
57 ::ll::TypedStorage<8, 40, ::SlotData> mTouchSplitData;
58 ::ll::TypedStorage<8, 136, ::ItemGroup> mSelectedSplitTarget;
59 ::ll::TypedStorage<1, 1, bool> mSplitDraggingToPlace;
60 ::ll::TypedStorage<1, 1, bool> mPreviousGestureControlEnabled;
61 ::ll::TypedStorage<1, 1, bool> mEnterKeyPressedForSplitting;
62 ::ll::TypedStorage<1, 1, bool> mArrowKeyPressed;
63 ::ll::TypedStorage<8, 96, ::ProgressiveTakeButtonData> mProgressiveTakeButton;
64 ::ll::TypedStorage<4, 4, uint> mTouchProgressiveSelectButton;
65 ::ll::TypedStorage<8, 24, ::std::vector<::ItemStateData>> mPreviousState;
66 ::ll::TypedStorage<8, 16, ::std::map<::std::pair<::std::string, int>, ::std::pair<double, int>>> mFadeInIconData;
67 ::ll::TypedStorage<8, 40, ::SlotData> mSelectedSlotData;
68 ::ll::TypedStorage<8, 40, ::SlotData> mLastSelectedSlotData;
69 ::ll::TypedStorage<8, 40, ::SlotData> mHoveredSlotData;
70 ::ll::TypedStorage<1, 1, bool> mShowHoverText;
71 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastHoverTime;
72 ::ll::TypedStorage<8, 40, ::SlotData> mStartDraggingSlotData;
73 ::ll::TypedStorage<1, 1, bool> mPointerHasMoved;
74 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::vector<::std::string>>> mCoalesceOrderMap;
75 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::vector<::AutoPlaceItem>>> mAutoPlaceOrderMap;
76 ::ll::TypedStorage<1, 1, bool> mIsHoldingScrolling;
77 ::ll::TypedStorage<1, 1, bool> mReadyToVibrate;
78 ::ll::TypedStorage<1, 1, bool> mNeedsUpdatedBinds;
79 ::ll::TypedStorage<4, 4, int> mStartHeldTime;
80 ::ll::TypedStorage<1, 1, bool> mStartDeciding;
81 ::ll::TypedStorage<2, 2, short> mLastPointerX;
82 ::ll::TypedStorage<2, 2, short> mLastPointerY;
83 ::ll::TypedStorage<2, 2, short> mStartDraggingPointerX;
84 ::ll::TypedStorage<2, 2, short> mStartDraggingPointerY;
85 ::ll::TypedStorage<8, 32, ::std::string> mDraggingCollectionName;
86 ::ll::TypedStorage<4, 4, int> mDraggingCollectionIndex;
87 ::ll::TypedStorage<8, 32, ::std::string> mInteractingCollectionName;
88 ::ll::TypedStorage<4, 4, int> mInteractingCollectionIndex;
89 ::ll::TypedStorage<4, 4, uint> mInteractingButtonId;
90 ::ll::TypedStorage<1, 1, bool> mIsDraggingTooFast;
91 ::ll::TypedStorage<1, 1, bool> mProgressBarShowing;
92 ::ll::TypedStorage<8, 144, ::BundleHelper> mBundleHelper;
93 ::ll::TypedStorage<4, 4, ::ui::DirtyFlag> mDirty;
94 ::ll::TypedStorage<1, 1, bool> mStartOutputSlotDeciding;
95 ::ll::TypedStorage<8, 32, ::std::string> mOutputCollectionName;
96 ::ll::TypedStorage<4, 4, int> mOutputCollectionIndex;
97 ::ll::TypedStorage<4, 4, int> mLastReleaseOutputSlotTime;
98 ::ll::TypedStorage<1, 1, bool> mScreenCanBeClosedByServer;
99 ::ll::TypedStorage<1, 1, ::ItemLockAction> mDefaultItemLockAction;
100 ::ll::TypedStorage<4, 4, ::InteractionModel> mInteractionModel;
101 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::ContainerManagerController>> mContainerManagerController;
102 // NOLINTEND
103
104public:
105 // prevent constructor by default
106 ContainerScreenController();
107
108public:
109 // virtual functions
110 // NOLINTBEGIN
111 virtual ~ContainerScreenController() /*override*/;
112
113 virtual ::ui::DirtyFlag tick() /*override*/;
114
115 virtual void onOpen() /*override*/;
116
117 virtual ::ui::DirtyFlag handleGameEventNotification(::ui::GameEventNotification notification) /*override*/;
118
119 virtual void onLeave() /*override*/;
120
121 virtual void setAssociatedBlockPos(::BlockPos const& pos) /*override*/;
122
123 virtual void setAssociatedEntityUniqueID(::ActorUniqueID const uniqueID) /*override*/;
124
125 virtual void addStaticScreenVars(::Json::Value& globalVars) /*override*/;
126
127 virtual bool _isStillValid() const /*override*/;
128
129 virtual void _handleTakeHalf(::std::string const& collectionName, int index);
130
131 virtual void _handlePlaceAll(::std::string const& collectionName, int index);
132
133 virtual void _handlePlaceOne(::std::string const& collectionName, int index);
134
135 virtual int _handleTakePlace(::std::string const& collectionName, int collectionIndex, bool allItems);
136
137 virtual void _handleSelectSlot(::std::string const& collectionName, int collectionIndex);
138
139 virtual ::SelectedSlotInfo const _getSelectedSlotInfo() const;
140
141 virtual ::SlotData _reevaluateSlotData(::SlotData&& slotData) const;
142
143 virtual ::std::string _getButtonADescription() /*override*/;
144
145 virtual ::std::string _getButtonXDescription() /*override*/;
146
147 virtual ::std::string _getButtonYDescription() /*override*/;
148
149 virtual ::ui::ViewRequest _onContainerSlotHovered(::std::string const& collectionName, int index);
150
151 virtual ::ui::ViewRequest _onContainerSlotUnhovered(::std::string const& collectionName, int index);
152
153 virtual ::ui::ViewRequest _onContainerSlotSelected(::std::string const& collectionName, int index);
154
155 virtual ::ui::ViewRequest _onContainerSlotPressed(::std::string const& collectionName, int index);
156
157 virtual ::ui::ViewRequest _onHotbarSlotHotkeyUsed(::SlotData const& dstSlot);
158
159 virtual bool _shouldSwap(
160 ::std::string const& collectionName,
161 int collectionIndex,
162 ::std::string const& otherCollectionName,
163 int otherCollectionIndex
164 ) const;
165
166 virtual bool _isTargetSwappable(::std::string const& otherCollectionName, int otherCollectionIndex) const;
167
168 virtual ::std::string _getCollectionName(::UIPropertyBag* bag) const;
169
170 virtual bool _canSplit(::std::string const& collectionName) const;
171
172 virtual void _sendFlyingItem(
173 ::ItemStackBase const& item,
174 ::std::string const& fromName,
175 int fromIndex,
176 ::std::string const& toName,
177 int toIndex,
178 ::FadeInIconBehavior fadeInIconBehavior
179 );
180
181 virtual bool _isContainerScreen() const /*override*/;
182
183 virtual ::ItemStackBase const&
184 _getVisualItemStackImpl(::std::string const& collectionName, int collectionIndex) const;
185
186 virtual void _registerCoalesceOrder() = 0;
187
188 virtual void _registerAutoPlaceOrder() = 0;
189
190 virtual void _createItemLockNotification(::ItemLockAction const action);
191
192 virtual ::ProgressiveTakeBarLocation
193 _getProgressiveBarDirection(::std::string const& collectionName, int collectionIndex) const;
194
195 virtual bool _isInCreativeContainer(::std::string const& containerName) const;
196
197 virtual bool _getGestureControlEnabled() const /*override*/;
198 // NOLINTEND
199
200public:
201 // member functions
202 // NOLINTBEGIN
203 MCAPI ContainerScreenController(
204 ::std::shared_ptr<::ClientInstanceScreenModel> model,
205 ::InteractionModel interactionModel
206 );
207
208 MCAPI bool _canProgressiveTakeFromCollection() const;
209
210 MCAPI void _compareStatesForFlyingItems();
211
212 MCAPI ::std::vector<::std::string> const& _getCoalesceOrder(::std::string const& collectionName) const;
213
214 MCAPI ::ItemGroup const& _getCursorSelectedItemGroup() const;
215
216 MCAPI short _getDraggingDistanceSqrFromStartingPoint() const;
217
218 MCAPI ::ItemStack const& _getItemStack(::std::string const& collectionName, int collectionIndex) const;
219
220 MCAPI ::std::vector<::AutoPlaceItem>& _getReservedAutoPlaceOrder(::ContainerEnumName name, uint64 reserve);
221
222 MCAPI ::ItemStackBase const& _getSelectedItemStackBase() const;
223
224 MCAPI ::ItemStackBase const&
225 _getTakeableItemStackBase(::std::string const& collectionName, int collectionIndex) const;
226
227 MCAPI ::ItemStackBase const& _getVisualItemStack(::std::string const& collectionName, int collectionIndex) const;
228
229 MCAPI void _handleAddAllToCursor(::std::string const& collectionName, int collectionIndex);
230
231 MCAPI void _handleAutoPlace(int amount, ::std::string const& collectionName, int index);
232
233 MCAPI bool _handleCoalesceStack(::std::string const& collectionName);
234
235 MCAPI bool _handleCoalesceToIndex(::std::string const& collectionName, int collectionIndex);
236
237 MCAPI void
238 _handleDropItem(::std::string const& collectionName, int collectionIndex, ::ItemTransferAmount transferAmount);
239
240 MCAPI void _handleDropSelectedItem(::ItemTransferAmount transferAmount);
241
242 MCAPI void _handleSplit(::std::string const& collectionName, int collectionIndex);
243
244 MCAPI void
245 _handleSwap(::std::string const& firstName, int firstIndex, ::std::string const& secondName, int secondIndex);
246
247 MCAPI void _handleTakeAll(::std::string const& collectionName, int index);
248
249 MCAPI void _handleTakeAmount(int amount, ::std::string const& collectionName, int index);
250
251 MCAPI void _handleUnselectSlot();
252
253 MCAPI bool _hasCustomDisplayName() const;
254
255 MCAPI bool _hasItems(::std::string const& collectionName, int collectionIndex) const;
256
257 MCAPI bool _isCursorSelectedActive() const;
258
259 MCAPI bool _isInValidCraftingResultContainer(::std::string_view collectionName, int collectionIndex) const;
260
261 MCAPI bool _isProgressiveSelectBarVisible(::ProgressiveTakeBarLocation location) const;
262
263 MCAPI bool _isSelectedSlot(::std::string const& collectionName, int collectionIndex) const;
264
265 MCAPI void _loadLastSelectedSlot();
266
267 MCAPI bool _moveItemFromSlotIntoStorageItem(
268 ::std::string const& collectionName,
269 int collectionIndex,
270 ::ItemStack const& toStorageItem
271 );
272
273 MCAPI bool _moveSelectedItemFromStorageItem(
274 ::ItemStack const& fromStorageItem,
275 int selectedItemIdx,
276 ::std::string const& collectionName,
277 int collectionIndex
278 );
279
280 MCAPI bool _moveTopItemFromStorageItem(
281 ::ItemStack const& fromStorageItem,
282 ::std::string const& collectionName,
283 int collectionIndex
284 );
285
286 MCAPI void _playSound(::SharedTypes::Legacy::LevelSoundEvent type);
287
288 MCAPI void _postSetSelectedSlot(
289 ::SelectedSlotInfo const& selected,
290 bool allowEmpty,
291 bool unselect,
292 ::ItemLockAction actionOverride
293 );
294
295 MCAPI void _registerBindings();
296
297 MCAPI void _registerEventHandlers();
298
299 MCAPI void _registerEventHandlersForStateMachine(uint buttonId);
300
301 MCAPI void _registerSingleTouchOutputSlot(::ContainerEnumName outputContainer);
302
303 MCAPI void _registerStateMachine();
304
305 MCAPI void _registerTouchHoldEventHandlersForStateMachine(uint buttonId);
306
307 MCAPI void _saveLastSelectedSlot();
308
309 MCAPI void _stopSplitting();
310
311 MCAPI ::std::vector<::AutoPlaceItem> const* tryGetAutoPlaceOrder(::std::string const& collectionName) const;
312 // NOLINTEND
313
314public:
315 // static functions
316 // NOLINTBEGIN
317 MCAPI static bool _isInRecipeContainer(::std::string const& collectionName);
318 // NOLINTEND
319
320public:
321 // static variables
322 // NOLINTBEGIN
323 MCAPI static ::SlotData const& mCursorSlotData();
324 // NOLINTEND
325
326public:
327 // constructor thunks
328 // NOLINTBEGIN
329 MCAPI void* $ctor(::std::shared_ptr<::ClientInstanceScreenModel> model, ::InteractionModel interactionModel);
330 // NOLINTEND
331
332public:
333 // destructor thunk
334 // NOLINTBEGIN
335 MCAPI void $dtor();
336 // NOLINTEND
337
338public:
339 // virtual function thunks
340 // NOLINTBEGIN
341 MCAPI ::ui::DirtyFlag $tick();
342
343 MCAPI void $onOpen();
344
345 MCAPI ::ui::DirtyFlag $handleGameEventNotification(::ui::GameEventNotification notification);
346
347 MCAPI void $onLeave();
348
349 MCAPI void $setAssociatedBlockPos(::BlockPos const& pos);
350
351 MCAPI void $setAssociatedEntityUniqueID(::ActorUniqueID const uniqueID);
352
353 MCAPI void $addStaticScreenVars(::Json::Value& globalVars);
354
355 MCAPI bool $_isStillValid() const;
356
357 MCAPI void $_handleTakeHalf(::std::string const& collectionName, int index);
358
359 MCAPI void $_handlePlaceAll(::std::string const& collectionName, int index);
360
361 MCAPI void $_handlePlaceOne(::std::string const& collectionName, int index);
362
363 MCAPI int $_handleTakePlace(::std::string const& collectionName, int collectionIndex, bool allItems);
364
365 MCAPI void $_handleSelectSlot(::std::string const& collectionName, int collectionIndex);
366
367 MCAPI ::SelectedSlotInfo const $_getSelectedSlotInfo() const;
368
369 MCAPI ::SlotData $_reevaluateSlotData(::SlotData&& slotData) const;
370
371 MCAPI ::std::string $_getButtonADescription();
372
373 MCAPI ::std::string $_getButtonXDescription();
374
375 MCAPI ::std::string $_getButtonYDescription();
376
377 MCAPI ::ui::ViewRequest $_onContainerSlotHovered(::std::string const& collectionName, int index);
378
379 MCAPI ::ui::ViewRequest $_onContainerSlotUnhovered(::std::string const& collectionName, int index);
380
381 MCAPI ::ui::ViewRequest $_onContainerSlotSelected(::std::string const& collectionName, int index);
382
383 MCAPI ::ui::ViewRequest $_onContainerSlotPressed(::std::string const& collectionName, int index);
384
385 MCAPI ::ui::ViewRequest $_onHotbarSlotHotkeyUsed(::SlotData const& dstSlot);
386
387 MCAPI bool $_shouldSwap(
388 ::std::string const& collectionName,
389 int collectionIndex,
390 ::std::string const& otherCollectionName,
391 int otherCollectionIndex
392 ) const;
393
394 MCAPI bool $_isTargetSwappable(::std::string const& otherCollectionName, int otherCollectionIndex) const;
395
396 MCAPI ::std::string $_getCollectionName(::UIPropertyBag* bag) const;
397
398 MCAPI bool $_canSplit(::std::string const& collectionName) const;
399
400 MCAPI void $_sendFlyingItem(
401 ::ItemStackBase const& item,
402 ::std::string const& fromName,
403 int fromIndex,
404 ::std::string const& toName,
405 int toIndex,
406 ::FadeInIconBehavior fadeInIconBehavior
407 );
408
409 MCFOLD bool $_isContainerScreen() const;
410
411 MCAPI ::ItemStackBase const&
412 $_getVisualItemStackImpl(::std::string const& collectionName, int collectionIndex) const;
413
414 MCAPI void $_createItemLockNotification(::ItemLockAction const action);
415
416 MCAPI ::ProgressiveTakeBarLocation
417 $_getProgressiveBarDirection(::std::string const& collectionName, int collectionIndex) const;
418
419 MCFOLD bool $_isInCreativeContainer(::std::string const& containerName) const;
420
421 MCFOLD bool $_getGestureControlEnabled() const;
422 // NOLINTEND
423
424public:
425 // vftables
426 // NOLINTBEGIN
428
429 MCNAPI static void** $vftableForScreenController();
430 // NOLINTEND
431};
Definition ClientInstanceScreenController.h:5
Definition ClientInstanceScreenModel.h:5
Definition ContainerManagerController.h:47
Definition ContainerScreenController.h:5
static MCAPI void ** $vftableForEnableNonOwnerReferences()
static MCAPI void ** $vftableForScreenController()
Definition ItemStackBase.h:44
Definition ItemStack.h:26
Definition Value.h:16
Definition UIPropertyBag.h:5
Definition AutoPlaceItem.h:5
Definition ItemStateData.h:5
Definition ItemTransferAmount.h:5
Definition SelectedSlotInfo.h:10