mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Finished converting the main laser recipes to datagen.
This commit is contained in:
parent
b907f08847
commit
6d1aec9d2e
4 changed files with 75 additions and 83 deletions
|
@ -2,14 +2,22 @@ package de.ellpeck.actuallyadditions.data;
|
|||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlock;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
import net.minecraft.block.Blocks;
|
||||
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;
|
||||
|
||||
|
@ -27,9 +35,66 @@ public class LaserRecipeGenerator extends RecipeProvider {
|
|||
|
||||
@Override
|
||||
protected void buildShapelessRecipes(Consumer<IFinishedRecipe> consumer) {
|
||||
//Crystal Blocks
|
||||
laserCrystalizeRecipe(consumer, ActuallyBlocks.RESTONIA_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_REDSTONE, 400);
|
||||
laserCrystalizeRecipe(consumer, ActuallyBlocks.PALIS_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_LAPIS, 400);
|
||||
laserCrystalizeRecipe(consumer, ActuallyBlocks.DIAMATINE_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_DIAMOND, 600);
|
||||
laserCrystalizeRecipe(consumer, ActuallyBlocks.EMERADIC_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_EMERALD, 1000);
|
||||
laserCrystalizeRecipe(consumer, ActuallyBlocks.VOID_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_COAL, 600);
|
||||
laserCrystalizeRecipe(consumer, ActuallyBlocks.ENORI_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_IRON, 800);
|
||||
|
||||
//Crystal Items
|
||||
laserCrystalizeRecipe(consumer, ActuallyItems.RESTONIA_CRYSTAL.get(), Tags.Items.DUSTS_REDSTONE, 40);
|
||||
laserCrystalizeRecipe(consumer, ActuallyItems.PALIS_CRYSTAL.get(), Tags.Items.GEMS_LAPIS, 40);
|
||||
laserCrystalizeRecipe(consumer, ActuallyItems.DIAMATINE_CRYSTAL.get(), Tags.Items.GEMS_DIAMOND, 60);
|
||||
laserCrystalizeRecipe(consumer, ActuallyItems.EMERADIC_CRYSTAL.get(), Tags.Items.GEMS_EMERALD, 100);
|
||||
laserCrystalizeRecipe(consumer, ActuallyItems.VOID_CRYSTAL.get(), ItemTags.COALS, 60);
|
||||
laserCrystalizeRecipe(consumer, ActuallyItems.ENORI_CRYSTAL.get(), Tags.Items.INGOTS_IRON, 80);
|
||||
|
||||
consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser_restonia_block"),
|
||||
Ingredient.of(Tags.Items.STORAGE_BLOCKS_REDSTONE), 400, new ItemStack(ActuallyBlocks.RESTONIA_CRYSTAL.getItem())));
|
||||
//Lenses
|
||||
laserRecipe(consumer, ActuallyItems.COLOR_LENS.get(), ActuallyItems.LENS.get(), 5000);
|
||||
laserRecipe(consumer, ActuallyItems.EXPLOSION_LENS.get(), ActuallyItems.COLOR_LENS.get(), 5000);
|
||||
laserRecipe(consumer, ActuallyItems.DAMAGE_LENS.get(), ActuallyItems.EXPLOSION_LENS.get(), 5000);
|
||||
laserRecipe(consumer, ActuallyItems.LENS.get(), ActuallyItems.DAMAGE_LENS.get(), 5000);
|
||||
|
||||
//Relays
|
||||
laserRecipe(consumer, ActuallyBlocks.LASER_RELAY_FLUIDS.getItem(), ActuallyBlocks.LASER_RELAY.getItem(), 2000);
|
||||
laserRecipe(consumer, ActuallyBlocks.LASER_RELAY_ITEM.getItem(), ActuallyBlocks.LASER_RELAY_FLUIDS.getItem(), 2000);
|
||||
laserRecipe(consumer, ActuallyBlocks.LASER_RELAY.getItem(), ActuallyBlocks.LASER_RELAY_ITEM.getItem(), 2000);
|
||||
|
||||
//Misc
|
||||
laserRecipe(consumer, Items.SOUL_SAND, Tags.Items.SAND, 20000);
|
||||
laserRecipe(consumer, Items.LEATHER, Items.ROTTEN_FLESH, 20000);
|
||||
laserRecipe(consumer, Items.NETHER_WART, Items.RED_MUSHROOM, 150000);
|
||||
laserRecipe(consumer, Items.PRISMARINE_SHARD, Items.QUARTZ, 30000);
|
||||
laserRecipe(consumer, ActuallyItems.CRYSTALLIZED_CANOLA_SEED.get(), ActuallyItems.CANOLA_SEED.get(), 2000);
|
||||
laserRecipe(consumer, ActuallyBlocks.ETHETIC_WHITE_BLOCK.getItem(), Items.QUARTZ_BLOCK, 10);
|
||||
laserRecipe(consumer, ActuallyBlocks.ETHETIC_GREEN_BLOCK.getItem(), Items.CHISELED_QUARTZ_BLOCK, 10);
|
||||
|
||||
}
|
||||
|
||||
private void laserRecipe(Consumer<IFinishedRecipe> consumer, IItemProvider output, Ingredient input, int energy) {
|
||||
consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + output.asItem().getRegistryName().getPath()),
|
||||
input, energy, output));
|
||||
}
|
||||
private void laserRecipe(Consumer<IFinishedRecipe> consumer, IItemProvider output, ITag<Item> input, int energy) {
|
||||
consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + output.asItem().getRegistryName().getPath()),
|
||||
Ingredient.of(input), energy, output));
|
||||
}
|
||||
private void laserRecipe(Consumer<IFinishedRecipe> consumer, IItemProvider output, IItemProvider input, int energy) {
|
||||
consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + output.asItem().getRegistryName().getPath()),
|
||||
Ingredient.of(input), energy, output));
|
||||
}
|
||||
private void laserCrystalizeRecipe(Consumer<IFinishedRecipe> consumer, IItemProvider output, Ingredient input, int energy) {
|
||||
consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + output.asItem().getRegistryName().getPath()),
|
||||
input, energy, output));
|
||||
}
|
||||
private void laserCrystalizeRecipe(Consumer<IFinishedRecipe> consumer, IItemProvider output, ITag<Item> input, int energy) {
|
||||
consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + output.asItem().getRegistryName().getPath()),
|
||||
Ingredient.of(input), energy, output));
|
||||
}
|
||||
private void laserCrystalizeRecipe(Consumer<IFinishedRecipe> consumer, IItemProvider output, IItemProvider input, int energy) {
|
||||
consumer.accept(new LaserRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + output.asItem().getRegistryName().getPath()),
|
||||
Ingredient.of(input), energy, output));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,5 +26,7 @@ public class ActuallyRecipes {
|
|||
//public static final IRecipeType<CrushingRecipe> CRUSHING = IRecipeType.register(ActuallyAdditions.MODID + ":crush");
|
||||
//public static final IRecipeType<SolidFuelRecipe> SOLIDFUEL = IRecipeType.register(ActuallyAdditions.MODID + ":solid_fuel");
|
||||
//public static final IRecipeType<LiquidFuelRecipe> LIQUIDFUEL = IRecipeType.register(ActuallyAdditions.MODID + ":liquid_fuel");
|
||||
//public static final IRecipeType<PressingRecipe> PRESSING = IRecipeType.register(ActuallyAdditions.MODID + ":pressing");
|
||||
//public static final IRecipeType<FermentingRecipe> FERMENTING = IRecipeType.register(ActuallyAdditions.MODID + ":fermenting");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.*;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
@ -106,9 +107,9 @@ public class LaserRecipe implements IRecipe<IInventory> {
|
|||
private ResourceLocation id;
|
||||
private Ingredient itemIngredient;
|
||||
private int energy;
|
||||
private ItemStack output;
|
||||
private IItemProvider output;
|
||||
|
||||
public FinishedRecipe(ResourceLocation id, Ingredient itemIngredient, int energy, ItemStack output) {
|
||||
public FinishedRecipe(ResourceLocation id, Ingredient itemIngredient, int energy, IItemProvider output) {
|
||||
this.id = id;
|
||||
this.itemIngredient = itemIngredient;
|
||||
this.energy = energy;
|
||||
|
@ -119,7 +120,7 @@ public class LaserRecipe implements IRecipe<IInventory> {
|
|||
public void serializeRecipeData(JsonObject pJson) {
|
||||
pJson.add("input", itemIngredient.toJson());
|
||||
pJson.addProperty("energy", energy);
|
||||
pJson.addProperty("output", Registry.ITEM.getKey(output.getItem()).toString());
|
||||
pJson.addProperty("output", output.asItem().getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,86 +10,10 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||
|
||||
// TODO: [port] ADD BACK WITH DATA GENS
|
||||
// TODO: Need to figure out the enchanted stuff, and color changing still, the rest are datagen now.
|
||||
public final class LensRecipeHandler {
|
||||
//
|
||||
// public static final ArrayList<LensConversionRecipe> MAIN_PAGE_RECIPES = new ArrayList<>();
|
||||
// public static LensConversionRecipe recipeColorLens;
|
||||
// public static LensConversionRecipe recipeSoulSand;
|
||||
// public static LensConversionRecipe recipeGreenWall;
|
||||
// public static LensConversionRecipe recipeWhiteWall;
|
||||
// public static LensConversionRecipe recipeExplosionLens;
|
||||
// public static LensConversionRecipe recipeDamageLens;
|
||||
// public static LensConversionRecipe recipeLeather;
|
||||
// public static LensConversionRecipe recipeNetherWart;
|
||||
// public static LensConversionRecipe recipePrismarine;
|
||||
// public static LensConversionRecipe recipeCrystallizedCanolaSeed;
|
||||
// public static LensConversionRecipe recipeItemLaser;
|
||||
// public static LensConversionRecipe recipeFluidLaser;
|
||||
// public static EnchBookConversion recipeEnchBook;
|
||||
//
|
||||
public static void init() {
|
||||
// //Crystal Blocks
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.REDSTONE_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.REDSTONE.ordinal()), 400);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.LAPIS_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.LAPIS.ordinal()), 400);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.DIAMOND_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), 600);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.EMERALD_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.EMERALD.ordinal()), 1000);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.COAL_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()), 600);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.IRON_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal()), 800);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
//
|
||||
// //Crystal Items
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItems(Items.REDSTONE), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), 40);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromStacks(new ItemStack(Items.DYE, 1, 4)), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), 40);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItems(Items.DIAMOND), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), 60);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItems(Items.EMERALD), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), 100);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItems(Items.COAL), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), 60);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItems(Items.IRON_INGOT), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), 80);
|
||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe());
|
||||
//
|
||||
// //Lenses
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal())), new ItemStack(InitItems.itemColorLens), 5000);
|
||||
// recipeColorLens = RecipeUtil.lastReconstructorRecipe();
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItems(InitItems.itemColorLens), new ItemStack(InitItems.itemExplosionLens), 5000);
|
||||
// recipeExplosionLens = RecipeUtil.lastReconstructorRecipe();
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItems(InitItems.itemExplosionLens), new ItemStack(InitItems.itemDamageLens), 5000);
|
||||
// recipeDamageLens = RecipeUtil.lastReconstructorRecipe();
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItems(InitItems.itemDamageLens), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), 5000);
|
||||
//
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(InitBlocks.blockLaserRelay), new ItemStack(InitBlocks.blockLaserRelayFluids), 2000);
|
||||
// recipeFluidLaser = RecipeUtil.lastReconstructorRecipe();
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(InitBlocks.blockLaserRelayFluids), new ItemStack(InitBlocks.blockLaserRelayItem), 2000);
|
||||
// recipeItemLaser = RecipeUtil.lastReconstructorRecipe();
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(InitBlocks.blockLaserRelayItem), new ItemStack(InitBlocks.blockLaserRelay), 2000);
|
||||
//
|
||||
// //Misc
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.SAND), new ItemStack(Blocks.SOUL_SAND), 20000);
|
||||
// recipeSoulSand = RecipeUtil.lastReconstructorRecipe();
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItems(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), 8000);
|
||||
// recipeLeather = RecipeUtil.lastReconstructorRecipe();
|
||||
//
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.RED_MUSHROOM), new ItemStack(Items.NETHER_WART), 150000);
|
||||
// recipeNetherWart = RecipeUtil.lastReconstructorRecipe();
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItems(Items.QUARTZ), new ItemStack(Items.PRISMARINE_SHARD), 30000);
|
||||
// recipePrismarine = RecipeUtil.lastReconstructorRecipe();
|
||||
//
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromItems(InitItems.itemCanolaSeed), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal()), 2000);
|
||||
// recipeCrystallizedCanolaSeed = RecipeUtil.lastReconstructorRecipe();
|
||||
//
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(fromBlock(Blocks.QUARTZ_BLOCK), new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), 10);
|
||||
// recipeWhiteWall = RecipeUtil.lastReconstructorRecipe();
|
||||
// ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(Ingredient.fromStacks(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 1)), new ItemStack(InitBlocks.blockTestifiBucksGreenWall), 10);
|
||||
// recipeGreenWall = RecipeUtil.lastReconstructorRecipe();
|
||||
|
||||
//
|
||||
// ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(recipeEnchBook = new EnchBookConversion());
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue