This should fix bc 6 compatibility

Can some one test please.
This commit is contained in:
modmuss50 2015-06-08 18:26:22 +01:00
parent a94085229d
commit b56487b680
2 changed files with 38 additions and 19 deletions

View file

@ -14,7 +14,7 @@ public class RecipeManager {
LogHelper.info("IC2 Compat Loaded");
}
if (Loader.isModLoaded("BuildCraft|Builders"))
if (Loader.isModLoaded("BuildCraft"))
{
RecipesBuildcraft.init();

View file

@ -1,40 +1,59 @@
package techreborn.compat.recipes;
import buildcraft.BuildCraftBuilders;
import buildcraft.builders.BlockQuarry;
import buildcraft.core.Version;
import cpw.mods.fml.common.Loader;
import ic2.api.item.IC2Items;
import net.minecraft.item.ItemStack;
import techreborn.util.CraftingHelper;
import techreborn.util.LogHelper;
import techreborn.util.RecipeRemover;
public class RecipesBuildcraft {
public static void init()
{
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()
{
public static void removeRecipes() {
RecipeRemover.removeAnyRecipe(new ItemStack(
BuildCraftBuilders.quarryBlock));
quarryBlock));
}
public static void addRecipies()
{
public static void addRecipies() {
//Quarry
CraftingHelper.addShapedOreRecipe(
new ItemStack (BuildCraftBuilders.quarryBlock),
new ItemStack(quarryBlock),
new Object[]
{
"IAI", "GIG", "DED",
'I', "gearIron",
'G', "gearGold",
'D', "gearDiamond",
'A', IC2Items.getItem("advancedCircuit"),
'E', IC2Items.getItem("diamondDrill")
}
);
{
"IAI", "GIG", "DED",
'I', "gearIron",
'G', "gearGold",
'D', "gearDiamond",
'A', IC2Items.getItem("advancedCircuit"),
'E', IC2Items.getItem("diamondDrill")
}
);
}
}