Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuke ic2 recipes #63

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ dependencies {
implementation("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
implementation("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
implementation("curse.maven:cofh-lib-220333:2388748")
compileOnly("com.github.GTNewHorizons:ForestryMC:4.9.7:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:ForestryMC:4.9.10:dev") { transitive = false }
compileOnly("curse.maven:craftguide-75557:2459320")
compileOnly("com.github.GTNewHorizons:Mobs-Info:0.4.5-GTNH:dev")

runtimeOnly("com.github.GTNewHorizons:Baubles:1.0.4:dev") // for Thaumcraft
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.6.33-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.6.34-GTNH:dev")

compileOnlyApi("com.github.GTNewHorizons:Angelica:1.0.0-beta4:api")

Expand Down
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
Loading