Search in sources :

Example 1 with DummyModContainer

use of net.minecraftforge.fml.common.DummyModContainer in project MinecraftForge by MinecraftForge.

the class DummyBlockReplacementTest method setup.

@BeforeClass
public static void setup() {
    System.setProperty("fml.queryResult", "confirm");
    System.setProperty("fml.doNotBackup", "true");
    Loader.instance();
    Bootstrap.register();
    Loader.instance().setupTestHarness(new DummyModContainer(new ModMetadata() {

        {
            modId = "test";
        }
    }));
}
Also used : ModMetadata(net.minecraftforge.fml.common.ModMetadata) DummyModContainer(net.minecraftforge.fml.common.DummyModContainer) BeforeClass(org.junit.BeforeClass)

Example 2 with DummyModContainer

use of net.minecraftforge.fml.common.DummyModContainer in project MinecraftForge by MinecraftForge.

the class ItemBlockSubstitutionRemoveRestoreTest method setup.

@BeforeClass
public static void setup() {
    Loader.instance();
    Bootstrap.register();
    myDirtInstance = new ItemMyDirt();
    Loader.instance().setupTestHarness(new DummyModContainer(new ModMetadata() {

        {
            modId = "test";
        }
    }));
    originalDirt = new ItemStack(Blocks.DIRT).getItem();
}
Also used : ModMetadata(net.minecraftforge.fml.common.ModMetadata) DummyModContainer(net.minecraftforge.fml.common.DummyModContainer) ItemStack(net.minecraft.item.ItemStack) BeforeClass(org.junit.BeforeClass)

Example 3 with DummyModContainer

use of net.minecraftforge.fml.common.DummyModContainer in project MinecraftForge by MinecraftForge.

the class SubstitutionRemoveRestoreTest method setup.

@BeforeClass
public static void setup() {
    Loader.instance();
    Bootstrap.register();
    Loader.instance().setupTestHarness(new DummyModContainer(new ModMetadata() {

        {
            modId = "test";
        }
    }));
}
Also used : ModMetadata(net.minecraftforge.fml.common.ModMetadata) DummyModContainer(net.minecraftforge.fml.common.DummyModContainer) BeforeClass(org.junit.BeforeClass)

Example 4 with DummyModContainer

use of net.minecraftforge.fml.common.DummyModContainer in project MinecraftForge by MinecraftForge.

the class FMLClientHandler method detectOptifine.

private void detectOptifine() {
    try {
        Class<?> optifineConfig = Class.forName("Config", false, Loader.instance().getModClassLoader());
        String optifineVersion = (String) optifineConfig.getField("VERSION").get(null);
        Map<String, Object> dummyOptifineMeta = ImmutableMap.<String, Object>builder().put("name", "Optifine").put("version", optifineVersion).build();
        InputStream optifineModInfoInputStream = getClass().getResourceAsStream("optifinemod.info");
        try {
            ModMetadata optifineMetadata = MetadataCollection.from(optifineModInfoInputStream, "optifine").getMetadataForId("optifine", dummyOptifineMeta);
            optifineContainer = new DummyModContainer(optifineMetadata);
            FMLLog.info("Forge Mod Loader has detected optifine %s, enabling compatibility features", optifineContainer.getVersion());
        } finally {
            IOUtils.closeQuietly(optifineModInfoInputStream);
        }
    } catch (Exception e) {
        optifineContainer = null;
    }
}
Also used : ModMetadata(net.minecraftforge.fml.common.ModMetadata) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) DummyModContainer(net.minecraftforge.fml.common.DummyModContainer) JsonObject(com.google.gson.JsonObject) WrongMinecraftVersionException(net.minecraftforge.fml.common.WrongMinecraftVersionException) DuplicateModsFoundException(net.minecraftforge.fml.common.DuplicateModsFoundException) LoaderException(net.minecraftforge.fml.common.LoaderException) IOException(java.io.IOException) ModSortingException(net.minecraftforge.fml.common.toposort.ModSortingException) MissingModsException(net.minecraftforge.fml.common.MissingModsException) Java8VersionException(net.minecraftforge.fml.common.Java8VersionException)

Example 5 with DummyModContainer

use of net.minecraftforge.fml.common.DummyModContainer in project MinecraftForge by MinecraftForge.

the class BlockStateMappingsTest method setup.

@BeforeClass
public static void setup() {
    System.setProperty("fml.queryResult", "confirm");
    System.setProperty("fml.doNotBackup", "true");
    Loader.instance();
    Bootstrap.register();
    Loader.instance().setupTestHarness(new DummyModContainer(new ModMetadata() {

        {
            modId = "test";
        }
    }));
}
Also used : ModMetadata(net.minecraftforge.fml.common.ModMetadata) DummyModContainer(net.minecraftforge.fml.common.DummyModContainer) BeforeClass(org.junit.BeforeClass)

Aggregations

DummyModContainer (net.minecraftforge.fml.common.DummyModContainer)6 ModMetadata (net.minecraftforge.fml.common.ModMetadata)6 BeforeClass (org.junit.BeforeClass)5 JsonObject (com.google.gson.JsonObject)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ItemStack (net.minecraft.item.ItemStack)1 DuplicateModsFoundException (net.minecraftforge.fml.common.DuplicateModsFoundException)1 Java8VersionException (net.minecraftforge.fml.common.Java8VersionException)1 LoaderException (net.minecraftforge.fml.common.LoaderException)1 MissingModsException (net.minecraftforge.fml.common.MissingModsException)1 WrongMinecraftVersionException (net.minecraftforge.fml.common.WrongMinecraftVersionException)1 ModSortingException (net.minecraftforge.fml.common.toposort.ModSortingException)1