Ic2 recipes?
This commit is contained in:
parent
0bbc088524
commit
87f6ea1eb0
3 changed files with 87 additions and 17 deletions
|
@ -1,5 +1,6 @@
|
|||
package techreborn.compat;
|
||||
|
||||
import ic2.api.info.Info;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -19,27 +20,11 @@ public class CompatManager
|
|||
|
||||
public static CompatManager INSTANCE = new CompatManager();
|
||||
public static boolean isIC2Loaded = false;
|
||||
public static boolean isIC2ClassicLoaded = false;
|
||||
public static boolean isClassicEnet = false;
|
||||
public static boolean isGregTechLoaded = false;
|
||||
public ArrayList<ICompatModule> compatModules = new ArrayList<>();
|
||||
|
||||
public CompatManager()
|
||||
{
|
||||
isIC2Loaded = Loader.isModLoaded("IC2");
|
||||
isIC2ClassicLoaded = false;
|
||||
if (isIC2ClassicLoaded)
|
||||
{
|
||||
isClassicEnet = true;
|
||||
}
|
||||
if (Loader.isModLoaded("Uncomplication"))
|
||||
{
|
||||
isClassicEnet = true;
|
||||
}
|
||||
if (Loader.isModLoaded("gregtech"))
|
||||
{
|
||||
isGregTechLoaded = true;
|
||||
}
|
||||
//registerCompact(MinetweakerCompat.class, "MineTweaker3");
|
||||
registerCompact(TechRebornParts.class, "reborncore-mcmultipart");
|
||||
registerCompact(ClientPartLoader.class, "reborncore-mcmultipart", "@client");
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
package techreborn.init;
|
||||
|
||||
import ic2.api.item.IC2Items;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import techreborn.api.recipe.IRecipeCompact;
|
||||
import techreborn.blocks.BlockMachineFrame;
|
||||
import techreborn.compat.CompatManager;
|
||||
import techreborn.items.*;
|
||||
import techreborn.parts.powerCables.ItemStandaloneCables;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
|
@ -23,6 +27,8 @@ public class RecipeCompact implements IRecipeCompact
|
|||
|
||||
ArrayList<String> missingItems = new ArrayList<>();
|
||||
|
||||
HashMap<String, Ic2ItemLookup> lookupHashMap = new HashMap<>();
|
||||
|
||||
boolean inited = false;
|
||||
|
||||
public void init()
|
||||
|
@ -68,6 +74,30 @@ public class RecipeCompact implements IRecipeCompact
|
|||
recipes.put("compressor", new ItemStack(ModBlocks.Compressor));
|
||||
recipes.put("insulatedGoldCableItem", ItemStandaloneCables.getCableByName("insulatedgold"));
|
||||
recipes.put("fertilizer", new ItemStack(Items.DYE));
|
||||
|
||||
|
||||
lookupHashMap.put("miningDrill", new Ic2ItemLookup("drill"));
|
||||
lookupHashMap.put("reBattery", new Ic2ItemLookup("re_battery"));
|
||||
lookupHashMap.put("electronicCircuit", new Ic2ItemLookup("crafting", "circuit"));
|
||||
lookupHashMap.put("advancedCircuit", new Ic2ItemLookup("crafting", "advanced_circuit"));
|
||||
lookupHashMap.put("lapotronCrystal", new Ic2ItemLookup("lapotron_crystal"));
|
||||
lookupHashMap.put("lapotronCrystal", new Ic2ItemLookup("lapotron_crystal"));
|
||||
lookupHashMap.put("iridiumPlate", new Ic2ItemLookup(ItemPlates.getPlateByName("iridium")));
|
||||
lookupHashMap.put("advancedMachine", new Ic2ItemLookup("resource", "advanced_machine"));
|
||||
lookupHashMap.put("windMill", new Ic2ItemLookup("te", "wind_generator"));
|
||||
lookupHashMap.put("reinforcedGlass", new Ic2ItemLookup("glass", "reinforced"));
|
||||
lookupHashMap.put("extractor", new Ic2ItemLookup("te", "extractor"));
|
||||
lookupHashMap.put("machine", new Ic2ItemLookup("resource", "machine"));
|
||||
lookupHashMap.put("hvTransformer", new Ic2ItemLookup("te", "hv_transformer"));
|
||||
lookupHashMap.put("generator", new Ic2ItemLookup("te", "generator"));
|
||||
lookupHashMap.put("rubberWood", new Ic2ItemLookup("rubber_wood"));
|
||||
lookupHashMap.put("industrialTnt", new Ic2ItemLookup("te", "itnt"));
|
||||
lookupHashMap.put("industrialDiamond", new Ic2ItemLookup("crafting", "industrial_diamond"));
|
||||
lookupHashMap.put("macerator", new Ic2ItemLookup("te", "macerator"));
|
||||
lookupHashMap.put("diamondDrill", new Ic2ItemLookup("diamond_drill"));
|
||||
lookupHashMap.put("solarPanel", new Ic2ItemLookup("te", "solar_generator"));
|
||||
lookupHashMap.put("insulatedGoldCableItem", new Ic2ItemLookup("cable", "type:gold,insulation:1"));
|
||||
|
||||
inited = false;
|
||||
}
|
||||
|
||||
|
@ -78,6 +108,26 @@ public class RecipeCompact implements IRecipeCompact
|
|||
{
|
||||
init();
|
||||
}
|
||||
if(Loader.isModLoaded("IC2")){
|
||||
ItemStack stack = IC2Items.getItem(name);
|
||||
if(stack == null){
|
||||
if(lookupHashMap.containsKey(name)){
|
||||
Ic2ItemLookup lookup = lookupHashMap.get(name);
|
||||
if(lookup.getStack() != null){
|
||||
return lookup.getStack();
|
||||
}
|
||||
return IC2Items.getItem(lookup.getName(), lookup.getVariant());
|
||||
} else {
|
||||
String line = "IC2:" + name;
|
||||
if (!missingItems.contains(line))
|
||||
{
|
||||
missingItems.add(line);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
if (!recipes.containsKey(name))
|
||||
{
|
||||
if (!missingItems.contains(name))
|
||||
|
@ -107,4 +157,39 @@ public class RecipeCompact implements IRecipeCompact
|
|||
writer.close();
|
||||
}
|
||||
|
||||
class Ic2ItemLookup {
|
||||
@Nullable
|
||||
String name;
|
||||
@Nullable
|
||||
String variant;
|
||||
@Nullable
|
||||
ItemStack stack;
|
||||
|
||||
public Ic2ItemLookup(String name, String variant) {
|
||||
this.name = name;
|
||||
this.variant = variant;
|
||||
}
|
||||
|
||||
public Ic2ItemLookup(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Ic2ItemLookup(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getVariant() {
|
||||
return variant;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ public class ModInfo implements IModInfo
|
|||
public static final String MOD_NAME = "TechReborn";
|
||||
public static final String MOD_ID = "techreborn";
|
||||
public static final String MOD_VERSION = "@MODVERSION@";
|
||||
public static final String MOD_DEPENDENCIES = "required-after:Forge@[11.15.0.1609,);required-after:reborncore;after:JEI@[2.14,)";
|
||||
public static final String MOD_DEPENDENCIES = "required-after:Forge@[11.15.0.1609,);required-after:reborncore;after:JEI@[2.14,);after:IC2";
|
||||
public static final String SERVER_PROXY_CLASS = "techreborn.proxies.CommonProxy";
|
||||
public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy";
|
||||
public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory";
|
||||
|
|
Loading…
Reference in a new issue