From b5e9a91f751be91fe7f73a388347c9b751d64c22 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Sun, 22 Sep 2024 20:02:40 -0400 Subject: [PATCH] Test Crafting Remainder --- example-mods/recipes/recipes.cpp | 9 ++++++++- mods/src/misc/misc.cpp | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/example-mods/recipes/recipes.cpp b/example-mods/recipes/recipes.cpp index 5c1d559d5d..c372d07f55 100644 --- a/example-mods/recipes/recipes.cpp +++ b/example-mods/recipes/recipes.cpp @@ -4,6 +4,7 @@ #include // Custom Crafting Recipes +#define SAND 12 static void Recipes_injection(Recipes *recipes) { // Add Recipes_Type type1 = { @@ -11,7 +12,7 @@ static void Recipes_injection(Recipes *recipes) { .tile = 0, .instance = { .count = 1, - .id = 12, + .id = SAND, .auxiliary = 0 }, .letter = 'a' @@ -54,4 +55,10 @@ __attribute__((constructor)) static void init_recipes() { // Setup misc_run_on_recipes_setup(Recipes_injection); misc_run_on_furnace_recipes_setup(FurnaceRecipes_injection); + + // Recipe Remainder + overwrite_calls(Minecraft_init, [](Minecraft_init_t original, Minecraft *self) { + original(self); + Item::items[SAND]->craftingRemainingItem = Item::snowball; + }); } diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index fe7afdd97d..ccf899fb74 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -250,7 +250,7 @@ static ItemInstance *Item_getCraftingRemainingItem_injection(__attribute__((unus if (self->craftingRemainingItem != nullptr) { ItemInstance *ret = new ItemInstance; ret->id = self->craftingRemainingItem->id; - ret->count = item_instance->count; + ret->count = 1; ret->auxiliary = 0; return ret; }