Initial Block/Item Recipe generator classes.

Recipes for Battery box / Farmer done.
This commit is contained in:
Flanks255 2021-05-01 17:51:36 -05:00
parent 0146333e37
commit 80488b501e
4 changed files with 83 additions and 2 deletions

View file

@ -25,7 +25,8 @@ public class ActuallyAdditionsData {
BlockTagsGenerator generatorBlockTags = new BlockTagsGenerator(generator, helper); BlockTagsGenerator generatorBlockTags = new BlockTagsGenerator(generator, helper);
// generator.addProvider(new GeneratorLoot(generator)); // generator.addProvider(new GeneratorLoot(generator));
// generator.addProvider(new GeneratorRecipes(generator)); generator.addProvider(new BlockRecipeGenerator(generator));
generator.addProvider(new ItemRecipeGenerator(generator));
generator.addProvider(generatorBlockTags); generator.addProvider(generatorBlockTags);
generator.addProvider(new ItemTagsGenerator(generator, generatorBlockTags, helper)); generator.addProvider(new ItemTagsGenerator(generator, generatorBlockTags, helper));
} }

View file

@ -0,0 +1,49 @@
package de.ellpeck.actuallyadditions.data;
import com.google.gson.JsonObject;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import net.minecraft.data.*;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
import java.nio.file.Path;
import java.util.function.Consumer;
public class BlockRecipeGenerator extends RecipeProvider {
public BlockRecipeGenerator(DataGenerator generatorIn) {
super(generatorIn);
}
@Override
protected void registerRecipes(Consumer<IFinishedRecipe> consumer) {
// //Battery Box
// RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitBlocks.blockBatteryBox), new ItemStack(InitBlocks.blockEnergizer), new ItemStack(InitBlocks.blockEnervator), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()));
ShapelessRecipeBuilder.shapelessRecipe(ActuallyBlocks.blockBatteryBox.get())
.addIngredient(ActuallyBlocks.blockEnergizer.get())
.addIngredient(ActuallyBlocks.blockEnervator.get())
.addIngredient(ActuallyItems.itemCoil.get())
.addCriterion("", hasItem(Items.AIR))
.build(consumer, new ResourceLocation(ActuallyAdditions.MODID, "battery_box"));
// //Farmer
// RecipeHandler.addOreDictRecipe(new ItemStack(InitBlocks.blockFarmer), "ISI", "SCS", "ISI", 'I', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal()), 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()), 'S', new ItemStack(Items.WHEAT_SEEDS));
ShapedRecipeBuilder.shapedRecipe(ActuallyBlocks.blockFarmer.get())
.patternLine("ISI")
.patternLine("SCS")
.patternLine("ISI")
.key('I', ActuallyBlocks.CRYSTAL_ENORI.get())
.key('C', ActuallyBlocks.blockIronCasing.get())
.key('S', Tags.Items.SEEDS)
.addCriterion("", hasItem(Items.AIR))
.build(consumer, new ResourceLocation(ActuallyAdditions.MODID, "farmer"));
}
@Override
protected void saveRecipeAdvancement(DirectoryCache cache, JsonObject cache2, Path advancementJson) {
//Nope...
}
}

View file

@ -0,0 +1,26 @@
package de.ellpeck.actuallyadditions.data;
import com.google.gson.JsonObject;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.DirectoryCache;
import net.minecraft.data.IFinishedRecipe;
import net.minecraft.data.RecipeProvider;
import java.nio.file.Path;
import java.util.function.Consumer;
public class ItemRecipeGenerator extends RecipeProvider {
public ItemRecipeGenerator(DataGenerator generatorIn) {
super(generatorIn);
}
@Override
protected void registerRecipes(Consumer<IFinishedRecipe> consumer) {
super.registerRecipes(consumer);
}
@Override
protected void saveRecipeAdvancement(DirectoryCache cache, JsonObject cache2, Path advancementJson) {
//Nope...
}
}

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.blocks; package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals; import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
@ -25,12 +26,16 @@ public final class ActuallyBlocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID); public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID);
public static final RegistryObject<Block> blockMisc = BLOCKS.register("block_misc", BlockMisc::new); public static final RegistryObject<Block> blockMisc = BLOCKS.register("block_misc", BlockMisc::new);
public static final RegistryObject<Block> blockLavaCasing = BLOCKS.register("block_misc", BlockMisc::new); public static final RegistryObject<Block> blockWoodCasing = BLOCKS.register("block_wood_casing", BlockMisc::new); //TODO
public static final RegistryObject<Block> blockIronCasing = BLOCKS.register("block_iron_casing", BlockMisc::new); //TODO
public static final RegistryObject<Block> blockEnderCasing = BLOCKS.register("block_ender_casing", BlockMisc::new); //TODO
public static final RegistryObject<Block> blockLavaCasing = BLOCKS.register("block_lava_casing", BlockMisc::new);
public static final RegistryObject<Block> blockWildPlant = BLOCKS.register("block_wild", BlockWildPlant::new); public static final RegistryObject<Block> blockWildPlant = BLOCKS.register("block_wild", BlockWildPlant::new);
public static final RegistryObject<Block> blockFeeder = BLOCKS.register("block_feeder", BlockFeeder::new); public static final RegistryObject<Block> blockFeeder = BLOCKS.register("block_feeder", BlockFeeder::new);
public static final RegistryObject<Block> blockGrinder = BLOCKS.register("block_grinder", () -> new BlockGrinder(false)); public static final RegistryObject<Block> blockGrinder = BLOCKS.register("block_grinder", () -> new BlockGrinder(false));
public static final RegistryObject<Block> blockGrinderDouble = BLOCKS.register("block_grinder_double", () -> new BlockGrinder(true)); public static final RegistryObject<Block> blockGrinderDouble = BLOCKS.register("block_grinder_double", () -> new BlockGrinder(true));
public static final RegistryObject<Block> blockCrystalClusterRedstone = BLOCKS.register("block_crystal_cluster_redstone", () -> new BlockCrystalCluster(TheCrystals.REDSTONE)); public static final RegistryObject<Block> blockCrystalClusterRedstone = BLOCKS.register("block_crystal_cluster_redstone", () -> new BlockCrystalCluster(TheCrystals.REDSTONE));
public static final RegistryObject<Block> blockCrystalClusterLapis = BLOCKS.register("block_crystal_cluster_lapis", () -> new BlockCrystalCluster(TheCrystals.LAPIS)); public static final RegistryObject<Block> blockCrystalClusterLapis = BLOCKS.register("block_crystal_cluster_lapis", () -> new BlockCrystalCluster(TheCrystals.LAPIS));
public static final RegistryObject<Block> blockCrystalClusterDiamond = BLOCKS.register("block_crystal_cluster_diamond", () -> new BlockCrystalCluster(TheCrystals.DIAMOND)); public static final RegistryObject<Block> blockCrystalClusterDiamond = BLOCKS.register("block_crystal_cluster_diamond", () -> new BlockCrystalCluster(TheCrystals.DIAMOND));