Skip to content

Commit

Permalink
Merge pull request #129 from Gu-ZT/recipe
Browse files Browse the repository at this point in the history
修复牛肉炖蘑菇配方不耗水
  • Loading branch information
Gu-ZT authored Apr 1, 2024
2 parents bebe4a9 + 7adf89b commit b5e96a4
Showing 1 changed file with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
import dev.dubhe.anvilcraft.data.recipe.anvil.AnvilRecipe;
import dev.dubhe.anvilcraft.init.ModItems;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LayeredCauldronBlock;
import net.minecraft.world.phys.Vec3;

import java.util.Map;
import java.util.function.Consumer;

public abstract class CookingRecipesGenerator {
Expand All @@ -36,6 +39,33 @@ public static void cook(Item item, int count, Item item1, int count1, Consumer<F
.hasItemIngredient(new Vec3(0.0, -1.0, 0.0), count, item)
.spawnItem(item1, count1)
.unlockedBy(MyRecipesGenerator.hasItem(item), FabricRecipeProvider.has(item))
.save(exporter);
.save(exporter, "cook/" + BuiltInRegistries.ITEM.getKey(item1).getPath());
}

public static void boil(Item item, int count, Item item1, int count1, Consumer<FinishedRecipe> exporter) {
AnvilRecipe.Builder.create(RecipeCategory.FOOD)
.hasBlock(Blocks.WATER_CAULDRON, new Vec3(0.0, -1.0, 0.0), Map.entry(LayeredCauldronBlock.LEVEL, 1))
.hasBlock(new Vec3(0.0, -2.0, 0.0), BlockTags.CAMPFIRES)
.hasItemIngredient(new Vec3(0.0, -1.0, 0.0), count, item)
.setBlock(Blocks.CAULDRON)
.spawnItem(item1, count1)
.unlockedBy(MyRecipesGenerator.hasItem(item), FabricRecipeProvider.has(item))
.save(exporter, "boil/" + BuiltInRegistries.ITEM.getKey(item1).getPath() + "_1");
AnvilRecipe.Builder.create(RecipeCategory.FOOD)
.hasBlock(Blocks.WATER_CAULDRON, new Vec3(0.0, -1.0, 0.0), Map.entry(LayeredCauldronBlock.LEVEL, 2))
.hasBlock(new Vec3(0.0, -2.0, 0.0), BlockTags.CAMPFIRES)
.hasItemIngredient(new Vec3(0.0, -1.0, 0.0), count, item)
.setBlock(Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 1))
.spawnItem(item1, count1)
.unlockedBy(MyRecipesGenerator.hasItem(item), FabricRecipeProvider.has(item))
.save(exporter, "boil/" + BuiltInRegistries.ITEM.getKey(item1).getPath() + "_2");
AnvilRecipe.Builder.create(RecipeCategory.FOOD)
.hasBlock(Blocks.WATER_CAULDRON, new Vec3(0.0, -1.0, 0.0), Map.entry(LayeredCauldronBlock.LEVEL, 3))
.hasBlock(new Vec3(0.0, -2.0, 0.0), BlockTags.CAMPFIRES)
.hasItemIngredient(new Vec3(0.0, -1.0, 0.0), count, item)
.setBlock(Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 2))
.spawnItem(item1, count1)
.unlockedBy(MyRecipesGenerator.hasItem(item), FabricRecipeProvider.has(item))
.save(exporter, "boil/" + BuiltInRegistries.ITEM.getKey(item1).getPath() + "_3");
}
}

0 comments on commit b5e96a4

Please sign in to comment.