Added support for ic2 exp classic profile

This commit is contained in:
modmuss50 2019-02-04 20:19:51 +00:00
parent bccfe14d7c
commit 6916de2ad7
4 changed files with 59 additions and 7 deletions

View file

@ -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();
}
}

View file

@ -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;

View file

@ -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));
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.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.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");

View file

@ -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;