mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 22:34:21 +00:00
Make the checking of instances of other mods' interfaces safer.
Fixes (part of) #2316
This commit is contained in:
1 parent
dfefcaf69a
commit
4590a71759
9 files changed
+76
-10
No files matched your search
@@ -4,6 +4,7 @@ import java.util.HashMap;
|
||||
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import cpw.mods.fml.common.ModAPIManager;
|
||||
@@ -27,7 +28,7 @@ public class FuelHandler
|
||||
return fuels.get(gas.getName());
|
||||
}
|
||||
|
||||
if(ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|fuels") && gas.hasFluid())
|
||||
if(BCPresent() && gas.hasFluid())
|
||||
{
|
||||
IFuel bcFuel = BuildcraftFuelRegistry.fuel.getFuel(gas.getFluid());
|
||||
|
||||
@@ -60,4 +61,9 @@ public class FuelHandler
|
||||
energyPerTick = bcFuel.getPowerPerCycle() * general.FROM_TE;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean BCPresent()
|
||||
{
|
||||
return ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|fuels") && MekanismUtils.classExists("buildcraft.api.fuels.BuildcraftFuelRegistry") && MekanismUtils.classExists("buildcraft.api.fuels.IFuel");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user