Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
CraftingScreenController.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
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"
20
21// auto generated forward declare list
22// clang-format off
23class BlockPos;
26class ItemStackBase;
27class Player;
28class ToastMessage;
29class UIPropertyBag;
30struct ActorUniqueID;
31struct AutoPlaceResult;
32namespace Json { class Value; }
33// clang-format on
34
36public:
37 // CraftingScreenController inner types declare
38 // clang-format off
39 struct CategoryTabInfo;
40 struct ScrollItemData;
41 // clang-format on
42
43 // CraftingScreenController inner types define
44 struct CategoryTabInfo {
45 public:
46 // member variables
47 // NOLINTBEGIN
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;
52 // NOLINTEND
53 };
54
55 struct ScrollItemData {
56 public:
57 // member variables
58 // NOLINTBEGIN
59 ::ll::TypedStorage<8, 40, ::SlotData> mSlot;
60 ::ll::TypedStorage<4, 4, int> mNumExpandedItems;
61 // NOLINTEND
62 };
63
64public:
65 // member variables
66 // NOLINTBEGIN
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;
102 // NOLINTEND
103
104public:
105 // prevent constructor by default
106 CraftingScreenController();
107
108public:
109 // virtual functions
110 // NOLINTBEGIN
111 virtual ~CraftingScreenController() /*override*/ = default;
112
113 virtual void onOpen() /*override*/;
114
115 virtual void onEntered() /*override*/;
116
117 virtual void onTerminate() /*override*/;
118
119 virtual ::ui::DirtyFlag tick() /*override*/;
120
121 virtual void addStaticScreenVars(::Json::Value& globalVars) /*override*/;
122
123 virtual void showToast(::ToastMessage message, bool animateIn) /*override*/;
124
125 virtual void removeToast() /*override*/;
126
127 virtual void refreshToast() /*override*/;
128
129 virtual bool _isStillValid() const /*override*/;
130
131 virtual void _handlePlaceAll(::std::string const& collectionName, int index) /*override*/;
132
133 virtual void _handlePlaceOne(::std::string const& collectionName, int index) /*override*/;
134
135 virtual void _handleSelectSlot(::std::string const& collectionName, int collectionIndex) /*override*/;
136
137 virtual ::ItemStackBase const&
138 _getVisualItemStackImpl(::std::string const& collectionName, int collectionIndex) const /*override*/;
139
140 virtual ::std::string _getButtonADescription() /*override*/;
141
142 virtual ::std::string _getButtonBDescription() /*override*/;
143
144 virtual ::std::string _getButtonXDescription() /*override*/;
145
146 virtual ::std::string _getButtonYDescription() /*override*/;
147
148 virtual ::ui::ViewRequest _onContainerSlotHovered(::std::string const& collectionName, int index) /*override*/;
149
150 virtual ::ui::ViewRequest _onContainerSlotPressed(::std::string const& collectionName, int index) /*override*/;
151
152 virtual bool _onTouchScrollStartedWithSelectedSlot() /*override*/;
153
154 virtual ::std::string _getCollectionName(::UIPropertyBag* bag) const /*override*/;
155
156 virtual ::SlotData _reevaluateSlotData(::SlotData&& slotData) const /*override*/;
157
158 virtual bool _shouldSwap(
159 ::std::string const& collectionName,
160 int collectionIndex,
161 ::std::string const& otherCollectionName,
162 int otherCollectionIndex
163 ) const /*override*/;
164
165 virtual bool _isTargetSwappable(::std::string const& otherCollectionName, int otherCollectionIndex) const
166 /*override*/;
167
168 virtual void _sendFlyingItem(
169 ::ItemStackBase const& item,
170 ::std::string const& fromName,
171 int fromIndex,
172 ::std::string const& toName,
173 int toIndex,
174 ::FadeInIconBehavior fadeInIconBehavior
175 ) /*override*/;
176
177 virtual void _registerCoalesceOrder() /*override*/;
178
179 virtual void _registerAutoPlaceOrder() /*override*/;
180
181 virtual bool _isInCreativeContainer(::std::string const& containerName) const /*override*/;
182 // NOLINTEND
183
184public:
185 // member functions
186 // NOLINTBEGIN
187 MCNAPI CraftingScreenController(
188 ::std::shared_ptr<::ClientInstanceScreenModel> model,
189 ::Player& player,
190 ::BlockPos const& pos,
191 ::ActorUniqueID uniqueId,
192 ::CraftingType craftingType
193 );
194
195 MCNAPI bool _currentItemIsSelected(::std::string const& collectionName, int collectionIndex) const;
196
197 MCNAPI void _cycleLayout(int dir);
198
199 MCAPI void _evacuateCraftingGrid();
200
201 MCNAPI int _findNextLeftSideInventoryTab(int dir) const;
202
203 MCNAPI void _focusCollectionItem(::std::string const& collectionName, int collectionIndex, bool forceFocus);
204
205 MCNAPI void _handleRecipeSelect(::std::string const& collectionName, int collectionIndex, bool displayOnly);
206
207 MCNAPI bool _isConstructionTabVisible() const;
208
209 MCNAPI bool _isEquipmentTabVisible() const;
210
211 MCNAPI bool _isItemsTabVisible() const;
212
213 MCNAPI bool _isNatureTabVisible() const;
214
215 MCNAPI bool _isRecipeSlotCraftable(::SlotData const& slotData);
216
217 MCNAPI ::ui::ViewRequest
218 _recipeAutoCraft(::std::string const& collectionName, int collectionIndex, ::ItemCraftType craftType);
219
220 MCNAPI void _refreshFilters(::InventoryLeftTabIndex tab, bool forceRefresh);
221
223
225
226 MCNAPI void _setLeftSideInventoryTab(int tabIndex, bool saveOptions);
227
228 MCNAPI ::std::string _tabIndexToCollectionName(::InventoryLeftTabIndex index) const;
229
231 ::SlotData const& srcSlot,
232 ::ItemTakeType type,
233 ::ContainerEnumName containerName,
234 ::std::vector<::AutoPlaceResult>& autoPlaceResults
235 );
236 // NOLINTEND
237
238public:
239 // static functions
240 // NOLINTBEGIN
241 MCNAPI static void addStaticScreenVars(::Json::Value& globalVars, bool pocket);
242 // NOLINTEND
243
244public:
245 // static variables
246 // NOLINTBEGIN
247 MCNAPI static ::std::vector<::CraftingScreenController::CategoryTabInfo> const& mCategoryTabs();
248 // NOLINTEND
249
250public:
251 // constructor thunks
252 // NOLINTBEGIN
253 MCNAPI void* $ctor(
254 ::std::shared_ptr<::ClientInstanceScreenModel> model,
255 ::Player& player,
256 ::BlockPos const& pos,
257 ::ActorUniqueID uniqueId,
258 ::CraftingType craftingType
259 );
260 // NOLINTEND
261
262public:
263 // virtual function thunks
264 // NOLINTBEGIN
265 MCNAPI void $onOpen();
266
267 MCNAPI void $onEntered();
268
269 MCAPI void $onTerminate();
270
271 MCAPI ::ui::DirtyFlag $tick();
272
273 MCNAPI void $addStaticScreenVars(::Json::Value& globalVars);
274
275 MCNAPI void $showToast(::ToastMessage message, bool animateIn);
276
277 MCNAPI void $removeToast();
278
279 MCNAPI void $refreshToast();
280
281 MCNAPI bool $_isStillValid() const;
282
283 MCNAPI void $_handlePlaceAll(::std::string const& collectionName, int index);
284
285 MCAPI void $_handlePlaceOne(::std::string const& collectionName, int index);
286
287 MCNAPI void $_handleSelectSlot(::std::string const& collectionName, int collectionIndex);
288
289 MCAPI ::ItemStackBase const&
290 $_getVisualItemStackImpl(::std::string const& collectionName, int collectionIndex) const;
291
292 MCNAPI ::std::string $_getButtonADescription();
293
294 MCNAPI ::std::string $_getButtonBDescription();
295
296 MCNAPI ::std::string $_getButtonXDescription();
297
298 MCNAPI ::std::string $_getButtonYDescription();
299
300 MCAPI ::ui::ViewRequest $_onContainerSlotHovered(::std::string const& collectionName, int index);
301
302 MCNAPI ::ui::ViewRequest $_onContainerSlotPressed(::std::string const& collectionName, int index);
303
305
306 MCNAPI ::std::string $_getCollectionName(::UIPropertyBag* bag) const;
307
308 MCNAPI ::SlotData $_reevaluateSlotData(::SlotData&& slotData) const;
309
310 MCNAPI bool $_shouldSwap(
311 ::std::string const& collectionName,
312 int collectionIndex,
313 ::std::string const& otherCollectionName,
314 int otherCollectionIndex
315 ) const;
316
317 MCNAPI bool $_isTargetSwappable(::std::string const& otherCollectionName, int otherCollectionIndex) const;
318
319 MCNAPI void $_sendFlyingItem(
320 ::ItemStackBase const& item,
321 ::std::string const& fromName,
322 int fromIndex,
323 ::std::string const& toName,
324 int toIndex,
325 ::FadeInIconBehavior fadeInIconBehavior
326 );
327
329
331
332 MCNAPI bool $_isInCreativeContainer(::std::string const& containerName) const;
333 // NOLINTEND
334};
Definition BlockPos.h:14
Definition ClientInstanceScreenModel.h:5
Definition ContainerScreenController.h:5
Definition CraftingContainerManagerController.h:40
Definition CraftingScreenController.h:5
MCAPI void $_registerAutoPlaceOrder()
MCAPI bool _isNatureTabVisible() const
MCAPI bool _isEquipmentTabVisible() const
MCAPI::ui::ViewRequest $_onContainerSlotPressed(::std::string const &collectionName, int index)
MCAPI void _savePlayerInventoryOptions()
MCAPI void _handleRecipeSelect(::std::string const &collectionName, int collectionIndex, bool displayOnly)
MCAPI void _setLeftSideInventoryTab(int tabIndex, bool saveOptions)
MCAPI void _focusCollectionItem(::std::string const &collectionName, int collectionIndex, bool forceFocus)
MCAPI void * $ctor(::std::shared_ptr<::ClientInstanceScreenModel > model, ::Player &player, ::BlockPos const &pos, ::ActorUniqueID uniqueId, ::CraftingType craftingType)
MCAPI bool _currentItemIsSelected(::std::string const &collectionName, int collectionIndex) const
MCAPI::std::string $_getButtonBDescription()
MCAPI bool _isItemsTabVisible() const
MCAPI void _cycleLayout(int dir)
MCAPI void $_handleSelectSlot(::std::string const &collectionName, int collectionIndex)
MCAPI::std::string $_getButtonADescription()
MCAPI void _sendActiveLayoutInfo()
MCAPI::ui::ViewRequest _recipeAutoCraft(::std::string const &collectionName, int collectionIndex, ::ItemCraftType craftType)
MCAPI void $refreshToast()
MCAPI bool _isConstructionTabVisible() const
MCAPI int _tryAutoPlaceItemIntoContainer(::SlotData const &srcSlot, ::ItemTakeType type, ::ContainerEnumName containerName, ::std::vector<::AutoPlaceResult > &autoPlaceResults)
MCAPI void $_registerCoalesceOrder()
MCAPI::std::string $_getCollectionName(::UIPropertyBag *bag) const
MCAPI void _refreshFilters(::InventoryLeftTabIndex tab, bool forceRefresh)
MCAPI bool _isRecipeSlotCraftable(::SlotData const &slotData)
MCAPI::std::string $_getButtonYDescription()
MCAPI bool $_onTouchScrollStartedWithSelectedSlot()
MCAPI bool $_isInCreativeContainer(::std::string const &containerName) const
MCAPI bool $_shouldSwap(::std::string const &collectionName, int collectionIndex, ::std::string const &otherCollectionName, int otherCollectionIndex) const
MCAPI void $_sendFlyingItem(::ItemStackBase const &item, ::std::string const &fromName, int fromIndex, ::std::string const &toName, int toIndex, ::FadeInIconBehavior fadeInIconBehavior)
MCAPI::std::string _tabIndexToCollectionName(::InventoryLeftTabIndex index) const
MCAPI bool $_isStillValid() const
MCAPI void $addStaticScreenVars(::Json::Value &globalVars)
MCAPI::std::string $_getButtonXDescription()
MCAPI void $_handlePlaceAll(::std::string const &collectionName, int index)
MCAPI bool $_isTargetSwappable(::std::string const &otherCollectionName, int otherCollectionIndex) const
MCAPI void $showToast(::ToastMessage message, bool animateIn)
static MCAPI ::std::vector<::CraftingScreenController::CategoryTabInfo > const & mCategoryTabs()
MCAPI::SlotData $_reevaluateSlotData(::SlotData &&slotData) const
MCAPI int _findNextLeftSideInventoryTab(int dir) const
Definition IToastListener.h:5
Definition ItemStackBase.h:45
Definition Value.h:16
Definition Player.h:131
Definition ToastMessage.h:5
Definition UIPropertyBag.h:5
STL namespace.
Definition ActorUniqueID.h:5
Definition AutoPlaceResult.h:5
Definition CraftingScreenController.h:14
Definition CraftingScreenController.h:16
Definition SlotData.h:5