diff --git a/build.gradle b/build.gradle index 876db8847..c0c7aa6f4 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ configurations { compile.extendsFrom shade } -version = "2.20.6" +version = "2.20.9" def ENV = System.getenv() if (ENV.BUILD_NUMBER) { @@ -448,4 +448,4 @@ String humanizeArg(String arg){ task copyToLib(type: Copy) { into "$buildDir/output/lib" from configurations.runtime -} \ No newline at end of file +} diff --git a/src/main/java/techreborn/config/ConfigTechReborn.java b/src/main/java/techreborn/config/ConfigTechReborn.java index dae03730e..90d74d0eb 100644 --- a/src/main/java/techreborn/config/ConfigTechReborn.java +++ b/src/main/java/techreborn/config/ConfigTechReborn.java @@ -36,6 +36,9 @@ public class ConfigTechReborn { @ConfigRegistry(config = "recipes", category = "ic2", key = "deduplicate", comment = "Changes a lot of recipes and hides blocks to integrate TechReborn into IC2") public static boolean REMOVE_DUPLICATES = false; + @ConfigRegistry(config = "recipes", category = "ic2", key = "ic2_profile", comment = "Enter the ic2 profile name here (Experimental or Classic)") + public static String IC2_PROFILE = "Experimental"; + @ConfigRegistry(config = "misc", category = "general", key = "enableGemTools", comment = "Enable Gem armor and tools") public static boolean enableGemArmorAndTools = true; diff --git a/src/main/java/techreborn/init/IC2Duplicates.java b/src/main/java/techreborn/init/IC2Duplicates.java index 3703bd395..b26329bb3 100644 --- a/src/main/java/techreborn/init/IC2Duplicates.java +++ b/src/main/java/techreborn/init/IC2Duplicates.java @@ -25,11 +25,16 @@ package techreborn.init; import net.minecraft.item.ItemStack; +import org.apache.commons.lang3.Validate; import techreborn.api.TechRebornAPI; +import techreborn.blocks.BlockMachineFrames; import techreborn.blocks.cable.EnumCableType; import techreborn.config.ConfigTechReborn; +import techreborn.itemblocks.ItemBlockMachineFrames; import techreborn.items.ingredients.ItemIngots; import techreborn.items.ingredients.ItemParts; +import techreborn.items.ingredients.ItemPlates; +import techreborn.lib.ModInfo; /** * Created by Mark on 18/12/2016. @@ -65,19 +70,46 @@ public enum IC2Duplicates { THICK_NEUTRON_REFLECTOR(ItemParts.getPartByName("thick_neutron_reflector")), IRIDIUM_NEUTRON_REFLECTOR(ItemParts.getPartByName("iridium_neutron_reflector")), SCRAP(ItemParts.getPartByName("scrap")), - FREQ_TRANSMITTER(new ItemStack(ModItems.FREQUENCY_TRANSMITTER)); + FREQ_TRANSMITTER(new ItemStack(ModItems.FREQUENCY_TRANSMITTER)), + + //Classical dedupes + ENERGY_CRYSTAL(new ItemStack(ModItems.ENERGY_CRYSTAL), true), + LAPATRON_CRYSTAL(new ItemStack(ModItems.LAPOTRONIC_CRYSTAL), true), + RE_BATTERY(new ItemStack(ModItems.RE_BATTERY), true), + REFINED_IRON(ItemIngots.getIngotByName("refined_iron"), true), + BASIC_MACHINE_FRAME(BlockMachineFrames.getFrameByName("basic"), true), + ADVANCED_MACHINE_FRAME(BlockMachineFrames.getFrameByName("advanced"), true), + CARBON_PLATE(ItemPlates.getPlateByName("carbon"), true), + ADVANCED_ALLOY(ItemPlates.getPlateByName("advanced_alloy"), true); ItemStack ic2Stack; ItemStack trStack; + boolean classicOnly; IC2Duplicates(ItemStack trStack) { - this.trStack = trStack; + this(trStack, false); } IC2Duplicates(ItemStack ic2Stack, ItemStack trStack) { + this(ic2Stack, trStack, false); + } + + IC2Duplicates(ItemStack ic2Stack, ItemStack trStack, boolean classicOnly) { + Validate.notNull(trStack); + Validate.isTrue(!trStack.isEmpty()); + Validate.notNull(ic2Stack); + Validate.isTrue(!ic2Stack.isEmpty()); this.ic2Stack = ic2Stack; this.trStack = trStack; + this.classicOnly = classicOnly; + } + + IC2Duplicates(ItemStack trStack, boolean classicOnly) { + Validate.notNull(trStack); + Validate.isTrue(!trStack.isEmpty()); + this.trStack = trStack; + this.classicOnly = classicOnly; } public static boolean deduplicate() { @@ -98,6 +130,8 @@ public enum IC2Duplicates { } public void setIc2Stack(ItemStack ic2Stack) { + Validate.notNull(ic2Stack); + Validate.isTrue(!ic2Stack.isEmpty()); this.ic2Stack = ic2Stack; } @@ -113,10 +147,22 @@ public enum IC2Duplicates { } public ItemStack getStackBasedOnConfig() { + //Used only for when de-duping classic only items + if(!isClassicMode() && classicOnly){ + return getTrStack(); + } if (deduplicate()) { return getIc2Stack(); } return getTrStack(); } + public static boolean isClassicMode(){ + return ConfigTechReborn.IC2_PROFILE.equals("Classic"); + } + + public static boolean isClassicalDedupe(){ + return deduplicate() && isClassicMode(); + } + } diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 81b99d184..bd4bd4c73 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -137,7 +137,7 @@ public class ModRecipes { ItemPlates.getPlateByName("RedGarnet"), 300, 4)); RecipeHandler.addRecipe(new CompressorRecipe(OreUtil.getStackFromName("blockRedGarnet", 1), ItemPlates.getPlateByName("RedGarnet", 9), 300, 4)); - RecipeHandler.addRecipe(new CompressorRecipe(OreUtil.getStackFromName("ingotRefinedIron", 1), + RecipeHandler.addRecipe(new CompressorRecipe("ingotRefinedIron", ItemPlates.getPlateByName("RefinedIron"), 300, 4)); ItemStack plate; diff --git a/src/main/java/techreborn/init/OreDict.java b/src/main/java/techreborn/init/OreDict.java index ecd46ca88..f26879538 100644 --- a/src/main/java/techreborn/init/OreDict.java +++ b/src/main/java/techreborn/init/OreDict.java @@ -51,6 +51,31 @@ public class OreDict { ); public static void init() { + + for (String type : ItemGems.types) { + if (type.equals(ModItems.META_PLACEHOLDER)) + continue; //Aware of placeholders! + OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "gem_" + type), ItemGems.getGemByName(type)); + boolean ignoreIt = false; + for (String ignore : plateGenIgnores) + if (type.startsWith(ignore)) + ignoreIt = true; + if (!ignoreIt) + ItemPlates.registerType(type); + } + + for (String type : ItemIngots.types) { + if (type.equals(ModItems.META_PLACEHOLDER)) + continue; //Aware of placeholders! + OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "ingot_" + type), ItemIngots.getIngotByName(type)); + boolean ignoreIt = false; + for (String ignore : plateGenIgnores) + if (type.startsWith(ignore)) + ignoreIt = true; + if (!ignoreIt) + ItemPlates.registerType(type); + } + if(TechRebornAPI.ic2Helper != null){ TechRebornAPI.ic2Helper.initDuplicates(); } @@ -108,30 +133,6 @@ public class OreDict { OreUtil.registerOre("pulpWood", ItemDusts.getDustByName("saw_dust")); OreUtil.registerOre("dustAsh", ItemDusts.getDustByName("ashes")); - for (String type : ItemGems.types) { - if (type.equals(ModItems.META_PLACEHOLDER)) - continue; //Aware of placeholders! - OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "gem_" + type), ItemGems.getGemByName(type)); - boolean ignoreIt = false; - for (String ignore : plateGenIgnores) - if (type.startsWith(ignore)) - ignoreIt = true; - if (!ignoreIt) - ItemPlates.registerType(type); - } - - for (String type : ItemIngots.types) { - if (type.equals(ModItems.META_PLACEHOLDER)) - continue; //Aware of placeholders! - OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "ingot_" + type), ItemIngots.getIngotByName(type)); - boolean ignoreIt = false; - for (String ignore : plateGenIgnores) - if (type.startsWith(ignore)) - ignoreIt = true; - if (!ignoreIt) - ItemPlates.registerType(type); - } - for (String type : ItemPlates.types) { if (type.equals(ModItems.META_PLACEHOLDER)) continue; //Aware of placeholders! diff --git a/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java b/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java index 0bea7ae8f..d9360f25e 100644 --- a/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java +++ b/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java @@ -202,11 +202,15 @@ public class CraftingTableRecipes extends RecipeMethods { //Parts registerShaped(getMaterial("iridium_alloy", Type.INGOT), "IAI", "ADA", "IAI", 'I', "ingotIridium", 'D', "dustDiamond", 'A', "plateAdvancedAlloy"); - registerShaped(getStack(ModItems.RE_BATTERY), " W ", "TRT", "TRT", 'T', "ingotTin", 'R', "dustRedstone", 'W', getStack(IC2Duplicates.CABLE_ICOPPER)); registerShaped(getStack(ModItems.LITHIUM_BATTERY), " C ", "PFP", "PFP", 'F', getCell("lithium"), 'P', "plateAluminum", 'C', getStack(IC2Duplicates.CABLE_IGOLD)); - registerShaped(getStack(ModItems.LITHIUM_BATTERY_PACK), "BCB", "BPB", "B B", 'B', getStack(ModItems.LITHIUM_BATTERY), 'P', "plateAluminum", 'C', "circuitAdvanced"); - registerShaped(getStack(ModItems.ENERGY_CRYSTAL), "RRR", "RDR", "RRR", 'R', "dustRedstone", 'D', "gemDiamond"); - registerShaped(getStack(ModItems.LAPOTRONIC_CRYSTAL), "LCL", "LEL", "LCL", 'L', "dyeBlue", 'E', "energyCrystal", 'C', "circuitBasic"); + + if(!IC2Duplicates.isClassicalDedupe()){ + registerShaped(getStack(ModItems.ENERGY_CRYSTAL), "RRR", "RDR", "RRR", 'R', "dustRedstone", 'D', "gemDiamond"); + registerShaped(getStack(ModItems.LAPOTRONIC_CRYSTAL), "LCL", "LEL", "LCL", 'L', "dyeBlue", 'E', "energyCrystal", 'C', "circuitBasic"); + registerShaped(getStack(ModItems.RE_BATTERY), " W ", "TRT", "TRT", 'T', "ingotTin", 'R', "dustRedstone", 'W', getStack(IC2Duplicates.CABLE_ICOPPER)); + } + + registerShaped(getStack(ModItems.LITHIUM_BATTERY_PACK), "BCB", "BPB", "B B", 'B', getStack(ModItems.LITHIUM_BATTERY), 'P', "plateAluminum", 'C', "circuitAdvanced"); registerShaped(getStack(ModItems.LAPOTRONIC_ORB), "LLL", "LPL", "LLL", 'L', "lapotronCrystal", 'P', "plateIridiumAlloy"); registerShaped(getStack(ModItems.SCRAP_BOX), "SSS", "SSS", "SSS", 'S', getMaterial("scrap", Type.PART)); registerShaped(getMaterial("machine", Type.MACHINE_FRAME), "AAA", "A A", "AAA", 'A', "ingotRefinedIron"); diff --git a/src/main/java/techreborn/init/recipes/SmeltingRecipes.java b/src/main/java/techreborn/init/recipes/SmeltingRecipes.java index cc6c991ed..3103cdba1 100644 --- a/src/main/java/techreborn/init/recipes/SmeltingRecipes.java +++ b/src/main/java/techreborn/init/recipes/SmeltingRecipes.java @@ -38,13 +38,16 @@ public class SmeltingRecipes extends RecipeMethods { public static void init() { register(getMaterial("sap", Type.PART), getMaterial("rubber", Type.PART)); - register(getStack(Items.IRON_INGOT), getMaterial("refined_iron", Type.INGOT)); + if(!IC2Duplicates.isClassicalDedupe()){ + register(getStack(Items.IRON_INGOT), getMaterial("refined_iron", Type.INGOT)); + } register(BlockOre2.getOreByName("copper"), getMaterial("copper", Type.INGOT)); register(BlockOre2.getOreByName("tin"), getMaterial("tin", Type.INGOT)); register(BlockOre.getOreByName("silver"), getMaterial("silver", Type.INGOT)); register(BlockOre.getOreByName("lead"), getMaterial("lead", Type.INGOT)); register(BlockOre.getOreByName("sheldonite"), getMaterial("platinum", Type.INGOT)); register(IC2Duplicates.MIXED_METAL.getStackBasedOnConfig(), getMaterial("advanced_alloy", Type.INGOT)); + // Dust smelting register(getMaterial("iron", Type.DUST), getStack(Items.IRON_INGOT));