3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/client/gui/CraftingType.h"
7#include "mc/client/gui/DirtyFlag.h"
8#include "mc/client/gui/ViewRequest.h"
9#include "mc/client/gui/screens/controllers/ContainerScreenController.h"
10#include "mc/client/gui/screens/controllers/FadeInIconBehavior.h"
11#include "mc/client/gui/screens/controllers/RepeatCraftButtonData.h"
12#include "mc/client/social/IToastListener.h"
13#include "mc/deps/shared_types/item/CreativeItemCategory.h"
14#include "mc/world/containers/ContainerEnumName.h"
15#include "mc/world/containers/SlotData.h"
16#include "mc/world/containers/controllers/ItemCraftType.h"
17#include "mc/world/containers/controllers/ItemTakeType.h"
18#include "mc/world/inventory/InventoryLeftTabIndex.h"
19#include "mc/world/item/ItemInstance.h"
32namespace Json {
class Value; }
48 ::ll::TypedStorage<4, 4, ::InventoryLeftTabIndex> tabIndex;
49 ::ll::TypedStorage<1, 1, ::SharedTypes::CreativeItemCategory> category;
50 ::ll::TypedStorage<1, 1, ::ContainerEnumName> container;
51 ::ll::TypedStorage<8, 32, ::std::string> tabName;
59 ::ll::TypedStorage<8, 40, ::SlotData> mSlot;
60 ::ll::TypedStorage<4, 4, int> mNumExpandedItems;
67 ::ll::TypedStorage<4, 4, ::ui::DirtyFlag> mDirty;
68 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::CraftingContainerManagerController>>
69 mCraftingContainerManagerController;
70 ::ll::TypedStorage<8, 40, ::std::optional<::std::string>> mDelayedSearchString;
71 ::ll::TypedStorage<1, 1, bool> mWorkbench;
72 ::ll::TypedStorage<1, 1, bool> mPocket;
73 ::ll::TypedStorage<1, 1, bool> mCraftableFilterOn;
74 ::ll::TypedStorage<4, 4, ::CraftingType> mCraftingType;
75 ::ll::TypedStorage<1, 1, bool> mEntered;
76 ::ll::TypedStorage<4, 4, int> mLayout;
77 ::ll::TypedStorage<4, 4, int> mSavedLayout;
78 ::ll::TypedStorage<4, 4, int> mCurrentlySelectedIndex;
79 ::ll::TypedStorage<8, 128, ::ItemInstance> mCurrentlySelectedItem;
80 ::ll::TypedStorage<1, 1, bool> mNeedReselectRecipeIndex;
81 ::ll::TypedStorage<1, 1, bool> mCanReselectRecipeIndex;
82 ::ll::TypedStorage<1, 1, bool> mIngredientSetChanged;
83 ::ll::TypedStorage<1, 1, bool> mNeedFirstTabSelection;
84 ::ll::TypedStorage<1, 1, bool> mNeedDefaultFocusSet;
85 ::ll::TypedStorage<1, 1, bool> mSearchBarSelected;
86 ::ll::TypedStorage<1, 1, bool> mCanCreativeHotbarSwap;
87 ::ll::TypedStorage<1, 1, bool> mRecipeLocked;
88 ::ll::TypedStorage<1, 1, bool> mUseRecipeUnlocking;
89 ::ll::TypedStorage<4, 4, int> mFocusRestorationContextSelectedTab;
90 ::ll::TypedStorage<8, 40, ::SlotData> mFocusRestorationContext;
91 ::ll::TypedStorage<8, 32, ::std::string> mRepeatCollectionName;
92 ::ll::TypedStorage<4, 4, int> mRepeatCollectionIndex;
93 ::ll::TypedStorage<4, 4, int> mRepeatCraftStartTime;
94 ::ll::TypedStorage<4, 4, int> mRepeatCraftLoopStartTime;
95 ::ll::TypedStorage<8, 48, ::CraftingScreenController::ScrollItemData> mNeedToScrollToItem;
96 ::ll::TypedStorage<8, 136, ::RepeatCraftButtonData> mRepeatCraftButton;
97 ::ll::TypedStorage<4, 4, int> mTabFiltersDirty;
98 ::ll::TypedStorage<4, 4, int> mSelectedLeftTab;
99 ::ll::TypedStorage<4, 4, int> mSelectedRightTab;
100 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::std::string>> mRecipeHoverTextCache;
101 ::ll::TypedStorage<1, 1, bool> mRecipeHoverTextCacheShowCategory;
106 CraftingScreenController();
111 virtual ~CraftingScreenController() =
default;
113 virtual void onOpen() ;
115 virtual void onEntered() ;
117 virtual void onTerminate() ;
119 virtual ::ui::DirtyFlag tick() ;
121 virtual void addStaticScreenVars(::Json::Value& globalVars) ;
123 virtual void showToast(::ToastMessage message,
bool animateIn) ;
125 virtual void removeToast() ;
127 virtual void refreshToast() ;
129 virtual bool _isStillValid() const ;
131 virtual
void _handlePlaceAll(::std::
string const& collectionName,
int index) ;
133 virtual
void _handlePlaceOne(::std::
string const& collectionName,
int index) ;
135 virtual
void _handleSelectSlot(::std::
string const& collectionName,
int collectionIndex) ;
137 virtual ::ItemStackBase const&
138 _getVisualItemStackImpl(::std::
string const& collectionName,
int collectionIndex) const ;
140 virtual ::std::
string _getButtonADescription() ;
142 virtual ::std::
string _getButtonBDescription() ;
144 virtual ::std::
string _getButtonXDescription() ;
146 virtual ::std::
string _getButtonYDescription() ;
148 virtual ::ui::ViewRequest _onContainerSlotHovered(::std::
string const& collectionName,
int index) ;
150 virtual ::ui::ViewRequest _onContainerSlotPressed(::std::
string const& collectionName,
int index) ;
152 virtual
bool _onTouchScrollStartedWithSelectedSlot() ;
154 virtual ::std::
string _getCollectionName(::UIPropertyBag* bag) const ;
156 virtual ::SlotData _reevaluateSlotData(::SlotData&& slotData) const ;
158 virtual
bool _shouldSwap(
159 ::std::
string const& collectionName,
161 ::std::
string const& otherCollectionName,
162 int otherCollectionIndex
165 virtual
bool _isTargetSwappable(::std::
string const& otherCollectionName,
int otherCollectionIndex) const
168 virtual
void _sendFlyingItem(
169 ::ItemStackBase const& item,
170 ::std::
string const& fromName,
172 ::std::
string const& toName,
174 ::FadeInIconBehavior fadeInIconBehavior
177 virtual
void _registerCoalesceOrder() ;
179 virtual
void _registerAutoPlaceOrder() ;
181 virtual
bool _isInCreativeContainer(::std::
string const& containerName) const ;
187 MCAPI CraftingScreenController(
188 ::std::shared_ptr<::ClientInstanceScreenModel> model,
190 ::BlockPos const& pos,
191 ::ActorUniqueID uniqueId,
192 ::CraftingType craftingType
195 MCAPI
bool _currentItemIsSelected(::std::
string const& collectionName,
int collectionIndex) const;
197 MCAPI
void _cycleLayout(
int dir);
199 MCAPI
void _evacuateCraftingGrid();
201 MCAPI
int _findNextLeftSideInventoryTab(
int dir) const;
203 MCAPI
void _focusCollectionItem(::std::
string const& collectionName,
int collectionIndex,
bool forceFocus);
205 MCAPI
void _handleCraftItem(::ItemCraftType);
207 MCAPI
void _handleRecipeSelect(::std::
string const& collectionName,
int collectionIndex,
bool displayOnly);
209 MCAPI
bool _isConstructionTabVisible() const;
211 MCAPI
bool _isEquipmentTabVisible() const;
213 MCAPI
bool _isItemsTabVisible() const;
215 MCAPI
bool _isNatureTabVisible() const;
217 MCAPI
bool _isRecipeSlotCraftable(::SlotData const& slotData);
219 MCAPI ::ui::ViewRequest
220 _recipeAutoCraft(::std::
string const& collectionName,
int collectionIndex, ::ItemCraftType craftType);
222 MCAPI
void _refreshFilters(::InventoryLeftTabIndex tab,
bool forceRefresh);
224 MCAPI
void _savePlayerInventoryOptions();
226 MCAPI
void _sendActiveLayoutInfo();
228 MCAPI
void _setLeftSideInventoryTab(
int tabIndex,
bool saveOptions);
230 MCAPI ::std::
string _tabIndexToCollectionName(::InventoryLeftTabIndex index) const;
232 MCAPI
int _tryAutoPlaceItemIntoContainer(
233 ::SlotData const& srcSlot,
235 ::ContainerEnumName containerName,
236 ::std::vector<::AutoPlaceResult>& autoPlaceResults
243 MCAPI static
void addStaticScreenVars(::Json::Value& globalVars,
bool pocket);
249 MCAPI static ::std::vector<::CraftingScreenController::
CategoryTabInfo> const& mCategoryTabs();
256 ::std::shared_ptr<::ClientInstanceScreenModel> model,
258 ::BlockPos const& pos,
259 ::ActorUniqueID uniqueId,
260 ::CraftingType craftingType
267 MCAPI
void $onOpen();
269 MCAPI
void $onEntered();
271 MCAPI
void $onTerminate();
273 MCAPI ::ui::DirtyFlag $tick();
275 MCAPI
void $addStaticScreenVars(::Json::Value& globalVars);
277 MCAPI
void $showToast(::ToastMessage message,
bool animateIn);
279 MCAPI
void $removeToast();
281 MCAPI
void $refreshToast();
283 MCAPI
bool $_isStillValid() const;
285 MCAPI
void $_handlePlaceAll(::std::
string const& collectionName,
int index);
287 MCAPI
void $_handlePlaceOne(::std::
string const& collectionName,
int index);
289 MCAPI
void $_handleSelectSlot(::std::
string const& collectionName,
int collectionIndex);
291 MCAPI ::ItemStackBase const&
292 $_getVisualItemStackImpl(::std::
string const& collectionName,
int collectionIndex) const;
294 MCAPI ::std::
string $_getButtonADescription();
296 MCAPI ::std::
string $_getButtonBDescription();
298 MCAPI ::std::
string $_getButtonXDescription();
300 MCAPI ::std::
string $_getButtonYDescription();
302 MCAPI ::ui::ViewRequest $_onContainerSlotHovered(::std::
string const& collectionName,
int index);
304 MCAPI ::ui::ViewRequest $_onContainerSlotPressed(::std::
string const& collectionName,
int index);
306 MCAPI
bool $_onTouchScrollStartedWithSelectedSlot();
308 MCAPI ::std::
string $_getCollectionName(::UIPropertyBag* bag) const;
310 MCAPI ::SlotData $_reevaluateSlotData(::SlotData&& slotData) const;
312 MCAPI
bool $_shouldSwap(
313 ::std::
string const& collectionName,
315 ::std::
string const& otherCollectionName,
316 int otherCollectionIndex
319 MCAPI
bool $_isTargetSwappable(::std::
string const& otherCollectionName,
int otherCollectionIndex) const;
321 MCAPI
void $_sendFlyingItem(
322 ::ItemStackBase const& item,
323 ::std::
string const& fromName,
325 ::std::
string const& toName,
327 ::FadeInIconBehavior fadeInIconBehavior
330 MCAPI
void $_registerCoalesceOrder();
332 MCAPI
void $_registerAutoPlaceOrder();
334 MCAPI
bool $_isInCreativeContainer(::std::
string const& containerName) const;
Definition ClientInstanceScreenModel.h:5
Definition ContainerScreenController.h:5
Definition CraftingContainerManagerController.h:40
Definition CraftingScreenController.h:5
Definition IToastListener.h:5
Definition ItemStackBase.h:44
Definition ToastMessage.h:5
Definition UIPropertyBag.h:5
Definition ActorUniqueID.h:5
Definition AutoPlaceResult.h:5
Definition CraftingScreenController.h:14