Improved the way we handle other mods
This commit is contained in:
parent
0d20ba6d55
commit
6deb0b1d32
27 changed files with 2074 additions and 1969 deletions
|
@ -1,31 +0,0 @@
|
|||
package techreborn.compat.recipes;
|
||||
|
||||
import techreborn.util.LogHelper;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class RecipeManager {
|
||||
|
||||
public static void init()
|
||||
{
|
||||
if (Loader.isModLoaded("IC2"))
|
||||
{
|
||||
RecipesIC2.init();
|
||||
|
||||
LogHelper.info("IC2 Compat Loaded");
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("BuildCraft"))
|
||||
{
|
||||
RecipesBuildcraft.init();
|
||||
|
||||
LogHelper.info("Buildcraft Compat Loaded");
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("ThermalExpansion"))
|
||||
{
|
||||
RecipesThermalExpansion.init();
|
||||
|
||||
LogHelper.info("ThermalExpansion Compat Loaded");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,38 +3,21 @@ package techreborn.compat.recipes;
|
|||
import buildcraft.builders.BlockQuarry;
|
||||
import buildcraft.core.Version;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import ic2.api.item.IC2Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.compat.ICompatModule;
|
||||
import techreborn.util.CraftingHelper;
|
||||
import techreborn.util.LogHelper;
|
||||
import techreborn.util.RecipeRemover;
|
||||
|
||||
public class RecipesBuildcraft {
|
||||
public class RecipesBuildcraft implements ICompatModule {
|
||||
|
||||
public static BlockQuarry quarryBlock;
|
||||
|
||||
public static void init() {
|
||||
try {
|
||||
String itemClass = "buildcraft.BuildCraftBuilders";
|
||||
if (!Version.getVersion().startsWith("7")) {//Buildcraft 6
|
||||
if (Loader.isModLoaded("BuildCraft|Factory")) {
|
||||
itemClass = "buildcraft.BuildCraftFactory";
|
||||
}
|
||||
} else if (!Loader.isModLoaded("Buildcraft|Builders")) { //Buildcraft 7
|
||||
return;
|
||||
}
|
||||
Object obj = Class.forName(itemClass).getField("quarryBlock").get(null);
|
||||
if (obj instanceof BlockQuarry) {
|
||||
quarryBlock = (BlockQuarry) obj;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LogHelper.fatal("Could not retrieve quarry block from Buildcraft! This is a fatal error!");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
removeRecipes();
|
||||
addRecipies();
|
||||
}
|
||||
|
||||
public static void removeRecipes() {
|
||||
RecipeRemover.removeAnyRecipe(new ItemStack(
|
||||
quarryBlock));
|
||||
|
@ -56,4 +39,41 @@ public class RecipesBuildcraft {
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
try {
|
||||
String itemClass = "buildcraft.BuildCraftBuilders";
|
||||
if (!Version.getVersion().startsWith("7")) {//Buildcraft 6
|
||||
if (Loader.isModLoaded("BuildCraft|Factory")) {
|
||||
itemClass = "buildcraft.BuildCraftFactory";
|
||||
}
|
||||
} else if (!Loader.isModLoaded("Buildcraft|Builders")) { //Buildcraft 7
|
||||
return;
|
||||
}
|
||||
Object obj = Class.forName(itemClass).getField("quarryBlock").get(null);
|
||||
if (obj instanceof BlockQuarry) {
|
||||
quarryBlock = (BlockQuarry) obj;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LogHelper.fatal("Could not retrieve quarry block from Buildcraft! This is a fatal error!");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
removeRecipes();
|
||||
addRecipies();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,31 @@
|
|||
package techreborn.compat.recipes;
|
||||
|
||||
public class RecipesThermalExpansion {
|
||||
|
||||
public static void init()
|
||||
{
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import techreborn.compat.ICompatModule;
|
||||
|
||||
public class RecipesThermalExpansion implements ICompatModule {
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
// TODO remove basic machine frame recipe
|
||||
// TODO replace iron in recipe to steel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue