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