LeviLamina
Loading...
Searching...
No Matches
Recipes.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/string/HashedString.h"
7#include "mc/molang/MolangVersion.h"
8#include "mc/world/inventory/network/TypedServerNetId.h"
9#include "mc/world/item/ItemInstance.h"
10#include "mc/world/item/SortItemInstanceIdAux.h"
11#include "mc/world/item/crafting/ExternalRecipeStore.h"
12#include "mc/world/item/crafting/RecipeIngredient.h"
13
14// auto generated forward declare list
15// clang-format off
16class BaseGameVersion;
17class Block;
18class Experiments;
19class Item;
20class ItemStackBase;
21class Level;
23class PackInstance;
24class Recipe;
27class SemVersion;
28class ShapedRecipe;
29class ShapelessRecipe;
30struct RecipeNetIdTag;
31namespace Json { class Value; }
32namespace mce { class UUID; }
33// clang-format on
34
35class Recipes {
36public:
37 // Recipes inner types declare
38 // clang-format off
39 struct FurnaceRecipeKey;
41 class Type;
42 // clang-format on
43
44 // Recipes inner types define
46 public:
47 // member variables
48 // NOLINTBEGIN
49 ::ll::TypedStorage<4, 4, int> mID;
50 ::ll::TypedStorage<8, 48, ::HashedString> mTag;
51 // NOLINTEND
52
53 public:
54 // member functions
55 // NOLINTBEGIN
56 MCAPI ~FurnaceRecipeKey();
57 // NOLINTEND
58
59 public:
60 // destructor thunk
61 // NOLINTBEGIN
62 MCFOLD void $dtor();
63 // NOLINTEND
64 };
65
66 class Type {
67 public:
68 // member variables
69 // NOLINTBEGIN
70 ::ll::TypedStorage<8, 8, ::Item*> mItem;
71 ::ll::TypedStorage<8, 8, ::Block const*> mBlock;
72 ::ll::TypedStorage<8, 24, ::RecipeIngredient> mIngredient;
73 ::ll::TypedStorage<1, 1, char> mC;
74 // NOLINTEND
75
76 public:
77 // member functions
78 // NOLINTBEGIN
79 MCAPI ~Type();
80 // NOLINTEND
81
82 public:
83 // destructor thunk
84 // NOLINTBEGIN
85 MCAPI void $dtor();
86 // NOLINTEND
87 };
88
89 using TypeList = ::std::vector<::Recipes::Type>;
90
92 public:
93 // member variables
94 // NOLINTBEGIN
95 ::ll::TypedStorage<4, 4, int> mWidth;
96 ::ll::TypedStorage<4, 4, int> mHeight;
97 ::ll::TypedStorage<8, 32, ::std::string> mNormalizedResult;
98 ::ll::TypedStorage<8, 32, ::std::string> mWarning;
99 // NOLINTEND
100
101 public:
102 // member functions
103 // NOLINTBEGIN
105 // NOLINTEND
106
107 public:
108 // destructor thunk
109 // NOLINTBEGIN
110 MCNAPI void $dtor();
111 // NOLINTEND
112 };
113
114public:
115 // member variables
116 // NOLINTBEGIN
117 ::ll::TypedStorage<8, 8, ::ResourcePackManager*> mResourcePackManager;
118 ::ll::TypedStorage<8, 8, ::ExternalRecipeStore> mExternalRecipeStore;
119 ::ll::TypedStorage<8, 16, ::std::map<::HashedString, ::std::map<::std::string, ::std::shared_ptr<::Recipe>>>>
120 mRecipes;
121 ::ll::TypedStorage<8, 16, ::std::map<::Recipes::FurnaceRecipeKey, ::ItemInstance>> mFurnaceRecipes;
122 ::ll::TypedStorage<1, 1, bool> mInitializing;
123 ::ll::TypedStorage<
124 8,
125 16,
126 ::std::map<::ItemInstance, ::std::unordered_map<::std::string, ::Recipe*>, ::SortItemInstanceIdAux>>
127 mRecipesByOutput;
128 ::ll::TypedStorage<8, 64, ::std::unordered_map<::RecipeNetId, ::Recipe*>> mRecipesByNetId;
129 ::ll::TypedStorage<
130 8,
131 64,
132 ::std::unordered_map<uint64, ::std::unordered_map<uint64, ::std::shared_ptr<::std::vector<::ItemInstance>>>>>
133 mRecipesByInput;
134 ::ll::TypedStorage<8, 24, ::std::vector<::gsl::not_null<::Recipe*>>> mUnlockableRecipes;
135 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<::std::weak_ptr<bool>, ::std::function<void()>>>> mListeners;
136 ::ll::TypedStorage<8, 8, ::Level*> mLevel;
137 // NOLINTEND
138
139public:
140 // prevent constructor by default
141 Recipes();
142
143public:
144 // member functions
145 // NOLINTBEGIN
146 MCAPI explicit Recipes(::Level* level);
147
148 MCAPI void _addItemRecipe(::std::unique_ptr<::Recipe> recipe);
149
150 MCAPI void _addMapRecipes();
151
152 MCAPI bool _isRecipeValidToAdd(::Recipe const& recipe);
153
154 MCAPI bool _loadBrewingMix(::Json::Value const& objData, ::MinEngineVersion const& minEngineVersion);
155
156 MCAPI void _loadDataDrivenRecipes(::std::vector<::PackInstance> const& resourcePacksNewestToOldest);
157
158 MCAPI void _loadHardcodedRecipes(::BaseGameVersion const& baseGameVersion, ::Experiments const&);
159
160 MCAPI ::RecipeIngredient const _loadIngredientFromJson(
161 ::Json::Value const& obj,
162 ::MolangVersion molangVersion,
163 bool allowItemCount,
164 bool allowItemGroup
165 ) const;
166
167 MCAPI ::RecipeIngredient const
168 _loadInputIngredientFromJson(::Json::Value const& obj, ::MinEngineVersion const& minEngineVersion) const;
169
170 MCAPI bool _loadSmithingTransform(
171 ::Json::Value const& objData,
172 ::MolangVersion molangVersion,
173 ::std::string const& recipeId,
174 ::std::vector<::HashedString> const& tags
175 );
176
177 MCAPI bool _loadSmithingTrim(
178 ::Json::Value const& objData,
179 ::MolangVersion molangVersion,
180 ::std::string const& recipeId,
181 ::std::vector<::HashedString> const& tags
182 );
183
184 MCAPI ::std::optional<::RecipeUnlockingRequirement> _loadUnlockingRequirementFromJson(
185 ::Json::Value const& obj,
186 ::MolangVersion molangVersion,
187 ::std::string const& recipeId
188 ) const;
189
190 MCAPI void addDyedItemRecipe(
191 ::std::string recipeId,
192 ::ItemInstance const& result,
193 ::RecipeIngredient itemToDye,
195 ::RecipeUnlockingRequirement unlockingReq,
196 int priority,
197 ::SemVersion const& formatVersion
198 );
199
200 MCAPI void addFurnaceRecipeAuxData(
201 ::ItemInstance const& input,
202 ::ItemInstance const& result,
203 ::std::vector<::HashedString> const& tags
204 );
205
206 MCAPI void addShapedRecipe(
207 ::std::string recipeId,
208 ::ItemInstance const& result,
209 ::std::string const& r0,
210 ::std::vector<::Recipes::Type> const& types,
211 ::std::vector<::HashedString> const& tags,
212 int priority,
213 ::std::function<::std::unique_ptr<::ShapedRecipe>(
214 ::std::string,
215 int,
216 int,
217 ::std::vector<::RecipeIngredient> const&,
218 ::std::vector<::ItemInstance> const&,
220 bool,
221 int,
222 ::mce::UUID const*,
224 ::SemVersion const&
225 )> constructor,
226 ::RecipeUnlockingRequirement const& unlockingReq,
227 ::SemVersion const& formatVersion,
228 bool assumeSymmetry
229 );
230
231 MCAPI void addShapedRecipe(
232 ::std::string recipeId,
233 ::ItemInstance const& result,
234 ::std::vector<::std::string> const& rows,
235 ::std::vector<::Recipes::Type> const& types,
236 ::std::vector<::HashedString> const& tags,
237 int priority,
238 ::std::function<::std::unique_ptr<::ShapedRecipe>(
239 ::std::string,
240 int,
241 int,
242 ::std::vector<::RecipeIngredient> const&,
243 ::std::vector<::ItemInstance> const&,
245 bool,
246 int,
247 ::mce::UUID const*,
249 ::SemVersion const&
250 )> constructor,
251 ::RecipeUnlockingRequirement const& unlockingReq,
252 ::SemVersion const& formatVersion,
253 bool assumeSymmetry
254 );
255
256 MCAPI void addShapedRecipe(
257 ::std::string recipeId,
258 ::std::vector<::ItemInstance> const& result,
259 ::std::vector<::std::string> const& rows,
260 ::std::vector<::Recipes::Type> const& types,
261 ::std::vector<::HashedString> const& tags,
262 int priority,
263 ::std::function<::std::unique_ptr<::ShapedRecipe>(
264 ::std::string,
265 int,
266 int,
267 ::std::vector<::RecipeIngredient> const&,
268 ::std::vector<::ItemInstance> const&,
270 bool,
271 int,
272 ::mce::UUID const*,
274 ::SemVersion const&
275 )> constructor,
276 ::RecipeUnlockingRequirement const& unlockingReq,
277 ::SemVersion const& formatVersion,
278 bool assumeSymmetry
279 );
280
281 MCAPI void addShapedRecipe(
282 ::std::string recipeId,
283 ::ItemInstance const& result,
284 ::std::string const& r0,
285 ::std::string const& r1,
286 ::std::vector<::Recipes::Type> const& types,
287 ::std::vector<::HashedString> const& tags,
288 int priority,
289 ::std::function<::std::unique_ptr<::ShapedRecipe>(
290 ::std::string,
291 int,
292 int,
293 ::std::vector<::RecipeIngredient> const&,
294 ::std::vector<::ItemInstance> const&,
296 bool,
297 int,
298 ::mce::UUID const*,
300 ::SemVersion const&
301 )> constructor,
302 ::RecipeUnlockingRequirement const& unlockingReq,
303 ::SemVersion const& formatVersion,
304 bool assumeSymmetry
305 );
306
307 MCAPI void addShapedRecipe(
308 ::std::string recipeId,
309 ::ItemInstance const& result,
310 ::std::string const& r0,
311 ::std::string const& r1,
312 ::std::string const& r2,
313 ::std::vector<::Recipes::Type> const& types,
314 ::std::vector<::HashedString> const& tags,
315 int priority,
316 ::std::function<::std::unique_ptr<::ShapedRecipe>(
317 ::std::string,
318 int,
319 int,
320 ::std::vector<::RecipeIngredient> const&,
321 ::std::vector<::ItemInstance> const&,
323 bool,
324 int,
325 ::mce::UUID const*,
327 ::SemVersion const&
328 )> constructor,
329 ::RecipeUnlockingRequirement const& unlockingReq,
330 ::SemVersion const& formatVersion,
331 bool assumeSymmetry
332 );
333
334 MCAPI void addShapelessRecipe(
335 ::std::string recipeId,
336 ::ItemInstance const& result,
337 ::std::vector<::Recipes::Type> const& types,
338 ::std::vector<::HashedString> const& tags,
339 int priority,
340 ::std::function<::std::unique_ptr<::ShapelessRecipe>(
341 ::std::string,
342 ::std::vector<::RecipeIngredient> const&,
343 ::std::vector<::ItemInstance> const&,
345 int,
346 ::mce::UUID const*,
348 ::SemVersion const&
349 )> constructor,
350 ::RecipeUnlockingRequirement const& unlockingReq,
351 ::SemVersion const& formatVersion
352 );
353
354 MCAPI void addShulkerBoxRecipe(
355 ::std::string& recipeId,
356 ::ItemInstance const& result,
357 ::std::vector<::Recipes::Type> const& types,
358 ::std::vector<::HashedString> const& tags,
359 ::RecipeUnlockingRequirement const& unlockingReq,
360 ::SemVersion const& formatVersion
361 );
362
363 MCAPI void clearRecipes();
364
365 MCAPI ::SemVersion extractRecipeFormatVersion(::Json::Value const& obj);
366
367 MCAPI ::std::pair<::std::string, ::Json::Value> extractRecipeObjInfo(::Json::Value const& obj);
368
369 MCAPI ::ItemInstance getFurnaceRecipeResult(::ItemStackBase const& item, ::HashedString const& tag) const;
370
371 MCAPI ::Recipe const* getRecipeByNetId(::RecipeNetId const& netId) const;
372
373 MCAPI ::Recipe* getRecipeFor(::ItemInstance const& result, ::HashedString const& tag) const;
374
375 MCAPI void init(
376 ::ResourcePackManager& resourcePackManager,
377 ::ExternalRecipeStore& recipeStorage,
378 ::BaseGameVersion const& baseGameVersion,
379 ::Experiments const& experiments
380 );
381
382 MCAPI bool loadRecipe(
383 ::std::pair<::std::string, ::Json::Value> const& recipeObjInfo,
384 ::MinEngineVersion const& minEngineVersion,
385 ::SemVersion const& formatVersion,
386 bool isBaseGamePack
387 );
388
389 MCAPI ~Recipes();
390 // NOLINTEND
391
392public:
393 // static functions
394 // NOLINTBEGIN
395 MCAPI static ::Recipes::NormalizedRectangularRecipeResults
396 _normalizeRectangularRecipe(::std::vector<::std::string> const& rows);
397 // NOLINTEND
398
399public:
400 // constructor thunks
401 // NOLINTBEGIN
402 MCAPI void* $ctor(::Level* level);
403 // NOLINTEND
404
405public:
406 // destructor thunk
407 // NOLINTBEGIN
408 MCAPI void $dtor();
409 // NOLINTEND
410};
Definition BaseGameVersion.h:8
Definition Block.h:38
Definition Experiments.h:14
Definition ExternalRecipeStore.h:5
Definition HashedString.h:5
Definition ItemInstance.h:16
Definition ItemStackBase.h:35
Definition Item.h:65
Definition Value.h:16
Definition Level.h:239
Definition MinEngineVersion.h:10
Definition PackInstance.h:23
Definition RecipeIngredient.h:17
Definition RecipeUnlockingRequirement.h:10
Definition Recipe.h:29
Definition Recipes.h:66
Definition Recipes.h:35
Definition ResourcePackManager.h:24
Definition SemVersion.h:16
Definition ShapedRecipe.h:16
Definition ShapelessRecipe.h:16
Definition TypedServerNetId.h:6
Definition UUID.h:7
Definition RecipeNetIdTag.h:5
Definition Recipes.h:45
Definition SortItemInstanceIdAux.h:5