continue datagen, but broken
This commit is contained in:
@@ -28,7 +28,6 @@ public class JEIJRPlugin implements IModPlugin {
|
|||||||
return Constants.rl("jei_plugin");
|
return Constants.rl("jei_plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expose JEI ingredient manager so categories can access all item variants (including mod-provided filled tanks)
|
|
||||||
public static @org.jetbrains.annotations.Nullable IIngredientManager INGREDIENT_MANAGER;
|
public static @org.jetbrains.annotations.Nullable IIngredientManager INGREDIENT_MANAGER;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -38,24 +37,6 @@ public class JEIJRPlugin implements IModPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIngredients(IModIngredientRegistration registration) {
|
public void registerIngredients(IModIngredientRegistration registration) {
|
||||||
// We need to register the FluidStack ingredient type to use it in recipes
|
|
||||||
// However, JEI usually provides its own fluid type on each platform.
|
|
||||||
// In a common environment, we might be defining a duplicate type if we aren't careful.
|
|
||||||
// But since we are using Architectury's FluidStack, we can try to register it as a custom ingredient.
|
|
||||||
// Note: This might not automatically work with JEI's built-in fluid rendering unless we provide a helper.
|
|
||||||
// For now, we register it so we can use it in our custom renderer.
|
|
||||||
|
|
||||||
// registration.register(FLUID_STACK_TYPE, Collections.emptyList(), new FluidStackHelper(), new FluidStackRenderer());
|
|
||||||
// Implementing the helper and renderer is non-trivial without platform specifics.
|
|
||||||
// If we just want to use it in a custom slot renderer, we might not strictly need to register the *collection* of ingredients,
|
|
||||||
// but we do need the type to be recognized if we pass it to addIngredient.
|
|
||||||
|
|
||||||
// Actually, addIngredient(IIngredientType<T> type, T ingredient) requires the type to be known?
|
|
||||||
// JEI documentation says: "Custom ingredients must be registered with IModIngredientRegistration"
|
|
||||||
|
|
||||||
// Given the complexity of cross-platform fluid registration in a common module without a bridge library,
|
|
||||||
// and that we only want to render a static water stack, we might be better off faking it or waiting for a bridge.
|
|
||||||
// But let's try to define the constant at least.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -74,8 +55,7 @@ public class JEIJRPlugin implements IModPlugin {
|
|||||||
public void registerRecipes(IRecipeRegistration registration) {
|
public void registerRecipes(IRecipeRegistration registration) {
|
||||||
RecipeManager recipeManager = Minecraft.getInstance().level.getRecipeManager();
|
RecipeManager recipeManager = Minecraft.getInstance().level.getRecipeManager();
|
||||||
|
|
||||||
/*? if >1.20.1 {*/
|
//? if >1.20.1 {
|
||||||
|
|
||||||
/*List<DNAExtractorRecipe> dnaExtractorRecipes = recipeManager
|
/*List<DNAExtractorRecipe> dnaExtractorRecipes = recipeManager
|
||||||
.getAllRecipesFor(ModRecipes.DNA_EXTRACTOR_RECIPE_TYPE.get()).stream().map(net.minecraft.world.item.crafting.RecipeHolder::value).toList();
|
.getAllRecipesFor(ModRecipes.DNA_EXTRACTOR_RECIPE_TYPE.get()).stream().map(net.minecraft.world.item.crafting.RecipeHolder::value).toList();
|
||||||
List<DNAAnalyzerRecipe> dnaAnalyzerRecipes = recipeManager
|
List<DNAAnalyzerRecipe> dnaAnalyzerRecipes = recipeManager
|
||||||
@@ -92,7 +72,7 @@ public class JEIJRPlugin implements IModPlugin {
|
|||||||
.getAllRecipesFor(ModRecipes.EMBRYO_CALCIFICATION_MACHINE_RECIPE_TYPE.get()).stream().map(net.minecraft.world.item.crafting.RecipeHolder::value).toList();
|
.getAllRecipesFor(ModRecipes.EMBRYO_CALCIFICATION_MACHINE_RECIPE_TYPE.get()).stream().map(net.minecraft.world.item.crafting.RecipeHolder::value).toList();
|
||||||
List<IncubatorRecipe> incubatorRecipes = recipeManager
|
List<IncubatorRecipe> incubatorRecipes = recipeManager
|
||||||
.getAllRecipesFor(ModRecipes.INCUBATOR_RECIPE_TYPE.get()).stream().map(net.minecraft.world.item.crafting.RecipeHolder::value).toList();
|
.getAllRecipesFor(ModRecipes.INCUBATOR_RECIPE_TYPE.get()).stream().map(net.minecraft.world.item.crafting.RecipeHolder::value).toList();
|
||||||
*//*?} else {*/
|
*///?} else {
|
||||||
List<DNAExtractorRecipe> dnaExtractorRecipes = recipeManager.getAllRecipesFor(ModRecipes.DNA_EXTRACTOR_RECIPE_TYPE.get());
|
List<DNAExtractorRecipe> dnaExtractorRecipes = recipeManager.getAllRecipesFor(ModRecipes.DNA_EXTRACTOR_RECIPE_TYPE.get());
|
||||||
List<DNAAnalyzerRecipe> dnaAnalyzerRecipes = recipeManager.getAllRecipesFor(ModRecipes.DNA_ANALYZER_RECIPE_TYPE.get());
|
List<DNAAnalyzerRecipe> dnaAnalyzerRecipes = recipeManager.getAllRecipesFor(ModRecipes.DNA_ANALYZER_RECIPE_TYPE.get());
|
||||||
List<FossilGrinderRecipe> fossilGrinderRecipes = recipeManager.getAllRecipesFor(ModRecipes.FOSSIL_GRINDER_RECIPE_TYPE.get());
|
List<FossilGrinderRecipe> fossilGrinderRecipes = recipeManager.getAllRecipesFor(ModRecipes.FOSSIL_GRINDER_RECIPE_TYPE.get());
|
||||||
@@ -101,7 +81,7 @@ public class JEIJRPlugin implements IModPlugin {
|
|||||||
List<EmbryonicMachineRecipe> embryonicMachineRecipes = recipeManager.getAllRecipesFor(ModRecipes.EMBRYONIC_MACHINE_RECIPE_TYPE.get());
|
List<EmbryonicMachineRecipe> embryonicMachineRecipes = recipeManager.getAllRecipesFor(ModRecipes.EMBRYONIC_MACHINE_RECIPE_TYPE.get());
|
||||||
List<EmbryoCalcificationMachineRecipe> embryoCalcificationMachineRecipes = recipeManager.getAllRecipesFor(ModRecipes.EMBRYO_CALCIFICATION_MACHINE_RECIPE_TYPE.get());
|
List<EmbryoCalcificationMachineRecipe> embryoCalcificationMachineRecipes = recipeManager.getAllRecipesFor(ModRecipes.EMBRYO_CALCIFICATION_MACHINE_RECIPE_TYPE.get());
|
||||||
List<IncubatorRecipe> incubatorRecipes = recipeManager.getAllRecipesFor(ModRecipes.INCUBATOR_RECIPE_TYPE.get());
|
List<IncubatorRecipe> incubatorRecipes = recipeManager.getAllRecipesFor(ModRecipes.INCUBATOR_RECIPE_TYPE.get());
|
||||||
/*?}*/
|
//?}
|
||||||
|
|
||||||
registration.addRecipes(DNAExtractorRecipeCategory.DNA_EXTRACTOR_RECIPE_RECIPE_TYPE, dnaExtractorRecipes);
|
registration.addRecipes(DNAExtractorRecipeCategory.DNA_EXTRACTOR_RECIPE_RECIPE_TYPE, dnaExtractorRecipes);
|
||||||
registration.addRecipes(DNAAnalyzerRecipeCategory.DNA_ANALYZER_RECIPE_RECIPE_TYPE, dnaAnalyzerRecipes);
|
registration.addRecipes(DNAAnalyzerRecipeCategory.DNA_ANALYZER_RECIPE_RECIPE_TYPE, dnaAnalyzerRecipes);
|
||||||
|
|||||||
@@ -0,0 +1,296 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.block.ModBlocks;
|
||||||
|
import net.cmr.jurassicrevived.item.ModItems;
|
||||||
|
import net.minecraft.data.recipes.RecipeCategory;
|
||||||
|
import net.minecraft.tags.ItemTags;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ModRecipeProvider {
|
||||||
|
|
||||||
|
public interface RecipeHelper {
|
||||||
|
void buildShaped(RecipeCategory category, ItemLike result, int count, String[] patterns, Object... keys);
|
||||||
|
void buildShapeless(RecipeCategory category, ItemLike result, int count, ItemLike... ingredients);
|
||||||
|
void buildShapeless(RecipeCategory category, ItemLike result, int count, String name, ItemLike... ingredients);
|
||||||
|
void buildSmelting(List<ItemLike> ingredients, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group);
|
||||||
|
void buildBlasting(List<ItemLike> ingredients, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group);
|
||||||
|
void buildSmelting(TagKey<Item> tag, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group);
|
||||||
|
void buildBlasting(TagKey<Item> tag, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group);
|
||||||
|
|
||||||
|
// Custom
|
||||||
|
void dnaExtracting(ItemLike testTube, ItemLike tissue, ItemLike dna, int count);
|
||||||
|
void dnaAnalyzing(ItemLike testTube, ItemLike material, ItemLike dna, int count);
|
||||||
|
void dnaHybridizing(ItemLike result, int count, ItemLike catalyst, ItemLike... ingredients);
|
||||||
|
void embryonicMachine(ItemLike syringe, ItemLike dna, ItemLike catalyst, ItemLike result, int count);
|
||||||
|
void embryoCalcification(ItemLike syringe, ItemLike egg, ItemLike result, int count);
|
||||||
|
void incubating(ItemLike egg, ItemLike result, int count);
|
||||||
|
void fossilGrinding(ItemLike fossil, ItemLike tissue, int count);
|
||||||
|
void skullToTissue(ItemLike skull, ItemLike tissue, int count);
|
||||||
|
void fossilCleaning(ItemLike fossilBlock, ItemLike result, int count);
|
||||||
|
|
||||||
|
// Special cases
|
||||||
|
void amberRandomDNA(ItemLike testTube, ItemLike amber, ItemLike defaultDna, int count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerRecipes(RecipeHelper helper) {
|
||||||
|
List<ItemLike> GYPSUM_COBBLESTONE_SMELTABLES = List.of(ModBlocks.GYPSUM_COBBLESTONE.get());
|
||||||
|
helper.buildSmelting(GYPSUM_COBBLESTONE_SMELTABLES, RecipeCategory.MISC, ModBlocks.GYPSUM_STONE.get(), 0.25f, 200, "jr_gypsum_stone");
|
||||||
|
helper.buildBlasting(GYPSUM_COBBLESTONE_SMELTABLES, RecipeCategory.MISC, ModBlocks.GYPSUM_STONE.get(), 0.25f, 100, "jr_gypsum_stone");
|
||||||
|
|
||||||
|
List<ItemLike> GYPSUM_STONE_SMELTABLES = List.of(ModBlocks.GYPSUM_STONE.get());
|
||||||
|
helper.buildSmelting(GYPSUM_STONE_SMELTABLES, RecipeCategory.MISC, ModBlocks.SMOOTH_GYPSUM_STONE.get(), 0.25f, 200, "jr_smooth_gypsum_stone");
|
||||||
|
helper.buildBlasting(GYPSUM_STONE_SMELTABLES, RecipeCategory.MISC, ModBlocks.SMOOTH_GYPSUM_STONE.get(), 0.25f, 100, "jr_smooth_gypsum_stone");
|
||||||
|
|
||||||
|
TagKey<Item> CHARRED_TERRACOTTA_SMELTABLES = ItemTags.TERRACOTTA;
|
||||||
|
helper.buildSmelting(CHARRED_TERRACOTTA_SMELTABLES, RecipeCategory.MISC, ModBlocks.CHARRED_TERRACOTTA.get(), 0.25f, 200, "jr_charred_terracotta");
|
||||||
|
helper.buildBlasting(CHARRED_TERRACOTTA_SMELTABLES, RecipeCategory.MISC, ModBlocks.CHARRED_TERRACOTTA.get(), 0.25f, 100, "jr_charred_terracotta");
|
||||||
|
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.GYPSUM_BRICK_STAIRS.get(), 4, new String[]{"A ", "AA ", "AAA"}, 'A', ModBlocks.GYPSUM_STONE_BRICKS.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.GYPSUM_BRICK_SLAB.get(), 6, new String[]{"AAA"}, 'A', ModBlocks.GYPSUM_STONE_BRICKS.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.GYPSUM_BRICK_WALL.get(), 6, new String[]{"AAA", "AAA"}, 'A', ModBlocks.GYPSUM_STONE_BRICKS.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.CHISELED_GYPSUM_STONE.get(), 1, new String[]{"A", "A"}, 'A', ModBlocks.GYPSUM_BRICK_SLAB.get());
|
||||||
|
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.REINFORCED_BRICK_STAIRS.get(), 4, new String[]{"A ", "AA ", "AAA"}, 'A', ModBlocks.REINFORCED_STONE_BRICKS.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.REINFORCED_BRICK_SLAB.get(), 6, new String[]{"AAA"}, 'A', ModBlocks.REINFORCED_STONE_BRICKS.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.REINFORCED_BRICK_WALL.get(), 6, new String[]{"AAA", "AAA"}, 'A', ModBlocks.REINFORCED_STONE_BRICKS.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.CHISELED_REINFORCED_STONE.get(), 1, new String[]{"A", "A"}, 'A', ModBlocks.REINFORCED_BRICK_SLAB.get());
|
||||||
|
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.TRASH_CAN.get(), 1, new String[]{"AAA", "A A", "AAA"}, 'A', Items.IRON_INGOT);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.BENCH.get(), 1, new String[]{"A ", "AAA", "BBB"}, 'A', ItemTags.PLANKS, 'B', ModBlocks.REINFORCED_STONE_BRICKS.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.FENCE_LIGHT.get(), 1, new String[]{"A", "B"}, 'A', Blocks.GLOWSTONE, 'B', Items.IRON_INGOT);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.LIGHT_POST.get(), 1, new String[]{"A", "B"}, 'A', Blocks.GLOWSTONE, 'B', ModBlocks.GYPSUM_STONE.get());
|
||||||
|
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModItems.TEST_TUBE.get(), 3, new String[]{" A", " B ", "B "}, 'A', Items.IRON_INGOT, 'B', Blocks.GLASS);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModItems.SYRINGE.get(), 3, new String[]{" A", " B ", "C "}, 'A', Items.IRON_INGOT, 'B', Blocks.GLASS, 'C', Items.IRON_NUGGET);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModItems.CABLE.get(), 4, new String[]{" BA", "BAB", "AB "}, 'A', Items.COPPER_INGOT, 'B', Items.IRON_NUGGET);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModItems.SCREEN.get(), 2, new String[]{"ABA", "ABA", " C "}, 'A', Items.IRON_INGOT, 'B', Blocks.REDSTONE_LAMP, 'C', ModItems.CABLE.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModItems.PROCESSOR.get(), 1, new String[]{"ABA", "BCB", "ABA"}, 'A', Items.GOLD_NUGGET, 'B', Items.IRON_INGOT, 'C', Items.REDSTONE);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModItems.TIRE.get(), 1, new String[]{"AAA", "ABA", "AAA"}, 'A', Items.INK_SAC, 'B', Items.IRON_INGOT);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModItems.CUTTING_BLADES.get(), 4, new String[]{"A A", " A ", "A A"}, 'A', Items.IRON_INGOT);
|
||||||
|
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.GYPSUM_STONE_BRICKS.get(), 4, new String[]{"AA", "AA"}, 'A', ModBlocks.GYPSUM_STONE.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.REINFORCED_STONE.get(), 6, new String[]{"AAA", "AAA", "AAA"}, 'A', Blocks.STONE);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.REINFORCED_STONE_BRICKS.get(), 6, new String[]{"AAA", "AAA", "AAA"}, 'A', Blocks.STONE_BRICKS);
|
||||||
|
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.LOW_SECURITY_FENCE_POLE.get(), 8, new String[]{"ABA", " B ", "ABA"}, 'A', Items.IRON_NUGGET, 'B', Items.IRON_INGOT);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.LOW_SECURITY_FENCE_WIRE.get(), 16, new String[]{"AAA", " B ", "AAA"}, 'A', Items.IRON_INGOT, 'B', Items.REDSTONE);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.MEDIUM_SECURITY_FENCE_POLE.get(), 8, new String[]{"ABA", "ABA", "ABA"}, 'A', Items.IRON_INGOT, 'B', Items.IRON_NUGGET);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.MEDIUM_SECURITY_FENCE_WIRE.get(), 16, new String[]{"AAA", "BBB", "AAA"}, 'A', Items.IRON_INGOT, 'B', Items.REDSTONE);
|
||||||
|
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.TANK.get(), 1, new String[]{"AAA", "ABA", "AAA"}, 'A', Items.IRON_INGOT, 'B', Items.BUCKET);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.POWER_CELL.get(), 1, new String[]{"AAA", "ABA", "AAA"}, 'A', Items.IRON_INGOT, 'B', ModBlocks.POWER_PIPE.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.WOOD_CRATE.get(), 1, new String[]{"AAA", "ABA", "AAA"}, 'A', ItemTags.PLANKS, 'B', Blocks.CHEST);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.IRON_CRATE.get(), 1, new String[]{"AAA", "ABA", "AAA"}, 'A', Items.IRON_INGOT, 'B', Blocks.CHEST);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.CAT_PLUSHIE.get(), 1, new String[]{"ABA", "CBD", "BBA"}, 'A', Blocks.BLACK_WOOL, 'B', Blocks.WHITE_WOOL, 'C', Blocks.GREEN_WOOL, 'D', Blocks.GRAY_WOOL);
|
||||||
|
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.GENERATOR.get(), 1, new String[]{"ABA", "CDE", "ABA"}, 'A', Blocks.IRON_BLOCK, 'B', ModItems.CABLE.get(), 'C', Blocks.REDSTONE_BLOCK, 'D', ModItems.PROCESSOR.get(), 'E', Items.COPPER_INGOT);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.DNA_EXTRACTOR.get(), 1, new String[]{"AAA", "BCD", "AAA"}, 'A', Items.LAPIS_LAZULI, 'B', ModItems.SCREEN.get(), 'C', ModItems.CABLE.get(), 'D', ModItems.PROCESSOR.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.DNA_ANALYZER.get(), 1, new String[]{"AAA", "BCD", "EEE"}, 'A', ModItems.TEST_TUBE.get(), 'B', ModItems.SCREEN.get(), 'C', ModItems.CABLE.get(), 'D', ModItems.PROCESSOR.get(), 'E', ModItems.SYRINGE.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.FOSSIL_GRINDER.get(), 1, new String[]{"ABA", "CDC", "AEA"}, 'A', Items.IRON_INGOT, 'B', Blocks.GLASS, 'C', Items.LAPIS_LAZULI, 'D', ModItems.CUTTING_BLADES.get(), 'E', Items.WATER_BUCKET);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.FOSSIL_CLEANER.get(), 1, new String[]{"ABA", "ACA", "AAA"}, 'A', Items.IRON_INGOT, 'B', Items.IRON_NUGGET, 'C', Blocks.GLASS);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.DNA_HYBRIDIZER.get(), 1, new String[]{"ABA", "CDC", "BEB"}, 'A', ModItems.SCREEN.get(), 'B', Items.IRON_INGOT, 'C', ModItems.CABLE.get(), 'D', ModItems.PROCESSOR.get(), 'E', Items.REDSTONE);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.EMBRYONIC_MACHINE.get(), 1, new String[]{"AAA", "BCB", "ADA"}, 'A', Items.IRON_INGOT, 'B', ModItems.TEST_TUBE.get(), 'C', Items.IRON_NUGGET, 'D', Items.REDSTONE);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.EMBRYO_CALCIFICATION_MACHINE.get(), 1, new String[]{"AB ", "CDE", "FAF"}, 'A', Items.IRON_INGOT, 'B', ModItems.SYRINGE.get(), 'C', ModItems.SCREEN.get(), 'D', ModItems.CABLE.get(), 'E', ModItems.PROCESSOR.get(), 'F', Items.FLINT);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.INCUBATOR.get(), 1, new String[]{"AAA", "BCB", "DED"}, 'A', Blocks.GLASS, 'B', Items.COPPER_INGOT, 'C', Blocks.HAY_BLOCK, 'D', Items.IRON_INGOT, 'E', ModItems.CABLE.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModItems.WRENCH.get(), 1, new String[]{" A ", " BA", "B "}, 'A', Items.IRON_INGOT, 'B', Items.IRON_NUGGET);
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.ITEM_PIPE.get(), 8, new String[]{"AAA"}, 'A', ModItems.CABLE.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.FLUID_PIPE.get(), 8, new String[]{" A ", "BBB", " A "}, 'A', Items.WATER_BUCKET, 'B', ModItems.CABLE.get());
|
||||||
|
helper.buildShaped(RecipeCategory.MISC, ModBlocks.POWER_PIPE.get(), 8, new String[]{" A ", "BBB", " A "}, 'A', Items.REDSTONE, 'B', ModItems.CABLE.get());
|
||||||
|
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.WHITE_GENERATOR.get(), 1, "white_generator_from_generator", ModBlocks.GENERATOR.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.GENERATOR.get(), 1, "generator_from_white_generator", ModBlocks.WHITE_GENERATOR.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.WHITE_DNA_EXTRACTOR.get(), 1, "white_dna_extractor_from_dna_extractor", ModBlocks.DNA_EXTRACTOR.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.DNA_EXTRACTOR.get(), 1, "dna_extractor_from_white_dna_extractor", ModBlocks.WHITE_DNA_EXTRACTOR.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.WHITE_DNA_ANALYZER.get(), 1, "white_dna_analyzer_from_dna_analyzer", ModBlocks.DNA_ANALYZER.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.DNA_ANALYZER.get(), 1, "dna_analyzer_from_white_dna_analyzer", ModBlocks.WHITE_DNA_ANALYZER.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.WHITE_FOSSIL_GRINDER.get(), 1, "white_fossil_grinder_from_fossil_grinder", ModBlocks.FOSSIL_GRINDER.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.FOSSIL_GRINDER.get(), 1, "fossil_grinder_from_white_fossil_grinder", ModBlocks.WHITE_FOSSIL_GRINDER.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.WHITE_FOSSIL_CLEANER.get(), 1, "white_fossil_cleaner_from_fossil_cleaner", ModBlocks.FOSSIL_CLEANER.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.FOSSIL_CLEANER.get(), 1, "fossil_cleaner_from_white_fossil_cleaner", ModBlocks.WHITE_FOSSIL_CLEANER.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.WHITE_DNA_HYBRIDIZER.get(), 1, "white_dna_hybridizer_from_dna_hybridizer", ModBlocks.DNA_HYBRIDIZER.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.DNA_HYBRIDIZER.get(), 1, "dna_hybridizer_from_white_dna_hybridizer", ModBlocks.WHITE_DNA_HYBRIDIZER.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.WHITE_EMBRYONIC_MACHINE.get(), 1, "white_embryonic_machine_from_embryonic_machine", ModBlocks.EMBRYONIC_MACHINE.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.EMBRYONIC_MACHINE.get(), 1, "embryonic_machine_from_white_embryonic_machine", ModBlocks.WHITE_EMBRYONIC_MACHINE.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.WHITE_EMBRYO_CALCIFICATION_MACHINE.get(), 1, "white_embryo_calcification_machine_from_embryo_calcification_machine", ModBlocks.EMBRYO_CALCIFICATION_MACHINE.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.EMBRYO_CALCIFICATION_MACHINE.get(), 1, "embryo_calcification_machine_from_white_embryo_calcification_machine", ModBlocks.WHITE_EMBRYO_CALCIFICATION_MACHINE.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.WHITE_INCUBATOR.get(), 1, "white_incubator_from_incubator", ModBlocks.INCUBATOR.get());
|
||||||
|
helper.buildShapeless(RecipeCategory.MISC, ModBlocks.INCUBATOR.get(), 1, "incubator_from_white_incubator", ModBlocks.WHITE_INCUBATOR.get());
|
||||||
|
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.APATOSAURUS_TISSUE.get(), ModItems.APATOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.ALBERTOSAURUS_TISSUE.get(), ModItems.ALBERTOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.BRACHIOSAURUS_TISSUE.get(), ModItems.BRACHIOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.CERATOSAURUS_TISSUE.get(), ModItems.CERATOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.COMPSOGNATHUS_TISSUE.get(), ModItems.COMPSOGNATHUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.DILOPHOSAURUS_TISSUE.get(), ModItems.DILOPHOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.DIPLODOCUS_TISSUE.get(), ModItems.DIPLODOCUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.GALLIMIMUS_TISSUE.get(), ModItems.GALLIMIMUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.INDOMINUS_REX_TISSUE.get(), ModItems.INDOMINUS_REX_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.OURANOSAURUS_TISSUE.get(), ModItems.OURANOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.PARASAUROLOPHUS_TISSUE.get(), ModItems.PARASAUROLOPHUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.SPINOSAURUS_TISSUE.get(), ModItems.SPINOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.TRICERATOPS_TISSUE.get(), ModItems.TRICERATOPS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.TYRANNOSAURUS_REX_TISSUE.get(), ModItems.TYRANNOSAURUS_REX_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.VELOCIRAPTOR_TISSUE.get(), ModItems.VELOCIRAPTOR_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.BARYONYX_TISSUE.get(), ModItems.BARYONYX_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.CARNOTAURUS_TISSUE.get(), ModItems.CARNOTAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.CONCAVENATOR_TISSUE.get(), ModItems.CONCAVENATOR_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.DEINONYCHUS_TISSUE.get(), ModItems.DEINONYCHUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.EDMONTOSAURUS_TISSUE.get(), ModItems.EDMONTOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.GIGANOTOSAURUS_TISSUE.get(), ModItems.GIGANOTOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.GUANLONG_TISSUE.get(), ModItems.GUANLONG_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.HERRERASAURUS_TISSUE.get(), ModItems.HERRERASAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.MAJUNGASAURUS_TISSUE.get(), ModItems.MAJUNGASAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.PROCOMPSOGNATHUS_TISSUE.get(), ModItems.PROCOMPSOGNATHUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.PROTOCERATOPS_TISSUE.get(), ModItems.PROTOCERATOPS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.RUGOPS_TISSUE.get(), ModItems.RUGOPS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.SHANTUNGOSAURUS_TISSUE.get(), ModItems.SHANTUNGOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.STEGOSAURUS_TISSUE.get(), ModItems.STEGOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.STYRACOSAURUS_TISSUE.get(), ModItems.STYRACOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.THERIZINOSAURUS_TISSUE.get(), ModItems.THERIZINOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.DISTORTUS_REX_TISSUE.get(), ModItems.DISTORTUS_REX_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.ALLOSAURUS_TISSUE.get(), ModItems.ALLOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.ALVAREZSAURUS_TISSUE.get(), ModItems.ALVAREZSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.ANKYLOSAURUS_TISSUE.get(), ModItems.ANKYLOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.ARAMBOURGIANIA_TISSUE.get(), ModItems.ARAMBOURGIANIA_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.CARCHARODONTOSAURUS_TISSUE.get(), ModItems.CARCHARODONTOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.CEARADACTYLUS_TISSUE.get(), ModItems.CEARADACTYLUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.CHASMOSAURUS_TISSUE.get(), ModItems.CHASMOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.COELOPHYSIS_TISSUE.get(), ModItems.COELOPHYSIS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.COELURUS_TISSUE.get(), ModItems.COELURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.CORYTHOSAURUS_TISSUE.get(), ModItems.CORYTHOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.DIMORPHODON_TISSUE.get(), ModItems.DIMORPHODON_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.DRYOSAURUS_TISSUE.get(), ModItems.DRYOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.GEOSTERNBERGIA_TISSUE.get(), ModItems.GEOSTERNBERGIA_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.GUIDRACO_TISSUE.get(), ModItems.GUIDRACO_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.HADROSAURUS_TISSUE.get(), ModItems.HADROSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.HYPSILOPHODON_TISSUE.get(), ModItems.HYPSILOPHODON_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.INDORAPTOR_TISSUE.get(), ModItems.INDORAPTOR_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.INOSTRANCEVIA_TISSUE.get(), ModItems.INOSTRANCEVIA_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.LAMBEOSAURUS_TISSUE.get(), ModItems.LAMBEOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.LUDODACTYLUS_TISSUE.get(), ModItems.LUDODACTYLUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.MAMENCHISAURUS_TISSUE.get(), ModItems.MAMENCHISAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.METRIACANTHOSAURUS_TISSUE.get(), ModItems.METRIACANTHOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.MOGANOPTERUS_TISSUE.get(), ModItems.MOGANOPTERUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.NYCTOSAURUS_TISSUE.get(), ModItems.NYCTOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.ORNITHOLESTES_TISSUE.get(), ModItems.ORNITHOLESTES_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.ORNITHOMIMUS_TISSUE.get(), ModItems.ORNITHOMIMUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.OVIRAPTOR_TISSUE.get(), ModItems.OVIRAPTOR_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.PACHYCEPHALOSAURUS_TISSUE.get(), ModItems.PACHYCEPHALOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.PROCERATOSAURUS_TISSUE.get(), ModItems.PROCERATOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.PTERANODON_TISSUE.get(), ModItems.PTERANODON_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.PTERODAUSTRO_TISSUE.get(), ModItems.PTERODAUSTRO_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.QUETZALCOATLUS_TISSUE.get(), ModItems.QUETZALCOATLUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.RAJASAURUS_TISSUE.get(), ModItems.RAJASAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.SEGISAURUS_TISSUE.get(), ModItems.SEGISAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.TAPEJARA_TISSUE.get(), ModItems.TAPEJARA_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.TITANOSAURUS_TISSUE.get(), ModItems.TITANOSAURUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.TROODON_TISSUE.get(), ModItems.TROODON_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.TROPEOGNATHUS_TISSUE.get(), ModItems.TROPEOGNATHUS_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.TUPUXUARA_TISSUE.get(), ModItems.TUPUXUARA_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.UTAHRAPTOR_TISSUE.get(), ModItems.UTAHRAPTOR_DNA.get(), 1);
|
||||||
|
helper.dnaExtracting(ModItems.TEST_TUBE.get(), ModItems.ZHENYUANOPTERUS_TISSUE.get(), ModItems.ZHENYUANOPTERUS_DNA.get(), 1);
|
||||||
|
|
||||||
|
helper.fossilCleaning(ModBlocks.STONE_FOSSIL.get(), ModItems.APATOSAURUS_SKULL_FOSSIL.get(), 1);
|
||||||
|
helper.fossilCleaning(ModBlocks.DEEPSLATE_FOSSIL.get(), ModItems.VELOCIRAPTOR_SKULL_FOSSIL.get(), 1);
|
||||||
|
|
||||||
|
helper.dnaHybridizing(ModItems.INDOMINUS_REX_DNA.get(), 1, ModItems.FROG_DNA.get(),
|
||||||
|
ModItems.TYRANNOSAURUS_REX_DNA.get(),
|
||||||
|
ModItems.VELOCIRAPTOR_DNA.get(),
|
||||||
|
ModItems.CARNOTAURUS_DNA.get(),
|
||||||
|
ModItems.THERIZINOSAURUS_DNA.get(),
|
||||||
|
ModItems.MAJUNGASAURUS_DNA.get(),
|
||||||
|
ModItems.RUGOPS_DNA.get(),
|
||||||
|
ModItems.GIGANOTOSAURUS_DNA.get());
|
||||||
|
|
||||||
|
helper.dnaHybridizing(ModItems.DISTORTUS_REX_DNA.get(), 1, ModItems.FROG_DNA.get(),
|
||||||
|
ModItems.TYRANNOSAURUS_REX_DNA.get(),
|
||||||
|
ModItems.BRACHIOSAURUS_DNA.get(),
|
||||||
|
ModItems.VELOCIRAPTOR_DNA.get());
|
||||||
|
|
||||||
|
helper.dnaHybridizing(ModItems.INDORAPTOR_DNA.get(), 1, ModItems.FROG_DNA.get(),
|
||||||
|
ModItems.INDOMINUS_REX_DNA.get(),
|
||||||
|
ModItems.VELOCIRAPTOR_DNA.get());
|
||||||
|
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.APATOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.APATOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.ALBERTOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.ALBERTOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.BRACHIOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.BRACHIOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.CERATOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.CERATOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.COMPSOGNATHUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.COMPSOGNATHUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.DILOPHOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.DILOPHOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.DIPLODOCUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.DIPLODOCUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.GALLIMIMUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.GALLIMIMUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.INDOMINUS_REX_DNA.get(), ModItems.FROG_DNA.get(), ModItems.INDOMINUS_REX_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.OURANOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.OURANOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.PARASAUROLOPHUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.PARASAUROLOPHUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.SPINOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.SPINOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.TRICERATOPS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.TRICERATOPS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.TYRANNOSAURUS_REX_DNA.get(), ModItems.FROG_DNA.get(), ModItems.TYRANNOSAURUS_REX_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.VELOCIRAPTOR_DNA.get(), ModItems.FROG_DNA.get(), ModItems.VELOCIRAPTOR_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.BARYONYX_DNA.get(), ModItems.FROG_DNA.get(), ModItems.BARYONYX_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.CARNOTAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.CARNOTAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.CONCAVENATOR_DNA.get(), ModItems.FROG_DNA.get(), ModItems.CONCAVENATOR_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.DEINONYCHUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.DEINONYCHUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.EDMONTOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.EDMONTOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.GIGANOTOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.GIGANOTOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.GUANLONG_DNA.get(), ModItems.FROG_DNA.get(), ModItems.GUANLONG_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.HERRERASAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.HERRERASAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.MAJUNGASAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.MAJUNGASAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.PROCOMPSOGNATHUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.PROCOMPSOGNATHUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.PROTOCERATOPS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.PROTOCERATOPS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.RUGOPS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.RUGOPS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.SHANTUNGOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.SHANTUNGOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.STEGOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.STEGOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.STYRACOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.STYRACOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.THERIZINOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.THERIZINOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.DISTORTUS_REX_DNA.get(), ModItems.FROG_DNA.get(), ModItems.DISTORTUS_REX_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.ALLOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.ALLOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.ALVAREZSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.ALVAREZSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.ANKYLOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.ANKYLOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.ARAMBOURGIANIA_DNA.get(), ModItems.FROG_DNA.get(), ModItems.ARAMBOURGIANIA_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.CARCHARODONTOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.CARCHARODONTOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.CEARADACTYLUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.CEARADACTYLUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.CHASMOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.CHASMOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.COELOPHYSIS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.COELOPHYSIS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.COELURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.COELURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.CORYTHOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.CORYTHOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.DIMORPHODON_DNA.get(), ModItems.FROG_DNA.get(), ModItems.DIMORPHODON_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.DRYOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.DRYOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.GEOSTERNBERGIA_DNA.get(), ModItems.FROG_DNA.get(), ModItems.GEOSTERNBERGIA_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.GUIDRACO_DNA.get(), ModItems.FROG_DNA.get(), ModItems.GUIDRACO_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.HADROSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.HADROSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.HYPSILOPHODON_DNA.get(), ModItems.FROG_DNA.get(), ModItems.HYPSILOPHODON_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.INDORAPTOR_DNA.get(), ModItems.FROG_DNA.get(), ModItems.INDORAPTOR_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.INOSTRANCEVIA_DNA.get(), ModItems.FROG_DNA.get(), ModItems.INOSTRANCEVIA_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.LAMBEOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.LAMBEOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.LUDODACTYLUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.LUDODACTYLUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.MAMENCHISAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.MAMENCHISAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.METRIACANTHOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.METRIACANTHOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.MOGANOPTERUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.MOGANOPTERUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.NYCTOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.NYCTOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.ORNITHOLESTES_DNA.get(), ModItems.FROG_DNA.get(), ModItems.ORNITHOLESTES_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.ORNITHOMIMUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.ORNITHOMIMUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.OVIRAPTOR_DNA.get(), ModItems.FROG_DNA.get(), ModItems.OVIRAPTOR_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.PACHYCEPHALOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.PACHYCEPHALOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.PROCERATOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.PROCERATOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.PTERANODON_DNA.get(), ModItems.FROG_DNA.get(), ModItems.PTERANODON_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.PTERODAUSTRO_DNA.get(), ModItems.FROG_DNA.get(), ModItems.PTERODAUSTRO_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.QUETZALCOATLUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.QUETZALCOATLUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.RAJASAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.RAJASAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.SEGISAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.SEGISAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.TAPEJARA_DNA.get(), ModItems.FROG_DNA.get(), ModItems.TAPEJARA_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.TITANOSAURUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.TITANOSAURUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.TROODON_DNA.get(), ModItems.FROG_DNA.get(), ModItems.TROODON_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.TROPEOGNATHUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.TROPEOGNATHUS_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.TUPUXUARA_DNA.get(), ModItems.FROG_DNA.get(), ModItems.TUPUXUARA_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.UTAHRAPTOR_DNA.get(), ModItems.FROG_DNA.get(), ModItems.UTAHRAPTOR_SYRINGE.get(), 1);
|
||||||
|
helper.embryonicMachine(ModItems.SYRINGE.get(), ModItems.ZHENYUANOPTERUS_DNA.get(), ModItems.FROG_DNA.get(), ModItems.ZHENYUANOPTERUS_SYRINGE.get(), 1);
|
||||||
|
|
||||||
|
helper.amberRandomDNA(ModItems.TEST_TUBE.get(), ModItems.MOSQUITO_IN_AMBER.get(), ModItems.FROG_DNA.get(), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
+199
@@ -0,0 +1,199 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen.custom;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.recipe.DNAAnalyzerRecipe;
|
||||||
|
import net.minecraft.advancements.*;
|
||||||
|
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
||||||
|
import net.minecraft.advancements.critereon.RecipeUnlockedTrigger;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*import net.minecraft.data.recipes.RecipeOutput;
|
||||||
|
*///?}
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
//? if <=1.20.1 {
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import net.cmr.jurassicrevived.recipe.ModRecipes;
|
||||||
|
import net.minecraft.data.recipes.FinishedRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
//?}
|
||||||
|
|
||||||
|
public class DNAAnalyzingRecipeBuilder {
|
||||||
|
private java.util.Optional<ItemLike> firstItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<ItemLike> secondItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<Item> resultItem = java.util.Optional.empty();
|
||||||
|
private final int count;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*private final Map<String, Criterion<?>> criteria;
|
||||||
|
*///?} else {
|
||||||
|
private final Map<String, InventoryChangeTrigger.TriggerInstance> criteria;
|
||||||
|
//?}
|
||||||
|
private final Map<ResourceLocation, Integer> weights = new java.util.HashMap<>();
|
||||||
|
|
||||||
|
public DNAAnalyzingRecipeBuilder(ItemLike ingredient, ItemLike secondIngredient, ItemLike result, int count) {
|
||||||
|
this.firstItem = java.util.Optional.of(ingredient);
|
||||||
|
this.secondItem = java.util.Optional.of(secondIngredient);
|
||||||
|
this.resultItem = java.util.Optional.of(result.asItem());
|
||||||
|
this.count = count;
|
||||||
|
this.criteria = new LinkedHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DNAAnalyzingRecipeBuilder amberRandomDNAUniform(ItemLike testtube, ItemLike amber, ItemLike placeholderResult, int count) {
|
||||||
|
return new DNAAnalyzingRecipeBuilder(testtube, amber, placeholderResult, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DNAAnalyzingRecipeBuilder addDNAWeight(ItemLike dnaItem, int weight) {
|
||||||
|
ResourceLocation id = BuiltInRegistries.ITEM.getKey(dnaItem.asItem());
|
||||||
|
if (id != null) {
|
||||||
|
weights.put(id, weight);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public void save(RecipeOutput output) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = ResourceLocation.fromNamespaceAndPath(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_dna_analyzing"
|
||||||
|
);
|
||||||
|
save(output, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(RecipeOutput output, ResourceLocation recipeId) {
|
||||||
|
NonNullList<Ingredient> inputs = NonNullList.create();
|
||||||
|
inputs.add(Ingredient.of(firstItem.orElseThrow()));
|
||||||
|
inputs.add(Ingredient.of(secondItem.orElseThrow()));
|
||||||
|
ItemStack result = new ItemStack(resultItem.orElseThrow(), this.count);
|
||||||
|
|
||||||
|
DNAAnalyzerRecipe recipe = new DNAAnalyzerRecipe(inputs, result, Map.copyOf(this.weights));
|
||||||
|
|
||||||
|
AdvancementHolder advancementHolder = null;
|
||||||
|
if (!this.criteria.isEmpty()) {
|
||||||
|
Advancement.Builder builder = output.advancement();
|
||||||
|
for (Map.Entry<String, Criterion<?>> e : this.criteria.entrySet()) {
|
||||||
|
builder.addCriterion(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
builder.rewards(AdvancementRewards.Builder.recipe(recipeId));
|
||||||
|
builder.requirements(AdvancementRequirements.Strategy.OR);
|
||||||
|
advancementHolder = builder.build(recipeId.withPrefix("recipes/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
output.accept(recipeId, recipe, advancementHolder);
|
||||||
|
}
|
||||||
|
*///?} else {
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = new ResourceLocation(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_dna_analyzing"
|
||||||
|
);
|
||||||
|
save(consumer, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation recipeId) {
|
||||||
|
Advancement.Builder advancementBuilder = Advancement.Builder.advancement();
|
||||||
|
advancementBuilder.parent(new ResourceLocation("recipes/root"))
|
||||||
|
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId))
|
||||||
|
.rewards(AdvancementRewards.Builder.recipe(recipeId))
|
||||||
|
.requirements(RequirementsStrategy.OR);
|
||||||
|
this.criteria.forEach(advancementBuilder::addCriterion);
|
||||||
|
|
||||||
|
consumer.accept(new Result(
|
||||||
|
recipeId,
|
||||||
|
Ingredient.of(firstItem.orElseThrow()),
|
||||||
|
Ingredient.of(secondItem.orElseThrow()),
|
||||||
|
this.resultItem.orElseThrow(),
|
||||||
|
this.count,
|
||||||
|
this.weights,
|
||||||
|
advancementBuilder,
|
||||||
|
new ResourceLocation(recipeId.getNamespace(), "recipes/" + recipeId.getPath())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Result implements FinishedRecipe {
|
||||||
|
private final ResourceLocation id;
|
||||||
|
private final Ingredient first;
|
||||||
|
private final Ingredient second;
|
||||||
|
private final Item result;
|
||||||
|
private final int count;
|
||||||
|
private final Map<ResourceLocation, Integer> weights;
|
||||||
|
private final Advancement.Builder advancement;
|
||||||
|
private final ResourceLocation advancementId;
|
||||||
|
|
||||||
|
public Result(ResourceLocation id, Ingredient first, Ingredient second, Item result, int count, Map<ResourceLocation, Integer> weights, Advancement.Builder advancement, ResourceLocation advancementId) {
|
||||||
|
this.id = id;
|
||||||
|
this.first = first;
|
||||||
|
this.second = second;
|
||||||
|
this.result = result;
|
||||||
|
this.count = count;
|
||||||
|
this.weights = weights;
|
||||||
|
this.advancement = advancement;
|
||||||
|
this.advancementId = advancementId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serializeRecipeData(JsonObject json) {
|
||||||
|
JsonArray ingredients = new JsonArray();
|
||||||
|
ingredients.add(first.toJson());
|
||||||
|
ingredients.add(second.toJson());
|
||||||
|
json.add("ingredients", ingredients);
|
||||||
|
|
||||||
|
JsonObject resultObj = new JsonObject();
|
||||||
|
resultObj.addProperty("item", BuiltInRegistries.ITEM.getKey(result).toString());
|
||||||
|
if (count > 1) {
|
||||||
|
resultObj.addProperty("count", count);
|
||||||
|
}
|
||||||
|
json.add("result", resultObj);
|
||||||
|
|
||||||
|
if (!weights.isEmpty()) {
|
||||||
|
JsonObject weightsObj = new JsonObject();
|
||||||
|
weights.forEach((k, v) -> weightsObj.addProperty(k.toString(), v));
|
||||||
|
json.add("weights", weightsObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipeSerializer<?> getType() {
|
||||||
|
return ModRecipes.DNA_ANALYZER_SERIALIZER.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JsonObject serializeAdvancement() {
|
||||||
|
return advancement.serializeToJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getAdvancementId() {
|
||||||
|
return advancementId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//?}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public DNAAnalyzingRecipeBuilder unlockedBy(String name, Criterion<?> criterion) {
|
||||||
|
*///?} else {
|
||||||
|
public DNAAnalyzingRecipeBuilder unlockedBy(String name, InventoryChangeTrigger.TriggerInstance criterion) {
|
||||||
|
//?}
|
||||||
|
this.criteria.put(name, criterion);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
+199
@@ -0,0 +1,199 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen.custom;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.recipe.DNAExtractorRecipe;
|
||||||
|
import net.minecraft.advancements.*;
|
||||||
|
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
||||||
|
import net.minecraft.advancements.critereon.RecipeUnlockedTrigger;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*import net.minecraft.data.recipes.RecipeOutput;
|
||||||
|
*///?}
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
//? if <=1.20.1 {
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import net.cmr.jurassicrevived.recipe.ModRecipes;
|
||||||
|
import net.minecraft.data.recipes.FinishedRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
//?}
|
||||||
|
|
||||||
|
public class DNAExtractingRecipeBuilder {
|
||||||
|
private java.util.Optional<ItemLike> firstItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<ItemLike> secondItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<Item> resultItem = java.util.Optional.empty();
|
||||||
|
private final int count;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*private final Map<String, Criterion<?>> criteria;
|
||||||
|
*///?} else {
|
||||||
|
private final Map<String, InventoryChangeTrigger.TriggerInstance> criteria;
|
||||||
|
//?}
|
||||||
|
private final java.util.Map<ResourceLocation, Integer> weights = new java.util.HashMap<>();
|
||||||
|
|
||||||
|
public DNAExtractingRecipeBuilder(ItemLike ingredient, ItemLike secondIngredient, ItemLike result, int count) {
|
||||||
|
this.firstItem = java.util.Optional.of(ingredient);
|
||||||
|
this.secondItem = java.util.Optional.of(secondIngredient);
|
||||||
|
this.resultItem = java.util.Optional.of(result.asItem());
|
||||||
|
this.count = count;
|
||||||
|
this.criteria = new LinkedHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DNAExtractingRecipeBuilder amberRandomDNAUniform(ItemLike testtube, ItemLike amber, ItemLike placeholderResult, int count) {
|
||||||
|
return new DNAExtractingRecipeBuilder(testtube, amber, placeholderResult, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DNAExtractingRecipeBuilder addDNAWeight(ItemLike dnaItem, int weight) {
|
||||||
|
ResourceLocation id = BuiltInRegistries.ITEM.getKey(dnaItem.asItem());
|
||||||
|
if (id != null) {
|
||||||
|
weights.put(id, weight);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public void save(RecipeOutput output) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = ResourceLocation.fromNamespaceAndPath(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_dna_extracting"
|
||||||
|
);
|
||||||
|
save(output, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(RecipeOutput output, ResourceLocation recipeId) {
|
||||||
|
NonNullList<Ingredient> inputs = NonNullList.create();
|
||||||
|
inputs.add(Ingredient.of(firstItem.orElseThrow()));
|
||||||
|
inputs.add(Ingredient.of(secondItem.orElseThrow()));
|
||||||
|
ItemStack result = new ItemStack(resultItem.orElseThrow(), this.count);
|
||||||
|
|
||||||
|
DNAExtractorRecipe recipe = new DNAExtractorRecipe(inputs, result, java.util.Map.copyOf(this.weights));
|
||||||
|
|
||||||
|
AdvancementHolder advancementHolder = null;
|
||||||
|
if (!this.criteria.isEmpty()) {
|
||||||
|
Advancement.Builder builder = output.advancement();
|
||||||
|
for (Map.Entry<String, Criterion<?>> e : this.criteria.entrySet()) {
|
||||||
|
builder.addCriterion(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
builder.rewards(AdvancementRewards.Builder.recipe(recipeId));
|
||||||
|
builder.requirements(AdvancementRequirements.Strategy.OR);
|
||||||
|
advancementHolder = builder.build(recipeId.withPrefix("recipes/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
output.accept(recipeId, recipe, advancementHolder);
|
||||||
|
}
|
||||||
|
*///?} else {
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = new ResourceLocation(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_dna_extracting"
|
||||||
|
);
|
||||||
|
save(consumer, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation recipeId) {
|
||||||
|
Advancement.Builder advancementBuilder = Advancement.Builder.advancement();
|
||||||
|
advancementBuilder.parent(new ResourceLocation("recipes/root"))
|
||||||
|
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId))
|
||||||
|
.rewards(AdvancementRewards.Builder.recipe(recipeId))
|
||||||
|
.requirements(RequirementsStrategy.OR);
|
||||||
|
this.criteria.forEach(advancementBuilder::addCriterion);
|
||||||
|
|
||||||
|
consumer.accept(new Result(
|
||||||
|
recipeId,
|
||||||
|
Ingredient.of(firstItem.orElseThrow()),
|
||||||
|
Ingredient.of(secondItem.orElseThrow()),
|
||||||
|
this.resultItem.orElseThrow(),
|
||||||
|
this.count,
|
||||||
|
this.weights,
|
||||||
|
advancementBuilder,
|
||||||
|
new ResourceLocation(recipeId.getNamespace(), "recipes/" + recipeId.getPath())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Result implements FinishedRecipe {
|
||||||
|
private final ResourceLocation id;
|
||||||
|
private final Ingredient first;
|
||||||
|
private final Ingredient second;
|
||||||
|
private final Item result;
|
||||||
|
private final int count;
|
||||||
|
private final Map<ResourceLocation, Integer> weights;
|
||||||
|
private final Advancement.Builder advancement;
|
||||||
|
private final ResourceLocation advancementId;
|
||||||
|
|
||||||
|
public Result(ResourceLocation id, Ingredient first, Ingredient second, Item result, int count, Map<ResourceLocation, Integer> weights, Advancement.Builder advancement, ResourceLocation advancementId) {
|
||||||
|
this.id = id;
|
||||||
|
this.first = first;
|
||||||
|
this.second = second;
|
||||||
|
this.result = result;
|
||||||
|
this.count = count;
|
||||||
|
this.weights = weights;
|
||||||
|
this.advancement = advancement;
|
||||||
|
this.advancementId = advancementId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serializeRecipeData(JsonObject json) {
|
||||||
|
JsonArray ingredients = new JsonArray();
|
||||||
|
ingredients.add(first.toJson());
|
||||||
|
ingredients.add(second.toJson());
|
||||||
|
json.add("ingredients", ingredients);
|
||||||
|
|
||||||
|
JsonObject resultObj = new JsonObject();
|
||||||
|
resultObj.addProperty("item", BuiltInRegistries.ITEM.getKey(result).toString());
|
||||||
|
if (count > 1) {
|
||||||
|
resultObj.addProperty("count", count);
|
||||||
|
}
|
||||||
|
json.add("result", resultObj);
|
||||||
|
|
||||||
|
if (!weights.isEmpty()) {
|
||||||
|
JsonObject weightsObj = new JsonObject();
|
||||||
|
weights.forEach((k, v) -> weightsObj.addProperty(k.toString(), v));
|
||||||
|
json.add("weights", weightsObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipeSerializer<?> getType() {
|
||||||
|
return ModRecipes.DNA_EXTRACTOR_SERIALIZER.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JsonObject serializeAdvancement() {
|
||||||
|
return advancement.serializeToJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getAdvancementId() {
|
||||||
|
return advancementId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//?}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public DNAExtractingRecipeBuilder unlockedBy(String name, Criterion<?> criterion) {
|
||||||
|
*///?} else {
|
||||||
|
public DNAExtractingRecipeBuilder unlockedBy(String name, InventoryChangeTrigger.TriggerInstance criterion) {
|
||||||
|
//?}
|
||||||
|
this.criteria.put(name, criterion);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
+229
@@ -0,0 +1,229 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen.custom;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.recipe.DNAHybridizerRecipe;
|
||||||
|
import net.minecraft.advancements.*;
|
||||||
|
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
||||||
|
import net.minecraft.advancements.critereon.RecipeUnlockedTrigger;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*import net.minecraft.data.recipes.RecipeOutput;
|
||||||
|
*///?}
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
//? if <=1.20.1 {
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import net.cmr.jurassicrevived.recipe.ModRecipes;
|
||||||
|
import net.minecraft.data.recipes.FinishedRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
//?}
|
||||||
|
|
||||||
|
public class DNAHybridizingRecipeBuilder {
|
||||||
|
private java.util.Optional<Item> resultItem = java.util.Optional.empty();
|
||||||
|
private final int count;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*private final Map<String, Criterion<?>> criteria;
|
||||||
|
*///?} else {
|
||||||
|
private final Map<String, InventoryChangeTrigger.TriggerInstance> criteria;
|
||||||
|
//?}
|
||||||
|
private final NonNullList<Ingredient> ingredients = NonNullList.create();
|
||||||
|
private java.util.Optional<ItemLike> catalyst = java.util.Optional.empty();
|
||||||
|
|
||||||
|
public DNAHybridizingRecipeBuilder(ItemLike result, int count) {
|
||||||
|
this.resultItem = java.util.Optional.of(result.asItem());
|
||||||
|
this.count = count;
|
||||||
|
this.criteria = new LinkedHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DNAHybridizingRecipeBuilder result(ItemLike result, int count) {
|
||||||
|
return new DNAHybridizingRecipeBuilder(result, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DNAHybridizingRecipeBuilder addIngredient(ItemLike item) {
|
||||||
|
if (this.ingredients.size() >= 9) {
|
||||||
|
throw new IllegalStateException("DNAHybridizer supports at most 9 input ingredients");
|
||||||
|
}
|
||||||
|
this.ingredients.add(Ingredient.of(item));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DNAHybridizingRecipeBuilder addIngredient(Ingredient ingredient) {
|
||||||
|
if (this.ingredients.size() >= 9) {
|
||||||
|
throw new IllegalStateException("DNAHybridizer supports at most 9 input ingredients");
|
||||||
|
}
|
||||||
|
this.ingredients.add(ingredient);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DNAHybridizingRecipeBuilder setCatalyst(ItemLike item) {
|
||||||
|
this.catalyst = java.util.Optional.of(item);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public void save(RecipeOutput output) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = ResourceLocation.fromNamespaceAndPath(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_dna_hybridizing"
|
||||||
|
);
|
||||||
|
save(output, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(RecipeOutput output, ResourceLocation recipeId) {
|
||||||
|
if (this.ingredients.isEmpty()) {
|
||||||
|
throw new IllegalStateException("DNAHybridizingRecipeBuilder requires at least 1 ingredient");
|
||||||
|
}
|
||||||
|
NonNullList<Ingredient> inputs = NonNullList.create();
|
||||||
|
inputs.addAll(this.ingredients);
|
||||||
|
|
||||||
|
if (inputs.size() > 8 && catalyst.isPresent()) {
|
||||||
|
throw new IllegalStateException("When a catalyst is set, at most 8 regular ingredients are allowed (slot 9 is reserved).");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (catalyst.isPresent()) {
|
||||||
|
while (inputs.size() < 8) {
|
||||||
|
inputs.add(Ingredient.EMPTY);
|
||||||
|
}
|
||||||
|
inputs.add(Ingredient.of(catalyst.get()));
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack result = new ItemStack(resultItem.orElseThrow(), this.count);
|
||||||
|
|
||||||
|
DNAHybridizerRecipe recipe = new DNAHybridizerRecipe(inputs, result);
|
||||||
|
|
||||||
|
AdvancementHolder advancementHolder = null;
|
||||||
|
if (!this.criteria.isEmpty()) {
|
||||||
|
Advancement.Builder builder = output.advancement();
|
||||||
|
for (Map.Entry<String, Criterion<?>> e : this.criteria.entrySet()) {
|
||||||
|
builder.addCriterion(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
builder.rewards(AdvancementRewards.Builder.recipe(recipeId));
|
||||||
|
builder.requirements(AdvancementRequirements.Strategy.OR);
|
||||||
|
advancementHolder = builder.build(recipeId.withPrefix("recipes/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
output.accept(recipeId, recipe, advancementHolder);
|
||||||
|
}
|
||||||
|
*///?} else {
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = new ResourceLocation(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_dna_hybridizing"
|
||||||
|
);
|
||||||
|
save(consumer, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation recipeId) {
|
||||||
|
if (this.ingredients.isEmpty()) {
|
||||||
|
throw new IllegalStateException("DNAHybridizingRecipeBuilder requires at least 1 ingredient");
|
||||||
|
}
|
||||||
|
NonNullList<Ingredient> inputs = NonNullList.create();
|
||||||
|
inputs.addAll(this.ingredients);
|
||||||
|
|
||||||
|
if (inputs.size() > 8 && catalyst.isPresent()) {
|
||||||
|
throw new IllegalStateException("When a catalyst is set, at most 8 regular ingredients are allowed (slot 9 is reserved).");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (catalyst.isPresent()) {
|
||||||
|
while (inputs.size() < 8) {
|
||||||
|
inputs.add(Ingredient.EMPTY);
|
||||||
|
}
|
||||||
|
inputs.add(Ingredient.of(catalyst.get()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Advancement.Builder advancementBuilder = Advancement.Builder.advancement();
|
||||||
|
advancementBuilder.parent(new ResourceLocation("recipes/root"))
|
||||||
|
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId))
|
||||||
|
.rewards(AdvancementRewards.Builder.recipe(recipeId))
|
||||||
|
.requirements(RequirementsStrategy.OR);
|
||||||
|
this.criteria.forEach(advancementBuilder::addCriterion);
|
||||||
|
|
||||||
|
consumer.accept(new Result(
|
||||||
|
recipeId,
|
||||||
|
inputs,
|
||||||
|
this.resultItem.orElseThrow(),
|
||||||
|
this.count,
|
||||||
|
advancementBuilder,
|
||||||
|
new ResourceLocation(recipeId.getNamespace(), "recipes/" + recipeId.getPath())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Result implements FinishedRecipe {
|
||||||
|
private final ResourceLocation id;
|
||||||
|
private final NonNullList<Ingredient> ingredients;
|
||||||
|
private final Item result;
|
||||||
|
private final int count;
|
||||||
|
private final Advancement.Builder advancement;
|
||||||
|
private final ResourceLocation advancementId;
|
||||||
|
|
||||||
|
public Result(ResourceLocation id, NonNullList<Ingredient> ingredients, Item result, int count, Advancement.Builder advancement, ResourceLocation advancementId) {
|
||||||
|
this.id = id;
|
||||||
|
this.ingredients = ingredients;
|
||||||
|
this.result = result;
|
||||||
|
this.count = count;
|
||||||
|
this.advancement = advancement;
|
||||||
|
this.advancementId = advancementId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serializeRecipeData(JsonObject json) {
|
||||||
|
JsonArray ingredientsJson = new JsonArray();
|
||||||
|
for (Ingredient ingredient : ingredients) {
|
||||||
|
ingredientsJson.add(ingredient.toJson());
|
||||||
|
}
|
||||||
|
json.add("ingredients", ingredientsJson);
|
||||||
|
|
||||||
|
JsonObject resultObj = new JsonObject();
|
||||||
|
resultObj.addProperty("item", BuiltInRegistries.ITEM.getKey(result).toString());
|
||||||
|
if (count > 1) {
|
||||||
|
resultObj.addProperty("count", count);
|
||||||
|
}
|
||||||
|
json.add("result", resultObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipeSerializer<?> getType() {
|
||||||
|
return ModRecipes.DNA_HYBRIDIZER_SERIALIZER.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JsonObject serializeAdvancement() {
|
||||||
|
return advancement.serializeToJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getAdvancementId() {
|
||||||
|
return advancementId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//?}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public DNAHybridizingRecipeBuilder unlockedBy(String name, Criterion<?> criterion) {
|
||||||
|
*///?} else {
|
||||||
|
public DNAHybridizingRecipeBuilder unlockedBy(String name, InventoryChangeTrigger.TriggerInstance criterion) {
|
||||||
|
//?}
|
||||||
|
this.criteria.put(name, criterion);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
+177
@@ -0,0 +1,177 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen.custom;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.recipe.EmbryoCalcificationMachineRecipe;
|
||||||
|
import net.minecraft.advancements.*;
|
||||||
|
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
||||||
|
import net.minecraft.advancements.critereon.RecipeUnlockedTrigger;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*import net.minecraft.data.recipes.RecipeOutput;
|
||||||
|
*///?}
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
//? if <=1.20.1 {
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import net.cmr.jurassicrevived.recipe.ModRecipes;
|
||||||
|
import net.minecraft.data.recipes.FinishedRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
//?}
|
||||||
|
|
||||||
|
public class EmbryoCalcificationMachiningRecipeBuilder {
|
||||||
|
private java.util.Optional<ItemLike> firstItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<ItemLike> secondItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<Item> resultItem = java.util.Optional.empty();
|
||||||
|
private final int count;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*private final Map<String, Criterion<?>> criteria;
|
||||||
|
*///?} else {
|
||||||
|
private final Map<String, InventoryChangeTrigger.TriggerInstance> criteria;
|
||||||
|
//?}
|
||||||
|
|
||||||
|
public EmbryoCalcificationMachiningRecipeBuilder(ItemLike ingredient, ItemLike secondIngredient, ItemLike result, int count) {
|
||||||
|
this.firstItem = java.util.Optional.of(ingredient);
|
||||||
|
this.secondItem = java.util.Optional.of(secondIngredient);
|
||||||
|
this.resultItem = java.util.Optional.of(result.asItem());
|
||||||
|
this.count = count;
|
||||||
|
this.criteria = new LinkedHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public void save(RecipeOutput output) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = ResourceLocation.fromNamespaceAndPath(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_embryo_calcification_machining"
|
||||||
|
);
|
||||||
|
save(output, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(RecipeOutput output, ResourceLocation recipeId) {
|
||||||
|
NonNullList<Ingredient> inputs = NonNullList.create();
|
||||||
|
inputs.add(Ingredient.of(firstItem.orElseThrow()));
|
||||||
|
inputs.add(Ingredient.of(secondItem.orElseThrow()));
|
||||||
|
ItemStack result = new ItemStack(resultItem.orElseThrow(), this.count);
|
||||||
|
|
||||||
|
EmbryoCalcificationMachineRecipe recipe = new EmbryoCalcificationMachineRecipe(inputs, result);
|
||||||
|
|
||||||
|
AdvancementHolder advancementHolder = null;
|
||||||
|
if (!this.criteria.isEmpty()) {
|
||||||
|
Advancement.Builder builder = output.advancement();
|
||||||
|
for (Map.Entry<String, Criterion<?>> e : this.criteria.entrySet()) {
|
||||||
|
builder.addCriterion(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
builder.rewards(AdvancementRewards.Builder.recipe(recipeId));
|
||||||
|
builder.requirements(AdvancementRequirements.Strategy.OR);
|
||||||
|
advancementHolder = builder.build(recipeId.withPrefix("recipes/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
output.accept(recipeId, recipe, advancementHolder);
|
||||||
|
}
|
||||||
|
*///?} else {
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = new ResourceLocation(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_embryo_calcification_machining"
|
||||||
|
);
|
||||||
|
save(consumer, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation recipeId) {
|
||||||
|
Advancement.Builder advancementBuilder = Advancement.Builder.advancement();
|
||||||
|
advancementBuilder.parent(new ResourceLocation("recipes/root"))
|
||||||
|
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId))
|
||||||
|
.rewards(AdvancementRewards.Builder.recipe(recipeId))
|
||||||
|
.requirements(RequirementsStrategy.OR);
|
||||||
|
this.criteria.forEach(advancementBuilder::addCriterion);
|
||||||
|
|
||||||
|
consumer.accept(new Result(
|
||||||
|
recipeId,
|
||||||
|
Ingredient.of(firstItem.orElseThrow()),
|
||||||
|
Ingredient.of(secondItem.orElseThrow()),
|
||||||
|
this.resultItem.orElseThrow(),
|
||||||
|
this.count,
|
||||||
|
advancementBuilder,
|
||||||
|
new ResourceLocation(recipeId.getNamespace(), "recipes/" + recipeId.getPath())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Result implements FinishedRecipe {
|
||||||
|
private final ResourceLocation id;
|
||||||
|
private final Ingredient first;
|
||||||
|
private final Ingredient second;
|
||||||
|
private final Item result;
|
||||||
|
private final int count;
|
||||||
|
private final Advancement.Builder advancement;
|
||||||
|
private final ResourceLocation advancementId;
|
||||||
|
|
||||||
|
public Result(ResourceLocation id, Ingredient first, Ingredient second, Item result, int count, Advancement.Builder advancement, ResourceLocation advancementId) {
|
||||||
|
this.id = id;
|
||||||
|
this.first = first;
|
||||||
|
this.second = second;
|
||||||
|
this.result = result;
|
||||||
|
this.count = count;
|
||||||
|
this.advancement = advancement;
|
||||||
|
this.advancementId = advancementId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serializeRecipeData(JsonObject json) {
|
||||||
|
JsonArray ingredients = new JsonArray();
|
||||||
|
ingredients.add(first.toJson());
|
||||||
|
ingredients.add(second.toJson());
|
||||||
|
json.add("ingredients", ingredients);
|
||||||
|
|
||||||
|
JsonObject resultObj = new JsonObject();
|
||||||
|
resultObj.addProperty("item", BuiltInRegistries.ITEM.getKey(result).toString());
|
||||||
|
if (count > 1) {
|
||||||
|
resultObj.addProperty("count", count);
|
||||||
|
}
|
||||||
|
json.add("result", resultObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipeSerializer<?> getType() {
|
||||||
|
return ModRecipes.EMBRYO_CALCIFICATION_MACHINE_SERIALIZER.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JsonObject serializeAdvancement() {
|
||||||
|
return advancement.serializeToJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getAdvancementId() {
|
||||||
|
return advancementId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//?}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public EmbryoCalcificationMachiningRecipeBuilder unlockedBy(String name, Criterion<?> criterion) {
|
||||||
|
*///?} else {
|
||||||
|
public EmbryoCalcificationMachiningRecipeBuilder unlockedBy(String name, InventoryChangeTrigger.TriggerInstance criterion) {
|
||||||
|
//?}
|
||||||
|
this.criteria.put(name, criterion);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
+194
@@ -0,0 +1,194 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen.custom;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.recipe.EmbryonicMachineRecipe;
|
||||||
|
import net.minecraft.advancements.*;
|
||||||
|
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
||||||
|
import net.minecraft.advancements.critereon.RecipeUnlockedTrigger;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*import net.minecraft.data.recipes.RecipeOutput;
|
||||||
|
*///?}
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
//? if <=1.20.1 {
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import net.cmr.jurassicrevived.recipe.ModRecipes;
|
||||||
|
import net.minecraft.data.recipes.FinishedRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
//?}
|
||||||
|
|
||||||
|
public class EmbryonicMachineRecipeBuilder {
|
||||||
|
private java.util.Optional<ItemLike> firstItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<ItemLike> secondItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<ItemLike> thirdItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<Item> resultItem = java.util.Optional.empty();
|
||||||
|
private final int count;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*private final Map<String, Criterion<?>> criteria;
|
||||||
|
*///?} else {
|
||||||
|
private final Map<String, InventoryChangeTrigger.TriggerInstance> criteria;
|
||||||
|
//?}
|
||||||
|
private final Map<ResourceLocation, Integer> weights = new java.util.HashMap<>();
|
||||||
|
|
||||||
|
public EmbryonicMachineRecipeBuilder(ItemLike ingredient, ItemLike secondIngredient, ItemLike thirdIngredient, ItemLike result, int count) {
|
||||||
|
this.firstItem = java.util.Optional.of(ingredient);
|
||||||
|
this.secondItem = java.util.Optional.of(secondIngredient);
|
||||||
|
this.thirdItem = java.util.Optional.of(thirdIngredient);
|
||||||
|
this.resultItem = java.util.Optional.of(result.asItem());
|
||||||
|
this.count = count;
|
||||||
|
this.criteria = new LinkedHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public void save(RecipeOutput output) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = ResourceLocation.fromNamespaceAndPath(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_embryonic_machining"
|
||||||
|
);
|
||||||
|
save(output, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(RecipeOutput output, ResourceLocation recipeId) {
|
||||||
|
NonNullList<Ingredient> inputs = NonNullList.create();
|
||||||
|
inputs.add(Ingredient.of(firstItem.orElseThrow()));
|
||||||
|
inputs.add(Ingredient.of(secondItem.orElseThrow()));
|
||||||
|
inputs.add(Ingredient.of(thirdItem.orElseThrow()));
|
||||||
|
ItemStack result = new ItemStack(resultItem.orElseThrow(), this.count);
|
||||||
|
|
||||||
|
EmbryonicMachineRecipe recipe = new EmbryonicMachineRecipe(inputs, result, Map.copyOf(this.weights));
|
||||||
|
|
||||||
|
AdvancementHolder advancementHolder = null;
|
||||||
|
if (!this.criteria.isEmpty()) {
|
||||||
|
Advancement.Builder builder = output.advancement();
|
||||||
|
for (Map.Entry<String, Criterion<?>> e : this.criteria.entrySet()) {
|
||||||
|
builder.addCriterion(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
builder.rewards(AdvancementRewards.Builder.recipe(recipeId));
|
||||||
|
builder.requirements(AdvancementRequirements.Strategy.OR);
|
||||||
|
advancementHolder = builder.build(recipeId.withPrefix("recipes/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
output.accept(recipeId, recipe, advancementHolder);
|
||||||
|
}
|
||||||
|
*///?} else {
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = new ResourceLocation(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_embryonic_machining"
|
||||||
|
);
|
||||||
|
save(consumer, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation recipeId) {
|
||||||
|
Advancement.Builder advancementBuilder = Advancement.Builder.advancement();
|
||||||
|
advancementBuilder.parent(new ResourceLocation("recipes/root"))
|
||||||
|
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId))
|
||||||
|
.rewards(AdvancementRewards.Builder.recipe(recipeId))
|
||||||
|
.requirements(RequirementsStrategy.OR);
|
||||||
|
this.criteria.forEach(advancementBuilder::addCriterion);
|
||||||
|
|
||||||
|
consumer.accept(new Result(
|
||||||
|
recipeId,
|
||||||
|
Ingredient.of(firstItem.orElseThrow()),
|
||||||
|
Ingredient.of(secondItem.orElseThrow()),
|
||||||
|
Ingredient.of(thirdItem.orElseThrow()),
|
||||||
|
this.resultItem.orElseThrow(),
|
||||||
|
this.count,
|
||||||
|
this.weights,
|
||||||
|
advancementBuilder,
|
||||||
|
new ResourceLocation(recipeId.getNamespace(), "recipes/" + recipeId.getPath())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Result implements FinishedRecipe {
|
||||||
|
private final ResourceLocation id;
|
||||||
|
private final Ingredient first;
|
||||||
|
private final Ingredient second;
|
||||||
|
private final Ingredient third;
|
||||||
|
private final Item result;
|
||||||
|
private final int count;
|
||||||
|
private final Map<ResourceLocation, Integer> weights;
|
||||||
|
private final Advancement.Builder advancement;
|
||||||
|
private final ResourceLocation advancementId;
|
||||||
|
|
||||||
|
public Result(ResourceLocation id, Ingredient first, Ingredient second, Ingredient third, Item result, int count, Map<ResourceLocation, Integer> weights, Advancement.Builder advancement, ResourceLocation advancementId) {
|
||||||
|
this.id = id;
|
||||||
|
this.first = first;
|
||||||
|
this.second = second;
|
||||||
|
this.third = third;
|
||||||
|
this.result = result;
|
||||||
|
this.count = count;
|
||||||
|
this.weights = weights;
|
||||||
|
this.advancement = advancement;
|
||||||
|
this.advancementId = advancementId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serializeRecipeData(JsonObject json) {
|
||||||
|
JsonArray ingredients = new JsonArray();
|
||||||
|
ingredients.add(first.toJson());
|
||||||
|
ingredients.add(second.toJson());
|
||||||
|
ingredients.add(third.toJson());
|
||||||
|
json.add("ingredients", ingredients);
|
||||||
|
|
||||||
|
JsonObject resultObj = new JsonObject();
|
||||||
|
resultObj.addProperty("item", BuiltInRegistries.ITEM.getKey(result).toString());
|
||||||
|
if (count > 1) {
|
||||||
|
resultObj.addProperty("count", count);
|
||||||
|
}
|
||||||
|
json.add("result", resultObj);
|
||||||
|
|
||||||
|
if (!weights.isEmpty()) {
|
||||||
|
JsonObject weightsObj = new JsonObject();
|
||||||
|
weights.forEach((k, v) -> weightsObj.addProperty(k.toString(), v));
|
||||||
|
json.add("weights", weightsObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipeSerializer<?> getType() {
|
||||||
|
return ModRecipes.EMBRYONIC_MACHINE_SERIALIZER.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JsonObject serializeAdvancement() {
|
||||||
|
return advancement.serializeToJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getAdvancementId() {
|
||||||
|
return advancementId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//?}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public EmbryonicMachineRecipeBuilder unlockedBy(String name, Criterion<?> criterion) {
|
||||||
|
*///?} else {
|
||||||
|
public EmbryonicMachineRecipeBuilder unlockedBy(String name, InventoryChangeTrigger.TriggerInstance criterion) {
|
||||||
|
//?}
|
||||||
|
this.criteria.put(name, criterion);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
+192
@@ -0,0 +1,192 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen.custom;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.recipe.FossilCleanerRecipe;
|
||||||
|
import net.minecraft.advancements.*;
|
||||||
|
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
||||||
|
import net.minecraft.advancements.critereon.RecipeUnlockedTrigger;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*import net.minecraft.data.recipes.RecipeOutput;
|
||||||
|
*///?}
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
//? if <=1.20.1 {
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import net.cmr.jurassicrevived.recipe.ModRecipes;
|
||||||
|
import net.minecraft.data.recipes.FinishedRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
//?}
|
||||||
|
|
||||||
|
public class FossilCleaningRecipeBuilder {
|
||||||
|
private java.util.Optional<ItemLike> firstItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<Item> resultItem = java.util.Optional.empty();
|
||||||
|
private final int count;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*private final Map<String, Criterion<?>> criteria;
|
||||||
|
*///?} else {
|
||||||
|
private final Map<String, InventoryChangeTrigger.TriggerInstance> criteria;
|
||||||
|
//?}
|
||||||
|
private final Map<ResourceLocation, Integer> weights = new java.util.HashMap<>();
|
||||||
|
|
||||||
|
public FossilCleaningRecipeBuilder(ItemLike ingredient, ItemLike placeholderResult, int count) {
|
||||||
|
this.firstItem = java.util.Optional.of(ingredient);
|
||||||
|
this.resultItem = java.util.Optional.of(placeholderResult.asItem());
|
||||||
|
this.count = count;
|
||||||
|
this.criteria = new LinkedHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FossilCleaningRecipeBuilder randomFossil(ItemLike consumableInput, ItemLike placeholderResult, int count) {
|
||||||
|
return new FossilCleaningRecipeBuilder(consumableInput, placeholderResult, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FossilCleaningRecipeBuilder addFossilWeight(ItemLike fossilItem, int weight) {
|
||||||
|
ResourceLocation id = BuiltInRegistries.ITEM.getKey(fossilItem.asItem());
|
||||||
|
if (id != null) {
|
||||||
|
weights.put(id, weight);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public void save(RecipeOutput output) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = ResourceLocation.fromNamespaceAndPath(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_fossil_cleaning"
|
||||||
|
);
|
||||||
|
save(output, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(RecipeOutput output, ResourceLocation recipeId) {
|
||||||
|
NonNullList<Ingredient> inputs = NonNullList.create();
|
||||||
|
inputs.add(Ingredient.of(firstItem.orElseThrow()));
|
||||||
|
ItemStack result = new ItemStack(resultItem.orElseThrow(), this.count);
|
||||||
|
|
||||||
|
FossilCleanerRecipe recipe = new FossilCleanerRecipe(inputs, result, Map.copyOf(this.weights));
|
||||||
|
|
||||||
|
AdvancementHolder advancementHolder = null;
|
||||||
|
if (!this.criteria.isEmpty()) {
|
||||||
|
Advancement.Builder builder = output.advancement();
|
||||||
|
for (Map.Entry<String, Criterion<?>> e : this.criteria.entrySet()) {
|
||||||
|
builder.addCriterion(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
builder.rewards(AdvancementRewards.Builder.recipe(recipeId));
|
||||||
|
builder.requirements(AdvancementRequirements.Strategy.OR);
|
||||||
|
advancementHolder = builder.build(recipeId.withPrefix("recipes/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
output.accept(recipeId, recipe, advancementHolder);
|
||||||
|
}
|
||||||
|
*///?} else {
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = new ResourceLocation(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_fossil_cleaning"
|
||||||
|
);
|
||||||
|
save(consumer, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation recipeId) {
|
||||||
|
Advancement.Builder advancementBuilder = Advancement.Builder.advancement();
|
||||||
|
advancementBuilder.parent(new ResourceLocation("recipes/root"))
|
||||||
|
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId))
|
||||||
|
.rewards(AdvancementRewards.Builder.recipe(recipeId))
|
||||||
|
.requirements(RequirementsStrategy.OR);
|
||||||
|
this.criteria.forEach(advancementBuilder::addCriterion);
|
||||||
|
|
||||||
|
consumer.accept(new Result(
|
||||||
|
recipeId,
|
||||||
|
Ingredient.of(firstItem.orElseThrow()),
|
||||||
|
this.resultItem.orElseThrow(),
|
||||||
|
this.count,
|
||||||
|
this.weights,
|
||||||
|
advancementBuilder,
|
||||||
|
new ResourceLocation(recipeId.getNamespace(), "recipes/" + recipeId.getPath())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Result implements FinishedRecipe {
|
||||||
|
private final ResourceLocation id;
|
||||||
|
private final Ingredient first;
|
||||||
|
private final Item result;
|
||||||
|
private final int count;
|
||||||
|
private final Map<ResourceLocation, Integer> weights;
|
||||||
|
private final Advancement.Builder advancement;
|
||||||
|
private final ResourceLocation advancementId;
|
||||||
|
|
||||||
|
public Result(ResourceLocation id, Ingredient first, Item result, int count, Map<ResourceLocation, Integer> weights, Advancement.Builder advancement, ResourceLocation advancementId) {
|
||||||
|
this.id = id;
|
||||||
|
this.first = first;
|
||||||
|
this.result = result;
|
||||||
|
this.count = count;
|
||||||
|
this.weights = weights;
|
||||||
|
this.advancement = advancement;
|
||||||
|
this.advancementId = advancementId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serializeRecipeData(JsonObject json) {
|
||||||
|
JsonArray ingredients = new JsonArray();
|
||||||
|
ingredients.add(first.toJson());
|
||||||
|
json.add("ingredients", ingredients);
|
||||||
|
|
||||||
|
JsonObject resultObj = new JsonObject();
|
||||||
|
resultObj.addProperty("item", BuiltInRegistries.ITEM.getKey(result).toString());
|
||||||
|
if (count > 1) {
|
||||||
|
resultObj.addProperty("count", count);
|
||||||
|
}
|
||||||
|
json.add("result", resultObj);
|
||||||
|
|
||||||
|
if (!weights.isEmpty()) {
|
||||||
|
JsonObject weightsObj = new JsonObject();
|
||||||
|
weights.forEach((k, v) -> weightsObj.addProperty(k.toString(), v));
|
||||||
|
json.add("weights", weightsObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipeSerializer<?> getType() {
|
||||||
|
return ModRecipes.FOSSIL_CLEANER_SERIALIZER.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JsonObject serializeAdvancement() {
|
||||||
|
return advancement.serializeToJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getAdvancementId() {
|
||||||
|
return advancementId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//?}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public FossilCleaningRecipeBuilder unlockedBy(String name, Criterion<?> criterion) {
|
||||||
|
*///?} else {
|
||||||
|
public FossilCleaningRecipeBuilder unlockedBy(String name, InventoryChangeTrigger.TriggerInstance criterion) {
|
||||||
|
//?}
|
||||||
|
this.criteria.put(name, criterion);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
+219
@@ -0,0 +1,219 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen.custom;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.item.ModItems;
|
||||||
|
import net.cmr.jurassicrevived.recipe.FossilGrinderRecipe;
|
||||||
|
import net.minecraft.advancements.*;
|
||||||
|
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
||||||
|
import net.minecraft.advancements.critereon.RecipeUnlockedTrigger;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*import net.minecraft.data.recipes.RecipeOutput;
|
||||||
|
*///?}
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
//? if <=1.20.1 {
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import net.cmr.jurassicrevived.recipe.ModRecipes;
|
||||||
|
import net.minecraft.data.recipes.FinishedRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
//?}
|
||||||
|
|
||||||
|
public class FossilGrindingRecipeBuilder {
|
||||||
|
private java.util.Optional<ItemLike> inputItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<Item> resultItem = java.util.Optional.empty();
|
||||||
|
private final int count;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*private final Map<String, Criterion<?>> criteria;
|
||||||
|
*///?} else {
|
||||||
|
private final Map<String, InventoryChangeTrigger.TriggerInstance> criteria;
|
||||||
|
//?}
|
||||||
|
private final java.util.Map<ResourceLocation, Integer> weights = new java.util.HashMap<>();
|
||||||
|
|
||||||
|
public FossilGrindingRecipeBuilder(ItemLike input, ItemLike result, int count) {
|
||||||
|
this.inputItem = java.util.Optional.of(input);
|
||||||
|
this.resultItem = java.util.Optional.of(result.asItem());
|
||||||
|
this.count = count;
|
||||||
|
this.criteria = new LinkedHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FossilGrindingRecipeBuilder fossilWeighted(ItemLike fossil, ItemLike tissueResult, int count) {
|
||||||
|
FossilGrindingRecipeBuilder b = new FossilGrindingRecipeBuilder(fossil, tissueResult, count);
|
||||||
|
b.addWeightedOutput(Items.BONE_MEAL, 40)
|
||||||
|
.addWeightedOutput(ModItems.CRUSHED_FOSSIL.get(), 40)
|
||||||
|
.addWeightedOutput(tissueResult, 20);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FossilGrindingRecipeBuilder skullToTissue(ItemLike skull, ItemLike tissueResult, int count) {
|
||||||
|
return new FossilGrindingRecipeBuilder(skull, tissueResult, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FossilGrindingRecipeBuilder addWeightedOutput(ItemLike item, int weight) {
|
||||||
|
ResourceLocation id = BuiltInRegistries.ITEM.getKey(item.asItem());
|
||||||
|
if (id != null) {
|
||||||
|
weights.put(id, Math.max(0, weight));
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public void saveFossil(RecipeOutput output) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = ResourceLocation.fromNamespaceAndPath(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_fossil_" + "grinding"
|
||||||
|
);
|
||||||
|
save(output, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveSkull(RecipeOutput output) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = ResourceLocation.fromNamespaceAndPath(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_skull_" + "grinding"
|
||||||
|
);
|
||||||
|
save(output, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(RecipeOutput output, ResourceLocation recipeId) {
|
||||||
|
NonNullList<Ingredient> inputs = NonNullList.create();
|
||||||
|
inputs.add(Ingredient.of(inputItem.orElseThrow()));
|
||||||
|
ItemStack result = new ItemStack(resultItem.orElseThrow(), this.count);
|
||||||
|
FossilGrinderRecipe recipe = new FossilGrinderRecipe(inputs, result, java.util.Map.copyOf(this.weights));
|
||||||
|
|
||||||
|
AdvancementHolder advancementHolder = null;
|
||||||
|
if (!this.criteria.isEmpty()) {
|
||||||
|
Advancement.Builder builder = output.advancement();
|
||||||
|
for (Map.Entry<String, Criterion<?>> e : this.criteria.entrySet()) {
|
||||||
|
builder.addCriterion(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
builder.rewards(AdvancementRewards.Builder.recipe(recipeId));
|
||||||
|
builder.requirements(AdvancementRequirements.Strategy.OR);
|
||||||
|
advancementHolder = builder.build(recipeId.withPrefix("recipes/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
output.accept(recipeId, recipe, advancementHolder);
|
||||||
|
}
|
||||||
|
*///?} else {
|
||||||
|
public void saveFossil(Consumer<FinishedRecipe> consumer) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = new ResourceLocation(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_fossil_" + "grinding"
|
||||||
|
);
|
||||||
|
save(consumer, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveSkull(Consumer<FinishedRecipe> consumer) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = new ResourceLocation(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_skull_" + "grinding"
|
||||||
|
);
|
||||||
|
save(consumer, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation recipeId) {
|
||||||
|
Advancement.Builder advancementBuilder = Advancement.Builder.advancement();
|
||||||
|
advancementBuilder.parent(new ResourceLocation("recipes/root"))
|
||||||
|
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId))
|
||||||
|
.rewards(AdvancementRewards.Builder.recipe(recipeId))
|
||||||
|
.requirements(RequirementsStrategy.OR);
|
||||||
|
this.criteria.forEach(advancementBuilder::addCriterion);
|
||||||
|
|
||||||
|
consumer.accept(new Result(
|
||||||
|
recipeId,
|
||||||
|
Ingredient.of(inputItem.orElseThrow()),
|
||||||
|
this.resultItem.orElseThrow(),
|
||||||
|
this.count,
|
||||||
|
this.weights,
|
||||||
|
advancementBuilder,
|
||||||
|
new ResourceLocation(recipeId.getNamespace(), "recipes/" + recipeId.getPath())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Result implements FinishedRecipe {
|
||||||
|
private final ResourceLocation id;
|
||||||
|
private final Ingredient input;
|
||||||
|
private final Item result;
|
||||||
|
private final int count;
|
||||||
|
private final Map<ResourceLocation, Integer> weights;
|
||||||
|
private final Advancement.Builder advancement;
|
||||||
|
private final ResourceLocation advancementId;
|
||||||
|
|
||||||
|
public Result(ResourceLocation id, Ingredient input, Item result, int count, Map<ResourceLocation, Integer> weights, Advancement.Builder advancement, ResourceLocation advancementId) {
|
||||||
|
this.id = id;
|
||||||
|
this.input = input;
|
||||||
|
this.result = result;
|
||||||
|
this.count = count;
|
||||||
|
this.weights = weights;
|
||||||
|
this.advancement = advancement;
|
||||||
|
this.advancementId = advancementId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serializeRecipeData(JsonObject json) {
|
||||||
|
JsonArray ingredients = new JsonArray();
|
||||||
|
ingredients.add(input.toJson());
|
||||||
|
json.add("ingredients", ingredients);
|
||||||
|
|
||||||
|
JsonObject resultObj = new JsonObject();
|
||||||
|
resultObj.addProperty("item", BuiltInRegistries.ITEM.getKey(result).toString());
|
||||||
|
if (count > 1) {
|
||||||
|
resultObj.addProperty("count", count);
|
||||||
|
}
|
||||||
|
json.add("result", resultObj);
|
||||||
|
|
||||||
|
if (!weights.isEmpty()) {
|
||||||
|
JsonObject weightsObj = new JsonObject();
|
||||||
|
weights.forEach((k, v) -> weightsObj.addProperty(k.toString(), v));
|
||||||
|
json.add("weights", weightsObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipeSerializer<?> getType() {
|
||||||
|
return ModRecipes.FOSSIL_GRINDER_SERIALIZER.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JsonObject serializeAdvancement() {
|
||||||
|
return advancement.serializeToJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getAdvancementId() {
|
||||||
|
return advancementId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//?}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public FossilGrindingRecipeBuilder unlockedBy(String name, Criterion<?> criterion) {
|
||||||
|
*///?} else {
|
||||||
|
public FossilGrindingRecipeBuilder unlockedBy(String name, InventoryChangeTrigger.TriggerInstance criterion) {
|
||||||
|
//?}
|
||||||
|
this.criteria.put(name, criterion);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
+170
@@ -0,0 +1,170 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen.custom;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.recipe.IncubatorRecipe;
|
||||||
|
import net.minecraft.advancements.*;
|
||||||
|
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
||||||
|
import net.minecraft.advancements.critereon.RecipeUnlockedTrigger;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*import net.minecraft.data.recipes.RecipeOutput;
|
||||||
|
*///?}
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
//? if <=1.20.1 {
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import net.cmr.jurassicrevived.recipe.ModRecipes;
|
||||||
|
import net.minecraft.data.recipes.FinishedRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
//?}
|
||||||
|
|
||||||
|
public class IncubatingRecipeBuilder {
|
||||||
|
private java.util.Optional<ItemLike> inputItem = java.util.Optional.empty();
|
||||||
|
private java.util.Optional<Item> resultItem = java.util.Optional.empty();
|
||||||
|
private final int count;
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*private final Map<String, Criterion<?>> criteria;
|
||||||
|
*///?} else {
|
||||||
|
private final Map<String, InventoryChangeTrigger.TriggerInstance> criteria;
|
||||||
|
//?}
|
||||||
|
|
||||||
|
public IncubatingRecipeBuilder(ItemLike input, ItemLike result, int count) {
|
||||||
|
this.inputItem = java.util.Optional.of(input);
|
||||||
|
this.resultItem = java.util.Optional.of(result.asItem());
|
||||||
|
this.count = count;
|
||||||
|
this.criteria = new LinkedHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public void save(RecipeOutput output) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = ResourceLocation.fromNamespaceAndPath(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_incubating"
|
||||||
|
);
|
||||||
|
save(output, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(RecipeOutput output, ResourceLocation recipeId) {
|
||||||
|
NonNullList<Ingredient> inputs = NonNullList.create();
|
||||||
|
inputs.add(Ingredient.of(inputItem.orElseThrow()));
|
||||||
|
ItemStack result = new ItemStack(resultItem.orElseThrow(), this.count);
|
||||||
|
|
||||||
|
IncubatorRecipe recipe = new IncubatorRecipe(inputs, result);
|
||||||
|
|
||||||
|
AdvancementHolder advancementHolder = null;
|
||||||
|
if (!this.criteria.isEmpty()) {
|
||||||
|
Advancement.Builder builder = output.advancement();
|
||||||
|
for (Map.Entry<String, Criterion<?>> e : this.criteria.entrySet()) {
|
||||||
|
builder.addCriterion(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
builder.rewards(AdvancementRewards.Builder.recipe(recipeId));
|
||||||
|
builder.requirements(AdvancementRequirements.Strategy.OR);
|
||||||
|
advancementHolder = builder.build(recipeId.withPrefix("recipes/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
output.accept(recipeId, recipe, advancementHolder);
|
||||||
|
}
|
||||||
|
*///?} else {
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer) {
|
||||||
|
ResourceLocation resultKey = BuiltInRegistries.ITEM.getKey(this.resultItem.orElseThrow());
|
||||||
|
ResourceLocation id = new ResourceLocation(
|
||||||
|
resultKey.getNamespace(),
|
||||||
|
resultKey.getPath() + "_from_incubating"
|
||||||
|
);
|
||||||
|
save(consumer, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation recipeId) {
|
||||||
|
Advancement.Builder advancementBuilder = Advancement.Builder.advancement();
|
||||||
|
advancementBuilder.parent(new ResourceLocation("recipes/root"))
|
||||||
|
.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId))
|
||||||
|
.rewards(AdvancementRewards.Builder.recipe(recipeId))
|
||||||
|
.requirements(RequirementsStrategy.OR);
|
||||||
|
this.criteria.forEach(advancementBuilder::addCriterion);
|
||||||
|
|
||||||
|
consumer.accept(new Result(
|
||||||
|
recipeId,
|
||||||
|
Ingredient.of(inputItem.orElseThrow()),
|
||||||
|
this.resultItem.orElseThrow(),
|
||||||
|
this.count,
|
||||||
|
advancementBuilder,
|
||||||
|
new ResourceLocation(recipeId.getNamespace(), "recipes/" + recipeId.getPath())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Result implements FinishedRecipe {
|
||||||
|
private final ResourceLocation id;
|
||||||
|
private final Ingredient input;
|
||||||
|
private final Item result;
|
||||||
|
private final int count;
|
||||||
|
private final Advancement.Builder advancement;
|
||||||
|
private final ResourceLocation advancementId;
|
||||||
|
|
||||||
|
public Result(ResourceLocation id, Ingredient input, Item result, int count, Advancement.Builder advancement, ResourceLocation advancementId) {
|
||||||
|
this.id = id;
|
||||||
|
this.input = input;
|
||||||
|
this.result = result;
|
||||||
|
this.count = count;
|
||||||
|
this.advancement = advancement;
|
||||||
|
this.advancementId = advancementId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serializeRecipeData(JsonObject json) {
|
||||||
|
JsonArray ingredients = new JsonArray();
|
||||||
|
ingredients.add(input.toJson());
|
||||||
|
json.add("ingredients", ingredients);
|
||||||
|
|
||||||
|
JsonObject resultObj = new JsonObject();
|
||||||
|
resultObj.addProperty("item", BuiltInRegistries.ITEM.getKey(result).toString());
|
||||||
|
if (count > 1) {
|
||||||
|
resultObj.addProperty("count", count);
|
||||||
|
}
|
||||||
|
json.add("result", resultObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipeSerializer<?> getType() {
|
||||||
|
return ModRecipes.INCUBATOR_SERIALIZER.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JsonObject serializeAdvancement() {
|
||||||
|
return advancement.serializeToJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getAdvancementId() {
|
||||||
|
return advancementId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//?}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public IncubatingRecipeBuilder unlockedBy(String name, Criterion<?> criterion) {
|
||||||
|
*///?} else {
|
||||||
|
public IncubatingRecipeBuilder unlockedBy(String name, InventoryChangeTrigger.TriggerInstance criterion) {
|
||||||
|
//?}
|
||||||
|
this.criteria.put(name, criterion);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,5 +13,6 @@ public class DataGenerators implements DataGeneratorEntrypoint {
|
|||||||
pack.addProvider(FabricItemTagProvider::new);
|
pack.addProvider(FabricItemTagProvider::new);
|
||||||
pack.addProvider(FabricBlockLootTableProvider::new);
|
pack.addProvider(FabricBlockLootTableProvider::new);
|
||||||
pack.addProvider(FabricEntityLootTableProvider::new);
|
pack.addProvider(FabricEntityLootTableProvider::new);
|
||||||
|
pack.addProvider(FabricRecipeProvider::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,312 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.Constants;
|
||||||
|
import net.cmr.jurassicrevived.datagen.custom.*;
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||||
|
import net.minecraft.core.HolderLookup;
|
||||||
|
import net.minecraft.data.recipes.*;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.BlastingRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import net.minecraft.world.item.crafting.SmeltingRecipe;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
//? if <=1.20.1 {
|
||||||
|
import net.minecraft.data.recipes.FinishedRecipe;
|
||||||
|
//?}
|
||||||
|
|
||||||
|
public class FabricRecipeProvider extends net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider implements ModRecipeProvider.RecipeHelper {
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public FabricRecipeProvider(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registriesFuture) {
|
||||||
|
super(output, registriesFuture);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RecipeOutput output;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildRecipes(RecipeOutput output) {
|
||||||
|
this.output = output;
|
||||||
|
ModRecipeProvider.registerRecipes(this);
|
||||||
|
this.output = null;
|
||||||
|
}
|
||||||
|
*///?} else {
|
||||||
|
public FabricRecipeProvider(FabricDataOutput output) {
|
||||||
|
super(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Consumer<FinishedRecipe> output;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildRecipes(Consumer<FinishedRecipe> output) {
|
||||||
|
this.output = output;
|
||||||
|
ModRecipeProvider.registerRecipes(this);
|
||||||
|
this.output = null;
|
||||||
|
}
|
||||||
|
//?}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildShaped(RecipeCategory category, ItemLike result, int count, String[] patterns, Object... keys) {
|
||||||
|
ShapedRecipeBuilder builder = ShapedRecipeBuilder.shaped(category, result, count);
|
||||||
|
for (String pattern : patterns) {
|
||||||
|
builder.pattern(pattern);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < keys.length; i += 2) {
|
||||||
|
Character key = (Character) keys[i];
|
||||||
|
Object ingredient = keys[i + 1];
|
||||||
|
if (ingredient instanceof ItemLike) {
|
||||||
|
builder.define(key, (ItemLike) ingredient);
|
||||||
|
} else if (ingredient instanceof TagKey) {
|
||||||
|
builder.define(key, (TagKey<Item>) ingredient);
|
||||||
|
} else if (ingredient instanceof Ingredient) {
|
||||||
|
builder.define(key, (Ingredient) ingredient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_item", has(result));
|
||||||
|
builder.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildShapeless(RecipeCategory category, ItemLike result, int count, ItemLike... ingredients) {
|
||||||
|
ShapelessRecipeBuilder builder = ShapelessRecipeBuilder.shapeless(category, result, count);
|
||||||
|
for (ItemLike ingredient : ingredients) {
|
||||||
|
builder.requires(ingredient);
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_item", has(result));
|
||||||
|
builder.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildShapeless(RecipeCategory category, ItemLike result, int count, String name, ItemLike... ingredients) {
|
||||||
|
ShapelessRecipeBuilder builder = ShapelessRecipeBuilder.shapeless(category, result, count);
|
||||||
|
for (ItemLike ingredient : ingredients) {
|
||||||
|
builder.requires(ingredient);
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_item", has(result));
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*builder.save(output, ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, name));
|
||||||
|
*///?} else {
|
||||||
|
builder.save(output, new ResourceLocation(Constants.MOD_ID, name));
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildSmelting(List<ItemLike> ingredients, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*oreCooking(output, RecipeSerializer.SMELTING_RECIPE, SmeltingRecipe::new, ingredients, category, result, experience, cookingTime, group, "_from_smelting");
|
||||||
|
*///?} else {
|
||||||
|
oreCooking120(output, RecipeSerializer.SMELTING_RECIPE, ingredients, category, result, experience, cookingTime, group, "_from_smelting");
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildBlasting(List<ItemLike> ingredients, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*oreCooking(output, RecipeSerializer.BLASTING_RECIPE, BlastingRecipe::new, ingredients, category, result, experience, cookingTime, group, "_from_blasting");
|
||||||
|
*///?} else {
|
||||||
|
oreCooking120(output, RecipeSerializer.BLASTING_RECIPE, ingredients, category, result, experience, cookingTime, group, "_from_blasting");
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildSmelting(TagKey<Item> tag, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*SimpleCookingRecipeBuilder.generic(Ingredient.of(tag), category, result, experience, cookingTime, RecipeSerializer.SMELTING_RECIPE, SmeltingRecipe::new)
|
||||||
|
.group(group).unlockedBy("has_" + group, has(tag))
|
||||||
|
.save(output, ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, getItemName(result) + "_from_smelting_" + group));
|
||||||
|
*///?} else {
|
||||||
|
SimpleCookingRecipeBuilder.generic(Ingredient.of(tag), category, result, experience, cookingTime, RecipeSerializer.SMELTING_RECIPE)
|
||||||
|
.group(group).unlockedBy("has_" + group, has(tag))
|
||||||
|
.save(output, new ResourceLocation(Constants.MOD_ID, getItemName(result) + "_from_smelting_" + group));
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildBlasting(TagKey<Item> tag, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*SimpleCookingRecipeBuilder.generic(Ingredient.of(tag), category, result, experience, cookingTime, RecipeSerializer.BLASTING_RECIPE, BlastingRecipe::new)
|
||||||
|
.group(group).unlockedBy("has_" + group, has(tag))
|
||||||
|
.save(output, ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, getItemName(result) + "_from_blasting_" + group));
|
||||||
|
*///?} else {
|
||||||
|
SimpleCookingRecipeBuilder.generic(Ingredient.of(tag), category, result, experience, cookingTime, RecipeSerializer.BLASTING_RECIPE)
|
||||||
|
.group(group).unlockedBy("has_" + group, has(tag))
|
||||||
|
.save(output, new ResourceLocation(Constants.MOD_ID, getItemName(result) + "_from_blasting_" + group));
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*public static <T extends AbstractCookingRecipe> void oreCooking(
|
||||||
|
RecipeOutput pRecipeOutput,
|
||||||
|
RecipeSerializer<T> pCookingSerializer,
|
||||||
|
AbstractCookingRecipe.Factory<T> factory,
|
||||||
|
List<ItemLike> pIngredients,
|
||||||
|
RecipeCategory pCategory,
|
||||||
|
ItemLike pResult,
|
||||||
|
float pExperience,
|
||||||
|
int pCookingTime,
|
||||||
|
String pGroup,
|
||||||
|
String pRecipeName
|
||||||
|
) {
|
||||||
|
for(ItemLike itemlike : pIngredients) {
|
||||||
|
SimpleCookingRecipeBuilder.generic(Ingredient.of(itemlike), pCategory, pResult, pExperience, pCookingTime, pCookingSerializer, factory)
|
||||||
|
.group(pGroup).unlockedBy(getHasName(itemlike), has(itemlike))
|
||||||
|
.save(pRecipeOutput, ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, getItemName(pResult) + pRecipeName + "_" + getItemName(itemlike)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*///?} else {
|
||||||
|
protected static <T extends AbstractCookingRecipe> void oreCooking120(Consumer<FinishedRecipe> pRecipeOutput, RecipeSerializer<T> pCookingSerializer,
|
||||||
|
List<ItemLike> pIngredients, RecipeCategory pCategory, ItemLike pResult, float pExperience, int pCookingTime, String pGroup, String pRecipeName) {
|
||||||
|
for(ItemLike itemlike : pIngredients) {
|
||||||
|
SimpleCookingRecipeBuilder.generic(Ingredient.of(itemlike), pCategory, pResult, pExperience, pCookingTime, pCookingSerializer)
|
||||||
|
.group(pGroup).unlockedBy(getHasName(itemlike), has(itemlike))
|
||||||
|
.save(pRecipeOutput, new ResourceLocation(Constants.MOD_ID, getItemName(pResult) + pRecipeName + "_" + getItemName(itemlike)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//?}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dnaExtracting(ItemLike testTube, ItemLike tissue, ItemLike dna, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*new DNAExtractingRecipeBuilder(testTube, tissue, dna, count)
|
||||||
|
.unlockedBy("has_tissue", has(tissue))
|
||||||
|
.save(output);
|
||||||
|
*///?} else {
|
||||||
|
new DNAExtractingRecipeBuilder(testTube, tissue, dna, count)
|
||||||
|
.unlockedBy("has_tissue", has(tissue))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dnaAnalyzing(ItemLike testTube, ItemLike material, ItemLike dna, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*new DNAAnalyzingRecipeBuilder(testTube, material, dna, count)
|
||||||
|
.unlockedBy("has_material", has(material))
|
||||||
|
.save(output);
|
||||||
|
*///?} else {
|
||||||
|
new DNAAnalyzingRecipeBuilder(testTube, material, dna, count)
|
||||||
|
.unlockedBy("has_material", has(material))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dnaHybridizing(ItemLike result, int count, ItemLike catalyst, ItemLike... ingredients) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*DNAHybridizingRecipeBuilder builder = new DNAHybridizingRecipeBuilder(result, count)
|
||||||
|
.setCatalyst(catalyst);
|
||||||
|
for (ItemLike ingredient : ingredients) {
|
||||||
|
builder.addIngredient(ingredient);
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_catalyst", has(catalyst))
|
||||||
|
.save(output);
|
||||||
|
*///?} else {
|
||||||
|
DNAHybridizingRecipeBuilder builder = new DNAHybridizingRecipeBuilder(result, count)
|
||||||
|
.setCatalyst(catalyst);
|
||||||
|
for (ItemLike ingredient : ingredients) {
|
||||||
|
builder.addIngredient(ingredient);
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_catalyst", has(catalyst))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void embryonicMachine(ItemLike syringe, ItemLike dna, ItemLike catalyst, ItemLike result, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*new EmbryonicMachineRecipeBuilder(syringe, dna, catalyst, result, count)
|
||||||
|
.unlockedBy("has_dna", has(dna))
|
||||||
|
.save(output);
|
||||||
|
*///?} else {
|
||||||
|
new EmbryonicMachineRecipeBuilder(syringe, dna, catalyst, result, count)
|
||||||
|
.unlockedBy("has_dna", has(dna))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void embryoCalcification(ItemLike syringe, ItemLike egg, ItemLike result, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*new EmbryoCalcificationMachiningRecipeBuilder(syringe, egg, result, count)
|
||||||
|
.unlockedBy("has_egg", has(egg))
|
||||||
|
.save(output);
|
||||||
|
*///?} else {
|
||||||
|
new EmbryoCalcificationMachiningRecipeBuilder(syringe, egg, result, count)
|
||||||
|
.unlockedBy("has_egg", has(egg))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void incubating(ItemLike egg, ItemLike result, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*new IncubatingRecipeBuilder(egg, result, count)
|
||||||
|
.unlockedBy("has_egg", has(egg))
|
||||||
|
.save(output);
|
||||||
|
*///?} else {
|
||||||
|
new IncubatingRecipeBuilder(egg, result, count)
|
||||||
|
.unlockedBy("has_egg", has(egg))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fossilGrinding(ItemLike fossil, ItemLike tissue, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*FossilGrindingRecipeBuilder.fossilWeighted(fossil, tissue, count)
|
||||||
|
.unlockedBy("has_fossil", has(fossil))
|
||||||
|
.saveFossil(output);
|
||||||
|
*///?} else {
|
||||||
|
FossilGrindingRecipeBuilder.fossilWeighted(fossil, tissue, count)
|
||||||
|
.unlockedBy("has_fossil", has(fossil))
|
||||||
|
.saveFossil(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void skullToTissue(ItemLike skull, ItemLike tissue, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*FossilGrindingRecipeBuilder.skullToTissue(skull, tissue, count)
|
||||||
|
.unlockedBy("has_skull", has(skull))
|
||||||
|
.saveSkull(output);
|
||||||
|
*///?} else {
|
||||||
|
FossilGrindingRecipeBuilder.skullToTissue(skull, tissue, count)
|
||||||
|
.unlockedBy("has_skull", has(skull))
|
||||||
|
.saveSkull(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fossilCleaning(ItemLike fossilBlock, ItemLike result, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*FossilCleaningRecipeBuilder.randomFossil(fossilBlock, result, count)
|
||||||
|
.unlockedBy("has_fossil_block", has(fossilBlock))
|
||||||
|
.save(output);
|
||||||
|
*///?} else {
|
||||||
|
FossilCleaningRecipeBuilder.randomFossil(fossilBlock, result, count)
|
||||||
|
.unlockedBy("has_fossil_block", has(fossilBlock))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void amberRandomDNA(ItemLike testTube, ItemLike amber, ItemLike defaultDna, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
/*DNAExtractingRecipeBuilder.amberRandomDNAUniform(testTube, amber, defaultDna, count)
|
||||||
|
.unlockedBy("has_amber", has(amber))
|
||||||
|
.save(output);
|
||||||
|
*///?} else {
|
||||||
|
DNAExtractingRecipeBuilder.amberRandomDNAUniform(testTube, amber, defaultDna, count)
|
||||||
|
.unlockedBy("has_amber", has(amber))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,5 +39,6 @@ public class DataGenerators {
|
|||||||
new LootTableProvider.SubProviderEntry(ForgeEntityLootTableProvider::new, LootContextParamSets.ENTITY)
|
new LootTableProvider.SubProviderEntry(ForgeEntityLootTableProvider::new, LootContextParamSets.ENTITY)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
generator.addProvider(event.includeServer(), new ForgeRecipeProvider(packOutput));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+184
@@ -0,0 +1,184 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.Constants;
|
||||||
|
import net.cmr.jurassicrevived.datagen.custom.*;
|
||||||
|
import net.minecraft.core.HolderLookup;
|
||||||
|
import net.minecraft.data.PackOutput;
|
||||||
|
import net.minecraft.data.recipes.*;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.BlastingRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import net.minecraft.world.item.crafting.SmeltingRecipe;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class ForgeRecipeProvider extends RecipeProvider implements ModRecipeProvider.RecipeHelper {
|
||||||
|
|
||||||
|
public ForgeRecipeProvider(PackOutput output) {
|
||||||
|
super(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Consumer<FinishedRecipe> output;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildRecipes(Consumer<FinishedRecipe> output) {
|
||||||
|
this.output = output;
|
||||||
|
ModRecipeProvider.registerRecipes(this);
|
||||||
|
this.output = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildShaped(RecipeCategory category, ItemLike result, int count, String[] patterns, Object... keys) {
|
||||||
|
ShapedRecipeBuilder builder = ShapedRecipeBuilder.shaped(category, result, count);
|
||||||
|
for (String pattern : patterns) {
|
||||||
|
builder.pattern(pattern);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < keys.length; i += 2) {
|
||||||
|
Character key = (Character) keys[i];
|
||||||
|
Object ingredient = keys[i + 1];
|
||||||
|
if (ingredient instanceof ItemLike) {
|
||||||
|
builder.define(key, (ItemLike) ingredient);
|
||||||
|
} else if (ingredient instanceof TagKey) {
|
||||||
|
builder.define(key, (TagKey<Item>) ingredient);
|
||||||
|
} else if (ingredient instanceof Ingredient) {
|
||||||
|
builder.define(key, (Ingredient) ingredient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_item", has(result));
|
||||||
|
builder.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildShapeless(RecipeCategory category, ItemLike result, int count, ItemLike... ingredients) {
|
||||||
|
ShapelessRecipeBuilder builder = ShapelessRecipeBuilder.shapeless(category, result, count);
|
||||||
|
for (ItemLike ingredient : ingredients) {
|
||||||
|
builder.requires(ingredient);
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_item", has(result));
|
||||||
|
builder.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildShapeless(RecipeCategory category, ItemLike result, int count, String name, ItemLike... ingredients) {
|
||||||
|
ShapelessRecipeBuilder builder = ShapelessRecipeBuilder.shapeless(category, result, count);
|
||||||
|
for (ItemLike ingredient : ingredients) {
|
||||||
|
builder.requires(ingredient);
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_item", has(result));
|
||||||
|
builder.save(output, Constants.rl(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildSmelting(List<ItemLike> ingredients, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
oreCooking120(output, RecipeSerializer.SMELTING_RECIPE, ingredients, category, result, experience, cookingTime, group, "_from_smelting");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildBlasting(List<ItemLike> ingredients, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
oreCooking120(output, RecipeSerializer.BLASTING_RECIPE, ingredients, category, result, experience, cookingTime, group, "_from_blasting");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildSmelting(TagKey<Item> tag, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
SimpleCookingRecipeBuilder.generic(Ingredient.of(tag), category, result, experience, cookingTime, RecipeSerializer.SMELTING_RECIPE)
|
||||||
|
.group(group).unlockedBy("has_" + group, has(tag))
|
||||||
|
.save(output, Constants.rl(getItemName(result) + "_from_smelting_" + group));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildBlasting(TagKey<Item> tag, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
SimpleCookingRecipeBuilder.generic(Ingredient.of(tag), category, result, experience, cookingTime, RecipeSerializer.BLASTING_RECIPE)
|
||||||
|
.group(group).unlockedBy("has_" + group, has(tag))
|
||||||
|
.save(output, Constants.rl(getItemName(result) + "_from_blasting_" + group));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static <T extends AbstractCookingRecipe> void oreCooking120(Consumer<FinishedRecipe> pRecipeOutput, RecipeSerializer<T> pCookingSerializer,
|
||||||
|
List<ItemLike> pIngredients, RecipeCategory pCategory, ItemLike pResult, float pExperience, int pCookingTime, String pGroup, String pRecipeName) {
|
||||||
|
for(ItemLike itemlike : pIngredients) {
|
||||||
|
SimpleCookingRecipeBuilder.generic(Ingredient.of(itemlike), pCategory, pResult, pExperience, pCookingTime, pCookingSerializer)
|
||||||
|
.group(pGroup).unlockedBy(getHasName(itemlike), has(itemlike))
|
||||||
|
.save(pRecipeOutput, Constants.rl(getItemName(pResult) + pRecipeName + "_" + getItemName(itemlike)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dnaExtracting(ItemLike testTube, ItemLike tissue, ItemLike dna, int count) {
|
||||||
|
new DNAExtractingRecipeBuilder(testTube, tissue, dna, count)
|
||||||
|
.unlockedBy("has_tissue", has(tissue))
|
||||||
|
.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dnaAnalyzing(ItemLike testTube, ItemLike material, ItemLike dna, int count) {
|
||||||
|
new DNAAnalyzingRecipeBuilder(testTube, material, dna, count)
|
||||||
|
.unlockedBy("has_material", has(material))
|
||||||
|
.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dnaHybridizing(ItemLike result, int count, ItemLike catalyst, ItemLike... ingredients) {
|
||||||
|
DNAHybridizingRecipeBuilder builder = new DNAHybridizingRecipeBuilder(result, count)
|
||||||
|
.setCatalyst(catalyst);
|
||||||
|
for (ItemLike ingredient : ingredients) {
|
||||||
|
builder.addIngredient(ingredient);
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_catalyst", has(catalyst))
|
||||||
|
.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void embryonicMachine(ItemLike syringe, ItemLike dna, ItemLike catalyst, ItemLike result, int count) {
|
||||||
|
new EmbryonicMachineRecipeBuilder(syringe, dna, catalyst, result, count)
|
||||||
|
.unlockedBy("has_dna", has(dna))
|
||||||
|
.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void embryoCalcification(ItemLike syringe, ItemLike egg, ItemLike result, int count) {
|
||||||
|
new EmbryoCalcificationMachiningRecipeBuilder(syringe, egg, result, count)
|
||||||
|
.unlockedBy("has_egg", has(egg))
|
||||||
|
.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void incubating(ItemLike egg, ItemLike result, int count) {
|
||||||
|
new IncubatingRecipeBuilder(egg, result, count)
|
||||||
|
.unlockedBy("has_egg", has(egg))
|
||||||
|
.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fossilGrinding(ItemLike fossil, ItemLike tissue, int count) {
|
||||||
|
FossilGrindingRecipeBuilder.fossilWeighted(fossil, tissue, count)
|
||||||
|
.unlockedBy("has_fossil", has(fossil))
|
||||||
|
.saveFossil(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void skullToTissue(ItemLike skull, ItemLike tissue, int count) {
|
||||||
|
FossilGrindingRecipeBuilder.skullToTissue(skull, tissue, count)
|
||||||
|
.unlockedBy("has_skull", has(skull))
|
||||||
|
.saveSkull(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fossilCleaning(ItemLike fossilBlock, ItemLike result, int count) {
|
||||||
|
FossilCleaningRecipeBuilder.randomFossil(fossilBlock, result, count)
|
||||||
|
.unlockedBy("has_fossil_block", has(fossilBlock))
|
||||||
|
.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void amberRandomDNA(ItemLike testTube, ItemLike amber, ItemLike defaultDna, int count) {
|
||||||
|
DNAExtractingRecipeBuilder.amberRandomDNAUniform(testTube, amber, defaultDna, count)
|
||||||
|
.unlockedBy("has_amber", has(amber))
|
||||||
|
.save(output);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,6 @@ public class DataGenerators {
|
|||||||
),
|
),
|
||||||
lookupProvider
|
lookupProvider
|
||||||
));
|
));
|
||||||
|
generator.addProvider(event.includeServer(), new NeoForgeRecipeProvider(packOutput, lookupProvider));
|
||||||
generator.addProvider(event.includeServer(), new NeoForgeGlobalLootModifierProvider(packOutput));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,203 @@
|
|||||||
|
package net.cmr.jurassicrevived.datagen;
|
||||||
|
|
||||||
|
import net.cmr.jurassicrevived.Constants;
|
||||||
|
import net.cmr.jurassicrevived.datagen.custom.*;
|
||||||
|
import net.minecraft.core.HolderLookup;
|
||||||
|
import net.minecraft.data.PackOutput;
|
||||||
|
import net.minecraft.data.recipes.*;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.BlastingRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import net.minecraft.world.item.crafting.SmeltingRecipe;
|
||||||
|
import net.minecraft.world.level.ItemLike;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
public class NeoForgeRecipeProvider extends RecipeProvider implements ModRecipeProvider.RecipeHelper {
|
||||||
|
|
||||||
|
public NeoForgeRecipeProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries) {
|
||||||
|
super(output, registries);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RecipeOutput output;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildRecipes(RecipeOutput output) {
|
||||||
|
this.output = output;
|
||||||
|
ModRecipeProvider.registerRecipes(this);
|
||||||
|
this.output = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildShaped(RecipeCategory category, ItemLike result, int count, String[] patterns, Object... keys) {
|
||||||
|
ShapedRecipeBuilder builder = ShapedRecipeBuilder.shaped(category, result, count);
|
||||||
|
for (String pattern : patterns) {
|
||||||
|
builder.pattern(pattern);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < keys.length; i += 2) {
|
||||||
|
Character key = (Character) keys[i];
|
||||||
|
Object ingredient = keys[i + 1];
|
||||||
|
if (ingredient instanceof ItemLike) {
|
||||||
|
builder.define(key, (ItemLike) ingredient);
|
||||||
|
} else if (ingredient instanceof TagKey) {
|
||||||
|
builder.define(key, (TagKey<Item>) ingredient);
|
||||||
|
} else if (ingredient instanceof Ingredient) {
|
||||||
|
builder.define(key, (Ingredient) ingredient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_item", has(result));
|
||||||
|
builder.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildShapeless(RecipeCategory category, ItemLike result, int count, ItemLike... ingredients) {
|
||||||
|
ShapelessRecipeBuilder builder = ShapelessRecipeBuilder.shapeless(category, result, count);
|
||||||
|
for (ItemLike ingredient : ingredients) {
|
||||||
|
builder.requires(ingredient);
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_item", has(result));
|
||||||
|
builder.save(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildShapeless(RecipeCategory category, ItemLike result, int count, String name, ItemLike... ingredients) {
|
||||||
|
ShapelessRecipeBuilder builder = ShapelessRecipeBuilder.shapeless(category, result, count);
|
||||||
|
for (ItemLike ingredient : ingredients) {
|
||||||
|
builder.requires(ingredient);
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_item", has(result));
|
||||||
|
builder.save(output, ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildSmelting(List<ItemLike> ingredients, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
oreCooking(output, RecipeSerializer.SMELTING_RECIPE, SmeltingRecipe::new, ingredients, category, result, experience, cookingTime, group, "_from_smelting");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildBlasting(List<ItemLike> ingredients, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
oreCooking(output, RecipeSerializer.BLASTING_RECIPE, BlastingRecipe::new, ingredients, category, result, experience, cookingTime, group, "_from_blasting");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildSmelting(TagKey<Item> tag, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
SimpleCookingRecipeBuilder.generic(Ingredient.of(tag), category, result, experience, cookingTime, RecipeSerializer.SMELTING_RECIPE, SmeltingRecipe::new)
|
||||||
|
.group(group).unlockedBy("has_" + group, has(tag))
|
||||||
|
.save(output, ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, getItemName(result) + "_from_smelting_" + group));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildBlasting(TagKey<Item> tag, RecipeCategory category, ItemLike result, float experience, int cookingTime, String group) {
|
||||||
|
SimpleCookingRecipeBuilder.generic(Ingredient.of(tag), category, result, experience, cookingTime, RecipeSerializer.BLASTING_RECIPE, BlastingRecipe::new)
|
||||||
|
.group(group).unlockedBy("has_" + group, has(tag))
|
||||||
|
.save(output, ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, getItemName(result) + "_from_blasting_" + group));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static <T extends AbstractCookingRecipe> void oreCooking(RecipeOutput pRecipeOutput, RecipeSerializer<T> pCookingSerializer, AbstractCookingRecipe.Factory<T> factory,
|
||||||
|
List<ItemLike> pIngredients, RecipeCategory pCategory, ItemLike pResult, float pExperience, int pCookingTime, String pGroup, String pRecipeName) {
|
||||||
|
for(ItemLike itemlike : pIngredients) {
|
||||||
|
SimpleCookingRecipeBuilder.generic(Ingredient.of(itemlike), pCategory, pResult, pExperience, pCookingTime, pCookingSerializer, factory)
|
||||||
|
.group(pGroup).unlockedBy(getHasName(itemlike), has(itemlike))
|
||||||
|
.save(pRecipeOutput, ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, getItemName(pResult) + pRecipeName + "_" + getItemName(itemlike)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dnaExtracting(ItemLike testTube, ItemLike tissue, ItemLike dna, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
new DNAExtractingRecipeBuilder(testTube, tissue, dna, count)
|
||||||
|
.unlockedBy("has_tissue", has(tissue))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dnaAnalyzing(ItemLike testTube, ItemLike material, ItemLike dna, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
new DNAAnalyzingRecipeBuilder(testTube, material, dna, count)
|
||||||
|
.unlockedBy("has_material", has(material))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dnaHybridizing(ItemLike result, int count, ItemLike catalyst, ItemLike... ingredients) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
DNAHybridizingRecipeBuilder builder = new DNAHybridizingRecipeBuilder(result, count)
|
||||||
|
.setCatalyst(catalyst);
|
||||||
|
for (ItemLike ingredient : ingredients) {
|
||||||
|
builder.addIngredient(ingredient);
|
||||||
|
}
|
||||||
|
builder.unlockedBy("has_catalyst", has(catalyst))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void embryonicMachine(ItemLike syringe, ItemLike dna, ItemLike catalyst, ItemLike result, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
new EmbryonicMachineRecipeBuilder(syringe, dna, catalyst, result, count)
|
||||||
|
.unlockedBy("has_dna", has(dna))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void embryoCalcification(ItemLike syringe, ItemLike egg, ItemLike result, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
new EmbryoCalcificationMachiningRecipeBuilder(syringe, egg, result, count)
|
||||||
|
.unlockedBy("has_egg", has(egg))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void incubating(ItemLike egg, ItemLike result, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
new IncubatingRecipeBuilder(egg, result, count)
|
||||||
|
.unlockedBy("has_egg", has(egg))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fossilGrinding(ItemLike fossil, ItemLike tissue, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
FossilGrindingRecipeBuilder.fossilWeighted(fossil, tissue, count)
|
||||||
|
.unlockedBy("has_fossil", has(fossil))
|
||||||
|
.saveFossil(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void skullToTissue(ItemLike skull, ItemLike tissue, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
FossilGrindingRecipeBuilder.skullToTissue(skull, tissue, count)
|
||||||
|
.unlockedBy("has_skull", has(skull))
|
||||||
|
.saveSkull(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fossilCleaning(ItemLike fossilBlock, ItemLike result, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
FossilCleaningRecipeBuilder.randomFossil(fossilBlock, result, count)
|
||||||
|
.unlockedBy("has_fossil_block", has(fossilBlock))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void amberRandomDNA(ItemLike testTube, ItemLike amber, ItemLike defaultDna, int count) {
|
||||||
|
//? if >1.20.1 {
|
||||||
|
DNAExtractingRecipeBuilder.amberRandomDNAUniform(testTube, amber, defaultDna, count)
|
||||||
|
.unlockedBy("has_amber", has(amber))
|
||||||
|
.save(output);
|
||||||
|
//?}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user