Skip to content

Commit

Permalink
[F] Fix generated namespace.
Browse files Browse the repository at this point in the history
Signed-off-by: 秋雨落 <[email protected]>
  • Loading branch information
qyl27 committed Jan 23, 2025
1 parent 88afa8f commit 8903bb9
Showing 1 changed file with 79 additions and 53 deletions.
132 changes: 79 additions & 53 deletions src/main/java/cx/rain/mc/toast/generator/data/ModRecipeProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import cx.rain.mc.toast.generator.utility.Naming;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.data.recipes.*;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.*;
import net.minecraft.world.level.ItemLike;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -44,30 +43,30 @@ protected void buildRecipes() {
.pattern("III")
.pattern("I I")
.define('I', Items.IRON_NUGGET)
.unlockedBy("iron_nugget", has(Items.IRON_NUGGET))
.unlockedBy(getHasName(Items.IRON_NUGGET), has(Items.IRON_NUGGET))
.save(output, Naming.modRecipe("chainmail_helmet"));
shaped(RecipeCategory.COMBAT, Items.CHAINMAIL_CHESTPLATE)
.group("chainmail_armors")
.pattern("I I")
.pattern("III")
.pattern("III")
.define('I', Items.IRON_NUGGET)
.unlockedBy("iron_nugget", has(Items.IRON_NUGGET))
.unlockedBy(getHasName(Items.IRON_NUGGET), has(Items.IRON_NUGGET))
.save(output, Naming.modRecipe("chainmail_chestplate"));
shaped(RecipeCategory.COMBAT, Items.CHAINMAIL_LEGGINGS)
.group("chainmail_armors")
.pattern("III")
.pattern("I I")
.pattern("I I")
.define('I', Items.IRON_NUGGET)
.unlockedBy("iron_nugget", has(Items.IRON_NUGGET))
.unlockedBy(getHasName(Items.IRON_NUGGET), has(Items.IRON_NUGGET))
.save(output, Naming.modRecipe("chainmail_legging"));
shaped(RecipeCategory.COMBAT, Items.CHAINMAIL_BOOTS)
.group("chainmail_armors")
.pattern("I I")
.pattern("I I")
.define('I', Items.IRON_NUGGET)
.unlockedBy("iron_nugget", has(Items.IRON_NUGGET))
.unlockedBy(getHasName(Items.IRON_NUGGET), has(Items.IRON_NUGGET))
.save(output, Naming.modRecipe("chainmail_boots"));

shaped(RecipeCategory.MISC, Items.ENCHANTED_GOLDEN_APPLE, 2)
Expand All @@ -78,25 +77,22 @@ protected void buildRecipes() {
.define('B', Items.GOLD_BLOCK)
.define('E', Items.ENCHANTED_GOLDEN_APPLE)
.define('A', Items.GOLDEN_APPLE)
.unlockedBy("gold_block", has(Items.GOLD_BLOCK))
.unlockedBy("enchanted_golden_apple", has(Items.ENCHANTED_GOLDEN_APPLE))
.unlockedBy("golden_apple", has(Items.GOLDEN_APPLE))
.unlockedBy(getHasName(Items.GOLD_BLOCK), has(Items.GOLD_BLOCK))
.unlockedBy(getHasName(Items.ENCHANTED_GOLDEN_APPLE), has(Items.ENCHANTED_GOLDEN_APPLE))
.unlockedBy(getHasName(Items.GOLDEN_APPLE), has(Items.GOLDEN_APPLE))
.save(output, Naming.modRecipe("enchanted_golden_apple"));

shapeless(RecipeCategory.MISC, Items.GLOW_INK_SAC)
.group("misc")
.requires(Items.INK_SAC)
.requires(ModTags.Items.GLOWING)
.unlockedBy("ink", has(Items.INK_SAC))
.unlockedBy("glowing", has(ModTags.Items.GLOWING))
.unlockedBy(getHasName(Items.INK_SAC), has(Items.INK_SAC))
.unlockedBy("has_glowing", has(ModTags.Items.GLOWING))
.save(output, Naming.modRecipe("glow_ink_sac"));

oreSmelting(List.of(Items.RAW_IRON_BLOCK), RecipeCategory.MISC, Items.IRON_BLOCK, 6,1600, "raw_block_smelting");
oreBlasting(List.of(Items.RAW_IRON_BLOCK), RecipeCategory.MISC, Items.IRON_BLOCK, 6,800, "raw_block_smelting");
oreSmelting(List.of(Items.RAW_COPPER_BLOCK), RecipeCategory.MISC, Items.COPPER_BLOCK, 6,1600, "raw_block_smelting");
oreBlasting(List.of(Items.RAW_COPPER_BLOCK), RecipeCategory.MISC, Items.COPPER_BLOCK, 6,800, "raw_block_smelting");
oreSmelting(List.of(Items.RAW_GOLD_BLOCK), RecipeCategory.MISC, Items.GOLD_BLOCK, 6,1600, "raw_block_smelting");
oreBlasting(List.of(Items.RAW_GOLD_BLOCK), RecipeCategory.MISC, Items.GOLD_BLOCK, 6,800, "raw_block_smelting");
oreProcessing(Items.RAW_IRON_BLOCK, Items.IRON_BLOCK, 6,1600);
oreProcessing(Items.RAW_COPPER_BLOCK, Items.COPPER_BLOCK, 6,1600);
oreProcessing(Items.RAW_GOLD_BLOCK, Items.GOLD_BLOCK, 6,1600);

woodCutter(Items.OAK_LOG, Items.OAK_WOOD, Items.STRIPPED_OAK_LOG, Items.STRIPPED_OAK_WOOD, Items.OAK_PLANKS, Items.OAK_STAIRS, Items.OAK_SLAB);
woodCutter(Items.SPRUCE_LOG, Items.SPRUCE_WOOD, Items.STRIPPED_SPRUCE_LOG, Items.STRIPPED_SPRUCE_WOOD, Items.SPRUCE_PLANKS, Items.SPRUCE_STAIRS, Items.SPRUCE_SLAB);
Expand All @@ -111,46 +107,76 @@ protected void buildRecipes() {
woodCutter(Items.WARPED_STEM, Items.WARPED_HYPHAE, Items.STRIPPED_WARPED_STEM, Items.STRIPPED_WARPED_HYPHAE, Items.WARPED_PLANKS, Items.WARPED_STAIRS, Items.WARPED_SLAB);

{
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Items.STRIPPED_BAMBOO_BLOCK, Items.BAMBOO_BLOCK);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Items.BAMBOO_PLANKS, Items.STRIPPED_BAMBOO_BLOCK, 2);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Items.BAMBOO_PLANKS, Items.BAMBOO_BLOCK, 2);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Items.BAMBOO_MOSAIC, Items.STRIPPED_BAMBOO_BLOCK, 2);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Items.BAMBOO_MOSAIC, Items.BAMBOO_BLOCK, 2);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Items.BAMBOO_MOSAIC, Items.BAMBOO_PLANKS);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Items.BAMBOO_STAIRS, Items.BAMBOO_PLANKS);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Items.BAMBOO_SLAB, Items.BAMBOO_PLANKS, 2);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Items.BAMBOO_MOSAIC_STAIRS, Items.BAMBOO_MOSAIC);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Items.BAMBOO_MOSAIC_SLAB, Items.BAMBOO_MOSAIC, 2);
stoneCutting(Items.BAMBOO_BLOCK, Items.STRIPPED_BAMBOO_BLOCK, RecipeCategory.BUILDING_BLOCKS, "bamboo_cutting");
stoneCutting(Items.STRIPPED_BAMBOO_BLOCK, Items.BAMBOO_PLANKS, 2, RecipeCategory.BUILDING_BLOCKS, "bamboo_cutting");
stoneCutting(Items.BAMBOO_BLOCK, Items.BAMBOO_PLANKS, 2, RecipeCategory.BUILDING_BLOCKS, "bamboo_cutting");
stoneCutting(Items.STRIPPED_BAMBOO_BLOCK, Items.BAMBOO_MOSAIC, 2, RecipeCategory.BUILDING_BLOCKS, "bamboo_cutting");
stoneCutting(Items.BAMBOO_BLOCK, Items.BAMBOO_MOSAIC, 2, RecipeCategory.BUILDING_BLOCKS, "bamboo_cutting");
stoneCutting(Items.BAMBOO_PLANKS, Items.BAMBOO_MOSAIC, RecipeCategory.BUILDING_BLOCKS, "bamboo_cutting");
stoneCutting(Items.BAMBOO_PLANKS, Items.BAMBOO_STAIRS, RecipeCategory.BUILDING_BLOCKS, "bamboo_cutting");
stoneCutting(Items.BAMBOO_PLANKS, Items.BAMBOO_SLAB, 2, RecipeCategory.BUILDING_BLOCKS, "bamboo_cutting");
stoneCutting(Items.BAMBOO_MOSAIC, Items.BAMBOO_MOSAIC_STAIRS, RecipeCategory.BUILDING_BLOCKS, "bamboo_cutting");
stoneCutting(Items.BAMBOO_MOSAIC, Items.BAMBOO_MOSAIC_SLAB, 2, RecipeCategory.BUILDING_BLOCKS, "bamboo_cutting");
}

stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.WHITE_STAINED_GLASS_PANE, Items.WHITE_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.ORANGE_STAINED_GLASS_PANE, Items.ORANGE_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.MAGENTA_STAINED_GLASS_PANE, Items.MAGENTA_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.LIGHT_BLUE_STAINED_GLASS_PANE, Items.LIGHT_BLUE_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.YELLOW_STAINED_GLASS_PANE, Items.YELLOW_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.LIME_STAINED_GLASS_PANE, Items.LIME_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.PINK_STAINED_GLASS_PANE, Items.PINK_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.GRAY_STAINED_GLASS_PANE, Items.GRAY_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.LIGHT_GRAY_STAINED_GLASS_PANE, Items.LIGHT_GRAY_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.CYAN_STAINED_GLASS_PANE, Items.CYAN_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.PURPLE_STAINED_GLASS_PANE, Items.PURPLE_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.BLUE_STAINED_GLASS_PANE, Items.BLUE_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.BROWN_STAINED_GLASS_PANE, Items.BROWN_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.GREEN_STAINED_GLASS_PANE, Items.GREEN_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.RED_STAINED_GLASS_PANE, Items.RED_STAINED_GLASS, 4);
stonecutterResultFromBase(RecipeCategory.DECORATIONS, Items.BLACK_STAINED_GLASS_PANE, Items.BLACK_STAINED_GLASS, 4);

stoneCutting(Items.GLASS, Items.GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.WHITE_STAINED_GLASS, Items.WHITE_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.ORANGE_STAINED_GLASS, Items.ORANGE_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.MAGENTA_STAINED_GLASS, Items.MAGENTA_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.LIGHT_BLUE_STAINED_GLASS, Items.LIGHT_BLUE_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.YELLOW_STAINED_GLASS, Items.YELLOW_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.LIME_STAINED_GLASS, Items.LIME_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.PINK_STAINED_GLASS, Items.PINK_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.GRAY_STAINED_GLASS, Items.GRAY_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.LIGHT_GRAY_STAINED_GLASS, Items.LIGHT_GRAY_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.CYAN_STAINED_GLASS, Items.CYAN_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.PURPLE_STAINED_GLASS, Items.PURPLE_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.BLUE_STAINED_GLASS, Items.BLUE_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.BROWN_STAINED_GLASS, Items.BROWN_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.GREEN_STAINED_GLASS, Items.GREEN_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.RED_STAINED_GLASS, Items.RED_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
stoneCutting(Items.BLACK_STAINED_GLASS, Items.BLACK_STAINED_GLASS_PANE, 4, RecipeCategory.DECORATIONS, "glass_cutting");
}

private void woodCutter(ItemLike log, ItemLike wood, ItemLike strippedLog, ItemLike strippedWood,
ItemLike planks, ItemLike stairs, ItemLike slab) {
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, strippedLog, log);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, strippedWood, wood);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, planks, log, 4);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, planks, wood, 4);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, planks, strippedLog, 4);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, planks, strippedWood, 4);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, stairs, planks);
stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, slab, planks, 2);
stoneCutting(log, strippedLog, RecipeCategory.BUILDING_BLOCKS, "wood_cutting");
stoneCutting(wood, strippedWood, RecipeCategory.BUILDING_BLOCKS, "wood_cutting");
stoneCutting(log, planks, 4, RecipeCategory.BUILDING_BLOCKS, "wood_cutting");
stoneCutting(wood, planks, 4, RecipeCategory.BUILDING_BLOCKS, "wood_cutting");
stoneCutting(strippedLog, planks, 4, RecipeCategory.BUILDING_BLOCKS, "wood_cutting");
stoneCutting(strippedWood, planks, 4, RecipeCategory.BUILDING_BLOCKS, "wood_cutting");
stoneCutting(planks, stairs, RecipeCategory.BUILDING_BLOCKS, "wood_cutting");
stoneCutting(planks, slab, 2, RecipeCategory.BUILDING_BLOCKS, "wood_cutting");
}

private void oreProcessing(ItemLike material, ItemLike result, float experience, int normalCookingTime) {
smelting(material, result, experience, normalCookingTime, RecipeCategory.MISC, "raw_ore_block_smelting");
blasting(material, result, experience, normalCookingTime / 2, RecipeCategory.MISC, "raw_ore_block_smelting");
}

private void stoneCutting(ItemLike material, ItemLike result, RecipeCategory category, String group) {
stoneCutting(material, result, 1, category, group);
}

private void stoneCutting(ItemLike material, ItemLike result, int resultCount, RecipeCategory category, String group) {
SingleItemRecipeBuilder.stonecutting(Ingredient.of(material), category, result, resultCount)
.unlockedBy(getHasName(material), this.has(material))
.group(group)
.save(output, Naming.modRecipe(getConversionRecipeName(result, material) + "_stonecutting"));
}

private void smelting(ItemLike material, ItemLike result, float experience, int cookingTime, RecipeCategory category, String group) {
SimpleCookingRecipeBuilder.generic(Ingredient.of(material), category, result, experience, cookingTime, RecipeSerializer.SMELTING_RECIPE, SmeltingRecipe::new)
.unlockedBy(getHasName(material), has(material))
.group(group)
.save(output, Naming.modRecipe(getSmeltingRecipeName(result) + "_" + getItemName(material)));
}

private void blasting(ItemLike material, ItemLike result, float experience, int cookingTime, RecipeCategory category, String group) {
SimpleCookingRecipeBuilder.generic(Ingredient.of(material), category, result, experience, cookingTime, RecipeSerializer.BLASTING_RECIPE, BlastingRecipe::new)
.unlockedBy(getHasName(material), has(material))
.group(group)
.save(output, Naming.modRecipe(getBlastingRecipeName(result) + "_" + getItemName(material)));
}
}

0 comments on commit 8903bb9

Please sign in to comment.