Filter compressor and extractor recipes from JEI if IC2 dedupe is true

This commit is contained in:
drcrazy 2019-04-12 12:45:34 +03:00
parent 73f5554015
commit c57c8b5287
3 changed files with 101 additions and 60 deletions

View file

@ -293,6 +293,12 @@ public class TechRebornJeiPlugin implements IModPlugin {
if (recipe instanceof ScrapboxRecipe) {
return CompatConfigs.showScrapbox;
}
if (IC2Duplicates.deduplicate() && (recipe instanceof CompressorRecipe)) {
return false;
}
if (IC2Duplicates.deduplicate() && (recipe instanceof ExtractorRecipe)) {
return false;
}
return true;
}).collect(Collectors.toList()));

View file

@ -39,7 +39,6 @@ import reborncore.common.util.ItemUtils;
import reborncore.common.util.OreUtil;
import reborncore.common.util.RebornCraftingHelper;
import techreborn.Core;
import techreborn.api.recipe.machines.CompressorRecipe;
import techreborn.api.recipe.machines.GrinderRecipe;
import techreborn.api.recipe.machines.VacuumFreezerRecipe;
import techreborn.compat.CompatManager;
@ -48,10 +47,8 @@ import techreborn.init.recipes.*;
import techreborn.items.*;
import techreborn.items.ingredients.ItemDusts;
import techreborn.items.ingredients.ItemIngots;
import techreborn.items.ingredients.ItemPlates;
import techreborn.lib.ModInfo;
import java.security.InvalidParameterException;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
@ -86,12 +83,12 @@ public class ModRecipes {
AlloySmelterRecipes.init();
FluidReplicatorRecipes.init();
BlastFurnaceRecipes.init();
CompressorRecipes.init();
addVacuumFreezerRecipes();
addIc2Recipes();
addGrinderRecipes();
addCompressorRecipes();
}
public static void postInit() {
@ -114,62 +111,6 @@ public class ModRecipes {
IndustrialSawmillRecipes.init();
}
private static void addCompressorRecipes() {
RecipeHandler.addRecipe(new CompressorRecipe(ItemIngots.getIngotByName("advanced_alloy"),
ItemPlates.getPlateByName("advanced_alloy"), 400, 20));
RecipeHandler.addRecipe(new CompressorRecipe(IC2Duplicates.CARBON_MESH.getStackBasedOnConfig(),
ItemPlates.getPlateByName("carbon"), 400, 2));
RecipeHandler.addRecipe(new CompressorRecipe(OreUtil.getStackFromName("plankWood", 1),
OreUtil.getStackFromName("plateWood", 1), 300, 4));
RecipeHandler.addRecipe(new CompressorRecipe(OreUtil.getStackFromName("dustLazurite", 1),
ItemPlates.getPlateByName("lazurite", 1), 300, 4));
RecipeHandler.addRecipe(new CompressorRecipe(OreUtil.getStackFromName("obsidian", 1),
ItemPlates.getPlateByName("obsidian", 9), 300, 4));
RecipeHandler.addRecipe(new CompressorRecipe(OreUtil.getStackFromName("dustObsidian", 1),
ItemPlates.getPlateByName("obsidian", 1), 300, 4));
RecipeHandler.addRecipe(new CompressorRecipe(OreUtil.getStackFromName("dustYellowGarnet", 1),
ItemPlates.getPlateByName("YellowGarnet"), 300, 4));
RecipeHandler.addRecipe(new CompressorRecipe(OreUtil.getStackFromName("blockYellowGarnet", 1),
ItemPlates.getPlateByName("YellowGarnet", 9), 300, 4));
RecipeHandler.addRecipe(new CompressorRecipe(OreUtil.getStackFromName("dustRedGarnet", 1),
ItemPlates.getPlateByName("RedGarnet"), 300, 4));
RecipeHandler.addRecipe(new CompressorRecipe(OreUtil.getStackFromName("blockRedGarnet", 1),
ItemPlates.getPlateByName("RedGarnet", 9), 300, 4));
RecipeHandler.addRecipe(new CompressorRecipe("ingotRefinedIron",
ItemPlates.getPlateByName("RefinedIron"), 300, 4));
ItemStack plate;
for (String ore : OreUtil.oreNames) {
if (ore.equals("iridium")) {
continue;
}
if (OreUtil.hasPlate(ore)) {
try {
plate = ItemPlates.getPlateByName(ore, 1);
} catch (InvalidParameterException e) {
plate = OreUtil.getStackFromName("plate" + OreUtil.capitalizeFirstLetter(ore), 1);
}
if (plate.isEmpty()) {
continue;
}
if (OreUtil.hasIngot(ore)) {
RecipeHandler.addRecipe(new CompressorRecipe(
OreUtil.getStackFromName("ingot" + OreUtil.capitalizeFirstLetter(ore), 1), plate, 300, 4));
}
if (OreUtil.hasGem(ore) && OreUtil.hasDust(ore)) {
RecipeHandler.addRecipe(new CompressorRecipe(
OreUtil.getStackFromName("dust" + OreUtil.capitalizeFirstLetter(ore), 1), plate, 300, 4));
}
if (OreUtil.hasBlock(ore)) {
ItemStack morePlates = plate.copy();
morePlates.setCount(9);
RecipeHandler.addRecipe(new CompressorRecipe(
OreUtil.getStackFromName("block" + OreUtil.capitalizeFirstLetter(ore), 1), morePlates, 300, 4));
}
}
}
}
static void addGrinderRecipes() {
// Vanilla

View file

@ -0,0 +1,94 @@
/*
* 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.init.recipes;
import java.security.InvalidParameterException;
import net.minecraft.item.ItemStack;
import reborncore.api.recipe.RecipeHandler;
import reborncore.common.util.OreUtil;
import techreborn.api.recipe.machines.CompressorRecipe;
import techreborn.init.IC2Duplicates;
import techreborn.items.ingredients.ItemIngots;
import techreborn.items.ingredients.ItemPlates;
/**
* @author drcrazy
*
*/
public class CompressorRecipes extends RecipeMethods {
public static void init() {
register(ItemIngots.getIngotByName("advanced_alloy"), ItemPlates.getPlateByName("advanced_alloy"), 400, 20);
register(IC2Duplicates.CARBON_MESH.getStackBasedOnConfig(), ItemPlates.getPlateByName("carbon"), 400, 2);
register(OreUtil.getStackFromName("plankWood"), OreUtil.getStackFromName("plateWood"));
register(OreUtil.getStackFromName("dustLazurite"), ItemPlates.getPlateByName("lazurite"));
register(OreUtil.getStackFromName("obsidian"), ItemPlates.getPlateByName("obsidian", 9));
register(OreUtil.getStackFromName("dustObsidian"), ItemPlates.getPlateByName("obsidian"));
register(OreUtil.getStackFromName("dustYellowGarnet"), ItemPlates.getPlateByName("YellowGarnet"));
register(OreUtil.getStackFromName("blockYellowGarnet"), ItemPlates.getPlateByName("YellowGarnet", 9));
register(OreUtil.getStackFromName("dustRedGarnet"), ItemPlates.getPlateByName("RedGarnet"));
register(OreUtil.getStackFromName("blockRedGarnet"), ItemPlates.getPlateByName("RedGarnet", 9));
register("ingotRefinedIron", ItemPlates.getPlateByName("RefinedIron"));
ItemStack plate;
for (String ore : OreUtil.oreNames) {
if (ore.equals("iridium")) {
continue;
}
if (!OreUtil.hasPlate(ore)) {
continue;
}
try {
plate = ItemPlates.getPlateByName(ore, 1);
} catch (InvalidParameterException e) {
plate = OreUtil.getStackFromName("plate" + OreUtil.capitalizeFirstLetter(ore));
}
if (plate.isEmpty()) {
continue;
}
if (OreUtil.hasIngot(ore)) {
register(OreUtil.getStackFromName("ingot" + OreUtil.capitalizeFirstLetter(ore)), plate);
}
if (OreUtil.hasGem(ore) && OreUtil.hasDust(ore)) {
register(OreUtil.getStackFromName("dust" + OreUtil.capitalizeFirstLetter(ore)), plate);
}
if (OreUtil.hasBlock(ore)) {
ItemStack morePlates = plate.copy();
morePlates.setCount(9);
register(OreUtil.getStackFromName("block" + OreUtil.capitalizeFirstLetter(ore)), morePlates);
}
}
}
static void register(Object input, ItemStack output) {
register(input, output, 300, 4);
}
static void register(Object input, ItemStack output, int tickTime, int euPerTick) {
RecipeHandler.addRecipe(new CompressorRecipe(input, output, tickTime, euPerTick));
}
}