Skip to content

Commit

Permalink
fixed #8
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu-ZT committed Mar 24, 2024
1 parent be4496d commit 4ee4428
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,6 @@ public void buildRecipes(Consumer<FinishedRecipe> exporter) {
.unlockedBy(MyRecipesGenerator.hasItem(Items.DIAMOND), FabricRecipeProvider.has(Items.DIAMOND))
.unlockedBy(MyRecipesGenerator.hasItem(Items.AMETHYST_SHARD), FabricRecipeProvider.has(Items.AMETHYST_SHARD))
.save(exporter, AnvilCraft.of("craft_a_royal_steel_ingot"));
ItemAnvilRecipeBuilder.item(RecipeCategory.MISC)
.component(Blocks.IRON_TRAPDOOR)
.requires(Items.HEART_OF_THE_SEA)
.result(ModItems.SEED_OF_THE_SEA, 4)
.unlockedBy(MyRecipesGenerator.hasItem(Items.HEART_OF_THE_SEA), FabricRecipeProvider.has(Items.HEART_OF_THE_SEA))
.location(ItemAnvilRecipe.Location.UP)
.resultLocation(ItemAnvilRecipe.Location.IN)
.save(exporter);
ItemAnvilRecipeBuilder.item(RecipeCategory.MISC)
.component(Blocks.IRON_TRAPDOOR)
.requires(Items.WET_SPONGE)
.result(ModItems.SPONGE_GEMMULE, 2)
.unlockedBy(MyRecipesGenerator.hasItem(Items.WET_SPONGE), FabricRecipeProvider.has(Items.WET_SPONGE))
.location(ItemAnvilRecipe.Location.UP)
.resultLocation(ItemAnvilRecipe.Location.IN)
.save(exporter);
ItemAnvilRecipeBuilder.item(RecipeCategory.MISC)
.component(Blocks.IRON_TRAPDOOR)
.requires(Items.NETHER_STAR)
.result(ModItems.NETHER_STAR_SHARD, 4)
.unlockedBy(MyRecipesGenerator.hasItem(Items.NETHER_STAR), FabricRecipeProvider.has(Items.NETHER_STAR))
.location(ItemAnvilRecipe.Location.UP)
.resultLocation(ItemAnvilRecipe.Location.IN)
.save(exporter);
ItemAnvilRecipeBuilder.item(RecipeCategory.MISC)
.component(Blocks.SMITHING_TABLE)
.requires(Items.ANCIENT_DEBRIS)
Expand Down Expand Up @@ -153,6 +129,7 @@ public void buildRecipes(Consumer<FinishedRecipe> exporter) {
.location(ItemAnvilRecipe.Location.IN)
.resultLocation(ItemAnvilRecipe.Location.IN)
.save(exporter);
SmashRecipesGenerator.buildRecipes(exporter);
CookingRecipesGenerator.buildRecipes(exporter);
CompressRecipesGenerator.buildRecipes(exporter);
StampingRecipesGenerator.buildRecipes(exporter);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package dev.dubhe.anvilcraft.data.generator.recipe;

import dev.dubhe.anvilcraft.AnvilCraft;
import dev.dubhe.anvilcraft.data.generator.MyRecipesGenerator;
import dev.dubhe.anvilcraft.data.recipe.anvil.item.ItemAnvilRecipe;
import dev.dubhe.anvilcraft.data.recipe.anvil.item.ItemAnvilRecipeBuilder;
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.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
import org.jetbrains.annotations.NotNull;

import java.util.function.Consumer;

public abstract class SmashRecipesGenerator {
private SmashRecipesGenerator() {
}

public static void buildRecipes(Consumer<FinishedRecipe> exporter) {
smash(Items.HEART_OF_THE_SEA, ModItems.SEED_OF_THE_SEA, 4, exporter);
smash(Items.WET_SPONGE, ModItems.SPONGE_GEMMULE, 2, exporter);
smash(Items.NETHER_STAR, ModItems.NETHER_STAR_SHARD, 4, exporter);
smash(ModItems.HOLLOW_MAGNET_BLOCK, ModItems.MAGNET_INGOT, 8, exporter);
smash(ModItems.MAGNET_BLOCK, ModItems.MAGNET_INGOT, 9, exporter);
}

public static void smash(Item item, @NotNull Item item1, int count, Consumer<FinishedRecipe> exporter) {
ItemAnvilRecipeBuilder.item(RecipeCategory.MISC)
.requires(item)
.result(item1, count)
.component(Blocks.IRON_TRAPDOOR)
.location(ItemAnvilRecipe.Location.UP)
.resultLocation(ItemAnvilRecipe.Location.IN)
.unlockedBy(MyRecipesGenerator.hasItem(item), FabricRecipeProvider.has(item))
.save(exporter, AnvilCraft.of("smash/" + BuiltInRegistries.ITEM.getKey(item).getPath() + "_2_" + BuiltInRegistries.ITEM.getKey(item1).getPath()));
}
}

0 comments on commit 4ee4428

Please sign in to comment.