[Change] Datadriven Recipes

This commit is contained in:
Frank 2023-04-29 14:55:56 +02:00
parent f8c7fb9be8
commit 89e6b2348e
6 changed files with 44 additions and 8 deletions

View file

@ -8,7 +8,6 @@ import org.betterx.betterend.commands.CommandRegistry;
import org.betterx.betterend.config.Configs; import org.betterx.betterend.config.Configs;
import org.betterx.betterend.effects.EndPotions; import org.betterx.betterend.effects.EndPotions;
import org.betterx.betterend.integration.Integrations; import org.betterx.betterend.integration.Integrations;
import org.betterx.betterend.recipe.*;
import org.betterx.betterend.registry.*; import org.betterx.betterend.registry.*;
import org.betterx.betterend.util.BonemealPlants; import org.betterx.betterend.util.BonemealPlants;
import org.betterx.betterend.util.LootTableUtil; import org.betterx.betterend.util.LootTableUtil;
@ -47,12 +46,6 @@ public class BetterEnd implements ModInitializer {
EndItems.ensureStaticallyLoaded(); EndItems.ensureStaticallyLoaded();
EndEnchantments.register(); EndEnchantments.register();
EndPotions.register(); EndPotions.register();
CraftingRecipes.register();
FurnaceRecipes.register();
AlloyingRecipes.register();
AnvilRecipes.register();
SmithingRecipes.register();
InfusionRecipes.register();
EndStructures.register(); EndStructures.register();
BonemealPlants.init(); BonemealPlants.init();
GeneratorOptions.init(); GeneratorOptions.init();

View file

@ -248,6 +248,19 @@ public class InfusionRecipes {
.setGroup("enchantment") .setGroup("enchantment")
.setTime(300) .setTime(300)
.build(); .build();
InfusionRecipe.create("swift_sneak_book", Enchantments.SWIFT_SNEAK, 1)
.setPrimaryInputAndUnlock(Items.BOOK)
.addCatalyst(InfusionRecipe.Catalysts.NORTH, EndItems.ETERNAL_CRYSTAL)
.addCatalyst(InfusionRecipe.Catalysts.EAST, Items.SCULK_SENSOR)
.addCatalyst(InfusionRecipe.Catalysts.SOUTH, Items.SCULK_CATALYST)
.addCatalyst(InfusionRecipe.Catalysts.WEST, Items.SCULK_SENSOR)
.addCatalyst(InfusionRecipe.Catalysts.NORTH_EAST, Items.SCULK_VEIN)
.addCatalyst(InfusionRecipe.Catalysts.SOUTH_EAST, EndItems.ENCHANTED_PETAL)
.addCatalyst(InfusionRecipe.Catalysts.SOUTH_WEST, EndItems.ENCHANTED_PETAL)
.addCatalyst(InfusionRecipe.Catalysts.NORTH_WEST, Items.SCULK_VEIN)
.setGroup("enchantment")
.setTime(500)
.build();
InfusionRecipe.create("sharpness_book", Enchantments.SHARPNESS, 1) InfusionRecipe.create("sharpness_book", Enchantments.SHARPNESS, 1)
.setPrimaryInputAndUnlock(Items.BOOK) .setPrimaryInputAndUnlock(Items.BOOK)
.addCatalyst(InfusionRecipe.Catalysts.NORTH, EndItems.ENCHANTED_PETAL) .addCatalyst(InfusionRecipe.Catalysts.NORTH, EndItems.ENCHANTED_PETAL)
@ -260,6 +273,7 @@ public class InfusionRecipes {
.setTime(300) .setTime(300)
.build(); .build();
InfusionRecipe.create("smite_book", Enchantments.SMITE, 1) InfusionRecipe.create("smite_book", Enchantments.SMITE, 1)
.setPrimaryInputAndUnlock(Items.BOOK)
.addCatalyst(InfusionRecipe.Catalysts.NORTH, EndItems.ENCHANTED_PETAL) .addCatalyst(InfusionRecipe.Catalysts.NORTH, EndItems.ENCHANTED_PETAL)
.addCatalyst(InfusionRecipe.Catalysts.EAST, Blocks.SUNFLOWER) .addCatalyst(InfusionRecipe.Catalysts.EAST, Blocks.SUNFLOWER)
.addCatalyst(InfusionRecipe.Catalysts.SOUTH, Items.GOLD_INGOT) .addCatalyst(InfusionRecipe.Catalysts.SOUTH, Items.GOLD_INGOT)

View file

@ -243,7 +243,7 @@ public class InfusionRecipe implements Recipe<InfusionRitual>, UnknownReceipBook
NORTH(0, "north"), NORTH(0, "north"),
NORTH_EAST(1, "north_east"), NORTH_EAST(1, "north_east"),
EAST(2, "east"), EAST(2, "east"),
SOUTH_EAST(3, ""), SOUTH_EAST(3, "south_east"),
SOUTH(4, "south"), SOUTH(4, "south"),
SOUTH_WEST(5, "south_west"), SOUTH_WEST(5, "south_west"),
WEST(6, "west"), WEST(6, "west"),

View file

@ -1335,6 +1335,7 @@ public class EndFeatures {
.configuration(new OreLayerFeatureConfig(block.defaultBlockState(), radius, minY, maxY)) .configuration(new OreLayerFeatureConfig(block.defaultBlockState(), radius, minY, maxY))
.build() .build()
.place() .place()
.onlyInBiome()
.decoration(GenerationStep.Decoration.UNDERGROUND_ORES) .decoration(GenerationStep.Decoration.UNDERGROUND_ORES)
.count(count) .count(count)
.build(); .build();

View file

@ -1,6 +1,7 @@
package org.betterx.datagen.betterend; package org.betterx.datagen.betterend;
import org.betterx.datagen.betterend.advancement.EndAdvancementDataProvider; import org.betterx.datagen.betterend.advancement.EndAdvancementDataProvider;
import org.betterx.datagen.betterend.recipes.EndRecipeDataProvider;
import org.betterx.datagen.betterend.worldgen.EndBiomesDataProvider; import org.betterx.datagen.betterend.worldgen.EndBiomesDataProvider;
import org.betterx.datagen.betterend.worldgen.EndRegistriesDataProvider; import org.betterx.datagen.betterend.worldgen.EndRegistriesDataProvider;
@ -14,9 +15,12 @@ public class BetterEndDatagen implements DataGeneratorEntrypoint {
@Override @Override
public void onInitializeDataGenerator(FabricDataGenerator dataGenerator) { public void onInitializeDataGenerator(FabricDataGenerator dataGenerator) {
EndBiomesDataProvider.ensureStaticallyLoaded(); EndBiomesDataProvider.ensureStaticallyLoaded();
EndRecipeDataProvider.buildRecipes();
final FabricDataGenerator.Pack pack = dataGenerator.createPack(); final FabricDataGenerator.Pack pack = dataGenerator.createPack();
pack.addProvider(EndBiomesDataProvider::new); pack.addProvider(EndBiomesDataProvider::new);
pack.addProvider(EndRecipeDataProvider::new);
pack.addProvider(EndRegistriesDataProvider::new); pack.addProvider(EndRegistriesDataProvider::new);
pack.addProvider(EndAdvancementDataProvider::new); pack.addProvider(EndAdvancementDataProvider::new);
} }

View file

@ -0,0 +1,24 @@
package org.betterx.datagen.betterend.recipes;
import org.betterx.bclib.api.v3.datagen.RecipeDataProvider;
import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.recipe.*;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import java.util.List;
public class EndRecipeDataProvider extends RecipeDataProvider {
public EndRecipeDataProvider(FabricDataOutput output) {
super(List.of(BetterEnd.MOD_ID), output);
}
public static void buildRecipes() {
CraftingRecipes.register();
FurnaceRecipes.register();
AlloyingRecipes.register();
AnvilRecipes.register();
SmithingRecipes.register();
InfusionRecipes.register();
}
}