mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-25 00:18:34 +01:00
Compare commits
No commits in common. "f105b4c2658a402b5bd96ee718ecf741126b0a53" and "b907f08847c6b58d2274a96bbc8e672eb7888144" have entirely different histories.
f105b4c265
...
b907f08847
11 changed files with 206 additions and 376 deletions
|
@ -19,7 +19,6 @@ import de.ellpeck.actuallyadditions.api.laser.ILaserRelayConnectionHandler;
|
|||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.*;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -41,6 +40,7 @@ public final class ActuallyAdditionsAPI {
|
|||
public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<>();
|
||||
// public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<>();
|
||||
public static final List<LensConversionRecipe> RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<>();
|
||||
public static final List<EmpowererRecipe> EMPOWERER_RECIPES = new ArrayList<>();
|
||||
public static final Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<>();
|
||||
/**
|
||||
* Farmer behaviors are sorted when first accessed, this will not be done until after loading, but do not add behaviors at runtime.
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* This file ("EmpowererRecipe.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class EmpowererRecipe {
|
||||
|
||||
protected final Ingredient input;
|
||||
protected final ItemStack output;
|
||||
|
||||
protected final Ingredient modifier1;
|
||||
protected final Ingredient modifier2;
|
||||
protected final Ingredient modifier3;
|
||||
protected final Ingredient modifier4;
|
||||
|
||||
protected final int energyPerStand;
|
||||
protected final float[] particleColor;
|
||||
protected final int time;
|
||||
|
||||
@Deprecated
|
||||
public EmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor) {
|
||||
this(Ingredient.of(input), output, Ingredient.of(modifier1), Ingredient.of(modifier2), Ingredient.of(modifier3), Ingredient.of(modifier4), energyPerStand, time, particleColor);
|
||||
}
|
||||
|
||||
public EmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.modifier1 = modifier1;
|
||||
this.modifier2 = modifier2;
|
||||
this.modifier3 = modifier3;
|
||||
this.modifier4 = modifier4;
|
||||
this.energyPerStand = energyPerStand;
|
||||
this.particleColor = particleColor;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
|
||||
if (!this.input.test(base)) {
|
||||
return false;
|
||||
}
|
||||
List<Ingredient> matches = new ArrayList<>();
|
||||
ItemStack[] stacks = {stand1, stand2, stand3, stand4};
|
||||
boolean[] unused = {true, true, true, true};
|
||||
for (ItemStack s : stacks) {
|
||||
if (unused[0] && this.modifier1.test(s)) {
|
||||
matches.add(this.modifier1);
|
||||
unused[0] = false;
|
||||
} else if (unused[1] && this.modifier2.test(s)) {
|
||||
matches.add(this.modifier2);
|
||||
unused[1] = false;
|
||||
} else if (unused[2] && this.modifier3.test(s)) {
|
||||
matches.add(this.modifier3);
|
||||
unused[2] = false;
|
||||
} else if (unused[3] && this.modifier4.test(s)) {
|
||||
matches.add(this.modifier4);
|
||||
unused[3] = false;
|
||||
}
|
||||
}
|
||||
|
||||
return matches.size() == 4;
|
||||
}
|
||||
|
||||
public Ingredient getInput() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
public Ingredient getStandOne() {
|
||||
return this.modifier1;
|
||||
}
|
||||
|
||||
public Ingredient getStandTwo() {
|
||||
return this.modifier2;
|
||||
}
|
||||
|
||||
public Ingredient getStandThree() {
|
||||
return this.modifier3;
|
||||
}
|
||||
|
||||
public Ingredient getStandFour() {
|
||||
return this.modifier4;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return this.time;
|
||||
}
|
||||
|
||||
public int getEnergyPerStand() {
|
||||
return this.energyPerStand;
|
||||
}
|
||||
|
||||
public float[] getParticleColors() {
|
||||
return this.particleColor;
|
||||
}
|
||||
}
|
|
@ -31,7 +31,6 @@ public class ActuallyAdditionsData {
|
|||
generator.addProvider(new ItemTagsGenerator(generator, generatorBlockTags, helper));
|
||||
|
||||
generator.addProvider(new LaserRecipeGenerator(generator));
|
||||
generator.addProvider(new MiscRecipeGenerator(generator));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,22 +2,14 @@ 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;
|
||||
|
||||
|
@ -35,66 +27,9 @@ 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);
|
||||
|
||||
//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));
|
||||
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())));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
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 net.minecraft.util.IItemProvider;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class MiscRecipeGenerator extends RecipeProvider {
|
||||
public MiscRecipeGenerator(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveAdvancement(DirectoryCache pCache, JsonObject pAdvancementJson, Path pPath) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildShapelessRecipes(Consumer<IFinishedRecipe> p_200404_0_) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void addCrystalEmpowering(Consumer<IFinishedRecipe> consumer) {
|
||||
|
||||
}
|
||||
}
|
|
@ -17,17 +17,14 @@ public class ActuallyRecipes {
|
|||
|
||||
public static final RegistryObject<IRecipeSerializer<?>> KEEP_DATA_SHAPED_RECIPE = SERIALIZERS.register(RecipeKeepDataShaped.NAME, RecipeKeepDataShaped.Serializer::new);
|
||||
public static final RegistryObject<IRecipeSerializer<?>> LASER_RECIPE = SERIALIZERS.register(LaserRecipe.NAME, LaserRecipe.Serializer::new);
|
||||
public static final RegistryObject<IRecipeSerializer<?>> EMPOWERING_RECIPE = SERIALIZERS.register(EmpowererRecipe.NAME, EmpowererRecipe.Serializer::new);
|
||||
|
||||
|
||||
|
||||
public static class Types {
|
||||
public static final IRecipeType<LaserRecipe> LASER = IRecipeType.register(ActuallyAdditions.MODID + ":laser");
|
||||
public static final IRecipeType<EmpowererRecipe> EMPOWERING = IRecipeType.register(ActuallyAdditions.MODID + ":empower");
|
||||
//public static final IRecipeType<EmpoweringRecipe> EMPOWERING = IRecipeType.register(ActuallyAdditions.MODID + ":empower");
|
||||
//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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,252 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class EmpowererRecipe implements IRecipe<IInventory> {
|
||||
public static String NAME = "empowering";
|
||||
private ResourceLocation id;
|
||||
protected final Ingredient input;
|
||||
protected final ItemStack output;
|
||||
|
||||
protected final Ingredient modifier1;
|
||||
protected final Ingredient modifier2;
|
||||
protected final Ingredient modifier3;
|
||||
protected final Ingredient modifier4;
|
||||
|
||||
protected final int energyPerStand;
|
||||
protected final int particleColor;
|
||||
protected final int time;
|
||||
|
||||
public EmpowererRecipe(ResourceLocation id, ItemStack output, Ingredient input, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int particleColor, int time) {
|
||||
this.id = id;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.modifier1 = modifier1;
|
||||
this.modifier2 = modifier2;
|
||||
this.modifier3 = modifier3;
|
||||
this.modifier4 = modifier4;
|
||||
this.energyPerStand = energyPerStand;
|
||||
this.particleColor = particleColor;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
|
||||
if (!input.test(base) || stand1.isEmpty() || stand2.isEmpty() || stand3.isEmpty() || stand4.isEmpty())
|
||||
return false;
|
||||
List<Ingredient> matches = new ArrayList<>();
|
||||
ItemStack[] stacks = {stand1, stand2, stand3, stand4};
|
||||
boolean[] unused = {true, true, true, true};
|
||||
for (ItemStack s : stacks) {
|
||||
if (unused[0] && this.modifier1.test(s)) {
|
||||
matches.add(this.modifier1);
|
||||
unused[0] = false;
|
||||
} else if (unused[1] && this.modifier2.test(s)) {
|
||||
matches.add(this.modifier2);
|
||||
unused[1] = false;
|
||||
} else if (unused[2] && this.modifier3.test(s)) {
|
||||
matches.add(this.modifier3);
|
||||
unused[2] = false;
|
||||
} else if (unused[3] && this.modifier4.test(s)) {
|
||||
matches.add(this.modifier4);
|
||||
unused[3] = false;
|
||||
}
|
||||
}
|
||||
|
||||
return matches.size() == 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(IInventory pInv, World pLevel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack assemble(IInventory pInv) {
|
||||
return output.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraftInDimensions(int pWidth, int pHeight) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getResultItem() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer() {
|
||||
return ActuallyRecipes.EMPOWERING_RECIPE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeType<?> getType() {
|
||||
return ActuallyRecipes.Types.EMPOWERING;
|
||||
}
|
||||
|
||||
public Ingredient getInput() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
public Ingredient getStandOne() {
|
||||
return this.modifier1;
|
||||
}
|
||||
|
||||
public Ingredient getStandTwo() {
|
||||
return this.modifier2;
|
||||
}
|
||||
|
||||
public Ingredient getStandThree() {
|
||||
return this.modifier3;
|
||||
}
|
||||
|
||||
public Ingredient getStandFour() {
|
||||
return this.modifier4;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return this.time;
|
||||
}
|
||||
|
||||
public int getEnergyPerStand() {
|
||||
return this.energyPerStand;
|
||||
}
|
||||
|
||||
public int getParticleColors() {
|
||||
return this.particleColor;
|
||||
}
|
||||
|
||||
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<EmpowererRecipe> {
|
||||
@Override
|
||||
public EmpowererRecipe fromJson(ResourceLocation pRecipeId, JsonObject pJson) {
|
||||
ItemStack result = new ItemStack(JSONUtils.getAsItem(pJson, "result"));
|
||||
Ingredient base = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "base"));
|
||||
Ingredient mod1 = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "modifier1"));
|
||||
Ingredient mod2 = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "modifier2"));
|
||||
Ingredient mod3 = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "modifier3"));
|
||||
Ingredient mod4 = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "modifier4"));
|
||||
int energy = JSONUtils.getAsInt(pJson, "energy");
|
||||
int color = JSONUtils.getAsInt(pJson, "color");
|
||||
int time = JSONUtils.getAsInt(pJson, "time");
|
||||
|
||||
return new EmpowererRecipe(pRecipeId, result, base, mod1, mod2, mod3, mod4, energy, color, time);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public EmpowererRecipe fromNetwork(ResourceLocation pRecipeId, PacketBuffer pBuffer) {
|
||||
ItemStack result = pBuffer.readItem();
|
||||
Ingredient input = Ingredient.fromNetwork(pBuffer);
|
||||
Ingredient mod1 = Ingredient.fromNetwork(pBuffer);
|
||||
Ingredient mod2 = Ingredient.fromNetwork(pBuffer);
|
||||
Ingredient mod3 = Ingredient.fromNetwork(pBuffer);
|
||||
Ingredient mod4 = Ingredient.fromNetwork(pBuffer);
|
||||
int energy = pBuffer.readInt();
|
||||
int color = pBuffer.readInt();
|
||||
int time = pBuffer.readInt();
|
||||
|
||||
return new EmpowererRecipe(pRecipeId, result, input, mod1, mod2, mod3, mod4, energy, color, time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toNetwork(PacketBuffer pBuffer, EmpowererRecipe pRecipe) {
|
||||
pBuffer.writeItem(pRecipe.output);
|
||||
pRecipe.input.toNetwork(pBuffer);
|
||||
pRecipe.modifier1.toNetwork(pBuffer);
|
||||
pRecipe.modifier2.toNetwork(pBuffer);
|
||||
pRecipe.modifier3.toNetwork(pBuffer);
|
||||
pRecipe.modifier4.toNetwork(pBuffer);
|
||||
pBuffer.writeInt(pRecipe.energyPerStand);
|
||||
pBuffer.writeInt(pRecipe.particleColor);
|
||||
pBuffer.writeInt(pRecipe.time);
|
||||
}
|
||||
}
|
||||
|
||||
public static class FinishedRecipe implements IFinishedRecipe {
|
||||
private ResourceLocation id;
|
||||
private Ingredient base;
|
||||
private Ingredient mod1;
|
||||
private Ingredient mod2;
|
||||
private Ingredient mod3;
|
||||
private Ingredient mod4;
|
||||
private int energy;
|
||||
private int color;
|
||||
private int time;
|
||||
private IItemProvider output;
|
||||
|
||||
public FinishedRecipe(ResourceLocation id, IItemProvider output, Ingredient input, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int particleColor, int time) {
|
||||
this.id = id;
|
||||
this.base = input;
|
||||
this.output = output;
|
||||
this.mod1 = modifier1;
|
||||
this.mod2 = modifier2;
|
||||
this.mod3 = modifier3;
|
||||
this.mod4 = modifier4;
|
||||
this.energy = energyPerStand;
|
||||
this.color = particleColor;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeRecipeData(JsonObject pJson) {
|
||||
pJson.add("base", base.toJson());
|
||||
pJson.add("modifier1", mod1.toJson());
|
||||
pJson.add("modifier2", mod2.toJson());
|
||||
pJson.add("modifier3", mod3.toJson());
|
||||
pJson.add("modifier4", mod4.toJson());
|
||||
pJson.addProperty("energy", energy);
|
||||
pJson.addProperty("time", time);
|
||||
pJson.addProperty("color", color);
|
||||
pJson.addProperty("result", output.asItem().getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeSerializer<?> getType() {
|
||||
return ActuallyRecipes.EMPOWERING_RECIPE.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JsonObject serializeAdvancement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getAdvancementId() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,9 +6,9 @@ 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;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class LaserRecipe implements IRecipe<IInventory> {
|
|||
|
||||
@Override
|
||||
public ItemStack assemble(IInventory pInv) {
|
||||
return result.copy();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -106,9 +106,9 @@ public class LaserRecipe implements IRecipe<IInventory> {
|
|||
private ResourceLocation id;
|
||||
private Ingredient itemIngredient;
|
||||
private int energy;
|
||||
private IItemProvider output;
|
||||
private ItemStack output;
|
||||
|
||||
public FinishedRecipe(ResourceLocation id, Ingredient itemIngredient, int energy, IItemProvider output) {
|
||||
public FinishedRecipe(ResourceLocation id, Ingredient itemIngredient, int energy, ItemStack output) {
|
||||
this.id = id;
|
||||
this.itemIngredient = itemIngredient;
|
||||
this.energy = energy;
|
||||
|
@ -119,7 +119,7 @@ public class LaserRecipe implements IRecipe<IInventory> {
|
|||
public void serializeRecipeData(JsonObject pJson) {
|
||||
pJson.add("input", itemIngredient.toJson());
|
||||
pJson.addProperty("energy", energy);
|
||||
pJson.addProperty("output", output.asItem().getRegistryName().toString());
|
||||
pJson.addProperty("output", Registry.ITEM.getKey(output.getItem()).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,10 +10,86 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||
|
||||
// TODO: Need to figure out the enchanted stuff, and color changing still, the rest are datagen now.
|
||||
// TODO: [port] ADD BACK WITH DATA GENS
|
||||
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());
|
||||
//
|
||||
|
|
|
@ -13,12 +13,12 @@ package de.ellpeck.actuallyadditions.mod.items.metalists;
|
|||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum Crystals implements IStringSerializable {
|
||||
REDSTONE("red", 0xFF2F21, 0x9e2b27),
|
||||
LAPIS("blue", 0x5171FF, 0x253293),
|
||||
DIAMOND("light_blue", 0x35F1FF, 0x6387d2),
|
||||
COAL("black", 0x434442, 0x333333),
|
||||
EMERALD("green", 0x44E033, 0x354a18),
|
||||
IRON("white", 0xCEDDD4, 0xcccccc);
|
||||
REDSTONE("red", 0xFF2F21, 158F / 255F, 43F / 255F, 39F / 255F),
|
||||
LAPIS("blue", 0x5171FF, 37F / 255F, 49F / 255F, 147F / 255F),
|
||||
DIAMOND("light_blue", 0x35F1FF, 99F / 255F, 135F / 255F, 210F / 255F),
|
||||
COAL("black", 0x434442, 0.2F, 0.2F, 0.2F),
|
||||
EMERALD("green", 0x44E033, 54F / 255F, 75F / 255F, 24F / 255F),
|
||||
IRON("white", 0xCEDDD4, 0.8F, 0.8F, 0.8F);
|
||||
|
||||
public final String name;
|
||||
public final float[] conversionColorParticles;
|
||||
|
|
|
@ -12,9 +12,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
|
@ -31,7 +28,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
|
||||
public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||
|
||||
|
@ -40,7 +36,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
|||
private int lastRecipe;
|
||||
|
||||
public TileEntityEmpowerer() {
|
||||
super(ActuallyBlocks.EMPOWERER.getTileEntityType(), 1);
|
||||
super(ActuallyTiles.EMPOWERER_TILE.get(), 1);
|
||||
}
|
||||
|
||||
@Deprecated //Use findMatchingRecipe
|
||||
|
@ -69,7 +65,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
|||
|
||||
@Nullable
|
||||
public static EmpowererRecipe findMatchingRecipe(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
|
||||
for (EmpowererRecipe r : ServerLifecycleHooks.getCurrentServer().getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING)) {
|
||||
for (EmpowererRecipe r : ActuallyAdditionsAPI.EMPOWERER_RECIPES) {
|
||||
if (r.matches(base, stand1, stand2, stand3, stand4)) {
|
||||
return r;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue