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