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;
26class SemVersion;
27class ShapedRecipe;
28class ShapelessRecipe;
29struct 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 MCFOLD 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 addNetMappedRecipe(::RecipeNetId const& recipeNetId, ::std::unique_ptr<::Recipe> recipe);
207
208 MCAPI void addRecipeListener(::std::weak_ptr<bool> lifePtr, ::std::function<void()> callback);
209
210 MCAPI void addShapedRecipe(
211 ::std::string recipeId,
212 ::ItemInstance const& result,
213 ::std::string const& r0,
214 ::std::vector<::Recipes::Type> const& types,
215 ::std::vector<::HashedString> const& tags,
216 int priority,
217 ::std::function<::std::unique_ptr<::ShapedRecipe>(
218 ::std::string,
219 int,
220 int,
221 ::std::vector<::RecipeIngredient> const&,
222 ::std::vector<::ItemInstance> const&,
224 bool,
225 int,
226 ::mce::UUID const*,
228 ::SemVersion const&
229 )> constructor,
230 ::RecipeUnlockingRequirement const& unlockingReq,
231 ::SemVersion const& formatVersion,
232 bool assumeSymmetry
233 );
234
235 MCAPI void addShapedRecipe(
236 ::std::string recipeId,
237 ::ItemInstance const& result,
238 ::std::vector<::std::string> const& rows,
239 ::std::vector<::Recipes::Type> const& types,
240 ::std::vector<::HashedString> const& tags,
241 int priority,
242 ::std::function<::std::unique_ptr<::ShapedRecipe>(
243 ::std::string,
244 int,
245 int,
246 ::std::vector<::RecipeIngredient> const&,
247 ::std::vector<::ItemInstance> const&,
249 bool,
250 int,
251 ::mce::UUID const*,
253 ::SemVersion const&
254 )> constructor,
255 ::RecipeUnlockingRequirement const& unlockingReq,
256 ::SemVersion const& formatVersion,
257 bool assumeSymmetry
258 );
259
260 MCAPI void addShapedRecipe(
261 ::std::string recipeId,
262 ::std::vector<::ItemInstance> const& result,
263 ::std::vector<::std::string> const& rows,
264 ::std::vector<::Recipes::Type> const& types,
265 ::std::vector<::HashedString> const& tags,
266 int priority,
267 ::std::function<::std::unique_ptr<::ShapedRecipe>(
268 ::std::string,
269 int,
270 int,
271 ::std::vector<::RecipeIngredient> const&,
272 ::std::vector<::ItemInstance> const&,
274 bool,
275 int,
276 ::mce::UUID const*,
278 ::SemVersion const&
279 )> constructor,
280 ::RecipeUnlockingRequirement const& unlockingReq,
281 ::SemVersion const& formatVersion,
282 bool assumeSymmetry
283 );
284
285 MCAPI void addShapedRecipe(
286 ::std::string recipeId,
287 ::ItemInstance const& result,
288 ::std::string const& r0,
289 ::std::string const& r1,
290 ::std::vector<::Recipes::Type> const& types,
291 ::std::vector<::HashedString> const& tags,
292 int priority,
293 ::std::function<::std::unique_ptr<::ShapedRecipe>(
294 ::std::string,
295 int,
296 int,
297 ::std::vector<::RecipeIngredient> const&,
298 ::std::vector<::ItemInstance> const&,
300 bool,
301 int,
302 ::mce::UUID const*,
304 ::SemVersion const&
305 )> constructor,
306 ::RecipeUnlockingRequirement const& unlockingReq,
307 ::SemVersion const& formatVersion,
308 bool assumeSymmetry
309 );
310
311 MCAPI void addShapedRecipe(
312 ::std::string recipeId,
313 ::ItemInstance const& result,
314 ::std::string const& r0,
315 ::std::string const& r1,
316 ::std::string const& r2,
317 ::std::vector<::Recipes::Type> const& types,
318 ::std::vector<::HashedString> const& tags,
319 int priority,
320 ::std::function<::std::unique_ptr<::ShapedRecipe>(
321 ::std::string,
322 int,
323 int,
324 ::std::vector<::RecipeIngredient> const&,
325 ::std::vector<::ItemInstance> const&,
327 bool,
328 int,
329 ::mce::UUID const*,
331 ::SemVersion const&
332 )> constructor,
333 ::RecipeUnlockingRequirement const& unlockingReq,
334 ::SemVersion const& formatVersion,
335 bool assumeSymmetry
336 );
337
338 MCAPI void addShapelessRecipe(
339 ::std::string recipeId,
340 ::ItemInstance const& result,
341 ::std::vector<::Recipes::Type> const& types,
342 ::std::vector<::HashedString> const& tags,
343 int priority,
344 ::std::function<::std::unique_ptr<::ShapelessRecipe>(
345 ::std::string,
346 ::std::vector<::RecipeIngredient> const&,
347 ::std::vector<::ItemInstance> const&,
349 int,
350 ::mce::UUID const*,
352 ::SemVersion const&
353 )> constructor,
354 ::RecipeUnlockingRequirement const& unlockingReq,
355 ::SemVersion const& formatVersion
356 );
357
358 MCAPI void addShulkerBoxRecipe(
359 ::std::string& recipeId,
360 ::ItemInstance const& result,
361 ::std::vector<::Recipes::Type> const& types,
362 ::std::vector<::HashedString> const& tags,
363 ::RecipeUnlockingRequirement const& unlockingReq,
364 ::SemVersion const& formatVersion
365 );
366
367 MCAPI void clearRecipes();
368
369 MCAPI ::SemVersion extractRecipeFormatVersion(::Json::Value const& obj);
370
371 MCAPI ::std::pair<::std::string, ::Json::Value> extractRecipeObjInfo(::Json::Value const& obj);
372
373 MCAPI void
374 forEachRecipeFor(::HashedString const& tag, ::std::function<void(::Recipe const&)> const& callback) const;
375
376 MCAPI void forEachRecipeFor(
377 ::std::vector<::std::string> const& tags,
378 ::std::function<void(::Recipe const&)> const& callback
379 ) const;
380
381 MCAPI void forEachRecipeFor(
382 ::ItemInstance const& result,
383 ::std::vector<::std::string> const& tags,
384 ::std::function<void(::Recipe const&)> const& callback
385 ) const;
386
387 MCAPI void forEachRecipeUntil(
388 ::ItemInstance const& result,
389 ::std::vector<::std::string> const& tags,
390 ::std::function<bool(::Recipe const&)> const& callback
391 ) const;
392
393 MCAPI ::ItemInstance getFurnaceRecipeResult(::ItemStackBase const& item, ::HashedString const& tag) const;
394
395 MCAPI ::Recipe const* getRecipeByNetId(::RecipeNetId const& netId) const;
396
397 MCAPI ::Recipe* getRecipeFor(::ItemInstance const& result, ::HashedString const& tag) const;
398
399 MCAPI void init(
400 ::ResourcePackManager& resourcePackManager,
401 ::ExternalRecipeStore& recipeStorage,
402 ::BaseGameVersion const& baseGameVersion,
403 ::Experiments const& experiments
404 );
405
406 MCAPI bool loadRecipe(
407 ::std::pair<::std::string, ::Json::Value> const& recipeObjInfo,
408 ::MinEngineVersion const& minEngineVersion,
409 ::SemVersion const& formatVersion,
410 bool isBaseGamePack
411 );
412
413 MCAPI void notifyRecipeListeners();
414
415 MCAPI ~Recipes();
416 // NOLINTEND
417
418public:
419 // static functions
420 // NOLINTBEGIN
421 MCAPI static ::Recipes::NormalizedRectangularRecipeResults
422 _normalizeRectangularRecipe(::std::vector<::std::string> const& rows);
423 // NOLINTEND
424
425public:
426 // constructor thunks
427 // NOLINTBEGIN
428 MCAPI void* $ctor(::Level* level);
429 // NOLINTEND
430
431public:
432 // destructor thunk
433 // NOLINTBEGIN
434 MCAPI void $dtor();
435 // NOLINTEND
436};
Definition BaseGameVersion.h:8
Definition Block.h:45
Definition Experiments.h:13
Definition ExternalRecipeStore.h:10
Definition HashedString.h:5
Definition ItemInstance.h:15
Definition ItemStackBase.h:38
Definition Item.h:66
Definition Value.h:16
Definition Level.h:246
Definition MinEngineVersion.h:10
Definition PackInstance.h:16
Definition RecipeIngredient.h:17
Definition RecipeUnlockingRequirement.h:10
Definition Recipe.h:27
Definition Recipes.h:66
Definition Recipes.h:35
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 ResourcePackManager.h:5
Definition SortItemInstanceIdAux.h:5