3#include "mc/_HeaderOutputPredefine.h"
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"
35namespace Json {
class Value; }
41 using FadeInIconSlotInfo = ::std::pair<::std::string, int>;
43 using FadeInIconTimeAndReadCount = ::std::pair<double, int>;
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;
112 ContainerScreenController();
117 virtual ~ContainerScreenController() ;
119 virtual ::ui::DirtyFlag tick() ;
121 virtual void onOpen() ;
123 virtual ::ui::DirtyFlag handleGameEventNotification(::ui::GameEventNotification notification) ;
125 virtual void onLeave() ;
127 virtual void setAssociatedBlockPos(::BlockPos
const& pos) ;
129 virtual void setAssociatedEntityUniqueID(::ActorUniqueID
const uniqueID) ;
131 virtual void addStaticScreenVars(::Json::Value& globalVars) ;
133 virtual bool _isStillValid() const ;
135 virtual
void _handleTakeHalf(::std::
string const& collectionName,
int index);
137 virtual
void _handlePlaceAll(::std::
string const& collectionName,
int index);
139 virtual
void _handlePlaceOne(::std::
string const& collectionName,
int index);
141 virtual
int _handleTakePlace(::std::
string const& collectionName,
int collectionIndex,
bool allItems);
143 virtual
void _handleSelectSlot(::std::
string const& collectionName,
int collectionIndex);
145 virtual ::SelectedSlotInfo const _getSelectedSlotInfo() const;
147 virtual ::SlotData _reevaluateSlotData(::SlotData&& slotData) const;
149 virtual ::std::
string _getButtonADescription() ;
151 virtual ::std::
string _getButtonXDescription() ;
153 virtual ::std::
string _getButtonYDescription() ;
155 virtual ::ui::ViewRequest _onContainerSlotHovered(::std::
string const& collectionName,
int index);
157 virtual ::ui::ViewRequest _onContainerSlotUnhovered(::std::
string const& collectionName,
int index);
159 virtual ::ui::ViewRequest _onContainerSlotSelected(::std::
string const& collectionName,
int index);
161 virtual ::ui::ViewRequest _onContainerSlotPressed(::std::
string const& collectionName,
int index);
163 virtual ::ui::ViewRequest _onHotbarSlotHotkeyUsed(::SlotData const& dstSlot);
165 virtual
bool _onTouchScrollStartedWithSelectedSlot();
167 virtual
bool _shouldSwap(
168 ::std::
string const& collectionName,
170 ::std::
string const& otherCollectionName,
171 int otherCollectionIndex
174 virtual
bool _isTargetSwappable(::std::
string const& otherCollectionName,
int otherCollectionIndex) const;
176 virtual ::std::
string _getCollectionName(::UIPropertyBag* bag) const;
178 virtual
bool _canSplit(::std::
string const& collectionName) const;
180 virtual
void _sendFlyingItem(
181 ::ItemStackBase const& item,
182 ::std::
string const& fromName,
184 ::std::
string const& toName,
186 ::FadeInIconBehavior fadeInIconBehavior
189 virtual
bool _isContainerScreen() const ;
191 virtual ::ItemStackBase const&
192 _getVisualItemStackImpl(::std::
string const& collectionName,
int collectionIndex) const;
194 virtual
void _registerCoalesceOrder() = 0;
196 virtual
void _registerAutoPlaceOrder() = 0;
198 virtual
void _createItemLockNotification(::ItemLockAction const action);
200 virtual ::ProgressiveTakeBarLocation
201 _getProgressiveBarDirection(::std::
string const& collectionName,
int collectionIndex) const;
203 virtual
bool _isInCreativeContainer(::std::
string const& containerName) const;
205 virtual
bool _getGestureControlEnabled() const ;
207 virtual
void _onInputModeChanged() ;
213 MCAPI ContainerScreenController(
214 ::std::shared_ptr<::ClientInstanceScreenModel> model,
215 ::InteractionModel interactionModel
218 MCAPI
bool _canProgressiveTakeFromCollection() const;
220 MCAPI
void _compareStatesForFlyingItems();
222 MCAPI ::ItemStack const& _getItemStack(::std::
string const& collectionName,
int collectionIndex) const;
224 MCAPI ::ItemStackBase const&
225 _getTakeableItemStackBase(::std::
string const& collectionName,
int collectionIndex) const;
227 MCAPI ::ItemStackBase const& _getVisualItemStack(::std::
string const& collectionName,
int collectionIndex) const;
229 MCAPI
void _handleAddAllToCursor(::std::
string const& collectionName,
int collectionIndex);
231 MCAPI
void _handleAutoPlace(
int amount, ::std::
string const& collectionName,
int index);
234 _handleDropItem(::std::
string const& collectionName,
int collectionIndex, ::ItemTransferAmount transferAmount);
236 MCAPI
void _handleDropSelectedItem(::ItemTransferAmount transferAmount);
238 MCAPI
void _handleSplit(::std::
string const& collectionName,
int collectionIndex);
240 MCAPI
void _handleTakeAll(::std::
string const& collectionName,
int index);
242 MCAPI
void _handleTakeAmount(
int amount, ::std::
string const& collectionName,
int index);
244 MCAPI
void _handleUnselectSlot();
246 MCAPI
bool _hasItems(::std::
string const& collectionName,
int collectionIndex) const;
248 MCAPI
bool _isCursorSelectedActive() const;
250 MCAPI
bool _isInValidCraftingResultContainer(::std::string_view collectionName,
int collectionIndex) const;
252 MCAPI
void _loadLastSelectedSlot();
254 MCAPI
bool _moveItemFromSlotIntoStorageItem(
255 ::std::
string const& collectionName,
257 ::ItemStack const& toStorageItem
260 MCAPI
bool _moveSelectedItemFromStorageItem(
261 ::ItemStack const& fromStorageItem,
263 ::std::
string const& collectionName,
267 MCAPI
bool _moveTopItemFromStorageItem(
268 ::ItemStack const& fromStorageItem,
269 ::std::
string const& collectionName,
273 MCAPI
void _playSound(::SharedTypes::Legacy::LevelSoundEvent type);
275 MCAPI
void _postSetSelectedSlot(
276 ::SelectedSlotInfo const& selected,
279 ::ItemLockAction actionOverride
282 MCAPI
void _registerEventHandlersForStateMachine(uint buttonId);
284 MCAPI
void _saveLastSelectedSlot();
286 MCAPI
void _showSelectedItemDetailsPopup(::ItemStackBase const& item);
288 MCAPI
void _stopSplitting();
290 MCAPI ::std::vector<::AutoPlaceItem> const* tryGetAutoPlaceOrder(::std::
string const& collectionName) const;
296 MCAPI static
bool _isInRecipeContainer(::std::
string const& collectionName);
302 MCAPI static ::SlotData const& mCursorSlotData();
308 MCAPI
void* $ctor(::std::shared_ptr<::ClientInstanceScreenModel> model, ::InteractionModel interactionModel);
320 MCAPI ::ui::DirtyFlag $tick();
322 MCAPI
void $onOpen();
324 MCAPI ::ui::DirtyFlag $handleGameEventNotification(::ui::GameEventNotification notification);
326 MCAPI
void $onLeave();
328 MCAPI
void $setAssociatedBlockPos(::BlockPos const& pos);
330 MCAPI
void $setAssociatedEntityUniqueID(::ActorUniqueID const uniqueID);
332 MCAPI
void $addStaticScreenVars(::Json::Value& globalVars);
334 MCAPI
bool $_isStillValid() const;
336 MCAPI
void $_handleTakeHalf(::std::
string const& collectionName,
int index);
338 MCAPI
void $_handlePlaceAll(::std::
string const& collectionName,
int index);
340 MCAPI
void $_handlePlaceOne(::std::
string const& collectionName,
int index);
342 MCAPI
int $_handleTakePlace(::std::
string const& collectionName,
int collectionIndex,
bool allItems);
344 MCAPI
void $_handleSelectSlot(::std::
string const& collectionName,
int collectionIndex);
346 MCAPI ::SelectedSlotInfo const $_getSelectedSlotInfo() const;
348 MCAPI ::SlotData $_reevaluateSlotData(::SlotData&& slotData) const;
350 MCAPI ::std::
string $_getButtonADescription();
352 MCAPI ::std::
string $_getButtonXDescription();
354 MCAPI ::std::
string $_getButtonYDescription();
356 MCAPI ::ui::ViewRequest $_onContainerSlotHovered(::std::
string const& collectionName,
int index);
358 MCAPI ::ui::ViewRequest $_onContainerSlotUnhovered(::std::
string const& collectionName,
int index);
360 MCAPI ::ui::ViewRequest $_onContainerSlotSelected(::std::
string const& collectionName,
int index);
362 MCAPI ::ui::ViewRequest $_onContainerSlotPressed(::std::
string const& collectionName,
int index);
364 MCAPI ::ui::ViewRequest $_onHotbarSlotHotkeyUsed(::SlotData const& dstSlot);
366 MCFOLD
bool $_onTouchScrollStartedWithSelectedSlot();
368 MCAPI
bool $_shouldSwap(
369 ::std::
string const& collectionName,
371 ::std::
string const& otherCollectionName,
372 int otherCollectionIndex
375 MCAPI
bool $_isTargetSwappable(::std::
string const& otherCollectionName,
int otherCollectionIndex) const;
377 MCAPI ::std::
string $_getCollectionName(::UIPropertyBag* bag) const;
379 MCAPI
bool $_canSplit(::std::
string const& collectionName) const;
381 MCAPI
void $_sendFlyingItem(
382 ::ItemStackBase const& item,
383 ::std::
string const& fromName,
385 ::std::
string const& toName,
387 ::FadeInIconBehavior fadeInIconBehavior
390 MCFOLD
bool $_isContainerScreen() const;
392 MCAPI ::ItemStackBase const&
393 $_getVisualItemStackImpl(::std::
string const& collectionName,
int collectionIndex) const;
395 MCAPI
void $_createItemLockNotification(::ItemLockAction const action);
397 MCAPI ::ProgressiveTakeBarLocation
398 $_getProgressiveBarDirection(::std::
string const& collectionName,
int collectionIndex) const;
400 MCFOLD
bool $_isInCreativeContainer(::std::
string const& containerName) const;
402 MCAPI
bool $_getGestureControlEnabled() const;
404 MCAPI
void $_onInputModeChanged();
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 UIPropertyBag.h:5
Definition AutoPlaceItem.h:5
Definition ItemStateData.h:5
Definition ItemTransferAmount.h:5
Definition SelectedSlotInfo.h:10