Java Code Examples for net.minecraftforge.fml.relauncher.FMLLaunchHandler

The following are top voted examples for showing how to use net.minecraftforge.fml.relauncher.FMLLaunchHandler. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: CCTweaks   File: TweakRegistry.java   View source code 6 votes vote down vote up
private static void sortTweakers() {
    TaskProfiler profiler = new TaskProfiler();
    profiler.startOnce("Tweak Sorting.");
    LogHelper.info("Sorting tweakers..");
    for (TGameTweak tweak : allTweakers) {
        LogHelper.debug("Attempting registration of tweaker \"%s\"...", tweak.getTweakName());
        if (tweak instanceof TSideTweak) {
            if (!FMLLaunchHandler.side().equals(((TSideTweak) tweak).getSide())) {
                LogHelper.info("Tweaker \"%s\" will NOT be loaded as it is only for %s side!", tweak.getTweakName(), ((TSideTweak) tweak).getSide().toString());
                continue;
            }
        }
        if (tweak.isEnabled()) {
            activeTweakers.add(tweak);
            LogHelper.debug("Successfully registered Tweaker \"%s\"!", tweak.getTweakName());
        }
    }
    TaskProfiler.ProfilerResult result = profiler.endOnce();
    LogHelper.info("Tweaker sorting successfully found %s enabled tweakers in %sMs.", activeTweakers.size(), TimeUnit.NANOSECONDS.toMillis(result.time));
}
 
Example 2
Project: CustomWorldGen   File: FMLServerTweaker.java   View source code 5 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader)
{
    // The log4j2 queue is excluded so it is correctly visible from the obfuscated
    // and deobfuscated parts of the code. Without, the UI won't show anything
    classLoader.addClassLoaderExclusion("com.mojang.util.QueueLogAppender");

    classLoader.addClassLoaderExclusion("jline.");
    classLoader.addClassLoaderExclusion("org.fusesource.");
    classLoader.addClassLoaderExclusion("net.minecraftforge.server.console.TerminalConsoleAppender");

    FMLLaunchHandler.configureForServerLaunch(classLoader, this);
    FMLLaunchHandler.appendCoreMods();
}
 
Example 3
Project: CustomWorldGen   File: MinecraftDummyContainer.java   View source code 5 votes vote down vote up
@Override
public Certificate getSigningCertificate()
{
    if (FMLLaunchHandler.side() != Side.CLIENT)
        return null;

    try
    {
        Class<?> cbr = Class.forName("net.minecraft.client.ClientBrandRetriever", false, getClass().getClassLoader());
        Certificate[] certificates = cbr.getProtectionDomain().getCodeSource().getCertificates();
        return certificates != null ? certificates[0] : null;
    }
    catch (Exception e){} // Errors don't matter just return null.
    return null;
}
 
Example 4
Project: CustomWorldGen   File: FMLSanityChecker.java   View source code 5 votes vote down vote up
@Override
public void injectData(Map<String, Object> data)
{
    liveEnv = (Boolean)data.get("runtimeDeobfuscationEnabled");
    cl = (LaunchClassLoader) data.get("classLoader");
    File mcDir = (File)data.get("mcLocation");
    fmlLocation = (File)data.get("coremodLocation");
    ClassPatchManager.INSTANCE.setup(FMLLaunchHandler.side());
    FMLDeobfuscatingRemapper.INSTANCE.setup(mcDir, cl, (String) data.get("deobfuscationFileName"));
}
 
Example 5
Project: BIGB   File: NEITransformer.java   View source code 5 votes vote down vote up
@Override
public byte[] transform(String name, String tname, byte[] bytes) {
    if (bytes == null) return null;
    try {
        if (FMLLaunchHandler.side().isClient())
            bytes = transformSubclasses(name, bytes);

        bytes = transformer.transform(name, bytes);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    return bytes;
}
 
Example 6
Project: SasaLib   File: SasaClassTransformer.java   View source code 5 votes vote down vote up
@Override
public byte[] transform(String name, String transformedName, byte[] bytes)
{
    if (FMLLaunchHandler.side().isClient() && transformedName.equals(TARGET_CLASS_NAME2))
    {
        return transFormMethod(bytes);
    }
    return bytes;
}
 
Example 7
Project: CustomWorldGen   File: FMLTweaker.java   View source code 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader)
{
    FMLLaunchHandler.configureForClientLaunch(classLoader, this);
    FMLLaunchHandler.appendCoreMods();
}
 
Example 8
Project: TeslaEssentials   File: TileDataSync.java   View source code 4 votes vote down vote up
@Override
public IMessage handleClientMessage(TileDataSync message, MessageContext ctx) {
    if(FMLLaunchHandler.side().isClient()) message.sendToClassHandler();
    return null;
}
 
Example 9
Project: Alchemy   File: AlchemyEngine.java   View source code votes vote down vote up
public static Side runtimeSide() { return FMLLaunchHandler.side(); }