Should be all of the empowering recipes.

This commit is contained in:
Flanks255 2021-10-14 14:15:16 -05:00
parent f105b4c265
commit 2a6126a1df
5 changed files with 157 additions and 25 deletions

View file

@ -62,7 +62,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
//Shock Suppressor
Recipe.shaped(ActuallyBlocks.SHOCK_SUPPRESSOR.getItem())
.pattern("OAO", "ACA", "OAO")
.define('A', ActuallyItems.VOID_EMPOWERED_CRYSTAL.get())
.define('A', ActuallyItems.EMPOWERED_VOID_CRYSTAL.get())
.define('O', Tags.Items.OBSIDIAN)
.define('C', ActuallyItems.COIL_ADVANCED.get())
.save(consumer);
@ -80,7 +80,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
.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('C', ActuallyItems.EMPOWERED_VOID_CRYSTAL.get())
.define('D', ActuallyItems.DRILL.get())
.save(consumer);
@ -157,7 +157,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
// Extreme Laser Relay
Recipe.shaped(ActuallyBlocks.LASER_RELAY_EXTREME.getItem())
.pattern(" I ", "XRX", " I ")
.define('I', ActuallyItems.DIAMATINE_EMPOWERED_CRYSTAL.get())
.define('I', ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get())
.define('R', ActuallyBlocks.LASER_RELAY_ADVANCED.get())
.define('X', ActuallyItems.RESTONIA_CRYSTAL.get())
.save(consumer);

View file

@ -11,7 +11,6 @@ import net.minecraft.data.*;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation;
@ -42,7 +41,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
Recipe.shaped(ActuallyItems.ENGINEER_GOGGLES_ADVANCED.get())
.pattern(" R ")
.pattern("IGI")
.define('R', ActuallyItems.RESTONIA_EMPOWERED_CRYSTAL.get())
.define('R', ActuallyItems.EMPOWERED_RESTONIA_CRYSTAL.get())
.define('I', Items.IRON_BARS)
.define('G', ActuallyItems.ENGINEER_GOGGLES.get()).save(consumer);
@ -70,7 +69,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("IPI")
.pattern("DCD")
.pattern(" B ")
.define('I', ActuallyItems.ENORI_EMPOWERED_CRYSTAL.get())
.define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
.define('P', ActuallyItems.PALIS_CRYSTAL.get())
.define('C', ActuallyItems.COIL_ADVANCED.get())
.define('D', ActuallyItems.DIAMATINE_CRYSTAL.get())
@ -115,7 +114,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
Recipe.shapeless(ActuallyItems.DISENCHANTING_LENS.get())
.requires(ActuallyItems.LENS.get())
.requires(Items.ENCHANTING_TABLE)
.requires(ActuallyItems.DIAMATINE_EMPOWERED_CRYSTAL.get(), 7).save(consumer);
.requires(ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get(), 7).save(consumer);
//Mining Lens
Recipe.shaped(ActuallyItems.MINING_LENS.get())
@ -222,7 +221,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern(" FE")
.pattern(" S ")
.pattern("SB ")
.define('F', ActuallyItems.DIAMATINE_EMPOWERED_CRYSTAL.get())
.define('F', ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get())
.define('E', ActuallyBlocks.ENDER_PEARL_BLOCK.getItem())
.define('S', ActuallyBlocks.ENDER_CASING.getItem())
.define('B', ActuallyItems.BATTERY.get()).save(consumer);
@ -250,9 +249,9 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("ISI")
.pattern("SRS")
.pattern("ISI")
.define('I', ActuallyItems.ENORI_EMPOWERED_CRYSTAL.get())
.define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
.define('S', Items.SUGAR)
.define('R', ActuallyItems.DIAMATINE_EMPOWERED_CRYSTAL.get()).save(consumer);
.define('R', ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get()).save(consumer);
//Drill Fortune upgrade
Recipe.shaped(ActuallyItems.DRILL_UPGRADE_FORTUNE.get())
@ -269,7 +268,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("SRS")
.pattern("ISI")
.define('I', Items.GLOWSTONE)
.define('S', ActuallyItems.RESTONIA_EMPOWERED_CRYSTAL.get())
.define('S', ActuallyItems.EMPOWERED_RESTONIA_CRYSTAL.get())
.define('R', ActuallyBlocks.ENDER_CASING.getItem()).save(consumer);
//3x3
@ -286,7 +285,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("DID")
.pattern("ICI")
.pattern("DID")
.define('I', ActuallyItems.ENORI_EMPOWERED_CRYSTAL.get())
.define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
.define('D', ActuallyItems.DIAMATINE_CRYSTAL.get())
.define('C', ActuallyItems.COIL_ADVANCED.get()).save(consumer);
@ -360,7 +359,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("ICI")
.pattern("III")
.define('R', TargetNBTIngredient.of(ActuallyItems.BATTERY_DOUBLE.get()))
.define('I', ActuallyItems.ENORI_EMPOWERED_CRYSTAL.get())
.define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
.define('C', ActuallyItems.COIL_ADVANCED.get())
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
@ -370,7 +369,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("ICI")
.pattern("III")
.define('R', TargetNBTIngredient.of(ActuallyItems.BATTERY_TRIPLE.get()))
.define('I', ActuallyItems.ENORI_EMPOWERED_CRYSTAL.get())
.define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
.define('C', ActuallyItems.COIL_ADVANCED.get())
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
@ -380,7 +379,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("ICI")
.pattern("III")
.define('R', TargetNBTIngredient.of(ActuallyItems.BATTERY_QUADRUPLE.get()))
.define('I', ActuallyItems.DIAMATINE_EMPOWERED_CRYSTAL.get())
.define('I', ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get())
.define('C', ActuallyItems.COIL_ADVANCED.get())
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));

View file

@ -1,13 +1,29 @@
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.crafting.EmpowererRecipe;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.DirectoryCache;
import net.minecraft.data.IFinishedRecipe;
import net.minecraft.data.RecipeProvider;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
import sun.plugin.dom.exception.InvalidStateException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
public class MiscRecipeGenerator extends RecipeProvider {
@ -20,13 +36,130 @@ public class MiscRecipeGenerator extends RecipeProvider {
}
@Override
protected void buildShapelessRecipes(Consumer<IFinishedRecipe> p_200404_0_) {
protected void buildShapelessRecipes(Consumer<IFinishedRecipe> consumer) {
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_RESTONIA_CRYSTAL.get(), ActuallyItems.RESTONIA_CRYSTAL.get(), 5000, 50, Crystals.REDSTONE.conversionColorParticles)
.addModifier(Tags.Items.DYES_RED)
.addModifier(Items.NETHER_BRICK)
.addModifier(Tags.Items.DUSTS_REDSTONE)
.addModifier(Items.BRICK).save(consumer, "restonia");
EmpoweringBuilder.builder(ActuallyBlocks.EMPOWERED_RESTONIA_CRYSTAL.get(), ActuallyBlocks.RESTONIA_CRYSTAL.get(), 50000, 500, Crystals.REDSTONE.conversionColorParticles)
.addModifier(Tags.Items.DYES_RED)
.addModifier(Items.NETHER_BRICK)
.addModifier(Tags.Items.DUSTS_REDSTONE)
.addModifier(Items.BRICK).save(consumer, "restonia_block");
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_PALIS_CRYSTAL.get(), ActuallyItems.PALIS_CRYSTAL.get(), 5000, 50, Crystals.LAPIS.conversionColorParticles)
.addModifier(Tags.Items.DYES_CYAN)
.addModifier(Items.PRISMARINE_SHARD)
.addModifier(Items.PRISMARINE_SHARD)
.addModifier(Items.PRISMARINE_SHARD).save(consumer, "palis");
EmpoweringBuilder.builder(ActuallyBlocks.EMPOWERED_PALIS_CRYSTAL.get(), ActuallyBlocks.PALIS_CRYSTAL.get(), 50000, 500, Crystals.LAPIS.conversionColorParticles)
.addModifier(Tags.Items.DYES_CYAN)
.addModifier(Items.PRISMARINE_SHARD)
.addModifier(Items.PRISMARINE_SHARD)
.addModifier(Items.PRISMARINE_SHARD).save(consumer, "palis_block");
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get(), ActuallyItems.DIAMATINE_CRYSTAL.get(), 5000, 50, Crystals.DIAMOND.conversionColorParticles)
.addModifier(Tags.Items.DYES_LIGHT_BLUE)
.addModifier(Items.CLAY_BALL)
.addModifier(Items.CLAY_BALL)
.addModifier(Items.CLAY).save(consumer, "diamatine");
EmpoweringBuilder.builder(ActuallyBlocks.EMPOWERED_DIAMATINE_CRYSTAL.get(), ActuallyBlocks.DIAMATINE_CRYSTAL.get(), 50000, 500, Crystals.DIAMOND.conversionColorParticles)
.addModifier(Tags.Items.DYES_LIGHT_BLUE)
.addModifier(Items.CLAY_BALL)
.addModifier(Items.CLAY_BALL)
.addModifier(Items.CLAY).save(consumer, "diamatine_block");
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get(), ActuallyItems.ENORI_CRYSTAL.get(), 5000, 50, Crystals.IRON.conversionColorParticles)
.addModifier(Tags.Items.DYES_GRAY)
.addModifier(Items.SNOWBALL)
.addModifier(Items.STONE_BUTTON)
.addModifier(Tags.Items.COBBLESTONE).save(consumer, "enori");
EmpoweringBuilder.builder(ActuallyBlocks.EMPOWERED_ENORI_CRYSTAL.get(), ActuallyBlocks.ENORI_CRYSTAL.get(), 50000, 500, Crystals.IRON.conversionColorParticles)
.addModifier(Tags.Items.DYES_GRAY)
.addModifier(Items.SNOWBALL)
.addModifier(Items.STONE_BUTTON)
.addModifier(Tags.Items.COBBLESTONE).save(consumer, "enori_block");
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_VOID_CRYSTAL.get(), ActuallyItems.VOID_CRYSTAL.get(), 5000, 50, Crystals.COAL.conversionColorParticles)
.addModifier(Tags.Items.DYES_BLACK)
.addModifier(ItemTags.COALS)
.addModifier(Items.FLINT)
.addModifier(Tags.Items.STONE).save(consumer, "void");
EmpoweringBuilder.builder(ActuallyBlocks.EMPOWERED_VOID_CRYSTAL.get(), ActuallyBlocks.VOID_CRYSTAL.get(), 50000, 500, Crystals.COAL.conversionColorParticles)
.addModifier(Tags.Items.DYES_BLACK)
.addModifier(ItemTags.COALS)
.addModifier(Items.FLINT)
.addModifier(Tags.Items.STONE).save(consumer, "void_block");
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_EMERADIC_CRYSTAL.get(), ActuallyItems.EMERADIC_CRYSTAL.get(), 5000, 50, Crystals.EMERALD.conversionColorParticles)
.addModifier(Tags.Items.DYES_LIME)
.addModifier(Items.TALL_GRASS)
.addModifier(ItemTags.SAPLINGS)
.addModifier(Tags.Items.SLIMEBALLS).save(consumer, "emeradic");
EmpoweringBuilder.builder(ActuallyBlocks.EMPOWERED_EMERADIC_CRYSTAL.get(), ActuallyBlocks.EMERADIC_CRYSTAL.get(), 50000, 500, Crystals.EMERALD.conversionColorParticles)
.addModifier(Tags.Items.DYES_LIME)
.addModifier(Items.TALL_GRASS)
.addModifier(ItemTags.SAPLINGS)
.addModifier(Tags.Items.SLIMEBALLS).save(consumer, "emeradic_block");
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_CANOLA_SEED.get(), ActuallyItems.CRYSTALLIZED_CANOLA_SEED.get(), 1000, 30, 0x015b4c)
.addModifier(ActuallyItems.CANOLA_SEED.get())
.addModifier(ActuallyItems.CANOLA_SEED.get())
.addModifier(ActuallyItems.CANOLA_SEED.get())
.addModifier(ActuallyItems.CANOLA_SEED.get()).save(consumer, "empowered_canola");
}
public static class EmpoweringBuilder {
private final Item result;
private final Ingredient base;
private List<Ingredient> modifiers = new ArrayList<>();
private final int energy;
private final int time;
private final int color;
private void addCrystalEmpowering(Consumer<IFinishedRecipe> consumer) {
public EmpoweringBuilder(IItemProvider resultIn, Ingredient baseIn, int energyIn, int timeIn, int colorIn) {
result = resultIn.asItem();
base = baseIn;
energy = energyIn;
time = timeIn;
color = colorIn;
}
public static EmpoweringBuilder builder(IItemProvider resultIn, IItemProvider base, int energyIn, int timeIn, int colorIn) {
return new EmpoweringBuilder(resultIn, Ingredient.of(base), energyIn, timeIn, colorIn);
}
public EmpoweringBuilder addModifier(IItemProvider input) {
if (modifiers.size() >= 4)
throw new InvalidStateException("too many modifiers for empowering recipe, input: " + input.asItem().getRegistryName());
modifiers.add(Ingredient.of(input));
return this;
}
public EmpoweringBuilder addModifier(ItemStack input) {
if (modifiers.size() >= 4)
throw new InvalidStateException("too many modifiers for empowering recipe, input: " + input.getItem().getRegistryName());
modifiers.add(Ingredient.of(input));
return this;
}
public EmpoweringBuilder addModifier(ITag<Item> input) {
if (modifiers.size() >= 4)
throw new InvalidStateException("too many modifiers for empowering recipe, input: " + input.toString());
modifiers.add(Ingredient.of(input));
return this;
}
public void save(Consumer<IFinishedRecipe> consumer, ResourceLocation name) {
if (modifiers.size() != 4)
throw new InvalidStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + name.toString());
consumer.accept(new EmpowererRecipe.FinishedRecipe(name, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, time, color));
}
public void save(Consumer<IFinishedRecipe> consumer, String name) {
ResourceLocation res = new ResourceLocation(ActuallyAdditions.MODID, "empowering/" + name);
if (modifiers.size() != 4)
throw new InvalidStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + res.toString());
consumer.accept(new EmpowererRecipe.FinishedRecipe(res, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, time, color));
}
}
}

View file

@ -76,12 +76,12 @@ public final class ActuallyItems {
public static final RegistryObject<Item> EMERADIC_CRYSTAL = ITEMS.register("emeradic_crystal", ItemCrystal::new);
public static final RegistryObject<Item> ENORI_CRYSTAL = ITEMS.register("enori_crystal", ItemCrystal::new);
public static final RegistryObject<Item> RESTONIA_EMPOWERED_CRYSTAL = ITEMS.register("restonia_empowered_crystal", () -> new ItemCrystal(true));
public static final RegistryObject<Item> PALIS_EMPOWERED_CRYSTAL = ITEMS.register("palis_empowered_crystal", () -> new ItemCrystal(true));
public static final RegistryObject<Item> DIAMATINE_EMPOWERED_CRYSTAL = ITEMS.register("diamatine_empowered_crystal", () -> new ItemCrystal(true));
public static final RegistryObject<Item> VOID_EMPOWERED_CRYSTAL = ITEMS.register("void_empowered_crystal", () -> new ItemCrystal(true));
public static final RegistryObject<Item> EMERADIC_EMPOWERED_CRYSTAL = ITEMS.register("emeradic_empowered_crystal", () -> new ItemCrystal(true));
public static final RegistryObject<Item> ENORI_EMPOWERED_CRYSTAL = ITEMS.register("enori_empowered_crystal", () -> new ItemCrystal(true));
public static final RegistryObject<Item> EMPOWERED_RESTONIA_CRYSTAL = ITEMS.register("restonia_empowered_crystal", () -> new ItemCrystal(true));
public static final RegistryObject<Item> EMPOWERED_PALIS_CRYSTAL = ITEMS.register("palis_empowered_crystal", () -> new ItemCrystal(true));
public static final RegistryObject<Item> EMPOWERED_DIAMATINE_CRYSTAL = ITEMS.register("diamatine_empowered_crystal", () -> new ItemCrystal(true));
public static final RegistryObject<Item> EMPOWERED_VOID_CRYSTAL = ITEMS.register("void_empowered_crystal", () -> new ItemCrystal(true));
public static final RegistryObject<Item> EMPOWERED_EMERADIC_CRYSTAL = ITEMS.register("emeradic_empowered_crystal", () -> new ItemCrystal(true));
public static final RegistryObject<Item> EMPOWERED_ENORI_CRYSTAL = ITEMS.register("enori_empowered_crystal", () -> new ItemCrystal(true));
// BLACK QUARTZ
public static final RegistryObject<Item> BLACK_QUARTZ = ITEMS.register("black_quartz", ItemBase::new);

View file

@ -21,10 +21,10 @@ public enum Crystals implements IStringSerializable {
IRON("white", 0xCEDDD4, 0xcccccc);
public final String name;
public final float[] conversionColorParticles;
public final int conversionColorParticles;
public final int clusterColor;
Crystals(String name, int clusterColor, float... conversionColorParticles) {
Crystals(String name, int clusterColor, int conversionColorParticles) {
this.name = name;
this.conversionColorParticles = conversionColorParticles;
this.clusterColor = clusterColor;