Starting to put the launch itself together
This commit is contained in:
parent
7e5bd4ecdb
commit
5b05e103f4
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import cpw.mods.modlauncher.api.IEnvironment;
|
||||
|
||||
public abstract class FMLCommonLaunchHandler
|
||||
{
|
||||
public void setup(final IEnvironment environment)
|
||||
{
|
||||
// We need to check for deobf and patched jar here and if not, build one.
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import cpw.mods.modlauncher.api.IEnvironment;
|
||||
import cpw.mods.modlauncher.api.ILaunchHandlerService;
|
||||
import net.minecraft.client.main.Main;
|
||||
|
||||
|
@ -27,7 +28,10 @@ import java.nio.file.Path;
|
|||
import java.nio.file.Paths;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class FMLDevLaunchProvider implements ILaunchHandlerService
|
||||
import static net.minecraftforge.fml.Logging.CORE;
|
||||
import static net.minecraftforge.fml.Logging.fmlLog;
|
||||
|
||||
public class FMLDevLaunchProvider extends FMLCommonLaunchHandler implements ILaunchHandlerService
|
||||
{
|
||||
@Override
|
||||
public String name()
|
||||
|
@ -58,4 +62,10 @@ public class FMLDevLaunchProvider implements ILaunchHandlerService
|
|||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(IEnvironment environment)
|
||||
{
|
||||
fmlLog.debug(CORE, "No jar creation necessary. Launch is dev environment");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.client.main.Main;
|
|||
import java.nio.file.Path;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class FMLLaunchProvider implements ILaunchHandlerService
|
||||
public class FMLLaunchProvider extends FMLCommonLaunchHandler implements ILaunchHandlerService
|
||||
{
|
||||
@Override
|
||||
public String name()
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import cpw.mods.modlauncher.api.IEnvironment;
|
||||
import cpw.mods.modlauncher.api.ILaunchHandlerService;
|
||||
import cpw.mods.modlauncher.api.ITransformationService;
|
||||
import cpw.mods.modlauncher.api.IncompatibleEnvironmentException;
|
||||
import cpw.mods.modlauncher.serviceapi.ILaunchPluginService;
|
||||
|
@ -89,6 +90,24 @@ public class FMLLoader
|
|||
languageLoadingProvider = new LanguageLoadingProvider();
|
||||
}
|
||||
|
||||
static void setupLaunchHandler(final IEnvironment environment) throws IncompatibleEnvironmentException
|
||||
{
|
||||
final String launchTarget = environment.getProperty(IEnvironment.Keys.LAUNCHTARGET.get()).orElse("MISSING");
|
||||
final Optional<ILaunchHandlerService> launchHandler = environment.findLaunchHandler(launchTarget);
|
||||
fmlLog.debug(CORE, "Using {} as launch service", launchTarget);
|
||||
if (!launchHandler.isPresent()) {
|
||||
fmlLog.error(CORE,"Missing LaunchHandler {}, cannot continue", launchTarget);
|
||||
throw new IncompatibleEnvironmentException("Missing launch handler");
|
||||
}
|
||||
|
||||
if (!(launchHandler.get() instanceof FMLCommonLaunchHandler)) {
|
||||
fmlLog.error(CORE, "Incompatible Launch handler found - type {}, cannot continue", launchHandler.get().getClass().getName());
|
||||
throw new IncompatibleEnvironmentException("Incompatible launch handler found");
|
||||
}
|
||||
|
||||
FMLCommonLaunchHandler commonLaunchHandler = (FMLCommonLaunchHandler)launchHandler.get();
|
||||
commonLaunchHandler.setup(environment);
|
||||
}
|
||||
public static void beginModScan()
|
||||
{
|
||||
fmlLog.debug(SCAN,"Scanning for Mod Locators");
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import cpw.mods.modlauncher.api.IEnvironment;
|
||||
import cpw.mods.modlauncher.api.ILaunchHandlerService;
|
||||
import cpw.mods.modlauncher.api.ITransformationService;
|
||||
import cpw.mods.modlauncher.api.ITransformer;
|
||||
import cpw.mods.modlauncher.api.IncompatibleEnvironmentException;
|
||||
|
@ -31,6 +32,7 @@ import net.minecraftforge.fml.common.FMLPaths;
|
|||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
|
|
Loading…
Reference in New Issue