generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix smoker miscellaneous recipe group
- Loading branch information
1 parent
6b57319
commit b01cbcb
Showing
9 changed files
with
29 additions
and
25 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/main/generated/.cache/23ea077d1d6c303dee4db4b707eb3883dc4bc6bb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/generated/.cache/9ac78b54b5833f183877ec224e276c4aea5aac3a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/generated/data/caffeinated/recipe/coffee_beans_from_campfire_cooking.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/generated/data/caffeinated/recipe/coffee_beans_from_smoking.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 7 additions & 8 deletions
15
src/main/java/net/chikorita_lover/caffeinated/mixin/CookingRecipeJsonBuilderMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |