use of cpw.mods.fml.common.ModContainer in project LogisticsPipes by RS485.
the class StorageDrawersInventoryHandler method init.
@Override
public boolean init() {
List<ModContainer> modList = Loader.instance().getModList();
for (ModContainer mod : modList) {
if (mod.getModId().equals("StorageDrawers")) {
try {
VersionRange validVersions = VersionRange.createFromVersionSpec("[1.7.8,)");
ArtifactVersion version = new DefaultArtifactVersion(mod.getVersion());
return validVersions.containsVersion(version);
} catch (InvalidVersionSpecificationException e) {
return false;
}
}
}
return false;
}
use of cpw.mods.fml.common.ModContainer in project LogisticsPipes by RS485.
the class ModStatusHelper method isModVersionEqualsOrHigher.
public static boolean isModVersionEqualsOrHigher(String modId, String version) {
ComparableVersion v1 = new ComparableVersion(version);
ModContainer mod = Loader.instance().getIndexedModList().get(modId);
if (mod != null) {
ComparableVersion v2 = new ComparableVersion(mod.getVersion());
return v1.compareTo(v2) <= 0;
}
return false;
}
use of cpw.mods.fml.common.ModContainer in project MineFactoryReloaded by powercrystals.
the class Railcraft method load.
@Init
public void load(FMLInitializationEvent evt) {
if (!Loader.isModLoaded("Railcraft")) {
FMLLog.warning("Railcraft missing - MFR Railcraft Compat not loading");
// why warn?
return;
}
try {
int id = MineFactoryReloadedCore.factoryDecorativeStoneBlock.blockID;
FMLInterModComms.sendMessage("Railcraft", "balast", String.format("%s@%s", id, 8));
FMLInterModComms.sendMessage("Railcraft", "balast", String.format("%s@%s", id, 9));
// white sand? black sand?
Object rockCrusher = Class.forName("mods.railcraft.api.crafting.RailcraftCraftingManager").getField("rockCrusher").get(null);
Method createNewRecipe = Class.forName("mods.railcraft.api.crafting.IRockCrusherCraftingManager").getMethod("createNewRecipe", ItemStack.class, boolean.class, boolean.class);
Method addOutput = Class.forName("mods.railcraft.api.crafting.IRockCrusherRecipe").getMethod("addOutput", ItemStack.class, float.class);
Object recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 10), true, false);
// Paved Blackstone -> Cobble
addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 2), 1.0f);
recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 11), true, false);
// Paved Whitestone -> Cobble
addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 3), 1.0f);
recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 0), true, false);
// Smooth Blackstone -> Cobble
addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 2), 1.0f);
recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 1), true, false);
// Smooth Whitestone -> Cobble
addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 3), 1.0f);
recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 2), true, false);
// Cobble Blackstone -> Gravel + flint
addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 8), 1.0f);
addOutput.invoke(recipe, new ItemStack(Item.flint, 1, 0), 0.05f);
recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 3), true, false);
// Cobble Whitestone -> Gravel + flint
addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 9), 1.0f);
addOutput.invoke(recipe, new ItemStack(Item.flint, 1, 0), 0.05f);
} catch (Throwable _) {
ModContainer This = FMLCommonHandler.instance().findContainerFor(this);
FMLLog.log(This.getModId(), Level.SEVERE, "There was a problem loading %s.", This.getName());
_.printStackTrace();
}
}
use of cpw.mods.fml.common.ModContainer in project Trains-In-Motion-1.7.10 by EternalBlueFlame.
the class FuelManager method addBoilerFuel.
/**
* Register the amount of heat in a bucket of liquid fuel.
*
* @param fluid
* @param heatValuePerBucket
*/
public static void addBoilerFuel(Fluid fluid, int heatValuePerBucket) {
ModContainer mod = Loader.instance().activeModContainer();
String modName = mod != null ? mod.getName() : "An Unknown Mod";
if (fluid == null) {
FMLLog.log("Railcraft", Level.WARN, String.format("An error occured while %s was registering a Boiler fuel source", modName));
return;
}
boilerFuel.put(fluid, heatValuePerBucket);
FMLLog.log("Railcraft", Level.DEBUG, String.format("%s registered \"%s\" as a valid Boiler fuel source with %d heat.", modName, fluid.getName(), heatValuePerBucket));
}
use of cpw.mods.fml.common.ModContainer in project Engine by VoltzEngine-Project.
the class JsonContentLoader method preInit.
@Override
public void preInit() {
debug.start("Phase: Pre-Init");
//---------------------------------------------------------------------------
debug.start("Validating file paths");
//Init data
externalContentFolder = new File(References.BBM_CONFIG_FOLDER, "json");
//Validate data
validateFilePaths();
debug.end("Done...");
//===========================================================================
debug.start("Registering default processors");
//Load processors
add(blockProcessor);
blockProcessor.addSubProcessor(JsonBlockTileProcessor.KEY, new JsonBlockTileProcessor());
blockProcessor.addSubProcessor(JsonBlockListenerProcessor.KEY, new JsonBlockListenerProcessor());
add(itemProcessor);
add(new JsonOreNameProcessor());
//TODO add entity loading
add(worldOreGenProcessor);
add(craftingRecipeProcessor);
add(furnaceRecipeProcessor);
add(new JsonRecipeReplacementProcessor());
add(new JsonOverrideProcessor());
add(new JsonMultiBlockLayoutProcessor());
add(new JsonMissingMapEventProcessor());
//TODO add machine recipes
debug.end("Done...");
//===========================================================================
debug.start("Registering mod processors");
for (ModContainer container : Loader.instance().getModList()) {
Object mod = container.getMod();
if (mod instanceof IJsonGenMod) {
debug.log("Mod: " + container.getName() + " " + container.getDisplayVersion());
((IJsonGenMod) mod).loadJsonContentHandlers();
}
}
debug.end("Done...");
//===========================================================================
debug.start("Loading files");
//Resources are loaded before they can be processed to allow early processing
if (!ignoreFileLoading) {
//Load resources from file system
loadResources();
} else {
debug.log("Resource loading is disable, this might be due to testing suits or other reasons");
debug.log("JUnit: " + Engine.isJUnitTest());
}
debug.end("Done...");
//===========================================================================
debug.start("Process Run[1]");
processEntries();
debug.end("Done...");
//---------------------------------------------------------------------------
debug.end("Done...");
}
Aggregations