Skip to content

Commit

Permalink
nuke ic2 recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdoru committed Sep 1, 2024
1 parent c5a3ce3 commit d491ce9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/main/java/mods/railcraft/common/modules/ModuleIC2.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import org.apache.logging.log4j.Level;

import cpw.mods.fml.common.Loader;
import ic2.api.recipe.Recipes;
import mods.railcraft.common.blocks.RailcraftBlocks;
import mods.railcraft.common.blocks.detector.BlockDetector;
Expand Down Expand Up @@ -140,6 +141,10 @@ private static void createRecipes() {
}
}

if (Loader.isModLoaded("dreamcraft")) {
return;
}

ItemStack battery = IC2Plugin.getItem("reBattery");
ItemStack machine = IC2Plugin.getItem("machine");

Expand Down
25 changes: 22 additions & 3 deletions src/main/java/mods/railcraft/common/plugins/ic2/IC2Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public class IC2Plugin {
public static final int[] POWER_TIERS = { 1, 6, 32, 512, 2048, 8192 };
private static final Map<String, ItemStack> itemCache = new HashMap<String, ItemStack>();
private static final Map<String, Boolean> itemCacheFlag = new HashMap<String, Boolean>();
private static Boolean modLoaded = null;
private static Boolean IC2modLoaded = null;
private static Boolean dreamcraftLoaded = null;
private static Boolean classic = null;

public static ItemStack getItem(String tag) {
Expand Down Expand Up @@ -150,6 +151,9 @@ public static boolean canDischarge(ItemStack stack, int tier) {

@Optional.Method(modid = "IC2")
public static void addMaceratorRecipe(ItemStack input, ItemStack output) {
if (isDreamCraftInstalled()) {
return;
}
try {
Recipes.macerator.addRecipe(new RecipeInputItemStack(input), null, output);
} catch (Throwable error) {
Expand All @@ -159,6 +163,9 @@ public static void addMaceratorRecipe(ItemStack input, ItemStack output) {

@Optional.Method(modid = "IC2")
public static void removeMaceratorRecipes(ItemStack... items) {
if (isDreamCraftInstalled()) {
return;
}
try {
Map<IRecipeInput, RecipeOutput> recipes = Recipes.macerator.getRecipes();

Expand Down Expand Up @@ -190,6 +197,9 @@ private static boolean doesRecipeProduce(RecipeOutput recipe, ItemStack... items

@Optional.Method(modid = "IC2")
public static void removeMaceratorDustRecipes(ItemStack... items) {
if (isDreamCraftInstalled()) {
return;
}
try {
Map<IRecipeInput, RecipeOutput> recipes = Recipes.macerator.getRecipes();

Expand Down Expand Up @@ -220,8 +230,17 @@ public static void nerfSyntheticCoal() {
}

public static boolean isModInstalled() {
if (modLoaded == null) modLoaded = Loader.isModLoaded("IC2") || Loader.isModLoaded("IC2-Classic-Spmod");
return modLoaded;
if (IC2modLoaded == null) {
IC2modLoaded = Loader.isModLoaded("IC2") || Loader.isModLoaded("IC2-Classic-Spmod");
}
return IC2modLoaded;
}

public static boolean isDreamCraftInstalled() {
if (dreamcraftLoaded == null) {
dreamcraftLoaded = Loader.isModLoaded("dreamcraft");
}
return dreamcraftLoaded;
}

public static boolean isClassic() {
Expand Down

0 comments on commit d491ce9

Please sign in to comment.