LeviLamina
Loading...
Searching...
No Matches
CraftingContainerManagerController.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/world/containers/SlotData.h"
7#include "mc/world/containers/controllers/ItemCraftType.h"
8#include "mc/world/containers/controllers/ItemTakeType.h"
9#include "mc/world/containers/managers/controllers/ContainerManagerController.h"
10#include "mc/world/containers/managers/controllers/CraftingSessionInfo.h"
11#include "mc/world/item/ItemInstance.h"
12#include "mc/world/level/BlockChangedEventTarget.h"
13#include "mc/world/level/BlockSourceListener.h"
14
15// auto generated forward declare list
16// clang-format off
17class Actor;
18class Block;
19class BlockPos;
20class BlockSource;
23class ItemStack;
24class ItemStackBase;
25class Recipe;
26class Recipes;
28struct AutoPlaceItem;
29struct AutoPlaceResult;
33struct ItemStateData;
36struct SelectedSlotInfo;
38// clang-format on
39
40class CraftingContainerManagerController : public ::ContainerManagerController {
41public:
42 // CraftingContainerManagerController inner types declare
43 // clang-format off
45 // clang-format on
46
47 // CraftingContainerManagerController inner types define
48 struct BlockChangeListener : public ::BlockSourceListener {
49 public:
50 // member variables
51 // NOLINTBEGIN
55 // NOLINTEND
56
57 public:
58 // prevent constructor by default
59 BlockChangeListener& operator=(BlockChangeListener const&);
60 BlockChangeListener(BlockChangeListener const&);
61 BlockChangeListener();
62
63 public:
64 // virtual functions
65 // NOLINTBEGIN
66 virtual ~BlockChangeListener() /*override*/ = default;
67
68 virtual void onBlockChanged(
69 ::BlockSource& source,
70 ::BlockPos const& pos,
71 uint layer,
72 ::Block const& block,
73 ::Block const& oldBlock,
74 int updateFlags,
75 ::ActorBlockSyncMessage const* syncMsg,
76 ::BlockChangedEventTarget eventTarget,
77 ::Actor* blockChangeSource
78 ) /*override*/;
79
80 virtual void onSourceDestroyed(::BlockSource& source) /*override*/;
81 // NOLINTEND
82
83 public:
84 // virtual function thunks
85 // NOLINTBEGIN
86#ifdef LL_PLAT_C
87 MCNAPI void $onBlockChanged(
88 ::BlockSource& source,
89 ::BlockPos const& pos,
90 uint layer,
91 ::Block const& block,
92 ::Block const& oldBlock,
93 int updateFlags,
94 ::ActorBlockSyncMessage const* syncMsg,
95 ::BlockChangedEventTarget eventTarget,
96 ::Actor* blockChangeSource
97 );
98
99 MCNAPI void $onSourceDestroyed(::BlockSource& source);
100#endif
101
102
103 // NOLINTEND
104
105 public:
106 // vftables
107 // NOLINTBEGIN
108 MCNAPI static void** $vftable();
109 // NOLINTEND
110 };
111
112public:
113 // member variables
114 // NOLINTBEGIN
115 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::CraftingContainerManagerModel>> mCraftingContainerManagerModel;
116 ::ll::TypedStorage<4, 4, int> mGridSize;
117 ::ll::TypedStorage<8, 8, ::Recipes*> mLevelRecipes;
118 ::ll::TypedStorage<8, 24, ::std::vector<::std::reference_wrapper<::Recipe const>>> mRecipes;
119 ::ll::TypedStorage<8, 8, ::Recipe const*> mCraftingRecipe;
120 ::ll::TypedStorage<8, 8, ::Recipe const*> mSelectedRecipe;
121 ::ll::TypedStorage<1, 1, bool> mDisplayingInvalidRecipe;
122 ::ll::TypedStorage<1, 1, bool> mClearInputGridOnChange;
123 ::ll::TypedStorage<8, 40, ::SlotData const> mCreatedItemOutputSlot;
124 ::ll::TypedStorage<8, 24, ::std::vector<::ItemStateData>> mSavedInventoryState;
125 ::ll::TypedStorage<8, 48, ::CraftingSessionInfo> mCraftingInformation;
126 ::ll::TypedStorage<8, 24, ::std::vector<::ItemStack>> mRemainingItems;
127 ::ll::TypedStorage<8, 128, ::ItemInstance> mResultPreviewItem;
128 ::ll::TypedStorage<8, 24, ::std::vector<::ItemInstance>> mAllResults;
129 ::ll::TypedStorage<8, 16, ::std::shared_ptr<bool>> mListenerLifeIndicator;
130 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CraftingContainerManagerController::BlockChangeListener>>
131 mBlockChangeListener;
132 ::ll::TypedStorage<1, 1, bool> mCloseCraftingContainer;
133 ::ll::TypedStorage<1, 1, bool> mIsCrafting;
134 // NOLINTEND
135
136#ifdef LL_PLAT_S
137#else // LL_PLAT_C
138public:
139 // prevent constructor by default
140 CraftingContainerManagerController();
141
142#endif
143public:
144 // virtual functions
145 // NOLINTBEGIN
146#ifdef LL_PLAT_S
147 virtual ~CraftingContainerManagerController() /*override*/ = default;
148#else // LL_PLAT_C
149 virtual ~CraftingContainerManagerController() /*override*/;
150#endif
151
152#ifdef LL_PLAT_S
153 virtual bool isOutputSlot(::std::string const&) const /*override*/;
154#else // LL_PLAT_C
155 virtual bool isOutputSlot(::std::string const& collectionName) const /*override*/;
156#endif
157
158#ifdef LL_PLAT_S
159 virtual void handleTakeAmount(::SlotData const&, int, ::SlotData const&) /*override*/;
160#else // LL_PLAT_C
161 virtual void handleTakeAmount(::SlotData const& dstSlot, int amount, ::SlotData const& srcSlot) /*override*/;
162#endif
163
164#ifdef LL_PLAT_S
165 virtual void handleTakeAll(::SlotData const&, ::SlotData const&) /*override*/;
166#else // LL_PLAT_C
167 virtual void handleTakeAll(::SlotData const& dstSlot, ::SlotData const& srcSlot) /*override*/;
168#endif
169
170#ifdef LL_PLAT_S
171 virtual void handlePlaceAll(::SelectedSlotInfo const&, ::SlotData const&) /*override*/;
172#else // LL_PLAT_C
173 virtual void handlePlaceAll(::SelectedSlotInfo const& selected, ::SlotData const& dstSlot) /*override*/;
174#endif
175
176#ifdef LL_PLAT_S
177 virtual void handleTakeHalf(::SlotData const&, ::SlotData const&) /*override*/;
178#else // LL_PLAT_C
179 virtual void handleTakeHalf(::SlotData const& dstSlot, ::SlotData const& srcSlot) /*override*/;
180#endif
181
182#ifdef LL_PLAT_S
183 virtual void handlePlaceOne(::SlotData const&, ::SlotData const&) /*override*/;
184#else // LL_PLAT_C
185 virtual void handlePlaceOne(::SlotData const& srcSlot, ::SlotData const& dstSlot) /*override*/;
186#endif
187
188#ifdef LL_PLAT_S
189 virtual int handleAutoPlace(
190 ::SlotData const&,
191 int,
192 ::std::vector<::AutoPlaceItem> const&,
193 ::std::vector<::AutoPlaceResult>&
194 ) /*override*/;
195#else // LL_PLAT_C
196 virtual int handleAutoPlace(
197 ::SlotData const& srcSlot,
198 int amount,
199 ::std::vector<::AutoPlaceItem> const& autoPlaceOrder,
200 ::std::vector<::AutoPlaceResult>& destinations
201 ) /*override*/;
202#endif
203
204#ifdef LL_PLAT_S
205 virtual int handleAutoPlaceStack(
206 ::SlotData const&,
207 ::ItemTakeType,
208 ::std::vector<::AutoPlaceItem> const&,
209 ::std::vector<::AutoPlaceResult>&
210 ) /*override*/;
211#else // LL_PLAT_C
212 virtual int handleAutoPlaceStack(
213 ::SlotData const& srcSlot,
214 ::ItemTakeType type,
215 ::std::vector<::AutoPlaceItem> const& autoPlaceOrder,
216 ::std::vector<::AutoPlaceResult>& destinations
217 ) /*override*/;
218#endif
219
220#ifdef LL_PLAT_S
221 virtual void handleSplitSingle(::SlotData const&, ::SlotData const&) /*override*/;
222#else // LL_PLAT_C
223 virtual void handleSplitSingle(::SlotData const& srcSlot, ::SlotData const& dstSlot) /*override*/;
224#endif
225
226#ifdef LL_PLAT_S
227 virtual void handleSplitMultiple(::SelectedSlotInfo const&, ::ItemInstance const&, ::SlotData const&) /*override*/;
228#else // LL_PLAT_C
229 virtual void handleSplitMultiple(
230 ::SelectedSlotInfo const& selected,
231 ::ItemInstance const& itemTemplate,
232 ::SlotData const& dstSlot
233 ) /*override*/;
234#endif
235
236#ifdef LL_PLAT_S
237 virtual void handleAddToStack(::SlotData const&, ::SlotData const&, ::ItemTakeType) /*override*/;
238#else // LL_PLAT_C
239 virtual void
240 handleAddToStack(::SlotData const& dstSlot, ::SlotData const& srcSlot, ::ItemTakeType type) /*override*/;
241#endif
242
243#ifdef LL_PLAT_S
244 virtual bool handleDrop(::SlotData const&, ::ItemTransferAmount const) /*override*/;
245#else // LL_PLAT_C
246 virtual bool handleDrop(::SlotData const& srcSlot, ::ItemTransferAmount const transferAmount) /*override*/;
247#endif
248
249 virtual void closeContainers() /*override*/;
250
251#ifdef LL_PLAT_S
252 virtual ::ItemStackBase const& getTakeableItemStackBase(::SlotData const&) const /*override*/;
253#else // LL_PLAT_C
254 virtual ::ItemStackBase const& getTakeableItemStackBase(::SlotData const& slot) const /*override*/;
255#endif
256
257 // NOLINTEND
258
259public:
260 // member functions
261 // NOLINTBEGIN
262#ifdef LL_PLAT_C
263 MCNAPI explicit CraftingContainerManagerController(
264 ::std::weak_ptr<::CraftingContainerManagerModel> containerManagerModel
265 );
266
267 MCNAPI ::std::vector<::ItemInstance> _craftItem(::ItemStackRequestScope const& requestScope, uchar craftCount);
268
269 MCNAPI void _filterRecipes();
270
271 MCNAPI ::std::vector<::RecipeSearchResult>
272 _getRecipesForItem(::ItemInstance const& recipeItem, ::std::vector<::std::string> const& tags, bool);
273
274 MCNAPI void _handleItemCraftedEvents(
275 ::ItemInstance const& resultItem,
276 ::std::vector<short> const& ingredientIds,
277 ::ShapedRecipeTriggeredEvent const& shapedRecipeTriggeredEvent
278 );
279
280 MCNAPI bool _handleTransferCraft(::SlotData const& srcSlot, ::SlotData const& dstSlot);
281
282 MCNAPI void _handleTransferCraftExtraResults(::std::vector<::ItemInstance>& allResults);
283
284 MCNAPI bool _inventoryContainsItemForRecipeInputSlot(::std::string const& containerName, int collectionIndex) const;
285
286 MCNAPI ::CreateContainerItemScope _makeCreateItemScopeCrafting(
287 ::SlotData const& srcSlot,
288 ::ItemTransferAmount const& takeAmount,
289 ::std::vector<::ItemInstance>& allResults
290 );
291
292 MCNAPI ::CreateContainerItemScope
293 _makeCreateItemScopeCreative(::SlotData const& srcSlot, ::ItemTransferAmount const& takeAmount);
294
295 MCNAPI void _setupCallbacks();
296
297 MCNAPI void _updateCraftingResultItem();
298
299 MCNAPI bool
300 autoCraftItem(::SlotData const& recipeSlot, ::ItemCraftType craftAmount, ::std::vector<::AutoPlaceItem> const&);
301
302 MCNAPI void clearAllRecipes();
303
304 MCNAPI void evacuateCraftingContainerToInventory(
305 ::ContainerController* container,
306 ::std::vector<::AutoPlaceItem> const& autoPlace
307 );
308
309 MCNAPI int getBackgroundStyle(::std::string const& containerName, int collectionIndex) const;
310
311 MCNAPI ::CraftableCountingData getCraftableCount(::ItemInstance const& item);
312
313 MCNAPI ::CraftingSessionInfo& getCraftingInformation();
314
315 MCNAPI ::Recipe const* getCurrentRecipe() const;
316
317 MCNAPI ::std::string const& getExpandoItemGroupName(::std::string const& collectionName, int collectionIndex);
318
319 MCNAPI ::ItemInstance const& getGhostItem(::std::string const& collectionName, int collectionIndex) const;
320
321 MCNAPI int getIndexForCreativeItem(::std::string const& collectionName, ::ItemStackBase const& item) const;
322
323 MCNAPI ::ItemInstance const& getRecipeItem(::std::string const& collectionName, int collectionIndex) const;
324
325 MCNAPI ::std::string const& getSearchString() const;
326
327 MCNAPI void handleRecipeSelect(
328 ::std::string const& collectionName,
329 int collectionIndex,
330 bool displayOnly,
331 ::std::vector<::AutoPlaceItem> const& autoPlace
332 );
333
334 MCNAPI bool hasIngredientSetChanged(::ItemStack const& inHand);
335
336 MCNAPI bool isCraftingTableValid(float pickRange);
337
338 MCNAPI bool isCreativeContainer(::std::string const& containerName) const;
339
340 MCNAPI bool isExpandableItemFiltered(::std::string const& collectionName, int collectionIndex) const;
341
342 MCNAPI bool isTakeableContainer(::std::string const& containerName) const;
343
344 MCNAPI void resetCraftingInformation();
345
346 MCNAPI void setIsFiltering(bool filtering);
347
348 MCNAPI bool setLastCraftedItem(::ItemInstance const& item);
349
350 MCNAPI void setOnItemExpandedCallback(::std::function<void(::std::string const&, int, int)> callback);
351
352 MCNAPI void setSearchString(::std::string const& searchString);
353
354 MCNAPI void switchExpandoItem(::std::string const& collectionName, int collectionIndex);
355
356 MCNAPI bool tick();
357#endif
358 // NOLINTEND
359
360public:
361 // constructor thunks
362 // NOLINTBEGIN
363#ifdef LL_PLAT_C
364 MCNAPI void* $ctor(::std::weak_ptr<::CraftingContainerManagerModel> containerManagerModel);
365#endif
366 // NOLINTEND
367
368public:
369 // destructor thunk
370 // NOLINTBEGIN
371 MCNAPI void $dtor();
372 // NOLINTEND
373
374public:
375 // virtual function thunks
376 // NOLINTBEGIN
377#ifdef LL_PLAT_C
378 MCNAPI bool $isOutputSlot(::std::string const& collectionName) const;
379
380 MCNAPI void $handleTakeAmount(::SlotData const& dstSlot, int amount, ::SlotData const& srcSlot);
381
382 MCNAPI void $handleTakeAll(::SlotData const& dstSlot, ::SlotData const& srcSlot);
383
384 MCNAPI void $handlePlaceAll(::SelectedSlotInfo const& selected, ::SlotData const& dstSlot);
385
386 MCNAPI void $handleTakeHalf(::SlotData const& dstSlot, ::SlotData const& srcSlot);
387
388 MCNAPI void $handlePlaceOne(::SlotData const& srcSlot, ::SlotData const& dstSlot);
389
390 MCNAPI int $handleAutoPlace(
391 ::SlotData const& srcSlot,
392 int amount,
393 ::std::vector<::AutoPlaceItem> const& autoPlaceOrder,
394 ::std::vector<::AutoPlaceResult>& destinations
395 );
396
397 MCNAPI int $handleAutoPlaceStack(
398 ::SlotData const& srcSlot,
399 ::ItemTakeType type,
400 ::std::vector<::AutoPlaceItem> const& autoPlaceOrder,
401 ::std::vector<::AutoPlaceResult>& destinations
402 );
403
404 MCNAPI void $handleSplitSingle(::SlotData const& srcSlot, ::SlotData const& dstSlot);
405
406 MCNAPI void $handleSplitMultiple(
407 ::SelectedSlotInfo const& selected,
408 ::ItemInstance const& itemTemplate,
409 ::SlotData const& dstSlot
410 );
411
412 MCNAPI void $handleAddToStack(::SlotData const& dstSlot, ::SlotData const& srcSlot, ::ItemTakeType type);
413
414 MCNAPI bool $handleDrop(::SlotData const& srcSlot, ::ItemTransferAmount const transferAmount);
415
416 MCNAPI void $closeContainers();
417
418 MCNAPI ::ItemStackBase const& $getTakeableItemStackBase(::SlotData const& slot) const;
419#endif
420
421
422 // NOLINTEND
423
424public:
425 // vftables
426 // NOLINTBEGIN
427 MCNAPI static void** $vftable();
428 // NOLINTEND
429};
Definition Actor.h:125
Definition BlockPos.h:21
Definition BlockSourceListener.h:18
Definition BlockSource.h:73
Definition Block.h:69
Definition ContainerController.h:21
static MCAPI void ** $vftable()
Definition CraftingContainerManagerModel.h:25
Definition ItemInstance.h:15
Definition ItemStackBase.h:52
Definition ItemStack.h:35
Definition Recipe.h:32
Definition Recipes.h:36
Definition ActorBlockSyncMessage.h:8
Definition AutoPlaceItem.h:5
Definition AutoPlaceResult.h:5
Definition CraftableCountingData.h:5
Definition CraftingContainerManagerController.h:48
Definition CreateContainerItemScope.h:18
Definition ItemStackRequestScope.h:16
Definition ItemStateData.h:10
Definition ItemTransferAmount.h:9
Definition RecipeSearchResult.h:5
Definition SelectedSlotInfo.h:10
Definition ShapedRecipeTriggeredEvent.h:10
Definition SlotData.h:10
Definition Alias.h:14