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