Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
Recipe.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/deps/core/string/HashedString.h"
5#include "mc/platform/UUID.h"
6#include "mc/world/item/crafting/RecipeIngredient.h"
7#include "mc/world/item/crafting/RecipeUnlockingRequirement.h"
8
9// auto generated inclusion list
10#include "mc/deps/core/sem_ver/SemVersion.h"
11#include "mc/deps/core/string/HashedString.h"
12#include "mc/platform/UUID.h"
13#include "mc/world/inventory/network/TypedServerNetId.h"
14#include "mc/world/item/crafting/RecipeUnlockingRequirement.h"
15
16// auto generated forward declare list
17// clang-format off
18class BlockPalette;
19class CompoundTag;
20class ContainerModel;
22class CraftingContext;
23class ItemDescriptor;
24class ItemInstance;
25class ItemStack;
29struct RecipeNetIdTag;
30// clang-format on
31
32class Recipe {
33public:
34 // Recipe inner types declare
35 // clang-format off
36 class Results;
38 // clang-format on
39
40 // Recipe inner types define
41 enum class IngredientSearchMode : int {
42 AllPermutations = 0,
43 FirstPermutation = 1,
44 };
45
46 class Results {
47 public:
48 // member variables
49 // NOLINTBEGIN
50 ::ll::TypedStorage<1, 1, bool> mResultsAreLoaded;
51 ::ll::TypedStorage<8, 24, ::std::vector<::ItemInstance>> mResults;
52 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkItemInstanceDescriptor>> mUnloadedResults;
53 // NOLINTEND
54
55 public:
56 // prevent constructor by default
57 Results();
58
59 public:
60 // member functions
61 // NOLINTBEGIN
62 MCNAPI explicit Results(::std::vector<::ItemInstance> const& results);
63
64#ifdef LL_PLAT_C
65 MCAPI void load(::BlockPalette const& blockPalette) const;
66#endif
67
68 MCAPI ~Results();
69 // NOLINTEND
70
71 public:
72 // constructor thunks
73 // NOLINTBEGIN
74 MCNAPI void* $ctor(::std::vector<::ItemInstance> const& results);
75 // NOLINTEND
76
77 public:
78 // destructor thunk
79 // NOLINTBEGIN
80 MCAPI void $dtor();
81 // NOLINTEND
82 };
83
85 public:
86 // member variables
87 // NOLINTBEGIN
88 ::ll::TypedStorage<8, 32, ::std::string> recipeId;
89 ::ll::TypedStorage<8, 24, ::std::vector<::RecipeIngredient>> ingredients;
90 ::ll::TypedStorage<8, 56, ::Recipe::Results> results;
91 ::ll::TypedStorage<8, 48, ::HashedString> tag;
92 ::ll::TypedStorage<4, 4, int> priority;
93 ::ll::TypedStorage<8, 8, ::mce::UUID const*> uuid;
94 ::ll::TypedStorage<8, 32, ::RecipeUnlockingRequirement> unlockingRequirement;
95 ::ll::TypedStorage<8, 24, ::SemVersion> formatVersion;
96 // NOLINTEND
97
98 public:
99 // member functions
100 // NOLINTBEGIN
101 MCAPI ~ConstructionContext();
102 // NOLINTEND
103
104 public:
105 // destructor thunk
106 // NOLINTBEGIN
107 MCAPI void $dtor();
108 // NOLINTEND
109 };
110
111 using Ingredients = ::std::vector<::RecipeIngredient>;
112
113 using ResultList = ::std::vector<::ItemInstance>;
114
115 using UnloadedItemInstanceResultList = ::std::vector<::NetworkItemInstanceDescriptor>;
116
117public:
118 // member variables
119 // NOLINTBEGIN
120 ::ll::TypedStorage<8, 32, ::std::string> mRecipeId;
121 ::ll::TypedStorage<8, 16, ::mce::UUID> mMyId;
122 ::ll::TypedStorage<4, 4, int> mWidth;
123 ::ll::TypedStorage<4, 4, int> mHeight;
124 ::ll::TypedStorage<4, 4, int> mPriority;
125 ::ll::TypedStorage<4, 4, ::RecipeNetId> mRecipeNetId;
126 ::ll::TypedStorage<8, 24, ::std::vector<::RecipeIngredient>> mMyIngredients;
127 ::ll::TypedStorage<8, 56, ::Recipe::Results> mResults;
128 ::ll::TypedStorage<8, 32, ::RecipeUnlockingRequirement> mUnlockingRequirement;
129 ::ll::TypedStorage<8, 24, ::SemVersion> mRecipeDataVersion;
130 ::ll::TypedStorage<8, 48, ::HashedString> mTag;
131 // NOLINTEND
132
133public:
134 // prevent constructor by default
135 Recipe();
136
137public:
138 // virtual functions
139 // NOLINTBEGIN
140 virtual ~Recipe();
141
142#ifdef LL_PLAT_S
143 virtual ::std::vector<::ItemInstance> const&
144 assemble(::CraftingContainer& craftingContainer, ::CraftingContext& craftingContext) const = 0;
145#else // LL_PLAT_C
146 virtual ::std::vector<::ItemInstance> const&
147 assemble(::CraftingContainer& craftSlots, ::CraftingContext& craftingContext) const = 0;
148#endif
149
150 virtual int getCraftingSize() const = 0;
151
152 virtual ::RecipeIngredient const& getIngredient(int x, int y) const = 0;
153
154 virtual bool isShapeless() const = 0;
155
156#ifdef LL_PLAT_S
157 virtual bool
158 matches(::CraftingContainer const& craftingContainer, ::CraftingContext const& craftingContext) const = 0;
159#else // LL_PLAT_C
160 virtual bool matches(::CraftingContainer const& craftSlots, ::CraftingContext const& craftingContext) const = 0;
161#endif
162
163 virtual int size() const = 0;
164
165 virtual ::mce::UUID const& getId() const;
166
167 virtual ::std::vector<::ItemInstance> const& getResultItems() const;
168
169 virtual bool isMultiRecipe() const;
170
171 virtual bool hasDataDrivenResult() const;
172
173 virtual bool
174 itemValidForRecipe(::ItemDescriptor const& recipeItem, ::ItemStack const& item, ::CraftingContext const*) const;
175
176 virtual bool itemsMatch(::ItemDescriptor const& lhs, ::ItemDescriptor const& rhs) const;
177
178 virtual bool
179 itemsMatch(::ItemDescriptor const& lhs, ::ItemDescriptor const& rhs, ::CompoundTag const* rhsTag) const;
180
181 virtual uint64 getIngredientsHash() const;
182 // NOLINTEND
183
184public:
185 // member functions
186 // NOLINTBEGIN
187 MCAPI explicit Recipe(::Recipe::ConstructionContext&& context);
188
189#ifdef LL_PLAT_C
190 MCNAPI ::IngredientSearchResults checkContainerItemsForUsability(
191 ::std::vector<::ContainerModel*> const& containers,
192 ::CraftingContext const* craftingContext,
193 ::Recipe::IngredientSearchMode searchMode
194 ) const;
195#endif
196
197 MCNAPI int countQuantityOfIngredient(::ItemInstance const& ingredient) const;
198 // NOLINTEND
199
200public:
201 // static functions
202 // NOLINTBEGIN
203 MCNAPI static bool isAnyAuxValue(::ItemDescriptor const& ii);
204 // NOLINTEND
205
206public:
207 // constructor thunks
208 // NOLINTBEGIN
209 MCAPI void* $ctor(::Recipe::ConstructionContext&& context);
210 // NOLINTEND
211
212public:
213 // destructor thunk
214 // NOLINTBEGIN
215 MCAPI void $dtor();
216 // NOLINTEND
217
218public:
219 // virtual function thunks
220 // NOLINTBEGIN
221 MCFOLD ::mce::UUID const& $getId() const;
222
223 MCFOLD ::std::vector<::ItemInstance> const& $getResultItems() const;
224
225 MCFOLD bool $isMultiRecipe() const;
226
227 MCFOLD bool $hasDataDrivenResult() const;
228
229 MCAPI bool
230 $itemValidForRecipe(::ItemDescriptor const& recipeItem, ::ItemStack const& item, ::CraftingContext const*) const;
231
232 MCAPI bool $itemsMatch(::ItemDescriptor const& lhs, ::ItemDescriptor const& rhs) const;
233
234 MCAPI bool $itemsMatch(::ItemDescriptor const& lhs, ::ItemDescriptor const& rhs, ::CompoundTag const* rhsTag) const;
235
236 MCAPI uint64 $getIngredientsHash() const;
237
238
239 // NOLINTEND
240
241public:
242 // vftables
243 // NOLINTBEGIN
244 MCNAPI static void** $vftable();
245 // NOLINTEND
246};
Definition BlockPalette.h:18
Definition CompoundTag.h:18
Definition ContainerModel.h:23
Definition CraftingContainer.h:14
Definition CraftingContext.h:21
Definition ItemDescriptor.h:24
Definition ItemInstance.h:15
Definition ItemStack.h:26
Definition NetworkItemInstanceDescriptor.h:17
Definition RecipeIngredient.h:8
Definition Recipe.h:46
MCAPI Results(::std::vector<::ItemInstance > const &results)
MCAPI void * $ctor(::std::vector<::ItemInstance > const &results)
static MCAPI bool isAnyAuxValue(::ItemDescriptor const &ii)
MCAPI int countQuantityOfIngredient(::ItemInstance const &ingredient) const
static MCAPI void ** $vftable()
Definition IngredientSearchResults.h:10
Definition RecipeNetIdTag.h:5
Definition Recipe.h:84
Definition context.h:5