Launch in the vanilla launcher now.

This commit is contained in:
cpw 2018-10-02 00:32:41 -04:00
parent 39307856b5
commit 0b11b0e6bb
6 changed files with 84 additions and 48 deletions

View File

@ -161,6 +161,7 @@ project(':forge') {
installer 'com.electronwill.night-config:toml:3.4.0'
installer 'org.jline:jline:3.5.1'
installer 'org.apache.maven:maven-artifact:3.5.3'
installer 'net.jodah:typetools:0.5.0'
installer 'java3d:vecmath:1.5.2'
}
@ -246,16 +247,16 @@ project(':forge') {
destinationDir = file('build/distributions')
from(zipTree(downloadCrowdin.output)){
eachFile { //Tired of waiting for crowdin API, rename things myself. Remove once crowdin stops being dumb
if (it.name.equals('en_us.json') && !it.path.startsWith('assets/')) {
it.name = it.path.split('/')[0] + '.json'
it.path = 'assets/forge/lang/' + it.name
if (it.name.equals('en_us.json') && !it.path.startsWith('assets/')) {
it.name = it.path.split('/')[0] + '.json'
it.path = 'assets/forge/lang/' + it.name
}
}
exclude { it.isDirectory() }
rename { it.toLowerCase() }//Minecraft needs it lowercase.
exclude '**/*.lang' //Pre-1.13 format
}
exclude { it.isDirectory() }
rename { it.toLowerCase() }//Minecraft needs it lowercase.
exclude '**/*.lang' //Pre-1.13 format
}
}
// We apply the bin patches we just created to make a jar that is JUST our changes
task applyClientBinPatches(type: ApplyBinPatches, dependsOn: genClientBinPatches) {
@ -314,6 +315,7 @@ project(':forge') {
}
task launcherJson(dependsOn: universalJar) {
inputs.file universalJar.archivePath
ext {
output = file('build/libs/version.json')
vanilla = project(':mcp').file('build/mcp/downloadJson/version.json')

View File

@ -25,48 +25,33 @@ import org.apache.logging.log4j.Logger;
import javax.annotation.Nullable;
import static net.minecraftforge.fml.Logging.CORE;
public class ForgeVersion
{
private static final Logger LOGGER = LogManager.getLogger();
// This is Forge's Mod Id, used for the ForgeMod and resource locations
public static final String MOD_ID = "forge";
//This number is incremented every time we remove deprecated code/major API changes, never reset
public static final int majorVersion = 14;
//This number is incremented every minecraft release, never reset
public static final int minorVersion = 23;
//This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version
public static final int revisionVersion = 2;
//This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code.
public static final int buildVersion = 0;
// This is the minecraft version we're building for - used in various places in Forge/FML code
public static final String mcVersion = "1.13";
// This is the MCP data version we're using
public static final String mcpVersion = "9.42";
private static final Logger log = LogManager.getLogger();
private static final String forgeVersion;
public static int getMajorVersion()
{
return majorVersion;
}
public static int getMinorVersion()
{
return minorVersion;
}
public static int getRevisionVersion()
{
return revisionVersion;
}
public static int getBuildVersion()
{
return buildVersion;
static {
String vers = ForgeVersion.class.getPackage().getImplementationVersion();
if (vers == null) {
vers = System.getProperty("forge.version");
}
if (vers == null) throw new RuntimeException("Missing forge version, cannot continue");
forgeVersion = vers;
LOGGER.info(CORE, "Found Forge version {}", forgeVersion);
}
public static String getVersion()
{
return String.format("%d.%d.%d.%d", majorVersion, minorVersion, revisionVersion, buildVersion);
return forgeVersion;
}
public static VersionChecker.Status getStatus()

View File

@ -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));

View File

@ -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

View File

@ -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);
}
}

View File

@ -0,0 +1,41 @@
package net.minecraftforge.mcp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import static net.minecraftforge.fml.Logging.CORE;
public class MCPVersion {
private static final Logger LOGGER = LogManager.getLogger();
private static final String mcVersion;
private static final String mcpVersion;
static {
String vers = MCPVersion.class.getPackage().getSpecificationVersion();
if (vers == null) {
vers = System.getProperty("mc.version");
}
if (vers == null) throw new RuntimeException("Missing MC version, cannot continue");
mcVersion = vers;
vers = MCPVersion.class.getPackage().getImplementationVersion();
if (vers == null) {
vers = System.getProperty("mcp.version");
}
if (vers == null) throw new RuntimeException("Missing MCP version, cannot continue");
mcpVersion = vers;
LOGGER.info(CORE, "Found MC version information {}", mcVersion);
LOGGER.info(CORE, "Found MCP version information {}", mcpVersion);
}
public static String getMCVersion() {
return mcVersion;
}
public static String getMCPVersion() {
return mcpVersion;
}
public static String getMCPandMCVersion()
{
return mcVersion+"-"+mcpVersion;
}
}