diff --git a/src/main/java/techreborn/TechReborn.java b/src/main/java/techreborn/TechReborn.java index a0c915164..aca1ac9df 100644 --- a/src/main/java/techreborn/TechReborn.java +++ b/src/main/java/techreborn/TechReborn.java @@ -25,10 +25,8 @@ package techreborn; import net.minecraft.block.BlockDispenser; -import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; - import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; @@ -38,11 +36,8 @@ import net.minecraftforge.fml.common.registry.VillagerRegistry; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.ForgeRegistries; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import reborncore.api.recipe.RecipeHandler; import reborncore.common.multiblock.MultiblockEventHandler; import reborncore.common.multiblock.MultiblockServerTickHandler; import reborncore.common.registration.RegistrationManager; @@ -144,7 +139,6 @@ public class TechReborn { proxy.postInit(); ModRecipes.postInit(); - LOGGER.debug(RecipeHandler.recipeList.size() + " recipes loaded"); //todo: remove, gens localization // for (Item item : ForgeRegistries.ITEMS.getValues()) { diff --git a/src/main/java/techreborn/api/Reference.java b/src/main/java/techreborn/api/Reference.java deleted file mode 100644 index 971a8b2a6..000000000 --- a/src/main/java/techreborn/api/Reference.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api; - -/** - * This contains some static stuff used in recipes and other things - */ -public class Reference { - - public static String ALLOY_SMELTER_RECIPE = "ALLOY_SMELTER_RECIPE"; - public static String ASSEMBLING_MACHINE_RECIPE = "ASSEMBLING_MACHINE_RECIPE"; - public static String BLAST_FURNACE_RECIPE = "BLAST_FURNACE_RECIPE"; - public static String CENTRIFUGE_RECIPE = "CENTRIFUGE_RECIPE"; - public static String CHEMICAL_REACTOR_RECIPE = "CHEMICAL_REACTOR_RECIPE"; - public static String COMPRESSOR_RECIPE = "COMPRESSOR_RECIPE"; - public static String DISTILLATION_TOWER_RECIPE = "DISTILLATION_TOWER_RECIPE"; - public static String EXTRACTOR_RECIPE = "EXTRACTOR_RECIPE"; - public static String GRINDER_RECIPE = "GRINDER_RECIPE"; - public static String IMPLOSION_COMPRESSOR_RECIPE = "IMPLOSION_COMPRESSOR_RECIPE"; - public static String INDUSTRIAL_ELECTROLYZER_RECIPE = "INDUSTRIAL_ELECTROLYZER_RECIPE"; - public static String INDUSTRIAL_GRINDER_RECIPE = "INDUSTRIAL_GRINDER_RECIPE"; - public static String INDUSTRIAL_SAWMILL_RECIPE = "INDUSTRIAL_SAWMILL_RECIPE"; - public static String RECYCLER_RECIPE = "RECYCLER_RECIPE"; - public static String SCRAPBOX_RECIPE = "SCRAPBOX_RECIPE"; - public static String VACUUM_FREEZER_RECIPE = "VACUUM_FREEZER_RECIPE"; - public static String FLUID_REPLICATOR_RECIPE = "FLUID_REPLICATOR_RECIPE"; -} diff --git a/src/main/java/techreborn/api/fluidreplicator/FluidReplicatorRecipeCrafter.java b/src/main/java/techreborn/api/fluidreplicator/FluidReplicatorRecipeCrafter.java index 641bcecd0..261e0b061 100644 --- a/src/main/java/techreborn/api/fluidreplicator/FluidReplicatorRecipeCrafter.java +++ b/src/main/java/techreborn/api/fluidreplicator/FluidReplicatorRecipeCrafter.java @@ -31,7 +31,7 @@ import net.minecraftforge.fluids.FluidStack; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.util.Inventory; import reborncore.common.util.Tank; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.tiles.machine.multiblock.TileFluidReplicator; @@ -53,7 +53,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter { * @param outputSlots This is the list of slots that the crafting logic should look for output fluid */ public FluidReplicatorRecipeCrafter(TileEntity parentTile, Inventory inventory, int[] inputSlots, int[] outputSlots) { - super(Reference.FLUID_REPLICATOR_RECIPE, parentTile, 1, 1, inventory, inputSlots, outputSlots); + super(ModRecipes.FLUID_REPLICATOR, parentTile, 1, 1, inventory, inputSlots, outputSlots); } /** @@ -92,7 +92,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter { // RecipeCrafter @Override public void updateEntity() { - if (parentTile.getWorld().isRemote) { + if (tile.getWorld().isRemote) { return; } ticksSinceLastChange++; @@ -114,7 +114,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter { } // If it has reached the recipe tick time if (currentRecipe != null && currentTickTime >= currentNeededTicks && hasAllInputs()) { - TileFluidReplicator tileFluidReplicator = (TileFluidReplicator) parentTile; + TileFluidReplicator tileFluidReplicator = (TileFluidReplicator) tile; // Checks to see if it can fit the output // And fill tank with replicated fluid if (canFit(currentRecipe.getFluid(), tileFluidReplicator.tank) && currentRecipe.onCraft(tileFluidReplicator)) { @@ -137,7 +137,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter { // Increase the ticktime currentTickTime ++; if(currentTickTime == 1 || currentTickTime % 20 == 0 && soundHanlder != null){ - soundHanlder.playSound(false, parentTile); + soundHanlder.playSound(false, tile); } } } @@ -147,7 +147,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter { @Override public void updateCurrentRecipe() { - TileFluidReplicator tileFluidReplicator = (TileFluidReplicator) parentTile; + TileFluidReplicator tileFluidReplicator = (TileFluidReplicator) tile; for (FluidReplicatorRecipe recipe : FluidReplicatorRecipeList.recipes) { if (recipe.canCraft(tileFluidReplicator) && hasAllInputs(recipe)) { if (!canFit(recipe.getFluid(), tileFluidReplicator.tank)) { @@ -187,7 +187,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter { @Override public boolean canCraftAgain() { - TileFluidReplicator tileFluidReplicator = (TileFluidReplicator) parentTile; + TileFluidReplicator tileFluidReplicator = (TileFluidReplicator) tile; for (FluidReplicatorRecipe recipe : FluidReplicatorRecipeList.recipes) { if (recipe.canCraft(tileFluidReplicator) && hasAllInputs(recipe)) { if (!canFit(recipe.getFluid(), tileFluidReplicator.tank)) { diff --git a/src/main/java/techreborn/api/recipe/BaseRecipe.java b/src/main/java/techreborn/api/recipe/BaseRecipe.java deleted file mode 100644 index 47e43a109..000000000 --- a/src/main/java/techreborn/api/recipe/BaseRecipe.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import reborncore.api.recipe.IBaseRecipeType; -import reborncore.common.recipes.RecipeTranslator; - -import java.security.InvalidParameterException; -import java.util.ArrayList; -import java.util.List; - -/** - * Extend this to add a recipe - */ -public abstract class BaseRecipe implements IBaseRecipeType, Cloneable { - - public String name; - public int tickTime; - public int euPerTick; - private ArrayList inputs; - private ArrayList outputs; - private boolean oreDict = true; - - public BaseRecipe(String name, int tickTime, int euPerTick) { - inputs = new ArrayList<>(); - outputs = new ArrayList<>(); - this.name = name; - // This adds all new recipes - this.tickTime = tickTime; - this.euPerTick = euPerTick; - } - - @Override - public ItemStack getOutput(int i) { - return outputs.get(i).copy(); - } - - @Override - public int getOutputsSize() { - return outputs.size(); - } - - public void addOutput(ItemStack stack) { - if (stack == null || stack.isEmpty()) { - throw new InvalidParameterException("Output stack is null or empty"); - } - outputs.add(stack); - } - - @Override - public List getInputs() { - return inputs; - } - - @Override - public String getRecipeName() { - return name; - } - - @Override - public int tickTime() { - return tickTime; - } - - @Override - public int euPerTick() { - return euPerTick; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public boolean canCraft(TileEntity tile) { - if (tile instanceof ITileRecipeHandler) { - return ((ITileRecipeHandler) tile).canCraft(tile, this); - } - return true; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public boolean onCraft(TileEntity tile) { - if (tile instanceof ITileRecipeHandler) { - return ((ITileRecipeHandler) tile).onCraft(tile, this); - } - return true; - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public void setOreDict(boolean oreDict) { - this.oreDict = oreDict; - } - - @Override - public boolean useOreDic() { - return oreDict; - } - - @Override - public List getOutputs() { - return outputs; - } - - public void addInput(Object inuput) { - if (inuput == null) { - throw new InvalidParameterException("input is invalid!"); - } - if (inuput instanceof ItemStack) { - if (((ItemStack) inuput).isEmpty()) { - throw new InvalidParameterException("input is invalid!"); - } - } - if (RecipeTranslator.getStackFromObject(inuput) == null || RecipeTranslator.getStackFromObject(inuput).isEmpty()) { - throw new InvalidParameterException("Could not determin recipe input for " + inuput); - } - inputs.add(inuput); - } -} diff --git a/src/main/java/techreborn/api/recipe/ITileRecipeHandler.java b/src/main/java/techreborn/api/recipe/ITileRecipeHandler.java deleted file mode 100644 index 031249447..000000000 --- a/src/main/java/techreborn/api/recipe/ITileRecipeHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe; - -import net.minecraft.tileentity.TileEntity; - -/** - * Created by Mark on 03/04/2016. - * @param descendant of BaseRecipe - */ -public interface ITileRecipeHandler { - boolean canCraft(TileEntity tile, T recipe); - - boolean onCraft(TileEntity tile, T recipe); -} diff --git a/src/main/java/techreborn/api/recipe/ScrapboxRecipeCrafter.java b/src/main/java/techreborn/api/recipe/ScrapboxRecipeCrafter.java index a2a38a8ab..b9dd278cf 100644 --- a/src/main/java/techreborn/api/recipe/ScrapboxRecipeCrafter.java +++ b/src/main/java/techreborn/api/recipe/ScrapboxRecipeCrafter.java @@ -25,11 +25,10 @@ package techreborn.api.recipe; import net.minecraft.tileentity.TileEntity; -import reborncore.api.recipe.IBaseRecipeType; -import reborncore.api.recipe.RecipeHandler; +import reborncore.common.crafting.Recipe; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.util.Inventory; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import java.util.List; @@ -46,16 +45,16 @@ public class ScrapboxRecipeCrafter extends RecipeCrafter { * @param outputSlots Slot IDs for output */ public ScrapboxRecipeCrafter(TileEntity parentTile, Inventory inventory, int[] inputSlots, int[] outputSlots) { - super(Reference.SCRAPBOX_RECIPE, parentTile, 1, 1, inventory, inputSlots, outputSlots); + super(ModRecipes.SCRAPBOX, parentTile, 1, 1, inventory, inputSlots, outputSlots); } @Override public void updateCurrentRecipe(){ - List scrapboxRecipeList = RecipeHandler.getRecipeClassFromName(Reference.SCRAPBOX_RECIPE); - int random = parentTile.getWorld().rand.nextInt(scrapboxRecipeList.size()); + List scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(tile.getWorld()); + int random = tile.getWorld().rand.nextInt(scrapboxRecipeList.size()); // Sets the current recipe then syncs setCurrentRecipe(scrapboxRecipeList.get(random)); - this.currentNeededTicks = Math.max((int) (currentRecipe.tickTime() * (1.0 - getSpeedMultiplier())), 1); + this.currentNeededTicks = Math.max((int) (currentRecipe.getTime() * (1.0 - getSpeedMultiplier())), 1); this.currentTickTime = 0; setIsActive(); } diff --git a/src/main/java/techreborn/api/recipe/machines/AlloySmelterRecipe.java b/src/main/java/techreborn/api/recipe/machines/AlloySmelterRecipe.java deleted file mode 100644 index 4e4f4dee7..000000000 --- a/src/main/java/techreborn/api/recipe/machines/AlloySmelterRecipe.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class AlloySmelterRecipe extends BaseRecipe { - - public AlloySmelterRecipe(Object input1, Object input2, ItemStack output1, int tickTime, int euPerTick) { - super(Reference.ALLOY_SMELTER_RECIPE, tickTime, euPerTick); - if (input1 != null) - addInput(input1); - if (input2 != null) - addInput(input2); - if (output1 != null) - addOutput(output1); - } - - @Override - public String getUserFreindlyName() { - return "Alloy Smelter"; - } -} diff --git a/src/main/java/techreborn/api/recipe/machines/AssemblingMachineRecipe.java b/src/main/java/techreborn/api/recipe/machines/AssemblingMachineRecipe.java deleted file mode 100644 index 58ff593f2..000000000 --- a/src/main/java/techreborn/api/recipe/machines/AssemblingMachineRecipe.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class AssemblingMachineRecipe extends BaseRecipe { - - public AssemblingMachineRecipe(Object input1, Object input2, ItemStack output1, int tickTime, int euPerTick) { - super(Reference.ASSEMBLING_MACHINE_RECIPE, tickTime, euPerTick); - if (input1 != null) - addInput(input1); - if (input2 != null) - addInput(input2); - if (output1 != null) - addOutput(output1); - } - - @Override - public String getUserFreindlyName() { - return "Assembling Machine"; - } -} diff --git a/src/main/java/techreborn/api/recipe/machines/BlastFurnaceRecipe.java b/src/main/java/techreborn/api/recipe/machines/BlastFurnaceRecipe.java deleted file mode 100644 index 165296ed5..000000000 --- a/src/main/java/techreborn/api/recipe/machines/BlastFurnaceRecipe.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class BlastFurnaceRecipe extends BaseRecipe { - - public int neededHeat; - - public BlastFurnaceRecipe(Object input1, Object input2, ItemStack output1, ItemStack output2, int tickTime, - int euPerTick, int neededHeat) { - super(Reference.BLAST_FURNACE_RECIPE, tickTime, euPerTick); - if (input1 != null) - addInput(input1); - if (input2 != null) - addInput(input2); - if (output1 != null) - addOutput(output1); - if (output2 != null) - addOutput(output2); - - this.neededHeat = neededHeat; - } - - @Override - public String getUserFreindlyName() { - return "Blast Furnace"; - } -} diff --git a/src/main/java/techreborn/api/recipe/machines/CentrifugeRecipe.java b/src/main/java/techreborn/api/recipe/machines/CentrifugeRecipe.java deleted file mode 100644 index d6f42beed..000000000 --- a/src/main/java/techreborn/api/recipe/machines/CentrifugeRecipe.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class CentrifugeRecipe extends BaseRecipe { - - public CentrifugeRecipe(Object input1, Object input2, ItemStack output1, ItemStack output2, ItemStack output3, - ItemStack output4, int tickTime, int euPerTick) { - super(Reference.CENTRIFUGE_RECIPE, tickTime, euPerTick); - if (input1 != null) - addInput(input1); - if (input2 != null) - addInput(input2); - if (output1 != null) - addOutput(output1); - if (output2 != null) - addOutput(output2); - if (output3 != null) - addOutput(output3); - if (output4 != null) - addOutput(output4); - setOreDict(false); - } - - public CentrifugeRecipe(Object input1, Object input2, ItemStack output1, ItemStack output2, ItemStack output3, - ItemStack output4, int tickTime, int euPerTick, boolean useOreDic) { - this(input1, input2, output1, output2, output3, output4, tickTime, euPerTick); - setOreDict(useOreDic); - } - - @Override - public String getUserFreindlyName() { - return "Centrifuge"; - } - -} diff --git a/src/main/java/techreborn/api/recipe/machines/ChemicalReactorRecipe.java b/src/main/java/techreborn/api/recipe/machines/ChemicalReactorRecipe.java deleted file mode 100644 index 8250698a9..000000000 --- a/src/main/java/techreborn/api/recipe/machines/ChemicalReactorRecipe.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class ChemicalReactorRecipe extends BaseRecipe { - - public ChemicalReactorRecipe(Object input1, Object input2, ItemStack output1, int tickTime, int euPerTick) { - super(Reference.CHEMICAL_REACTOR_RECIPE, tickTime, euPerTick); - if (input1 != null) - addInput(input1); - if (input2 != null) - addInput(input2); - if (output1 != null) - addOutput(output1); - } - - @Override - public String getUserFreindlyName() { - return "Chemical Reactor"; - } -} diff --git a/src/main/java/techreborn/api/recipe/machines/CompressorRecipe.java b/src/main/java/techreborn/api/recipe/machines/CompressorRecipe.java deleted file mode 100644 index 5a094135a..000000000 --- a/src/main/java/techreborn/api/recipe/machines/CompressorRecipe.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class CompressorRecipe extends BaseRecipe { - - public CompressorRecipe(Object input1, ItemStack output1, int tickTime, int euPerTick) { - super(Reference.COMPRESSOR_RECIPE, tickTime, euPerTick); - if (input1 != null) - addInput(input1); - if (output1 != null) - addOutput(output1); - } - - @Override - public String getUserFreindlyName() { - return "Compressor"; - } -} diff --git a/src/main/java/techreborn/api/recipe/machines/DistillationTowerRecipe.java b/src/main/java/techreborn/api/recipe/machines/DistillationTowerRecipe.java deleted file mode 100644 index 717410958..000000000 --- a/src/main/java/techreborn/api/recipe/machines/DistillationTowerRecipe.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -/** - * @author drcrazy - * - */ -public class DistillationTowerRecipe extends BaseRecipe { - - /** - * @param inputCells Cells with to-be-distilled ingredient - * @param input2 Additional empty cells for output products - * @param output1 First output product - * @param output2 Second output product - * @param output3 Third output product - * @param output4 Firth output product - * @param tickTime Number of ticks for recipe to complete - * @param euPerTick Amount of EU consumed per tick - */ - public DistillationTowerRecipe(Object inputCells, Object input2, ItemStack output1, ItemStack output2, - ItemStack output3, ItemStack output4, int tickTime, int euPerTick) { - super(Reference.DISTILLATION_TOWER_RECIPE, tickTime, euPerTick); - if (inputCells != null) - addInput(inputCells); - if (input2 != null) - addInput(input2); - if (output1 != null) - addOutput(output1); - if (output2 != null) - addOutput(output2); - if (output3 != null) - addOutput(output3); - if (output4 != null) - addOutput(output4); - } - - public DistillationTowerRecipe(Object inputCells, Object input2, ItemStack output1, ItemStack output2, - ItemStack output3, ItemStack output4, int tickTime, int euPerTick, boolean oreDict) { - this(inputCells, input2, output1, output2, output3, output4, tickTime, euPerTick); - setOreDict(oreDict); - } - - /* (non-Javadoc) - * @see reborncore.api.recipe.IBaseRecipeType#getUserFreindlyName() - */ - @Override - public String getUserFreindlyName() { - return "Distillation Tower"; - } - -} diff --git a/src/main/java/techreborn/api/recipe/machines/ExtractorRecipe.java b/src/main/java/techreborn/api/recipe/machines/ExtractorRecipe.java deleted file mode 100644 index d68e28182..000000000 --- a/src/main/java/techreborn/api/recipe/machines/ExtractorRecipe.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class ExtractorRecipe extends BaseRecipe { - - public ExtractorRecipe(Object input1, ItemStack output1, int tickTime, int euPerTick) { - super(Reference.EXTRACTOR_RECIPE, tickTime, euPerTick); - if (input1 != null) - addInput(input1); - if (output1 != null) - addOutput(output1); - } - - public ExtractorRecipe(Object input1, ItemStack output1, int tickTime, int euPerTick, boolean useOreDic) { - this(input1, output1, tickTime, euPerTick); - setOreDict(useOreDic); - } - - @Override - public String getUserFreindlyName() { - return "Extractor"; - } - -} diff --git a/src/main/java/techreborn/api/recipe/machines/GrinderRecipe.java b/src/main/java/techreborn/api/recipe/machines/GrinderRecipe.java deleted file mode 100644 index bbb860567..000000000 --- a/src/main/java/techreborn/api/recipe/machines/GrinderRecipe.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class GrinderRecipe extends BaseRecipe { - - - public GrinderRecipe(Object input1, ItemStack output1, int tickTime, int euPerTick) { - super(Reference.GRINDER_RECIPE, tickTime, euPerTick / 10); //Done to buff energy usage to be more in line with ic2 - if (input1 != null) - addInput(input1); - if (output1 != null) - addOutput(output1); - } - - public GrinderRecipe(Object input1, ItemStack output1, int tickTime, int euPerTick, boolean useOreDict) { - super(Reference.GRINDER_RECIPE, tickTime, euPerTick / 10); //Done to buff energy usage to be more in line with ic2 - setOreDict(useOreDict); - if (input1 != null) - addInput(input1); - if (output1 != null) - addOutput(output1); - } - - @Override - public String getUserFreindlyName() { - return "Grinder"; - } -} diff --git a/src/main/java/techreborn/api/recipe/machines/ImplosionCompressorRecipe.java b/src/main/java/techreborn/api/recipe/machines/ImplosionCompressorRecipe.java deleted file mode 100644 index 6f3fc29ca..000000000 --- a/src/main/java/techreborn/api/recipe/machines/ImplosionCompressorRecipe.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class ImplosionCompressorRecipe extends BaseRecipe { - - public ImplosionCompressorRecipe(Object input1, Object input2, ItemStack output1, ItemStack output2, - int tickTime, int euPerTick) { - super(Reference.IMPLOSION_COMPRESSOR_RECIPE, tickTime, euPerTick); - if (input1 != null) - addInput(input1); - if (input2 != null) - addInput(input2); - if (output1 != null) - addOutput(output1); - if (output2 != null) - addOutput(output2); - } - - @Override - public String getUserFreindlyName() { - return "Implosion Compressor"; - } -} diff --git a/src/main/java/techreborn/api/recipe/machines/IndustrialElectrolyzerRecipe.java b/src/main/java/techreborn/api/recipe/machines/IndustrialElectrolyzerRecipe.java deleted file mode 100644 index 6580c03e6..000000000 --- a/src/main/java/techreborn/api/recipe/machines/IndustrialElectrolyzerRecipe.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class IndustrialElectrolyzerRecipe extends BaseRecipe { - - public IndustrialElectrolyzerRecipe(Object inputCells, Object input2, ItemStack output1, ItemStack output2, - ItemStack output3, ItemStack output4, int tickTime, int euPerTick) { - super(Reference.INDUSTRIAL_ELECTROLYZER_RECIPE, tickTime, euPerTick); - if (inputCells != null) - addInput(inputCells); - if (input2 != null) - addInput(input2); - if (output1 != null) - addOutput(output1); - if (output2 != null) - addOutput(output2); - if (output3 != null) - addOutput(output3); - if (output4 != null) - addOutput(output4); - } - - public IndustrialElectrolyzerRecipe(ItemStack inputCells, ItemStack input2, ItemStack output1, ItemStack output2, - ItemStack output3, ItemStack output4, int tickTime, int euPerTick, boolean oreDict) { - this(inputCells, input2, output1, output2, output3, output4, tickTime, euPerTick); - setOreDict(oreDict); - } - - @Override - public String getUserFreindlyName() { - return "Industrial Electrolyzer"; - } - -} diff --git a/src/main/java/techreborn/api/recipe/machines/IndustrialGrinderRecipe.java b/src/main/java/techreborn/api/recipe/machines/IndustrialGrinderRecipe.java deleted file mode 100644 index ffffc3bb0..000000000 --- a/src/main/java/techreborn/api/recipe/machines/IndustrialGrinderRecipe.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class IndustrialGrinderRecipe extends BaseRecipe { - - public FluidStack fluidStack; - - public IndustrialGrinderRecipe(Object input1, FluidStack fluidStack, ItemStack output1, - ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick) { - super(Reference.INDUSTRIAL_GRINDER_RECIPE, tickTime, euPerTick); - if (input1 != null) - addInput(input1); - if (output1 != null) - addOutput(output1); - if (output2 != null) - addOutput(output2); - if (output3 != null) - addOutput(output3); - if (output4 != null) - addOutput(output4); - this.fluidStack = fluidStack; - setOreDict(true); - } - - public IndustrialGrinderRecipe(Object input1, FluidStack fluidStack, ItemStack output1, - ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick, boolean useOreDict) { - this(input1, fluidStack, output1, output2, output3, output4, tickTime, euPerTick); - setOreDict(useOreDict); - } - - @Override - public String getUserFreindlyName() { - return "IndustrialGrinder"; - } - -} diff --git a/src/main/java/techreborn/api/recipe/machines/IndustrialSawmillRecipe.java b/src/main/java/techreborn/api/recipe/machines/IndustrialSawmillRecipe.java deleted file mode 100644 index 76332303e..000000000 --- a/src/main/java/techreborn/api/recipe/machines/IndustrialSawmillRecipe.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class IndustrialSawmillRecipe extends BaseRecipe { - - public FluidStack fluidStack; - - public IndustrialSawmillRecipe(ItemStack input1, FluidStack fluidStack, ItemStack output1, - ItemStack output2, ItemStack output3, int tickTime, int euPerTick) { - super(Reference.INDUSTRIAL_SAWMILL_RECIPE, tickTime, euPerTick); - if (input1 != null) - addInput(input1); - if (output1 != null) - addOutput(output1); - if (output2 != null) - addOutput(output2); - if (output3 != null) - addOutput(output3); - this.fluidStack = fluidStack; - setOreDict(false); - } - - public IndustrialSawmillRecipe(Object input1, FluidStack fluidStack, ItemStack output1, - ItemStack output2, ItemStack output3, int tickTime, int euPerTick, boolean canUseOreDict) { - super(Reference.INDUSTRIAL_SAWMILL_RECIPE, tickTime, euPerTick); - if (input1 != null) - addInput(input1); - if (output1 != null) - addOutput(output1); - if (output2 != null) - addOutput(output2); - if (output3 != null) - addOutput(output3); - this.fluidStack = fluidStack; - setOreDict(canUseOreDict); - } - - @Override - public String getUserFreindlyName() { - return "Industrial Sawmill"; - } - -} diff --git a/src/main/java/techreborn/api/recipe/machines/RecyclerRecipe.java b/src/main/java/techreborn/api/recipe/machines/RecyclerRecipe.java deleted file mode 100644 index 0ac5f6427..000000000 --- a/src/main/java/techreborn/api/recipe/machines/RecyclerRecipe.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.TechRebornAPI; -import techreborn.api.recipe.BaseRecipe; - -//THIS is only here to trick JEI into showing recipes for the recycler -public class RecyclerRecipe extends BaseRecipe { - - public RecyclerRecipe(ItemStack input) { - super(Reference.RECYCLER_RECIPE, 0, 0); - addInput(input); - addOutput(TechRebornAPI.subItemRetriever.getPartByName("scrap")); - } - - @Override - public String getUserFreindlyName() { - return "Recycler"; - } -} diff --git a/src/main/java/techreborn/api/recipe/machines/ScrapboxRecipe.java b/src/main/java/techreborn/api/recipe/machines/ScrapboxRecipe.java deleted file mode 100644 index 4b6678d76..000000000 --- a/src/main/java/techreborn/api/recipe/machines/ScrapboxRecipe.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.TechRebornAPI; -import techreborn.api.recipe.BaseRecipe; - -public class ScrapboxRecipe extends BaseRecipe { - - public ScrapboxRecipe(ItemStack output, int tickTime, int euPerTick) { - super(Reference.SCRAPBOX_RECIPE, tickTime, euPerTick); - if (output != null) { - // TODO: Fix recipe - addInput(new ItemStack(TechRebornAPI.getItem("SCRAP_BOX"))); - addOutput(output); - } - } - - @Override - public String getUserFreindlyName() { - return "Scrapbox"; - } -} diff --git a/src/main/java/techreborn/api/recipe/machines/VacuumFreezerRecipe.java b/src/main/java/techreborn/api/recipe/machines/VacuumFreezerRecipe.java deleted file mode 100644 index d092bc689..000000000 --- a/src/main/java/techreborn/api/recipe/machines/VacuumFreezerRecipe.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.api.recipe.machines; - -import net.minecraft.item.ItemStack; -import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; - -public class VacuumFreezerRecipe extends BaseRecipe { - - public VacuumFreezerRecipe(Object input, ItemStack output, int tickTime, int euPerTick) { - super(Reference.VACUUM_FREEZER_RECIPE, tickTime, euPerTick); - if (input != null) - addInput(input); - if (output != null) - addOutput(output); - } - - @Override - public String getUserFreindlyName() { - return "Vacuum Freezer"; - } -} \ No newline at end of file diff --git a/src/main/java/techreborn/api/recipe/recipes/BlastFurnaceRecipe.java b/src/main/java/techreborn/api/recipe/recipes/BlastFurnaceRecipe.java new file mode 100644 index 000000000..ebf993b4f --- /dev/null +++ b/src/main/java/techreborn/api/recipe/recipes/BlastFurnaceRecipe.java @@ -0,0 +1,44 @@ +package techreborn.api.recipe.recipes; + +import com.google.gson.JsonObject; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.JsonUtils; +import net.minecraft.util.ResourceLocation; +import reborncore.common.crafting.Recipe; +import reborncore.common.crafting.RecipeType; +import techreborn.tiles.machine.multiblock.TileIndustrialBlastFurnace; + +public class BlastFurnaceRecipe extends Recipe { + + int heat; + + public BlastFurnaceRecipe(RecipeType type, ResourceLocation name) { + super(type, name); + } + + @Override + public void deserialize(JsonObject jsonObject) { + super.deserialize(jsonObject); + heat = JsonUtils.getInt(jsonObject, "heat"); + } + + @Override + public void serialize(JsonObject jsonObject) { + super.serialize(jsonObject); + jsonObject.addProperty("heat", heat); + } + + @Override + public boolean canCraft(final TileEntity tile) { + if (tile instanceof TileIndustrialBlastFurnace) { + final TileIndustrialBlastFurnace blastFurnace = (TileIndustrialBlastFurnace) tile; + return blastFurnace.getHeat() >= heat; + } + return false; + } + + @Override + public boolean onCraft(final TileEntity tile) { + return true; + } +} diff --git a/src/main/java/techreborn/api/recipe/recipes/IndustrialGrinderRecipe.java b/src/main/java/techreborn/api/recipe/recipes/IndustrialGrinderRecipe.java new file mode 100644 index 000000000..ff1348573 --- /dev/null +++ b/src/main/java/techreborn/api/recipe/recipes/IndustrialGrinderRecipe.java @@ -0,0 +1,66 @@ +package techreborn.api.recipe.recipes; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; +import reborncore.common.crafting.Recipe; +import reborncore.common.crafting.RecipeType; +import techreborn.tiles.machine.multiblock.TileIndustrialGrinder; + +public class IndustrialGrinderRecipe extends Recipe { + + //TODO 1.14 fluids + FluidStack fluidStack = null; + + public IndustrialGrinderRecipe(RecipeType type, ResourceLocation name) { + super(type, name); + } + + @Override + public boolean canCraft(final TileEntity tileEntity) { + TileIndustrialGrinder tile = (TileIndustrialGrinder) tileEntity; + if (!tile.getMultiBlock()) { + return false; + } + final FluidStack recipeFluid = fluidStack; + final FluidStack tankFluid = tile.tank.getFluid(); + if (fluidStack == null) { + return true; + } + if (tankFluid == null) { + return false; + } + if (tankFluid.isFluidEqual(recipeFluid)) { + if (tankFluid.amount >= recipeFluid.amount) { + return true; + } + } + return false; + } + + @Override + public boolean onCraft(final TileEntity tileEntity) { + TileIndustrialGrinder tile = (TileIndustrialGrinder) tileEntity; + final FluidStack recipeFluid = fluidStack; + final FluidStack tankFluid = tile.tank.getFluid(); + if (fluidStack == null) { + return true; + } + if (tankFluid == null) { + return false; + } + if (tankFluid.isFluidEqual(recipeFluid)) { + if (tankFluid.amount >= recipeFluid.amount) { + if (tankFluid.amount == recipeFluid.amount) { + tile.tank.setFluid(null); + } + else { + tankFluid.amount -= recipeFluid.amount; + } + tile.syncWithAll(); + return true; + } + } + return false; + } +} diff --git a/src/main/java/techreborn/api/recipe/recipes/IndustrialSawmillRecipe.java b/src/main/java/techreborn/api/recipe/recipes/IndustrialSawmillRecipe.java new file mode 100644 index 000000000..68d096f61 --- /dev/null +++ b/src/main/java/techreborn/api/recipe/recipes/IndustrialSawmillRecipe.java @@ -0,0 +1,65 @@ +package techreborn.api.recipe.recipes; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; +import reborncore.common.crafting.Recipe; +import reborncore.common.crafting.RecipeType; +import techreborn.tiles.machine.multiblock.TileIndustrialSawmill; + +public class IndustrialSawmillRecipe extends Recipe { + + //TODO 1.14 fluids + FluidStack fluidStack = null; + + public IndustrialSawmillRecipe(RecipeType type, ResourceLocation name) { + super(type, name); + } + + @Override + public boolean canCraft(TileEntity tileEntity) { + TileIndustrialSawmill tile = (TileIndustrialSawmill) tileEntity; + if (!tile.getMutliBlock()) { + return false; + } + final FluidStack recipeFluid = fluidStack; + final FluidStack tankFluid = tile.tank.getFluid(); + if (fluidStack == null) { + return true; + } + if (tankFluid == null) { + return false; + } + if (tankFluid.isFluidEqual(recipeFluid)) { + if (tankFluid.amount >= recipeFluid.amount) { + return true; + } + } + return false; + } + + @Override + public boolean onCraft(TileEntity tileEntity) { + TileIndustrialSawmill tile = (TileIndustrialSawmill) tileEntity; + final FluidStack recipeFluid = fluidStack; + final FluidStack tankFluid = tile.tank.getFluid(); + if (fluidStack == null) { + return true; + } + if (tankFluid == null) { + return false; + } + if (tankFluid.isFluidEqual(recipeFluid)) { + if (tankFluid.amount >= recipeFluid.amount) { + if (tankFluid.amount == recipeFluid.amount) { + tile.tank.setFluid(null); + } else { + tankFluid.amount -= recipeFluid.amount; + } + tile.syncWithAll(); + return true; + } + } + return false; + } +} diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 6e698ef76..1a497a973 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -24,29 +24,41 @@ package techreborn.init; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; -import reborncore.api.recipe.RecipeHandler; import reborncore.common.crafting.Recipe; import reborncore.common.crafting.RecipeManager; import reborncore.common.crafting.RecipeType; import reborncore.common.registration.RebornRegister; import techreborn.TechReborn; -import techreborn.api.Reference; -import techreborn.api.recipe.machines.GrinderRecipe; -import techreborn.api.recipe.machines.VacuumFreezerRecipe; -import techreborn.items.ItemCells; +import techreborn.api.recipe.recipes.BlastFurnaceRecipe; +import techreborn.api.recipe.recipes.IndustrialGrinderRecipe; +import techreborn.api.recipe.recipes.IndustrialSawmillRecipe; @RebornRegister(TechReborn.MOD_ID) public class ModRecipes { + public static final RecipeType ALLOY_SMELTER = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:alloy_smelter")); + public static final RecipeType ASSEMBLING_MACHINE = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:assembling_machine")); + public static final RecipeType BLAST_FURNACE = RecipeManager.newRecipeType(BlastFurnaceRecipe.class, new ResourceLocation("techreborn:blast_furnace")); + public static final RecipeType CENTRIFUGE = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:centrifuge")); + public static final RecipeType CHEMICAL_REACTOR = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:chemical_reactor")); + public static final RecipeType COMPRESSOR = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:compressor")); + public static final RecipeType DISTILLATION_TOWER = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:distillation_tower")); + public static final RecipeType EXTRACTOR = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:extractor")); public static final RecipeType GRINDER = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:grinder")); + public static final RecipeType IMPLOSION_COMPRESSOR = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:implosion_compressor")); + public static final RecipeType INDUSTRIAL_ELECTROLYZER = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:industrial_electrolyzer")); + public static final RecipeType INDUSTRIAL_GRINDER = RecipeManager.newRecipeType(IndustrialGrinderRecipe.class, new ResourceLocation("techreborn:industrial_grinder")); + public static final RecipeType INDUSTRIAL_SAWMILL = RecipeManager.newRecipeType(IndustrialSawmillRecipe.class, new ResourceLocation("techreborn:industrial_sawmill")); + public static final RecipeType RECYCLER = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:recycler")); + public static final RecipeType SCRAPBOX = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:scrapbox")); + public static final RecipeType VACUUM_FREEZER = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:vacuum_freezer")); + public static final RecipeType FLUID_REPLICATOR = RecipeManager.newRecipeType(Recipe.class, new ResourceLocation("techreborn:fluid_replicator")); @@ -151,15 +163,15 @@ public class ModRecipes { // new ItemStack(Items.DYE, 6, 15), // 170, 19)); - RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( - new ItemStack(Blocks.COBBLESTONE), - new ItemStack(Blocks.SAND), - 230, 23)); - - RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( - new ItemStack(Blocks.GRAVEL), - new ItemStack(Items.FLINT), - 200, 20)); +// RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( +// new ItemStack(Blocks.COBBLESTONE), +// new ItemStack(Blocks.SAND), +// 230, 23)); +// +// RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( +// new ItemStack(Blocks.GRAVEL), +// new ItemStack(Items.FLINT), +// 200, 20)); // RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( // new ItemStack(Items.COAL), @@ -209,11 +221,11 @@ public class ModRecipes { // new ItemStack(Blocks.OBSIDIAN), // ItemDusts.getDustByName("obsidian", 4), // 170, 19)); - - RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( - new ItemStack(Items.BLAZE_ROD), - new ItemStack(Items.BLAZE_POWDER, 4), - 170, 19)); +// +// RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( +// new ItemStack(Items.BLAZE_ROD), +// new ItemStack(Items.BLAZE_POWDER, 4), +// 170, 19)); // if (OreUtil.doesOreExistAndValid("stoneMarble")) { // ItemStack marbleStack = getOre("stoneMarble"); @@ -231,25 +243,25 @@ public class ModRecipes { // } //See comments bellow, this allows the ore to go to the product when it sometimes goes straight to dust. - RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( - "oreCoal", new ItemStack(Items.COAL, 2), - 270, 31)); - - RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( - "oreDiamond", new ItemStack(Items.DIAMOND, 1), - 270, 31)); - - RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( - "oreEmerald", new ItemStack(Items.EMERALD, 1), - 270, 31)); - - RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( - "oreRedstone", new ItemStack(Items.REDSTONE, 8), - 270, 31)); - - RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( - "oreQuartz", new ItemStack(Items.QUARTZ, 2), - 270, 31)); +// RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( +// "oreCoal", new ItemStack(Items.COAL, 2), +// 270, 31)); +// +// RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( +// "oreDiamond", new ItemStack(Items.DIAMOND, 1), +// 270, 31)); +// +// RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( +// "oreEmerald", new ItemStack(Items.EMERALD, 1), +// 270, 31)); +// +// RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( +// "oreRedstone", new ItemStack(Items.REDSTONE, 8), +// 270, 31)); +// +// RecipeHandler.addRecipe(Reference.GRINDER_RECIPE, new GrinderRecipe( +// "oreQuartz", new ItemStack(Items.QUARTZ, 2), +// 270, 31)); // for (String oreDictionaryName : OreDictionary.getOreNames()) { @@ -294,17 +306,17 @@ public class ModRecipes { } static void addVacuumFreezerRecipes() { - RecipeHandler.addRecipe(Reference.VACUUM_FREEZER_RECIPE, - new VacuumFreezerRecipe(new ItemStack(Blocks.ICE, 2), new ItemStack(Blocks.PACKED_ICE), 60, 64)); +// RecipeHandler.addRecipe(Reference.VACUUM_FREEZER_RECIPE, +// new VacuumFreezerRecipe(new ItemStack(Blocks.ICE, 2), new ItemStack(Blocks.PACKED_ICE), 60, 64)); // TODO: Fix recipe // RecipeHandler.addRecipe(Reference.VACUUM_FREEZER_RECIPE, new VacuumFreezerRecipe( // ItemIngots.getIngotByName("hot_tungstensteel"), ItemIngots.getIngotByName("tungstensteel"), 440, 64)); - RecipeHandler.addRecipe(Reference.VACUUM_FREEZER_RECIPE, new VacuumFreezerRecipe( - ItemCells.getCellByName("heliumplasma"), ItemCells.getCellByName("helium"), 440, 64)); - - RecipeHandler.addRecipe(Reference.VACUUM_FREEZER_RECIPE, - new VacuumFreezerRecipe(ItemCells.getCellByName("water"), ItemCells.getCellByName("cell"), 60, 64)); +// RecipeHandler.addRecipe(Reference.VACUUM_FREEZER_RECIPE, new VacuumFreezerRecipe( +// ItemCells.getCellByName("heliumplasma"), ItemCells.getCellByName("helium"), 440, 64)); +// +// RecipeHandler.addRecipe(Reference.VACUUM_FREEZER_RECIPE, +// new VacuumFreezerRecipe(ItemCells.getCellByName("water"), ItemCells.getCellByName("cell"), 60, 64)); } diff --git a/src/main/java/techreborn/init/recipes/ChemicalReactorRecipes.java b/src/main/java/techreborn/init/recipes/ChemicalReactorRecipes.java index dc4d35bf5..0904c7a21 100644 --- a/src/main/java/techreborn/init/recipes/ChemicalReactorRecipes.java +++ b/src/main/java/techreborn/init/recipes/ChemicalReactorRecipes.java @@ -27,9 +27,6 @@ package techreborn.init.recipes; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import reborncore.api.recipe.RecipeHandler; -import techreborn.api.Reference; -import techreborn.api.recipe.machines.ChemicalReactorRecipe; /** * @author drcrazy @@ -61,7 +58,7 @@ public class ChemicalReactorRecipes extends RecipeMethods { } public static void register(ItemStack in1, ItemStack in2, ItemStack out, int tickTime, int euPerTick){ - RecipeHandler.addRecipe(Reference.CHEMICAL_REACTOR_RECIPE, new ChemicalReactorRecipe(in1, in2, out, tickTime, euPerTick)); + // RecipeHandler.addRecipe(Reference.CHEMICAL_REACTOR_RECIPE, new ChemicalReactorRecipe(in1, in2, out, tickTime, euPerTick)); } public static void register (ItemStack in1, ItemStack in2, ItemStack out, int tickTime){ diff --git a/src/main/java/techreborn/init/recipes/DistillationTowerRecipes.java b/src/main/java/techreborn/init/recipes/DistillationTowerRecipes.java index 62ffb3003..660fce274 100644 --- a/src/main/java/techreborn/init/recipes/DistillationTowerRecipes.java +++ b/src/main/java/techreborn/init/recipes/DistillationTowerRecipes.java @@ -25,9 +25,6 @@ package techreborn.init.recipes; import net.minecraft.item.ItemStack; -import reborncore.api.recipe.RecipeHandler; -import techreborn.api.Reference; -import techreborn.api.recipe.machines.DistillationTowerRecipe; import techreborn.items.DynamicCell; import techreborn.items.ItemCells; @@ -97,7 +94,7 @@ public class DistillationTowerRecipes extends RecipeMethods { } cells = DynamicCell.getEmptyCell(cellCount); } - RecipeHandler.addRecipe(Reference.DISTILLATION_TOWER_RECIPE, new DistillationTowerRecipe(input, cells, output1, output2, output3, output4, ticks, euPerTick, oreDict)); + // RecipeHandler.addRecipe(Reference.DISTILLATION_TOWER_RECIPE, new DistillationTowerRecipe(input, cells, output1, output2, output3, output4, ticks, euPerTick, oreDict)); } static void register(ItemStack input, int ticks, int euPerTick, ItemStack... outputs) { diff --git a/src/main/java/techreborn/init/recipes/ImplosionCompressorRecipes.java b/src/main/java/techreborn/init/recipes/ImplosionCompressorRecipes.java index 55eea3276..c2ef37948 100644 --- a/src/main/java/techreborn/init/recipes/ImplosionCompressorRecipes.java +++ b/src/main/java/techreborn/init/recipes/ImplosionCompressorRecipes.java @@ -26,9 +26,6 @@ package techreborn.init.recipes; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import reborncore.api.recipe.RecipeHandler; -import techreborn.api.Reference; -import techreborn.api.recipe.machines.ImplosionCompressorRecipe; import java.security.InvalidParameterException; @@ -77,6 +74,6 @@ public class ImplosionCompressorRecipes extends RecipeMethods { throw new InvalidParameterException("Invalid implosion compressor darkAshes input: " + darkAshes); } - RecipeHandler.addRecipe(Reference.IMPLOSION_COMPRESSOR_RECIPE, new ImplosionCompressorRecipe(input, getStack(Blocks.TNT, 16), output, getMaterial("dark_ashes", darkAshes, Type.DUST), 20, 32)); + //RecipeHandler.addRecipe(Reference.IMPLOSION_COMPRESSOR_RECIPE, new ImplosionCompressorRecipe(input, getStack(Blocks.TNT, 16), output, getMaterial("dark_ashes", darkAshes, Type.DUST), 20, 32)); } } diff --git a/src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java b/src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java index f7590a885..400e86994 100644 --- a/src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java +++ b/src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java @@ -27,9 +27,6 @@ package techreborn.init.recipes; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import reborncore.api.recipe.RecipeHandler; -import techreborn.api.Reference; -import techreborn.api.recipe.machines.CentrifugeRecipe; import techreborn.items.DynamicCell; import java.security.InvalidParameterException; @@ -174,7 +171,7 @@ public class IndustrialCentrifugeRecipes extends RecipeMethods { } cells = DynamicCell.getEmptyCell(cellCount); } - RecipeHandler.addRecipe(Reference.CENTRIFUGE_RECIPE, new CentrifugeRecipe(input, cells, output1, output2, output3, output4, ticks, 5, oreDict)); + //RecipeHandler.addRecipe(Reference.CENTRIFUGE_RECIPE, new CentrifugeRecipe(input, cells, output1, output2, output3, output4, ticks, 5, oreDict)); } static void register(Object input, int ticks, ItemStack... outputs) { diff --git a/src/main/java/techreborn/init/recipes/ScrapboxRecipes.java b/src/main/java/techreborn/init/recipes/ScrapboxRecipes.java index c487d3a7c..8ea9c6a98 100644 --- a/src/main/java/techreborn/init/recipes/ScrapboxRecipes.java +++ b/src/main/java/techreborn/init/recipes/ScrapboxRecipes.java @@ -28,9 +28,6 @@ import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import reborncore.api.recipe.RecipeHandler; -import techreborn.api.Reference; -import techreborn.api.recipe.machines.ScrapboxRecipe; import techreborn.init.TRContent; import techreborn.items.DynamicCell; import techreborn.utils.StackWIPHandler; @@ -216,7 +213,7 @@ public class ScrapboxRecipes extends RecipeMethods { if(output == null || output.isEmpty()){ return; } - RecipeHandler.addRecipe(Reference.SCRAPBOX_RECIPE, new ScrapboxRecipe(output, 20, 2)); + //RecipeHandler.addRecipe(Reference.SCRAPBOX_RECIPE, new ScrapboxRecipe(output, 20, 2)); } diff --git a/src/main/java/techreborn/items/ItemScrapBox.java b/src/main/java/techreborn/items/ItemScrapBox.java index fa4efff04..928c1487a 100644 --- a/src/main/java/techreborn/items/ItemScrapBox.java +++ b/src/main/java/techreborn/items/ItemScrapBox.java @@ -31,11 +31,10 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.world.World; -import reborncore.api.recipe.IBaseRecipeType; -import reborncore.api.recipe.RecipeHandler; +import reborncore.common.crafting.Recipe; import reborncore.common.util.WorldUtils; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import java.util.List; @@ -49,9 +48,9 @@ public class ItemScrapBox extends Item { public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItemMainhand(); if (!world.isRemote) { - List scrapboxRecipeList = RecipeHandler.getRecipeClassFromName(Reference.SCRAPBOX_RECIPE); + List scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(world); int random = world.rand.nextInt(scrapboxRecipeList.size()); - ItemStack out = scrapboxRecipeList.get(random).getOutput(0); + ItemStack out = scrapboxRecipeList.get(random).getOutputs().get(0); WorldUtils.dropItem(out, world, player.getPosition()); stack.shrink(1); } diff --git a/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java b/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java index a038e2cf4..2b53f6ea6 100644 --- a/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java +++ b/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java @@ -37,7 +37,7 @@ import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import reborncore.common.util.ItemUtils; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.items.DynamicCell; @@ -57,7 +57,7 @@ public class TileIndustrialCentrifuge extends TileGenericMachine implements ICon final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2, 3, 4, 5 }; this.inventory = new Inventory<>(7, "TileIndustrialCentrifuge", 64, this).withConfiguredAccess(); - this.crafter = new RecipeCrafter(Reference.CENTRIFUGE_RECIPE, this, 2, 4, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.CENTRIFUGE, this, 2, 4, this.inventory, inputs, outputs); } // IContainerProvider diff --git a/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java b/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java index 5760907f9..4561d05c3 100644 --- a/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java +++ b/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java @@ -26,23 +26,22 @@ package techreborn.tiles.machine.iron; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.EnumFacing; import reborncore.api.IToolDrop; -import reborncore.api.recipe.IBaseRecipeType; -import reborncore.api.recipe.RecipeHandler; import reborncore.api.tile.ItemHandlerProvider; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import reborncore.common.crafting.Recipe; import reborncore.common.recipes.RecipeTranslator; import reborncore.common.registration.RebornRegister; import reborncore.common.tile.TileMachineBase; import reborncore.common.util.Inventory; import reborncore.common.util.ItemUtils; import techreborn.TechReborn; -import techreborn.api.Reference; -import techreborn.api.recipe.machines.AlloySmelterRecipe; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; @@ -118,21 +117,15 @@ public class TileIronAlloyFurnace extends TileMachineBase } } - public boolean hasAllInputs(final IBaseRecipeType recipeType) { + public boolean hasAllInputs(final Recipe recipeType) { if (recipeType == null) { return false; } - for (final Object input : recipeType.getInputs()) { + for (Ingredient ingredient : recipeType.getIngredients()) { boolean hasItem = false; - boolean useTags = input instanceof String || recipeType.useOreDic(); - boolean checkSize = input instanceof ItemStack; for (int inputslot = 0; inputslot < 2; inputslot++) { - if (ItemUtils.isInputEqual(input, inventory.getStackInSlot(inputslot), true, - useTags)) { - ItemStack stack = RecipeTranslator.getStackFromObject(input); - if (!checkSize || inventory.getStackInSlot(inputslot).getCount() >= stack.getCount()) { - hasItem = true; - } + if (ingredient.test(inventory.getStackInSlot(inputslot))) { + hasItem = true; } } if (!hasItem) @@ -146,9 +139,9 @@ public class TileIronAlloyFurnace extends TileMachineBase return false; } else { ItemStack itemstack = null; - for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.ALLOY_SMELTER_RECIPE)) { + for (final Recipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) { if (this.hasAllInputs(recipeType)) { - itemstack = recipeType.getOutput(0); + itemstack = recipeType.getOutputs().get(0); break; } } @@ -178,9 +171,9 @@ public class TileIronAlloyFurnace extends TileMachineBase public void smeltItem() { if (this.canSmelt()) { ItemStack itemstack = ItemStack.EMPTY; - for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.ALLOY_SMELTER_RECIPE)) { + for (final Recipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) { if (this.hasAllInputs(recipeType)) { - itemstack = recipeType.getOutput(0); + itemstack = recipeType.getOutputs().get(0); break; } if (!itemstack.isEmpty()) { @@ -194,7 +187,7 @@ public class TileIronAlloyFurnace extends TileMachineBase inventory.shrinkSlot(this.output, -itemstack.getCount()); } - for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.ALLOY_SMELTER_RECIPE)) { + for (final Recipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) { boolean hasAllRecipes = true; if (this.hasAllInputs(recipeType)) { @@ -202,14 +195,11 @@ public class TileIronAlloyFurnace extends TileMachineBase hasAllRecipes = false; } if (hasAllRecipes) { - for (Object input : recipeType.getInputs()) { - boolean useOreDict = input instanceof String || recipeType.useOreDic(); + for (Ingredient ingredient : recipeType.getIngredients()) { for (int inputSlot = 0; inputSlot < 2; inputSlot++) { - if (ItemUtils.isInputEqual(input, this.inventory.getStackInSlot(inputSlot), true, useOreDict)) { + if (ingredient.test(this.inventory.getStackInSlot(inputSlot))) { int count = 1; - if (input instanceof ItemStack) { - count = RecipeTranslator.getStackFromObject(input).getCount(); - } + //TODO also look into ingredient size here inventory.shrinkSlot(inputSlot, count); break; } @@ -290,13 +280,9 @@ public class TileIronAlloyFurnace extends TileMachineBase return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142) .addInventory().tile(this) .filterSlot(0, 47, 17, - stack -> RecipeHandler.recipeList.stream() - .anyMatch(recipe -> recipe instanceof AlloySmelterRecipe - && ItemUtils.isInputEqual(recipe.getInputs().get(0), stack, true, true))) + stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getIngredients().get(0).test(stack))) .filterSlot(1, 65, 17, - stack -> RecipeHandler.recipeList.stream() - .anyMatch(recipe -> recipe instanceof AlloySmelterRecipe - && ItemUtils.isInputEqual(recipe.getInputs().get(1), stack, true, true))) + stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getIngredients().get(1).test(stack))) .outputSlot(2, 116, 35).fuelSlot(3, 56, 53).syncIntegerValue(this::getBurnTime, this::setBurnTime) .syncIntegerValue(this::getCookTime, this::setCookTime) .syncIntegerValue(this::getCurrentItemBurnTime, this::setCurrentItemBurnTime).addInventory().create(this); diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java b/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java index ee8c998bf..b4609bd41 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java @@ -35,7 +35,7 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @@ -55,7 +55,7 @@ public class TileDistillationTower extends TileGenericMachine implements IContai final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2, 3, 4, 5 }; this.inventory = new Inventory<>(7, "TileDistillationTower", 64, this).withConfiguredAccess(); - this.crafter = new RecipeCrafter(Reference.DISTILLATION_TOWER_RECIPE, this, 2, 4, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.DISTILLATION_TOWER, this, 2, 4, this.inventory, inputs, outputs); } public boolean getMutliBlock() { diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java b/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java index 16ab2dbbc..45195b529 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java @@ -34,7 +34,7 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @@ -54,7 +54,7 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2, 3 }; this.inventory = new Inventory<>(5, "TileImplosionCompressor", 64, this); - this.crafter = new RecipeCrafter(Reference.IMPLOSION_COMPRESSOR_RECIPE, this, 2, 2, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.IMPLOSION_COMPRESSOR, this, 2, 2, this.inventory, inputs, outputs); } public boolean getMutliBlock() { diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java index ee3839b05..391921d39 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java @@ -40,10 +40,8 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.api.Reference; -import techreborn.api.recipe.ITileRecipeHandler; -import techreborn.api.recipe.machines.BlastFurnaceRecipe; import techreborn.blocks.BlockMachineCasing; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.multiblocks.MultiBlockCasing; @@ -51,7 +49,7 @@ import techreborn.tiles.TileGenericMachine; import techreborn.tiles.TileMachineCasing; @RebornRegister(TechReborn.MOD_ID) -public class TileIndustrialBlastFurnace extends TileGenericMachine implements IContainerProvider, ITileRecipeHandler { +public class TileIndustrialBlastFurnace extends TileGenericMachine implements IContainerProvider { @ConfigRegistry(config = "machines", category = "industrial_furnace", key = "IndustrialFurnaceMaxInput", comment = "Industrial Blast Furnace Max Input (Value in EU)") public static int maxInput = 128; @@ -66,7 +64,7 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2, 3 }; this.inventory = new Inventory<>(5, "TileIndustrialBlastFurnace", 64, this).withConfiguredAccess(); - this.crafter = new RecipeCrafter(Reference.BLAST_FURNACE_RECIPE, this, 2, 2, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.BLAST_FURNACE, this, 2, 2, this.inventory, inputs, outputs); } public int getHeat() { @@ -154,19 +152,5 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC .energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue() .syncIntegerValue(this::getHeat, this::setHeat).addInventory().create(this); } - - // ITileRecipeHandler - @Override - public boolean canCraft(final TileEntity tile, final BlastFurnaceRecipe recipe) { - if (tile instanceof TileIndustrialBlastFurnace) { - final TileIndustrialBlastFurnace blastFurnace = (TileIndustrialBlastFurnace) tile; - return blastFurnace.getHeat() >= recipe.neededHeat; - } - return false; - } - @Override - public boolean onCraft(final TileEntity tile, final BlastFurnaceRecipe recipe) { - return true; - } } diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java index 8ff3bab97..639dbeca1 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java @@ -45,9 +45,7 @@ import reborncore.common.util.IInventoryAccess; import reborncore.common.util.Inventory; import reborncore.common.util.Tank; import techreborn.TechReborn; -import techreborn.api.Reference; -import techreborn.api.recipe.ITileRecipeHandler; -import techreborn.api.recipe.machines.IndustrialGrinderRecipe; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @@ -55,7 +53,7 @@ import techreborn.tiles.TileGenericMachine; import javax.annotation.Nullable; @RebornRegister(TechReborn.MOD_ID) -public class TileIndustrialGrinder extends TileGenericMachine implements IContainerProvider, ITileRecipeHandler { +public class TileIndustrialGrinder extends TileGenericMachine implements IContainerProvider{ @ConfigRegistry(config = "machines", category = "industrial_grinder", key = "IndustrialGrinderMaxInput", comment = "Industrial Grinder Max Input (Value in EU)") public static int maxInput = 128; @@ -72,7 +70,7 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] {2, 3, 4, 5}; this.inventory = new Inventory<>(8, "TileIndustrialGrinder", 64, this, getInventoryAccess()); - this.crafter = new RecipeCrafter(Reference.INDUSTRIAL_GRINDER_RECIPE, this, 1, 4, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.INDUSTRIAL_GRINDER, this, 1, 4, this.inventory, inputs, outputs); this.tank = new Tank("TileIndustrialGrinder", TileIndustrialGrinder.TANK_CAPACITY, this); this.ticksSinceLastChange = 0; } @@ -154,51 +152,5 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai .outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).energySlot(7, 8, 72) .syncEnergyValue().syncCrafterValue().addInventory().create(this); } - - // ITileRecipeHandler - @Override - public boolean canCraft(final TileEntity tile, final IndustrialGrinderRecipe recipe) { - if (!getMultiBlock()) { - return false; - } - final FluidStack recipeFluid = recipe.fluidStack; - final FluidStack tankFluid = tank.getFluid(); - if (recipe.fluidStack == null) { - return true; - } - if (tankFluid == null) { - return false; - } - if (tankFluid.isFluidEqual(recipeFluid)) { - if (tankFluid.amount >= recipeFluid.amount) { - return true; - } - } - return false; - } - @Override - public boolean onCraft(final TileEntity tile, final IndustrialGrinderRecipe recipe) { - final FluidStack recipeFluid = recipe.fluidStack; - final FluidStack tankFluid = tank.getFluid(); - if (recipe.fluidStack == null) { - return true; - } - if (tankFluid == null) { - return false; - } - if (tankFluid.isFluidEqual(recipeFluid)) { - if (tankFluid.amount >= recipeFluid.amount) { - if (tankFluid.amount == recipeFluid.amount) { - tank.setFluid(null); - } - else { - tankFluid.amount -= recipeFluid.amount; - } - syncWithAll(); - return true; - } - } - return false; - } } \ No newline at end of file diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java index 4013f2550..e5b666461 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java @@ -45,9 +45,8 @@ import reborncore.common.util.IInventoryAccess; import reborncore.common.util.Inventory; import reborncore.common.util.Tank; import techreborn.TechReborn; -import techreborn.api.Reference; -import techreborn.api.recipe.ITileRecipeHandler; -import techreborn.api.recipe.machines.IndustrialSawmillRecipe; + +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @@ -55,7 +54,7 @@ import techreborn.tiles.TileGenericMachine; import javax.annotation.Nullable; @RebornRegister(TechReborn.MOD_ID) -public class TileIndustrialSawmill extends TileGenericMachine implements IContainerProvider, ITileRecipeHandler { +public class TileIndustrialSawmill extends TileGenericMachine implements IContainerProvider { @ConfigRegistry(config = "machines", category = "industrial_sawmill", key = "IndustrialSawmillMaxInput", comment = "Industrial Sawmill Max Input (Value in EU)") public static int maxInput = 128; @@ -72,7 +71,7 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2, 3, 4 }; this.inventory = new Inventory<>(7, "TileSawmill", 64, this, getInventoryAccess()); - this.crafter = new RecipeCrafter(Reference.INDUSTRIAL_SAWMILL_RECIPE, this, 1, 3, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.INDUSTRIAL_SAWMILL, this, 1, 3, this.inventory, inputs, outputs); this.tank = new Tank("TileSawmill", TileIndustrialSawmill.TANK_CAPACITY, this); this.ticksSinceLastChange = 0; } @@ -155,50 +154,5 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai .outputSlot(4, 126, 61).outputSlot(5, 34, 55).energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue() .addInventory().create(this); } - - // ITileRecipeHandler - @Override - public boolean canCraft(TileEntity tile, IndustrialSawmillRecipe recipe) { - if (!getMutliBlock()) { - return false; - } - final FluidStack recipeFluid = recipe.fluidStack; - final FluidStack tankFluid = tank.getFluid(); - if (recipe.fluidStack == null) { - return true; - } - if (tankFluid == null) { - return false; - } - if (tankFluid.isFluidEqual(recipeFluid)) { - if (tankFluid.amount >= recipeFluid.amount) { - return true; - } - } - return false; - } - @Override - public boolean onCraft(TileEntity tile, IndustrialSawmillRecipe recipe) { - final FluidStack recipeFluid = recipe.fluidStack; - final FluidStack tankFluid = tank.getFluid(); - if (recipe.fluidStack == null) { - return true; - } - if (tankFluid == null) { - return false; - } - if (tankFluid.isFluidEqual(recipeFluid)) { - if (tankFluid.amount >= recipeFluid.amount) { - if (tankFluid.amount == recipeFluid.amount) { - tank.setFluid(null); - } else { - tankFluid.amount -= recipeFluid.amount; - } - syncWithAll(); - return true; - } - } - return false; - } } \ No newline at end of file diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java b/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java index 1a251fbbc..69ede4d52 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java @@ -34,7 +34,7 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @@ -54,7 +54,7 @@ public class TileVacuumFreezer extends TileGenericMachine implements IContainerP final int[] inputs = new int[] { 0 }; final int[] outputs = new int[] { 1 }; this.inventory = new Inventory<>(3, "TileVacuumFreezer", 64, this).withConfiguredAccess(); - this.crafter = new RecipeCrafter(Reference.VACUUM_FREEZER_RECIPE, this, 2, 1, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.VACUUM_FREEZER, this, 2, 1, this.inventory, inputs, outputs); } public boolean getMultiBlock() { diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java b/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java index 75e81425e..8edb7910a 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java @@ -25,7 +25,6 @@ package techreborn.tiles.machine.tier1; import net.minecraft.entity.player.EntityPlayer; -import reborncore.api.recipe.RecipeHandler; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; @@ -33,10 +32,8 @@ import reborncore.common.recipes.RecipeCrafter; import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; -import reborncore.common.util.ItemUtils; import techreborn.TechReborn; -import techreborn.api.Reference; -import techreborn.api.recipe.machines.AlloySmelterRecipe; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @@ -54,7 +51,7 @@ public class TileAlloySmelter extends TileGenericMachine implements IContainerPr final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2 }; this.inventory = new Inventory<>(4, "TileAlloySmelter", 64, this).withConfiguredAccess(); - this.crafter = new RecipeCrafter(Reference.ALLOY_SMELTER_RECIPE, this, 2, 1, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.ALLOY_SMELTER, this, 2, 1, this.inventory, inputs, outputs); } // IContainerProvider @@ -63,13 +60,9 @@ public class TileAlloySmelter extends TileGenericMachine implements IContainerPr return new ContainerBuilder("alloysmelter").player(player.inventory).inventory().hotbar() .addInventory().tile(this) .filterSlot(0, 34, 47, - stack -> RecipeHandler.recipeList.stream() - .anyMatch(recipe -> recipe instanceof AlloySmelterRecipe - && ItemUtils.isInputEqual(recipe.getInputs().get(0), stack, true, true))) + stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getIngredients().get(0).test(stack))) .filterSlot(1, 126, 47, - stack -> RecipeHandler.recipeList.stream() - .anyMatch(recipe -> recipe instanceof AlloySmelterRecipe - && ItemUtils.isInputEqual(recipe.getInputs().get(1), stack, true, true))) + stack -> ModRecipes.ALLOY_SMELTER.getRecipes(player.world).stream().anyMatch(recipe -> recipe.getIngredients().get(1).test(stack))) .outputSlot(2, 80, 47).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory() .create(this); } diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java b/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java index b1f9b9edb..63646f03d 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java @@ -33,7 +33,7 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @@ -51,7 +51,7 @@ public class TileAssemblingMachine extends TileGenericMachine implements IContai final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2 }; this.inventory = new Inventory<>(4, "TileAssemblingMachine", 64, this).withConfiguredAccess(); - this.crafter = new RecipeCrafter(Reference.ASSEMBLING_MACHINE_RECIPE, this, 2, 2, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.ASSEMBLING_MACHINE, this, 2, 2, this.inventory, inputs, outputs); } // IContainerProvider diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java b/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java index 17b167e71..8d2b33e63 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java @@ -33,7 +33,7 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @@ -51,7 +51,7 @@ public class TileChemicalReactor extends TileGenericMachine implements IContaine final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2 }; this.inventory = new Inventory<>(4, "TileChemicalReactor", 64, this).withConfiguredAccess(); - this.crafter = new RecipeCrafter(Reference.CHEMICAL_REACTOR_RECIPE, this, 2, 2, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.CHEMICAL_REACTOR, this, 2, 2, this.inventory, inputs, outputs); } // IContainerProvider diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java b/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java index 24a223117..c7ff5e50c 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java @@ -33,7 +33,7 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @@ -51,7 +51,7 @@ public class TileCompressor extends TileGenericMachine implements IContainerProv final int[] inputs = new int[] { 0 }; final int[] outputs = new int[] { 1 }; this.inventory = new Inventory<>(3, "TileCompressor", 64, this).withConfiguredAccess(); - this.crafter = new RecipeCrafter(Reference.COMPRESSOR_RECIPE, this, 2, 1, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.COMPRESSOR, this, 2, 1, this.inventory, inputs, outputs); } // IContainerProvider diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java b/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java index 647ed1a2c..e13d6c814 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java @@ -33,7 +33,7 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @@ -51,7 +51,7 @@ public class TileExtractor extends TileGenericMachine implements IContainerProvi final int[] inputs = new int[] { 0 }; final int[] outputs = new int[] { 1 }; this.inventory = new Inventory<>(3, "TileExtractor", 64, this).withConfiguredAccess(); - this.crafter = new RecipeCrafter(Reference.EXTRACTOR_RECIPE, this, 2, 1, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.EXTRACTOR, this, 2, 1, this.inventory, inputs, outputs); } // IContainerProvider diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java b/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java index 7cd219129..9d9df2d5f 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java @@ -33,7 +33,7 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @@ -51,7 +51,7 @@ public class TileGrinder extends TileGenericMachine implements IContainerProvide final int[] inputs = new int[] { 0 }; final int[] outputs = new int[] { 1 }; this.inventory = new Inventory<>(3, "TileGrinder", 64, this).withConfiguredAccess(); - this.crafter = new RecipeCrafter(Reference.GRINDER_RECIPE, this, 2, 1, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.GRINDER, this, 2, 1, this.inventory, inputs, outputs); } // IContainerProvider diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java b/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java index 3a35dd591..8aa73aa8c 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java @@ -34,7 +34,7 @@ import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import reborncore.common.util.ItemUtils; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRTileEntities; import techreborn.items.DynamicCell; @@ -53,7 +53,7 @@ public class TileIndustrialElectrolyzer extends TileGenericMachine implements IC final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2, 3, 4, 5 }; this.inventory = new Inventory<>(7, "TileIndustrialElectrolyzer", 64, this).withConfiguredAccess(); - this.crafter = new RecipeCrafter(Reference.INDUSTRIAL_ELECTROLYZER_RECIPE, this, 2, 4, this.inventory, inputs, outputs); + this.crafter = new RecipeCrafter(ModRecipes.INDUSTRIAL_ELECTROLYZER, this, 2, 4, this.inventory, inputs, outputs); } // IContainerProvider diff --git a/src/main/java/techreborn/utils/BehaviorDispenseScrapbox.java b/src/main/java/techreborn/utils/BehaviorDispenseScrapbox.java index 183bea7c5..363e060e3 100644 --- a/src/main/java/techreborn/utils/BehaviorDispenseScrapbox.java +++ b/src/main/java/techreborn/utils/BehaviorDispenseScrapbox.java @@ -32,12 +32,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityDispenser; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import reborncore.api.recipe.IBaseRecipeType; -import reborncore.api.recipe.RecipeHandler; +import reborncore.common.crafting.Recipe; import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import techreborn.TechReborn; -import techreborn.api.Reference; +import techreborn.init.ModRecipes; import java.util.List; import java.util.Random; @@ -51,9 +50,9 @@ public class BehaviorDispenseScrapbox extends BehaviorDefaultDispenseItem { @Override protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { if (dispenseScrapboxes) { - List scrapboxRecipeList = RecipeHandler.getRecipeClassFromName(Reference.SCRAPBOX_RECIPE); + List scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(source.getWorld()); int random = new Random().nextInt(scrapboxRecipeList.size()); - ItemStack out = scrapboxRecipeList.get(random).getOutput(0); + ItemStack out = scrapboxRecipeList.get(random).getOutputs().get(0); stack.split(1); TileEntityDispenser tile = source.getBlockTileEntity();