mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 22:44:32 +00:00
Some more stuffs. ObjectHolder's replacement?
This commit is contained in:
1 parent
baa9dfe55a
commit
06b16aaa19
47 files changed
+987
-269
No files matched your search
@@ -19,6 +19,8 @@
|
||||
|
||||
package net.minecraftforge.fml.javafmlmod;
|
||||
|
||||
import net.minecraftforge.fml.DeferredWorkQueue;
|
||||
import net.minecraftforge.fml.LifecycleEventProvider;
|
||||
import net.minecraftforge.fml.language.IModLanguageProvider;
|
||||
import net.minecraftforge.fml.language.IModInfo;
|
||||
import net.minecraftforge.fml.language.ModFileScanData;
|
||||
@@ -29,6 +31,7 @@ import org.objectweb.asm.Type;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -59,6 +62,9 @@ public class FMLJavaModLanguageProvider implements IModLanguageProvider
|
||||
@Override
|
||||
public <T> T loadMod(final IModInfo info, final ClassLoader modClassLoader, final ModFileScanData modFileScanResults)
|
||||
{
|
||||
// This language class is loaded in the system level classloader - before the game even starts
|
||||
// So we must treat container construction as an arms length operation, and load the container
|
||||
// in the classloader of the game - the context classloader is appropriate here.
|
||||
try
|
||||
{
|
||||
final Constructor<?> constructor = Class.forName("net.minecraftforge.fml.javafmlmod.FMLModContainer", true, Thread.currentThread().getContextClassLoader()).
|
||||
@@ -92,4 +98,14 @@ public class FMLJavaModLanguageProvider implements IModLanguageProvider
|
||||
scanResult.addLanguageLoader(modTargetMap);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preLifecycleEvent(LifecycleEventProvider.LifecycleEvent lifecycleEvent)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postLifecycleEvent(LifecycleEventProvider.LifecycleEvent lifecycleEvent)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -49,9 +49,12 @@ public class FMLModContainer extends ModContainer
|
||||
{
|
||||
super(info);
|
||||
this.scanResults = modFileScanResults;
|
||||
triggerMap.put(ModLoadingStage.BEGIN, dummy().andThen(this::beforeEvent).andThen(this::constructMod).andThen(this::afterEvent));
|
||||
triggerMap.put(ModLoadingStage.CONSTRUCT, dummy().andThen(this::beforeEvent).andThen(this::preinitMod).andThen(this::fireEvent).andThen(this::afterEvent));
|
||||
triggerMap.put(ModLoadingStage.PREINIT, dummy().andThen(this::beforeEvent).andThen(this::initMod).andThen(this::fireEvent).andThen(this::afterEvent));
|
||||
triggerMap.put(ModLoadingStage.CONSTRUCT, dummy().andThen(this::beforeEvent).andThen(this::constructMod).andThen(this::afterEvent));
|
||||
triggerMap.put(ModLoadingStage.PREINIT, dummy().andThen(this::beforeEvent).andThen(this::preinitMod).andThen(this::fireEvent).andThen(this::afterEvent));
|
||||
triggerMap.put(ModLoadingStage.SIDEDINIT, dummy().andThen(this::beforeEvent).andThen(this::fireEvent).andThen(this::afterEvent));
|
||||
triggerMap.put(ModLoadingStage.INIT, dummy().andThen(this::beforeEvent).andThen(this::initMod).andThen(this::fireEvent).andThen(this::afterEvent));
|
||||
triggerMap.put(ModLoadingStage.POSTINIT, dummy().andThen(this::beforeEvent).andThen(this::fireEvent).andThen(this::afterEvent));
|
||||
triggerMap.put(ModLoadingStage.COMPLETE, dummy().andThen(this::beforeEvent).andThen(this::completeLoading).andThen(this::fireEvent).andThen(this::afterEvent));
|
||||
this.eventBus = IEventBus.create(this::onEventFailed);
|
||||
|
||||
try
|
||||
@@ -66,6 +69,11 @@ public class FMLModContainer extends ModContainer
|
||||
}
|
||||
}
|
||||
|
||||
private void completeLoading(LifecycleEventProvider.LifecycleEvent lifecycleEvent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void initMod(LifecycleEventProvider.LifecycleEvent lifecycleEvent)
|
||||
{
|
||||
|
||||
|
||||
@@ -20,8 +20,11 @@
|
||||
package net.minecraftforge.fml.javafmlmod;
|
||||
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.language.ExtensionPoint;
|
||||
import net.minecraftforge.fml.DeferredWorkQueue;
|
||||
import net.minecraftforge.fml.ExtensionPoint;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ModLoadingContext
|
||||
|
||||
Reference in new issue
Block a user