diff --git a/src/main/java/techreborn/init/IC2Duplicates.java b/src/main/java/techreborn/init/IC2Duplicates.java index 3703bd395..41262c932 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,45 @@ 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); 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 +129,8 @@ public enum IC2Duplicates { } public void setIc2Stack(ItemStack ic2Stack) { + Validate.notNull(ic2Stack); + Validate.isTrue(!ic2Stack.isEmpty()); this.ic2Stack = ic2Stack; } @@ -113,10 +146,22 @@ public enum IC2Duplicates { } public ItemStack getStackBasedOnConfig() { + //Used only for when de-duping classic only items + if(!classicOnly){ + return getTrStack(); + } if (deduplicate()) { return getIc2Stack(); } return getTrStack(); } + public static boolean isClassicMode(){ + return ModInfo.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/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/lib/ModInfo.java b/src/main/java/techreborn/lib/ModInfo.java index cb726c84b..f152d88ab 100644 --- a/src/main/java/techreborn/lib/ModInfo.java +++ b/src/main/java/techreborn/lib/ModInfo.java @@ -35,6 +35,9 @@ public class ModInfo implements IModInfo { public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy"; public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory"; + //This is in here as the ic2 event get called soo early it fucks the class loading order up :) weee + public static String IC2_PROFILE = "UNKNOWN"; + @Override public String MOD_NAME() { return MOD_NAME;