minecraft-pi-reborn/example-mods/recipes/recipes.cpp

58 lines
1.3 KiB
C++
Raw Permalink Normal View History

2022-06-27 18:47:55 +00:00
// Headers
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include <mods/misc/misc.h>
// Custom Crafting Recipes
2024-01-07 01:36:59 +00:00
static void Recipes_injection(Recipes *recipes) {
2022-06-27 18:47:55 +00:00
// Add
Recipes_Type type1 = {
.item = 0,
.tile = 0,
.instance = {
.count = 1,
.id = 12,
.auxiliary = 0
},
.letter = 'a'
};
Recipes_Type type2 = {
.item = 0,
.tile = 0,
.instance = {
.count = 1,
.id = 13,
.auxiliary = 0
},
.letter = 'b'
};
ItemInstance result = {
.count = 1,
.id = 344,
.auxiliary = 0
};
2024-01-07 01:36:59 +00:00
std::vector<Recipes_Type> types = {type1, type2};
2024-01-07 08:23:43 +00:00
Recipes_addShapelessRecipe(recipes, &result, &types);
2022-06-27 18:47:55 +00:00
}
// Custom Furnace Recipes
2024-01-07 01:36:59 +00:00
static void FurnaceRecipes_injection(FurnaceRecipes *recipes) {
2022-06-27 18:47:55 +00:00
// Add
2024-01-07 01:36:59 +00:00
ItemInstance result = {
.count = 1,
.id = 246,
.auxiliary = 0
};
2024-01-07 08:23:43 +00:00
FurnaceRecipes_addFurnaceRecipe(recipes, 49, &result);
2022-06-27 18:47:55 +00:00
}
// Init
__attribute__((constructor)) static void init_recipes() {
// Log
INFO("Loading Custom Recipes");
// Setup
misc_run_on_recipes_setup(Recipes_injection);
misc_run_on_furnace_recipes_setup(FurnaceRecipes_injection);
}