Skip to content

Commit

Permalink
Fix smoker miscellaneous recipe group
Browse files Browse the repository at this point in the history
  • Loading branch information
Chikorita-Lover committed Sep 18, 2024
1 parent 6b57319 commit b01cbcb
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-09-09T19:53:17.0429302 Caffeinated/Block Loot Tables
// 1.21 2024-09-17T22:54:59.3347647 Caffeinated/Block Loot Tables
548d115eeb79b74d3fbe03951bdc179110ed6f8a data\caffeinated\loot_table\blocks\ground_coffee_cauldron.json
8b8e67a4f2fbd3f51a69d1359cceb2704429f4c3 data\caffeinated\loot_table\blocks\coffee_berry_crate.json
d481f7802dfc0e83cd271518b47e73b256a24d2f data\caffeinated\loot_table\blocks\flowering_coffee_shrub.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-09-09T19:53:17.0429302 Caffeinated/Advancements
// 1.21 2024-09-17T22:54:59.3347647 Caffeinated/Advancements
bcaa279e3e0ad8280ebfe57370201ce6290340a1 data\caffeinated\advancement\husbandry\brew_coffee.json
3a0446170026d8aa5bbef46b956c9373eb0a91c8 data\caffeinated\advancement\husbandry\bake_tiramisu.json
fd764b415f61cad9c185cf3c952535113b90044f data\caffeinated\advancement\husbandry\brew_all_coffee.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// 1.21 2024-09-09T19:53:17.0439243 Caffeinated/Recipes
// 1.21 2024-09-17T22:54:59.3357799 Caffeinated/Recipes
c773cd5c995b67602b5f054f551a8f5d6f33d139 data\caffeinated\advancement\recipes\misc\coffee_beans.json
c9b5cb066d0fab702915da1774fdd48fcbc57229 data\caffeinated\advancement\recipes\misc\coffee_beans_from_smoking.json
6061a7a2ef7b2febcca08d801ffce55d131fda2b data\caffeinated\recipe\tiramisu_from_slices.json
9e061efc3626a119413e61ca86a53990ab4f8a8a data\caffeinated\advancement\recipes\misc\ground_coffee_from_coffee_beans.json
b8e94b6ab3e5b643e335a6036992426d7e3ed11c data\caffeinated\advancement\recipes\building_blocks\coffee_bean_block.json
861e142a5a287eba94cf46a7d37342304f9ad285 data\caffeinated\recipe\ground_coffee_block.json
afc5ab486779e47ce326b86ef93037905639d03a data\caffeinated\recipe\coffee_beans_from_smoking.json
f0185fd7adf812d29e6e5a362c792d604a300a06 data\caffeinated\recipe\coffee_beans_from_smoking.json
51cbbbc43481615db699ce0878398bb475466f96 data\caffeinated\advancement\recipes\building_blocks\ground_coffee_block.json
31f69cf23ef6a168c6d98a8fef731d470bcbb187 data\caffeinated\recipe\coffee_berries.json
081e951942029c81b7edec2c02074e4b47d00d3d data\caffeinated\recipe\ground_coffee_from_coffee_beans.json
Expand All @@ -22,7 +22,7 @@ a3089cb10cc080957830e10d1b276e6fb8e2845c data\caffeinated\advancement\recipes\fo
72418a991f973fb5cf728affdcbfde7d5818b251 data\caffeinated\advancement\recipes\food\coffee_bottle.json
1410b08380530f562102b9d54fde26a7163b2256 data\caffeinated\advancement\recipes\food\latte_coffee_bottle.json
145d4111298037135c323e1347f67b3871daaa3e data\caffeinated\recipe\java_banner_pattern.json
fd6bc1e87eab4e2bccc5d198e5bca2730df804db data\caffeinated\recipe\coffee_beans_from_campfire_cooking.json
3fbc068c16e4d63163f1d495c7a7c8cbefdf9ad0 data\caffeinated\recipe\coffee_beans_from_campfire_cooking.json
cf353bc3103b1834f861ecb7a2da0ae56550bb65 data\caffeinated\recipe\cafe_miel_coffee_bottle.json
514280f7d04586c23693c1dae8cf30241a810a24 data\caffeinated\advancement\recipes\building_blocks\coffee_berry_crate.json
e1d9fbf68af558ba9d59fc35535075266be4d5fe data\caffeinated\recipe\tiramisu.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-09-09T19:53:17.0388447 Caffeinated/Model Definitions
// 1.21 2024-09-17T22:54:59.3329635 Caffeinated/Model Definitions
da4528a3cfafc1ab21e5814b64029c10ec357178 assets\caffeinated\blockstates\ground_coffee_block.json
26f35f3a03b0d53578efd2c555721b08353d75f0 assets\caffeinated\blockstates\coffee_cauldron.json
b1a481861132973fe035c9b9ce7613e15938034c assets\caffeinated\models\block\coffee_berry_crate.json
Expand All @@ -15,8 +15,8 @@ cdbc1b9ed3c8b04b24b80402af15eb777423817d assets\caffeinated\models\block\ground_
86a7f801b70c8f877d0e3d52a8bce349a9232c4f assets\caffeinated\models\block\ground_coffee_block.json
37d547b30cad973f0223896df68f15c5eea49d4b assets\caffeinated\models\item\ground_coffee_block.json
2e82d1add55c94e56c5b85172449dc9ff539882d assets\caffeinated\models\block\coffee_cauldron_full.json
fe9155058173a06c1325878e72a8f42b0acfb9d7 assets\caffeinated\models\block\coffee_shrub_stage1.json
63ec6c618a3a23eab4cab9c52d7d3250de9b516e assets\caffeinated\models\item\civet_spawn_egg.json
fe9155058173a06c1325878e72a8f42b0acfb9d7 assets\caffeinated\models\block\coffee_shrub_stage1.json
2078aae9dd460adbf0bf14e46615e32012f351e8 assets\caffeinated\blockstates\ground_coffee_cauldron.json
865a21f6601205d70079dbcc9d2bc9d375fbbc73 assets\caffeinated\models\block\coffee_bean_block.json
16db00fbb67b98528c1a99e61640adc411cc4cff assets\caffeinated\models\item\tiramisu.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "minecraft:campfire_cooking",
"category": "food",
"category": "misc",
"cookingtime": 600,
"experience": 0.3,
"ingredient": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "minecraft:smoking",
"category": "food",
"category": "misc",
"cookingtime": 100,
"experience": 0.3,
"ingredient": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
import net.minecraft.item.Items;
import net.minecraft.recipe.CampfireCookingRecipe;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.SmokingRecipe;
import net.minecraft.recipe.book.RecipeCategory;
import net.minecraft.registry.RegistryWrapper;

Expand All @@ -30,8 +33,8 @@ public void generate(RecipeExporter exporter) {
final RecipeExporter farmersDelightExporter = this.withConditions(exporter, ResourceConditions.allModsLoaded("farmersdelight"));

CookingRecipeJsonBuilder.createSmelting(Ingredient.ofItems(CaffeinatedItems.COFFEE_BERRIES), RecipeCategory.MISC, CaffeinatedItems.COFFEE_BEANS, 0.3F, 200).criterion(hasItem(CaffeinatedItems.COFFEE_BERRIES), conditionsFromItem(CaffeinatedItems.COFFEE_BERRIES)).offerTo(exporter);
CookingRecipeJsonBuilder.createSmoking(Ingredient.ofItems(CaffeinatedItems.COFFEE_BERRIES), RecipeCategory.MISC, CaffeinatedItems.COFFEE_BEANS, 0.3F, 100).criterion(hasItem(CaffeinatedItems.COFFEE_BERRIES), conditionsFromItem(CaffeinatedItems.COFFEE_BERRIES)).offerTo(exporter, Caffeinated.of(getItemPath(CaffeinatedItems.COFFEE_BEANS) + "_from_smoking"));
CookingRecipeJsonBuilder.createCampfireCooking(Ingredient.ofItems(CaffeinatedItems.COFFEE_BERRIES), RecipeCategory.MISC, CaffeinatedItems.COFFEE_BEANS, 0.3F, 600).criterion(hasItem(CaffeinatedItems.COFFEE_BERRIES), conditionsFromItem(CaffeinatedItems.COFFEE_BERRIES)).offerTo(exporter, Caffeinated.of(getItemPath(CaffeinatedItems.COFFEE_BEANS) + "_from_campfire_cooking"));
CookingRecipeJsonBuilder.create(Ingredient.ofItems(CaffeinatedItems.COFFEE_BERRIES), RecipeCategory.MISC, CaffeinatedItems.COFFEE_BEANS, 0.3F, 100, RecipeSerializer.SMOKING, SmokingRecipe::new).criterion(hasItem(CaffeinatedItems.COFFEE_BERRIES), conditionsFromItem(CaffeinatedItems.COFFEE_BERRIES)).offerTo(exporter, Caffeinated.of(getItemPath(CaffeinatedItems.COFFEE_BEANS) + "_from_smoking"));
CookingRecipeJsonBuilder.create(Ingredient.ofItems(CaffeinatedItems.COFFEE_BERRIES), RecipeCategory.MISC, CaffeinatedItems.COFFEE_BEANS, 0.3F, 600, RecipeSerializer.CAMPFIRE_COOKING, CampfireCookingRecipe::new).criterion(hasItem(CaffeinatedItems.COFFEE_BERRIES), conditionsFromItem(CaffeinatedItems.COFFEE_BERRIES)).offerTo(exporter, Caffeinated.of(getItemPath(CaffeinatedItems.COFFEE_BEANS) + "_from_campfire_cooking"));

offer2x2CompactingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, CaffeinatedBlocks.COFFEE_BEAN_BLOCK, CaffeinatedItems.COFFEE_BEANS);
offer2x2CompactingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, CaffeinatedBlocks.GROUND_COFFEE_BLOCK, CaffeinatedItems.GROUND_COFFEE);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package net.chikorita_lover.caffeinated.mixin;

import com.chocohead.mm.api.ClassTinkerers;
import net.chikorita_lover.caffeinated.Caffeinated;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.sugar.Local;
import net.chikorita_lover.caffeinated.registry.CaffeinatedRecipeTypes;
import net.minecraft.client.recipebook.ClientRecipeBook;
import net.minecraft.client.recipebook.RecipeBookGroup;
Expand All @@ -28,13 +29,14 @@ private static void getGroupForRecipe(RecipeEntry<?> recipe, CallbackInfoReturna
}
}

@Inject(method = "getGroupForRecipe", at = @At("RETURN"), cancellable = true)
private static void getGroupForCookingRecipe(RecipeEntry<?> recipe, CallbackInfoReturnable<RecipeBookGroup> cir) {
@ModifyReturnValue(method = "getGroupForRecipe", at = @At("RETURN"))
private static RecipeBookGroup getGroupForCookingRecipe(RecipeBookGroup group, @Local(argsOnly = true) RecipeEntry<?> recipe) {
if (recipe.value() instanceof AbstractCookingRecipe cookingRecipe) {
CookingRecipeCategory cookingRecipeCategory = cookingRecipe.getCategory();
if (cir.getReturnValue() == RecipeBookGroup.SMOKER_FOOD && cookingRecipeCategory == CookingRecipeCategory.MISC) {
cir.setReturnValue(SMOKER_MISC);
CookingRecipeCategory category = cookingRecipe.getCategory();
if (group == RecipeBookGroup.SMOKER_FOOD && category != CookingRecipeCategory.FOOD) {
return SMOKER_MISC;
}
}
return group;
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
package net.chikorita_lover.caffeinated.mixin;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.data.server.recipe.CookingRecipeJsonBuilder;
import net.minecraft.item.ItemConvertible;
import net.minecraft.recipe.AbstractCookingRecipe;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.book.CookingRecipeCategory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(CookingRecipeJsonBuilder.class)
public class CookingRecipeJsonBuilderMixin {
@Inject(method = "getCookingRecipeCategory", at = @At("HEAD"), cancellable = true)
private static void getCookingRecipeCategory(RecipeSerializer<? extends AbstractCookingRecipe> serializer, ItemConvertible output, CallbackInfoReturnable<CookingRecipeCategory> cir) {
if (serializer == RecipeSerializer.SMOKING || serializer == RecipeSerializer.CAMPFIRE_COOKING) {
cir.setReturnValue(output.asItem().getComponents().contains(DataComponentTypes.FOOD) ? CookingRecipeCategory.FOOD : CookingRecipeCategory.MISC);
@ModifyReturnValue(method = "getCookingRecipeCategory", at = @At("RETURN"))
private static CookingRecipeCategory getCookingRecipeCategory(CookingRecipeCategory category, @Local(argsOnly = true) ItemConvertible output) {
if (category == CookingRecipeCategory.FOOD && !output.asItem().getComponents().contains(DataComponentTypes.FOOD)) {
return CookingRecipeCategory.MISC;
}
return category;
}
}

0 comments on commit b01cbcb

Please sign in to comment.