Some functionality fixes for @Instance injection.
This commit is contained in:
parent
fe73f11443
commit
85a585725b
3 changed files with 14 additions and 3 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,10 @@ import net.minecraft.src.Material;
|
|||
|
||||
public class MockBlock extends Block
|
||||
{
|
||||
static
|
||||
{
|
||||
Thread.dumpStack();
|
||||
}
|
||||
@Instance("mod_testMod")
|
||||
public static Object tstInstance;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue