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/CategoryTabState.h"
10#include "mc/client/gui/screens/controllers/ContainerScreenController.h"
11#include "mc/client/gui/screens/controllers/FadeInIconBehavior.h"
12#include "mc/client/gui/screens/controllers/RepeatCraftButtonData.h"
13#include "mc/client/social/IToastListener.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/CreativeItemCategory.h"
20#include "mc/world/item/ItemInstance.h"
33namespace Json {
class Value; }
49 ::ll::TypedStorage<4, 4, ::InventoryLeftTabIndex> tabIndex;
50 ::ll::TypedStorage<4, 4, ::CreativeItemCategory> category;
51 ::ll::TypedStorage<1, 1, ::ContainerEnumName> container;
52 ::ll::TypedStorage<8, 32, ::std::string> tabName;
53 ::ll::TypedStorage<8, 32, ::std::string> factoryName;
59 MCAPI ~CategoryTabInfo();
73 ::ll::TypedStorage<8, 40, ::SlotData> mSlot;
74 ::ll::TypedStorage<4, 4, int> mNumExpandedItems;
80 MCAPI ~ScrollItemData();
93 ::ll::TypedStorage<4, 4, ::ui::DirtyFlag> mDirty;
94 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::CraftingContainerManagerController>>
95 mCraftingContainerManagerController;
96 ::ll::TypedStorage<8, 40, ::std::optional<::std::string>> mDelayedSearchString;
97 ::ll::TypedStorage<1, 1, bool> mWorkbench;
98 ::ll::TypedStorage<1, 1, bool> mPocket;
99 ::ll::TypedStorage<1, 1, bool> mCraftableFilterOn;
100 ::ll::TypedStorage<4, 4, ::CraftingType> mCraftingType;
101 ::ll::TypedStorage<1, 1, bool> mEntered;
102 ::ll::TypedStorage<4, 4, int> mLayout;
103 ::ll::TypedStorage<4, 4, int> mSavedLayout;
104 ::ll::TypedStorage<4, 4, int> mCurrentlySelectedIndex;
105 ::ll::TypedStorage<8, 128, ::ItemInstance> mCurrentlySelectedItem;
106 ::ll::TypedStorage<1, 1, bool> mNeedReselectRecipeIndex;
107 ::ll::TypedStorage<1, 1, bool> mCanReselectRecipeIndex;
108 ::ll::TypedStorage<1, 1, bool> mIngredientSetChanged;
109 ::ll::TypedStorage<1, 1, bool> mNeedFirstTabSelection;
110 ::ll::TypedStorage<1, 1, bool> mNeedDefaultFocusSet;
111 ::ll::TypedStorage<1, 1, bool> mSearchBarSelected;
112 ::ll::TypedStorage<1, 1, bool> mCanCreativeHotbarSwap;
113 ::ll::TypedStorage<1, 1, bool> mRecipeLocked;
114 ::ll::TypedStorage<1, 1, bool> mUseRecipeUnlocking;
115 ::ll::TypedStorage<4, 4, int> mFocusRestorationContextSelectedTab;
116 ::ll::TypedStorage<8, 40, ::SlotData> mFocusRestorationContext;
117 ::ll::TypedStorage<8, 32, ::std::string> mRepeatCollectionName;
118 ::ll::TypedStorage<4, 4, int> mRepeatCollectionIndex;
119 ::ll::TypedStorage<4, 4, int> mRepeatCraftStartTime;
120 ::ll::TypedStorage<4, 4, int> mRepeatCraftLoopStartTime;
121 ::ll::TypedStorage<8, 48, ::CraftingScreenController::ScrollItemData> mNeedToScrollToItem;
122 ::ll::TypedStorage<8, 136, ::RepeatCraftButtonData> mRepeatCraftButton;
123 ::ll::TypedStorage<1, 1, bool> mHasInitalCategoryTabsState;
124 ::ll::TypedStorage<4, 4, int> mTicksLeftUntilCategoryTabUpdate;
125 ::ll::TypedStorage<4, 4, int> mTabFiltersDirty;
126 ::ll::TypedStorage<4, 4, int> mSelectedLeftTab;
127 ::ll::TypedStorage<4, 4, int> mSelectedRightTab;
128 ::ll::TypedStorage<8, 64, ::std::unordered_map<::InventoryLeftTabIndex, ::CategoryTabState>> mCategoryTabsState;
133 CraftingScreenController();
138 virtual ~CraftingScreenController() ;
140 virtual void onOpen() ;
142 virtual void onEntered() ;
144 virtual void onTerminate() ;
146 virtual ::ui::DirtyFlag tick() ;
148 virtual void addStaticScreenVars(::Json::Value& globalVars) ;
150 virtual void showToast(::ToastMessage message,
bool animateIn) ;
152 virtual void removeToast() ;
154 virtual void refreshToast() ;
156 virtual bool _isStillValid() const ;
158 virtual
void _handlePlaceAll(::std::
string const& collectionName,
int index) ;
160 virtual
void _handlePlaceOne(::std::
string const& collectionName,
int index) ;
162 virtual
void _handleSelectSlot(::std::
string const& collectionName,
int collectionIndex) ;
164 virtual ::ItemStackBase const&
165 _getVisualItemStackImpl(::std::
string const& collectionName,
int collectionIndex) const ;
167 virtual ::std::
string _getButtonADescription() ;
169 virtual ::std::
string _getButtonBDescription() ;
171 virtual ::std::
string _getButtonXDescription() ;
173 virtual ::std::
string _getButtonYDescription() ;
175 virtual ::ui::ViewRequest _onContainerSlotHovered(::std::
string const& collectionName,
int index) ;
177 virtual ::ui::ViewRequest _onContainerSlotPressed(::std::
string const& collectionName,
int index) ;
179 virtual ::std::
string _getCollectionName(::UIPropertyBag* bag) const ;
181 virtual ::SlotData _reevaluateSlotData(::SlotData&& slotData) const ;
183 virtual
bool _shouldSwap(
184 ::std::
string const& collectionName,
186 ::std::
string const& otherCollectionName,
187 int otherCollectionIndex
190 virtual
bool _isTargetSwappable(::std::
string const& otherCollectionName,
int otherCollectionIndex) const
193 virtual
void _sendFlyingItem(
194 ::ItemStackBase const& item,
195 ::std::
string const& fromName,
197 ::std::
string const& toName,
199 ::FadeInIconBehavior fadeInIconBehavior
202 virtual
void _registerCoalesceOrder() ;
204 virtual
void _registerAutoPlaceOrder() ;
206 virtual
bool _isInCreativeContainer(::std::
string const& containerName) const ;
212 MCAPI CraftingScreenController(
213 ::std::shared_ptr<::ClientInstanceScreenModel> model,
215 ::BlockPos const& pos,
216 ::ActorUniqueID uniqueId,
217 ::CraftingType craftingType
220 MCAPI
bool _currentItemIsSelected(::std::
string const& collectionName,
int collectionIndex) const;
222 MCAPI
void _cycleLayout(
int dir);
224 MCAPI
void _cycleRightSideInventoryTab(
int dir);
226 MCAPI
void _destroyCategoryTabs();
228 MCAPI
void _evacuateCraftingGrid();
230 MCAPI
int _findNextLeftSideInventoryTab(
int dir) const;
232 MCAPI
void _focusCollectionItem(::std::
string const& collectionName,
int collectionIndex,
bool forceFocus);
234 MCAPI ::std::
string _getButtonLeftStickDescription() const;
236 MCAPI ::std::
string _getCraftStackText() const;
238 MCAPI ::std::
string _getExpandoItemGroupName(::std::
string const& collectionName,
int collectionIndex);
240 MCAPI ::std::
string _getRecipeHoverText(::std::
string const& collectionName,
int collectionIndex);
242 MCAPI
void _handleCraftItem(::ItemCraftType);
244 MCAPI
void _handleCreativeHotbarPlaceAll(::std::
string const& collectionName,
int collectionIndex);
246 MCAPI
void _handleCreativeHotbarPlaceOne(::std::
string const& collectionName,
int collectionIndex);
248 MCAPI
void _handleRecipeSelect(::std::
string const& collectionName,
int collectionIndex,
bool displayOnly);
250 MCAPI
bool _isRecipeBookOnlyLayoutAvailable() const;
252 MCAPI
void _loadPlayerInventoryOptions();
254 MCAPI ::ui::ViewRequest
255 _recipeAutoCraft(::std::
string const& collectionName,
int collectionIndex, ::ItemCraftType craftType);
257 MCAPI
void _refreshFilters(::InventoryLeftTabIndex tab,
bool forceRefresh);
259 MCAPI
void _registerBindings();
261 MCAPI
void _registerEventHandlers();
263 MCAPI
void _registerStateMachine();
265 MCAPI
void _savePlayerInventoryOptions();
267 MCAPI
void _sendActiveLayoutInfo();
269 MCAPI
void _setInitialTabsSelected(
int defaultLeftTab,
int defaultRightTab);
271 MCAPI
void _setIsFiltering(
bool craftableFilterOn);
273 MCAPI
void _setLayout(
int layoutIndex,
bool saveOptions);
275 MCAPI
void _setLeftSideInventoryTab(
int tabIndex,
bool saveOptions);
277 MCAPI
bool _shouldAlwaysShowAllTabs() const;
279 MCAPI
void _showAllTabs();
282 _showCategoryTab(::CraftingScreenController::
CategoryTabInfo const& categoryTab,
bool animated,
int tabsToSlide);
284 MCAPI ::std::
string _tabIndexToCollectionName(::InventoryLeftTabIndex index) const;
286 MCAPI
int _tryAutoPlaceItemIntoContainer(
287 ::SlotData const& srcSlot,
289 ::ContainerEnumName containerName,
290 ::std::vector<::AutoPlaceResult>& autoPlaceResults
293 MCAPI
void _tryHoverOnIngredientSetChanged();
295 MCAPI ::ui::DirtyFlag _updateCategoryTabs();
301 MCAPI static
void addStaticScreenVars(::Json::Value& globalVars,
bool pocket);
307 MCAPI static ::std::string_view const& RECIPE_BOOK_COLLECTION_NAME();
309 MCAPI static ::std::vector<::CraftingScreenController::
CategoryTabInfo> const& mCategoryTabs();
311 MCAPI static
int& mTabsWaitingToBeAnimatedIn();
318 ::std::shared_ptr<::ClientInstanceScreenModel> model,
320 ::BlockPos const& pos,
321 ::ActorUniqueID uniqueId,
322 ::CraftingType craftingType
335 MCAPI
void $onOpen();
337 MCAPI
void $onEntered();
339 MCAPI
void $onTerminate();
341 MCAPI ::ui::DirtyFlag $tick();
343 MCAPI
void $addStaticScreenVars(::Json::Value& globalVars);
345 MCAPI
void $showToast(::ToastMessage message,
bool animateIn);
347 MCAPI
void $removeToast();
349 MCAPI
void $refreshToast();
351 MCAPI
bool $_isStillValid() const;
353 MCAPI
void $_handlePlaceAll(::std::
string const& collectionName,
int index);
355 MCAPI
void $_handlePlaceOne(::std::
string const& collectionName,
int index);
357 MCAPI
void $_handleSelectSlot(::std::
string const& collectionName,
int collectionIndex);
359 MCAPI ::ItemStackBase const&
360 $_getVisualItemStackImpl(::std::
string const& collectionName,
int collectionIndex) const;
362 MCAPI ::std::
string $_getButtonADescription();
364 MCAPI ::std::
string $_getButtonBDescription();
366 MCAPI ::std::
string $_getButtonXDescription();
368 MCAPI ::std::
string $_getButtonYDescription();
370 MCAPI ::ui::ViewRequest $_onContainerSlotHovered(::std::
string const& collectionName,
int index);
372 MCAPI ::ui::ViewRequest $_onContainerSlotPressed(::std::
string const& collectionName,
int index);
374 MCAPI ::std::
string $_getCollectionName(::UIPropertyBag* bag) const;
376 MCAPI ::SlotData $_reevaluateSlotData(::SlotData&& slotData) const;
378 MCAPI
bool $_shouldSwap(
379 ::std::
string const& collectionName,
381 ::std::
string const& otherCollectionName,
382 int otherCollectionIndex
385 MCAPI
bool $_isTargetSwappable(::std::
string const& otherCollectionName,
int otherCollectionIndex) const;
387 MCAPI
void $_sendFlyingItem(
388 ::ItemStackBase const& item,
389 ::std::
string const& fromName,
391 ::std::
string const& toName,
393 ::FadeInIconBehavior fadeInIconBehavior
396 MCAPI
void $_registerCoalesceOrder();
398 MCAPI
void $_registerAutoPlaceOrder();
400 MCAPI
bool $_isInCreativeContainer(::std::
string const& containerName) const;
Definition ClientInstanceScreenModel.h:5
Definition ContainerScreenController.h:5
Definition CraftingContainerManagerController.h:40
Definition CraftingScreenController.h:5
static MCAPI void ** $vftableForScreenController()
static MCAPI void ** $vftableForEnableNonOwnerReferences()
static MCAPI void ** $vftable()
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