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 MCAPI CraftingScreenController(
188 ::std::shared_ptr<::ClientInstanceScreenModel> model,
189 ::Player& player,
190 ::BlockPos const& pos,
191 ::ActorUniqueID uniqueId,
192 ::CraftingType craftingType
193 );
194
195 MCAPI bool _currentItemIsSelected(::std::string const& collectionName, int collectionIndex) const;
196
197 MCAPI void _cycleLayout(int dir);
198
199 MCAPI void _evacuateCraftingGrid();
200
201 MCAPI int _findNextLeftSideInventoryTab(int dir) const;
202
203 MCAPI void _focusCollectionItem(::std::string const& collectionName, int collectionIndex, bool forceFocus);
204
205 MCAPI void _handleCraftItem(::ItemCraftType);
206
207 MCAPI void _handleRecipeSelect(::std::string const& collectionName, int collectionIndex, bool displayOnly);
208
209 MCAPI bool _isConstructionTabVisible() const;
210
211 MCAPI bool _isEquipmentTabVisible() const;
212
213 MCAPI bool _isItemsTabVisible() const;
214
215 MCAPI bool _isNatureTabVisible() const;
216
217 MCAPI bool _isRecipeSlotCraftable(::SlotData const& slotData);
218
219 MCAPI ::ui::ViewRequest
220 _recipeAutoCraft(::std::string const& collectionName, int collectionIndex, ::ItemCraftType craftType);
221
222 MCAPI void _refreshFilters(::InventoryLeftTabIndex tab, bool forceRefresh);
223
224 MCAPI void _savePlayerInventoryOptions();
225
226 MCAPI void _sendActiveLayoutInfo();
227
228 MCAPI void _setLeftSideInventoryTab(int tabIndex, bool saveOptions);
229
230 MCAPI ::std::string _tabIndexToCollectionName(::InventoryLeftTabIndex index) const;
231
232 MCAPI int _tryAutoPlaceItemIntoContainer(
233 ::SlotData const& srcSlot,
234 ::ItemTakeType type,
235 ::ContainerEnumName containerName,
236 ::std::vector<::AutoPlaceResult>& autoPlaceResults
237 );
238 // NOLINTEND
239
240public:
241 // static functions
242 // NOLINTBEGIN
243 MCAPI static void addStaticScreenVars(::Json::Value& globalVars, bool pocket);
244 // NOLINTEND
245
246public:
247 // static variables
248 // NOLINTBEGIN
249 MCAPI static ::std::vector<::CraftingScreenController::CategoryTabInfo> const& mCategoryTabs();
250 // NOLINTEND
251
252public:
253 // constructor thunks
254 // NOLINTBEGIN
255 MCAPI void* $ctor(
256 ::std::shared_ptr<::ClientInstanceScreenModel> model,
257 ::Player& player,
258 ::BlockPos const& pos,
259 ::ActorUniqueID uniqueId,
260 ::CraftingType craftingType
261 );
262 // NOLINTEND
263
264public:
265 // virtual function thunks
266 // NOLINTBEGIN
267 MCAPI void $onOpen();
268
269 MCAPI void $onEntered();
270
271 MCAPI void $onTerminate();
272
273 MCAPI ::ui::DirtyFlag $tick();
274
275 MCAPI void $addStaticScreenVars(::Json::Value& globalVars);
276
277 MCAPI void $showToast(::ToastMessage message, bool animateIn);
278
279 MCAPI void $removeToast();
280
281 MCAPI void $refreshToast();
282
283 MCAPI bool $_isStillValid() const;
284
285 MCAPI void $_handlePlaceAll(::std::string const& collectionName, int index);
286
287 MCAPI void $_handlePlaceOne(::std::string const& collectionName, int index);
288
289 MCAPI void $_handleSelectSlot(::std::string const& collectionName, int collectionIndex);
290
291 MCAPI ::ItemStackBase const&
292 $_getVisualItemStackImpl(::std::string const& collectionName, int collectionIndex) const;
293
294 MCAPI ::std::string $_getButtonADescription();
295
296 MCAPI ::std::string $_getButtonBDescription();
297
298 MCAPI ::std::string $_getButtonXDescription();
299
300 MCAPI ::std::string $_getButtonYDescription();
301
302 MCAPI ::ui::ViewRequest $_onContainerSlotHovered(::std::string const& collectionName, int index);
303
304 MCAPI ::ui::ViewRequest $_onContainerSlotPressed(::std::string const& collectionName, int index);
305
306 MCAPI bool $_onTouchScrollStartedWithSelectedSlot();
307
308 MCAPI ::std::string $_getCollectionName(::UIPropertyBag* bag) const;
309
310 MCAPI ::SlotData $_reevaluateSlotData(::SlotData&& slotData) const;
311
312 MCAPI bool $_shouldSwap(
313 ::std::string const& collectionName,
314 int collectionIndex,
315 ::std::string const& otherCollectionName,
316 int otherCollectionIndex
317 ) const;
318
319 MCAPI bool $_isTargetSwappable(::std::string const& otherCollectionName, int otherCollectionIndex) const;
320
321 MCAPI void $_sendFlyingItem(
322 ::ItemStackBase const& item,
323 ::std::string const& fromName,
324 int fromIndex,
325 ::std::string const& toName,
326 int toIndex,
327 ::FadeInIconBehavior fadeInIconBehavior
328 );
329
330 MCAPI void $_registerCoalesceOrder();
331
332 MCAPI void $_registerAutoPlaceOrder();
333
334 MCAPI bool $_isInCreativeContainer(::std::string const& containerName) const;
335 // NOLINTEND
336};
Definition BlockPos.h:17
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 Value.h:16
Definition Player.h:129
Definition ToastMessage.h:5
Definition UIPropertyBag.h:5
Definition ActorUniqueID.h:5
Definition AutoPlaceResult.h:5
Definition CraftingScreenController.h:14
Definition CraftingScreenController.h:16