ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java

291 lines
12 KiB
Java
Raw Normal View History

package de.ellpeck.actuallyadditions.data;
import com.google.gson.JsonObject;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
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.IItemProvider;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.function.Consumer;
public class BlockRecipeGenerator extends RecipeProvider {
public BlockRecipeGenerator(DataGenerator generatorIn) {
super(generatorIn);
}
@Override
protected void buildShapelessRecipes(Consumer<IFinishedRecipe> consumer) {
2021-05-02 17:47:50 +02:00
//Battery Box
2021-10-02 18:49:11 +02:00
Recipe.shapeless(ActuallyBlocks.BATTERY_BOX.getItem()).ingredients(ActuallyBlocks.ENERGIZER.get(), ActuallyBlocks.ENERVATOR.get(), ActuallyItems.COIL.get()).save(consumer);
2021-05-02 17:47:50 +02:00
//Farmer
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.FARMER.getItem())
2021-08-22 23:40:28 +02:00
.pattern("ISI", "SCS", "ISI")
.define('I', ActuallyBlocks.ENORI_CRYSTAL.getItem())
.define('C', ActuallyBlocks.IRON_CASING.get())
.define('S', Tags.Items.SEEDS)
.save(consumer);
//Empowerer
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.EMPOWERER.getItem())
2021-08-22 23:40:28 +02:00
.pattern(" R ", " B ", "CDC")
.define('R', ActuallyItems.RESTONIA_CRYSTAL.get())
.define('B', ActuallyItems.BATTERY_DOUBLE.get())
.define('C', ActuallyBlocks.IRON_CASING.get())
.define('D', ActuallyBlocks.DISPLAY_STAND.get())
.save(consumer);
//Tiny Torch
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.TINY_TORCH.getItem(), 2)
2021-08-22 23:40:28 +02:00
.pattern("C", "S")
.define('C', ActuallyTags.Items.TINY_COALS)
.define('S', Tags.Items.RODS_WOODEN)
.save(consumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_torch"));
//Fireworks Box
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.FIREWORK_BOX.getItem())
2021-08-22 23:40:28 +02:00
.pattern("GFG", "SAS", "CCC")
.define('G', Tags.Items.GUNPOWDER)
.define('S', Tags.Items.RODS_WOODEN)
.define('A', ActuallyBlocks.IRON_CASING.get())
.define('F', Items.FIREWORK_ROCKET)
.define('C', ActuallyItems.ENORI_CRYSTAL.get())
.save(consumer);
//Shock Suppressor
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.SHOCK_SUPPRESSOR.getItem())
2021-08-22 23:40:28 +02:00
.pattern("OAO", "ACA", "OAO")
.define('A', ActuallyItems.VOID_EMPOWERED_CRYSTAL.get())
.define('O', Tags.Items.OBSIDIAN)
.define('C', ActuallyItems.COIL_ADVANCED.get())
.save(consumer);
2021-05-02 17:47:50 +02:00
//Display Stand
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.DISPLAY_STAND.getItem())
2021-08-22 23:40:28 +02:00
.pattern(" R ", "EEE", "GGG")
.define('R', ActuallyItems.COIL_ADVANCED.get())
.define('E', ActuallyBlocks.ETHETIC_GREEN_BLOCK.get())
.define('G', ActuallyBlocks.ETHETIC_WHITE_BLOCK.get())
.save(consumer);
2021-05-05 18:15:25 +02:00
//Vertical Digger
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.VERTICAL_DIGGER.getItem())
2021-08-22 23:40:28 +02:00
.pattern("IRI", "RCR", "IDI")
.define('R', Tags.Items.STORAGE_BLOCKS_REDSTONE)
.define('I', ActuallyBlocks.IRON_CASING.get())
.define('C', ActuallyItems.VOID_EMPOWERED_CRYSTAL.get())
.define('D', ActuallyItems.DRILL.get())
.save(consumer);
2021-05-05 18:15:25 +02:00
//Black Quartz Wall
2021-10-02 18:49:11 +02:00
Recipe.wall(ActuallyBlocks.BLACK_QUARTZ_WALL.getItem(), ActuallyBlocks.BLACK_QUARTZ_PILLAR_BLOCK.get(), consumer);
2021-05-05 18:15:25 +02:00
//Black Quartz Slab
2021-10-02 18:49:11 +02:00
Recipe.slab(ActuallyBlocks.BLACK_QUARTZ_SLAB.getItem(), ActuallyBlocks.BLACK_QUARTZ_PILLAR_BLOCK.get(), consumer);
2021-05-05 18:15:25 +02:00
//Black Quartz Stairs
2021-10-02 18:49:11 +02:00
Recipe.stairs(ActuallyBlocks.BLACK_QUARTZ_STAIR.getItem(), ActuallyBlocks.BLACK_QUARTZ_PILLAR_BLOCK.get(), consumer);
//Pillar Black Quartz Wall
2021-10-02 18:49:11 +02:00
Recipe.wall(ActuallyBlocks.BLACK_QUARTZ_PILLAR_WALL.getItem(), ActuallyBlocks.BLACK_QUARTZ_PILLAR_BLOCK.get(), consumer);
//Pillar Black Quartz Slab
2021-10-02 18:49:11 +02:00
Recipe.slab(ActuallyBlocks.BLACK_QUARTZ_PILLAR_SLAB.getItem(), ActuallyBlocks.BLACK_QUARTZ_PILLAR_BLOCK.get(), consumer);
//Pillar Black Quartz Stairs
2021-10-02 18:49:11 +02:00
Recipe.stairs(ActuallyBlocks.BLACK_QUARTZ_PILLAR_STAIR.getItem(), ActuallyBlocks.BLACK_QUARTZ_PILLAR_BLOCK.get(), consumer);
//Chiseled Black Quartz Wall
2021-10-02 18:49:11 +02:00
Recipe.wall(ActuallyBlocks.CHISELED_BLACK_QUARTZ_WALL.getItem(), ActuallyBlocks.CHISELED_BLACK_QUARTZ_BLOCK.get(), consumer);
//Chiseled Black Quartz Slab
2021-10-02 18:49:11 +02:00
Recipe.slab(ActuallyBlocks.CHISELED_BLACK_QUARTZ_SLAB.getItem(), ActuallyBlocks.CHISELED_BLACK_QUARTZ_BLOCK.get(), consumer);
//Chiseled Black Quartz Stairs
2021-10-02 18:49:11 +02:00
Recipe.stairs(ActuallyBlocks.CHISELED_BLACK_QUARTZ_STAIR.getItem(), ActuallyBlocks.CHISELED_BLACK_QUARTZ_BLOCK.get(), consumer);
2021-05-05 18:15:25 +02:00
//Ethetic White Wall
2021-10-02 18:49:11 +02:00
Recipe.wall(ActuallyBlocks.ETHETIC_WHITE_WALL.getItem(), ActuallyBlocks.ETHETIC_WHITE_BLOCK.get(), consumer);
2021-05-05 18:15:25 +02:00
//Ethetic White Slab
2021-10-02 18:49:11 +02:00
Recipe.slab(ActuallyBlocks.ETHETIC_WHITE_SLAB.getItem(), ActuallyBlocks.ETHETIC_WHITE_BLOCK.get(), consumer);
2021-05-05 18:15:25 +02:00
//Ethetic White Stairs
2021-10-02 18:49:11 +02:00
Recipe.stairs(ActuallyBlocks.ETHETIC_WHITE_STAIRS.getItem(), ActuallyBlocks.ETHETIC_WHITE_BLOCK.get(), consumer);
// Ethetic Green Wall
2021-10-02 18:49:11 +02:00
Recipe.wall(ActuallyBlocks.ETHETIC_GREEN_WALL.getItem(), ActuallyBlocks.ETHETIC_GREEN_BLOCK.get(), consumer);
// Ethetic Green Slab
2021-10-02 18:49:11 +02:00
Recipe.slab(ActuallyBlocks.ETHETIC_GREEN_SLAB.getItem(), ActuallyBlocks.ETHETIC_GREEN_BLOCK.get(), consumer);
// Ethetic Green Stairs
2021-10-02 18:49:11 +02:00
Recipe.stairs(ActuallyBlocks.ETHETIC_GREEN_STAIRS.getItem(), ActuallyBlocks.ETHETIC_GREEN_BLOCK.get(), consumer);
// Atomic Reconstructor
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem())
2021-08-22 23:40:28 +02:00
.pattern("IRI", "RCR", "IRI")
.define('R', Tags.Items.DUSTS_REDSTONE)
.define('I', Tags.Items.INGOTS_IRON)
.define('C', ActuallyBlocks.IRON_CASING.get())
.save(consumer);
2021-05-09 23:31:24 +02:00
// Laser Relay
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.LASER_RELAY.getItem(), 4)
2021-08-22 23:40:28 +02:00
.pattern("OBO", "RCR", "OBO")
.define('B', Tags.Items.STORAGE_BLOCKS_REDSTONE)
.define('O', Tags.Items.OBSIDIAN)
.define('R', ActuallyItems.RESTONIA_CRYSTAL.get())
.define('C', ActuallyItems.COIL_ADVANCED.get())
.save(consumer);
2021-05-09 23:31:24 +02:00
// Advanced Laser Relay
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.LASER_RELAY_ADVANCED.getItem())
2021-08-22 23:40:28 +02:00
.pattern(" I ", "XRX", " I ")
.define('I', ActuallyItems.ENORI_CRYSTAL.get())
.define('R', ActuallyBlocks.LASER_RELAY.get())
.define('X', ActuallyItems.RESTONIA_CRYSTAL.get())
.save(consumer);
2021-05-09 23:31:24 +02:00
// Extreme Laser Relay
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.LASER_RELAY_EXTREME.getItem())
2021-08-22 23:40:28 +02:00
.pattern(" I ", "XRX", " I ")
.define('I', ActuallyItems.DIAMATINE_EMPOWERED_CRYSTAL.get())
.define('R', ActuallyBlocks.LASER_RELAY_ADVANCED.get())
.define('X', ActuallyItems.RESTONIA_CRYSTAL.get())
.save(consumer);
// Whitelist Item Laser Relay
2021-10-02 18:49:11 +02:00
Recipe.shapeless(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.getItem())
2021-08-22 23:40:28 +02:00
.ingredients(ActuallyBlocks.LASER_RELAY_ITEM.get(), ActuallyItems.COIL_ADVANCED.get(), ActuallyItems.BLACK_QUARTZ.get())
.save(consumer);
// Item Interface
2021-10-02 18:49:11 +02:00
Recipe.shaped(ActuallyBlocks.ITEM_VIEWER.getItem())
2021-08-22 23:40:28 +02:00
.pattern("OBO", "RCR", "OBO")
.define('B', Tags.Items.DUSTS_REDSTONE)
.define('O', ActuallyItems.COIL.get())
.define('R', ActuallyItems.RESTONIA_CRYSTAL.get())
.define('C', Tags.Items.CHESTS_WOODEN)
.save(consumer);
// Hopping Item Interface
2021-08-22 23:40:28 +02:00
Recipe.shapeless(ActuallyBlocks.ITEM_VIEWER_HOPPING.get()).ingredients(ActuallyBlocks.ITEM_VIEWER.get()).save(consumer);
}
@Override
2021-08-22 23:40:28 +02:00
protected void saveAdvancement(DirectoryCache p_208310_1_, JsonObject p_208310_2_, Path p_208310_3_) {
2021-05-09 23:31:24 +02:00
//Nope... maybe later...
}
public static class Recipe {
public static Shapeless shapeless(IItemProvider result) {
return new Shapeless(result);
}
public static Shapeless shapeless(IItemProvider result, int count) {
return new Shapeless(result, count);
}
public static Shaped shaped(IItemProvider result) {
return new Shaped(result);
}
public static Shaped shaped(IItemProvider result, int count) {
return new Shaped(result, count);
}
public static void stairs(IItemProvider result, IItemProvider resource, Consumer<IFinishedRecipe> consumer) {
Recipe.shaped(result).patternSingleKey('Q', resource, "Q ", "QQ ", "QQQ").save(consumer);
}
public static void wall(IItemProvider result, IItemProvider resource, Consumer<IFinishedRecipe> consumer) {
Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ", "QQQ").save(consumer);
}
public static void slab(IItemProvider result, IItemProvider resource, Consumer<IFinishedRecipe> consumer) {
Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ").save(consumer);
}
private static class Shapeless extends ShapelessRecipeBuilder {
public Shapeless(IItemProvider result) {
this(result, 1);
}
public Shapeless(IItemProvider result, int countIn) {
super(result, countIn);
}
public Shapeless ingredients(IItemProvider... ingredients) {
Arrays.asList(ingredients).forEach(this::requires);
return this;
}
@Override
public void save(Consumer<IFinishedRecipe> consumer) {
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
super.save(consumer);
}
@Override
public void save(Consumer<IFinishedRecipe> consumer, ResourceLocation location) {
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
super.save(consumer, location);
}
}
private static class Shaped extends ShapedRecipeBuilder {
public Shaped(IItemProvider resultIn) {
this(resultIn, 1);
}
public Shaped(IItemProvider resultIn, int countIn) {
super(resultIn, countIn);
}
public Shaped pattern(String line1, String line2, String line3) {
this.pattern(line1);
this.pattern(line2);
this.pattern(line3);
return this;
}
public Shaped pattern(String line1, String line2) {
this.pattern(line1);
this.pattern(line2);
return this;
}
public Shaped patternSingleKey(char key, IItemProvider resource, String... lines) {
this.define(key, resource);
for (String line : lines) {
this.pattern(line);
}
return this;
}
@Override
public void save(Consumer<IFinishedRecipe> consumerIn) {
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
super.save(consumerIn);
}
@Override
public void save(Consumer<IFinishedRecipe> consumerIn, ResourceLocation id) {
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
super.save(consumerIn, id);
}
}
}
}