Some functionality fixes for @Instance injection.

This commit is contained in:
Christian 2012-08-26 10:55:55 -04:00
parent fe73f11443
commit 85a585725b
3 changed files with 14 additions and 3 deletions

View file

@ -291,7 +291,14 @@ public class FMLModContainer implements ModContainer
Class<?> clz = modInstance.getClass();
if (!Strings.isNullOrEmpty(targetMod))
{
mc = Loader.instance().getIndexedModList().get(targetMod);
if (Loader.isModLoaded(targetMod))
{
mc = Loader.instance().getIndexedModList().get(targetMod);
}
else
{
mc = null;
}
}
if (mc != null)
{

View file

@ -6,6 +6,10 @@ import net.minecraft.src.Material;
public class MockBlock extends Block
{
static
{
Thread.dumpStack();
}
@Instance("mod_testMod")
public static Object tstInstance;

View file

@ -45,8 +45,8 @@ public class MockMod
@Metadata
private ModMetadata meta;
@Block(name="MyBlock", itemTypeClass=TestItem.class)
private MockBlock myBlock;
// @Block(name="MyBlock", itemTypeClass=TestItem.class)
// private MockBlock myBlock;
@PreInit
public void preinit(FMLPreInitializationEvent evt)