mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 20:22:28 +00:00
Launch in the vanilla launcher now.
This commit is contained in:
1 parent
39307856b5
commit
0b11b0e6bb
6 files changed
+84
-48
No files matched your search
@@ -22,6 +22,7 @@ package net.minecraftforge.fml;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraftforge.common.ForgeVersion;
|
||||
import net.minecraftforge.mcp.MCPVersion;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Arrays;
|
||||
@@ -41,8 +42,8 @@ public class BrandingControl
|
||||
if (brandings == null)
|
||||
{
|
||||
ImmutableList.Builder<String> brd = ImmutableList.builder();
|
||||
brd.add("Minecraft " + ForgeVersion.mcVersion);
|
||||
brd.add("MCP " + ForgeVersion.mcpVersion);
|
||||
brd.add("Minecraft " + MCPVersion.getMCVersion());
|
||||
brd.add("MCP " + MCPVersion.getMCPVersion());
|
||||
brd.add("Forge " + ForgeVersion.getVersion());
|
||||
int tModCount = ModList.get().size();
|
||||
brd.add(ForgeI18n.parseMessage("fml.menu.loadingmods", tModCount));
|
||||
|
||||
@@ -24,6 +24,11 @@ import cpw.mods.modlauncher.api.ILaunchHandlerService;
|
||||
import cpw.mods.modlauncher.api.ITransformingClassLoader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.ForgeVersion;
|
||||
import net.minecraftforge.mcp.MCPVersion;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.core.config.Configurator;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Path;
|
||||
@@ -34,8 +39,10 @@ import java.util.concurrent.Callable;
|
||||
|
||||
public class FMLClientLaunchProvider extends FMLCommonLaunchHandler implements ILaunchHandlerService
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final Path forgePath;
|
||||
private static final Path mcPath;
|
||||
private static final Path patchedBinariesPath;
|
||||
private static final Path srgMcPath;
|
||||
private static final List<String> SKIPPACKAGES = Arrays.asList(
|
||||
"joptsimple.", "org.lwjgl.", "com.mojang.", "com.google.",
|
||||
"org.apache.commons.", "io.netty.", "net.minecraftforge.fml.loading.", "net.minecraftforge.fml.language.",
|
||||
@@ -46,7 +53,9 @@ public class FMLClientLaunchProvider extends FMLCommonLaunchHandler implements I
|
||||
static {
|
||||
try {
|
||||
forgePath = Paths.get(FMLClientLaunchProvider.class.getProtectionDomain().getCodeSource().getLocation().toURI());
|
||||
mcPath = forgePath.resolveSibling("forge-"+ForgeVersion.getVersion()+"-srg.jar");
|
||||
patchedBinariesPath = forgePath.resolveSibling("forge-"+MCPVersion.getMCVersion()+"-"+ForgeVersion.getVersion()+"-client.jar");
|
||||
Path libs = forgePath.getParent().getParent().getParent().getParent().getParent();
|
||||
srgMcPath = libs.resolve(Paths.get("net","minecraft", "client", MCPVersion.getMCPandMCVersion(), "client-"+MCPVersion.getMCPandMCVersion()+"-srg.jar")).toAbsolutePath();
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException("Unable to locate myself!");
|
||||
}
|
||||
@@ -60,7 +69,10 @@ public class FMLClientLaunchProvider extends FMLCommonLaunchHandler implements I
|
||||
@Override
|
||||
public Path[] identifyTransformationTargets()
|
||||
{
|
||||
return new Path[] {mcPath, forgePath};
|
||||
LOGGER.info("Found SRG MC at {}", srgMcPath.toString());
|
||||
LOGGER.info("Found Forge patches at {}", patchedBinariesPath.toString());
|
||||
LOGGER.info("Found Forge at {}", forgePath.toString());
|
||||
return new Path[] {forgePath, patchedBinariesPath, srgMcPath};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
@@ -72,18 +73,12 @@ public enum FMLPaths
|
||||
{
|
||||
for (FMLPaths path : FMLPaths.values())
|
||||
{
|
||||
path.absolutePath = rootPath.resolve(path.relativePath).toAbsolutePath();
|
||||
try {
|
||||
path.absolutePath = path.absolutePath.toRealPath();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Unable to resolve path {}", path.absolutePath, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
LOGGER.debug(CORE,"Path {} is {}", ()-> path, ()-> path.absolutePath);
|
||||
path.absolutePath = rootPath.resolve(path.relativePath).toAbsolutePath().normalize();
|
||||
if (path.isDirectory)
|
||||
{
|
||||
FileUtils.getOrCreateDirectory(path.absolutePath, path.name());
|
||||
}
|
||||
LOGGER.debug(CORE,"Path {} is {}", ()-> path, ()-> path.absolutePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user