client and server work standalone and in forge dev. Next up userdev.
Moved some launchplugin code to the launcher. Moved servermain to the launcher. server currently needs cmdline arguments --fml.forgeVersion=24.0.51-1.13-pre --fml.mcVersion=1.13 --fml.mcpVersion=2018.09.12.04.11.00 --fml.forgeGroup=net.minecraftforge.test
This commit is contained in:
parent
e9580877b4
commit
6baddc7e26
19 changed files with 71 additions and 34 deletions
|
@ -251,7 +251,7 @@ project(':forge') {
|
|||
installer 'org.ow2.asm:asm:6.2'
|
||||
installer 'org.ow2.asm:asm-commons:6.2'
|
||||
installer 'org.ow2.asm:asm-tree:6.2'
|
||||
installer 'cpw.mods:modlauncher:0.1.0'
|
||||
installer 'cpw.mods:modlauncher:0.2.0'
|
||||
installer 'net.minecraftforge:accesstransformers:0.10+:shadowed'
|
||||
installer 'net.minecraftforge:eventbus:0.1+:service'
|
||||
installer 'net.minecraftforge:forgespi:0.1+'
|
||||
|
|
|
@ -21,7 +21,7 @@ package net.minecraftforge.common.asm;
|
|||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import net.minecraftforge.fml.AdvancedLogMessageAdapter;
|
||||
import net.minecraftforge.fml.loading.AdvancedLogMessageAdapter;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.objectweb.asm.Label;
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml;
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import org.apache.logging.log4j.message.Message;
|
||||
import org.apache.logging.log4j.util.StringBuilderFormattable;
|
|
@ -43,7 +43,7 @@ public abstract class FMLCommonLaunchHandler
|
|||
"joptsimple.", "org.lwjgl.", "com.mojang.guava.", "com.google.", "org.apache.commons.", "io.netty.",
|
||||
"org.apache.logging.log4j.", "org.apache.http.", "org.apache.maven.", "org.objectweb.asm.",
|
||||
"paulscode.sound.", "com.ibm.icu.", "sun.", "gnu.trove.", "com.electronwill.nightconfig.",
|
||||
"net.minecraftforge.fml.loading.", "net.minecraftforge.fml.language.", "net.minecraftforge.versions.",
|
||||
"net.minecraftforge.fml.loading.", "net.minecraftforge.fml.language.",
|
||||
"net.minecraftforge.eventbus.", "net.minecraftforge.api."
|
||||
);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import cpw.mods.modlauncher.api.IEnvironment;
|
||||
import cpw.mods.modlauncher.api.ILaunchHandlerService;
|
||||
import cpw.mods.modlauncher.api.ITransformingClassLoader;
|
||||
|
@ -40,6 +41,7 @@ public class FMLDevClientLaunchProvider extends FMLCommonLaunchHandler implement
|
|||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private Path compiledClasses;
|
||||
private Path resources;
|
||||
|
||||
@Override
|
||||
public String name()
|
||||
|
@ -50,18 +52,21 @@ public class FMLDevClientLaunchProvider extends FMLCommonLaunchHandler implement
|
|||
@Override
|
||||
public Path[] identifyTransformationTargets()
|
||||
{
|
||||
return LibraryFinder.commonLibPaths(new Path[] {FMLLoader.getForgePath()});
|
||||
return LibraryFinder.commonLibPaths(ObjectArrays.concat(FMLLoader.getForgePath(), FMLLoader.getMCPaths()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getForgePath(final String mcVersion, final String forgeVersion, final String forgeGroup) {
|
||||
// In forge dev, we just find the path for ForgeVersion for everything
|
||||
compiledClasses = LibraryFinder.findJarPathFor("net/minecraftforge/versions/forge/ForgeVersion.class", "forge");
|
||||
resources = LibraryFinder.findJarPathFor("assets/minecraft/lang/en_us.json", "mcassets");
|
||||
return compiledClasses;
|
||||
}
|
||||
|
||||
public Path[] getMCPaths(final String mcVersion, final String forgeVersion, final String forgeGroup) {
|
||||
@Override
|
||||
public Path[] getMCPaths(final String mcVersion, final String mcpVersion, final String forgeVersion, final String forgeGroup) {
|
||||
// In forge dev, we just find the path for ForgeVersion for everything
|
||||
return new Path[] { compiledClasses, compiledClasses };
|
||||
return new Path[] { compiledClasses, resources };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,7 +85,6 @@ public class FMLDevClientLaunchProvider extends FMLCommonLaunchHandler implement
|
|||
@Override
|
||||
public void setup(IEnvironment environment, final Map<String, ?> arguments)
|
||||
{
|
||||
LOGGER.debug(CORE, "No jar creation necessary. Launch is dev environment");
|
||||
// we're injecting forge into the exploded dir finder
|
||||
final Path forgemodstoml = LibraryFinder.findJarPathFor("META-INF/mods.toml", "forgemodstoml");
|
||||
((Map<String, List<Pair<Path,Path>>>) arguments).computeIfAbsent("explodedTargets", a->new ArrayList<>()).
|
||||
|
|
|
@ -19,14 +19,18 @@
|
|||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import cpw.mods.modlauncher.api.IEnvironment;
|
||||
import cpw.mods.modlauncher.api.ILaunchHandlerService;
|
||||
import cpw.mods.modlauncher.api.ITransformingClassLoader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
|
@ -35,6 +39,8 @@ import static net.minecraftforge.fml.loading.LogMarkers.CORE;
|
|||
public class FMLDevServerLaunchProvider extends FMLCommonLaunchHandler implements ILaunchHandlerService
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private Path compiledClasses;
|
||||
private Path resources;
|
||||
|
||||
@Override
|
||||
public String name()
|
||||
|
@ -45,7 +51,21 @@ public class FMLDevServerLaunchProvider extends FMLCommonLaunchHandler implement
|
|||
@Override
|
||||
public Path[] identifyTransformationTargets()
|
||||
{
|
||||
return LibraryFinder.commonLibPaths(new Path[] { FMLLoader.getForgePath() });
|
||||
return LibraryFinder.commonLibPaths(ObjectArrays.concat(FMLLoader.getForgePath(), FMLLoader.getMCPaths()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getForgePath(final String mcVersion, final String forgeVersion, final String forgeGroup) {
|
||||
// In forge dev, we just find the path for ForgeVersion for everything
|
||||
compiledClasses = LibraryFinder.findJarPathFor("net/minecraftforge/versions/forge/ForgeVersion.class", "forge");
|
||||
resources = LibraryFinder.findJarPathFor("assets/minecraft/lang/en_us.json", "mcassets");
|
||||
return compiledClasses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path[] getMCPaths(final String mcVersion, final String mcpVersion, final String forgeVersion, final String forgeGroup) {
|
||||
// In forge dev, we just find the path for ForgeVersion for everything
|
||||
return new Path[] { compiledClasses, resources };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,7 +84,10 @@ public class FMLDevServerLaunchProvider extends FMLCommonLaunchHandler implement
|
|||
@Override
|
||||
public void setup(IEnvironment environment, final Map<String, ?> arguments)
|
||||
{
|
||||
LOGGER.debug(CORE, "No jar creation necessary. Launch is dev environment");
|
||||
// we're injecting forge into the exploded dir finder
|
||||
final Path forgemodstoml = LibraryFinder.findJarPathFor("META-INF/mods.toml", "forgemodstoml");
|
||||
((Map<String, List<Pair<Path,Path>>>) arguments).computeIfAbsent("explodedTargets", a->new ArrayList<>()).
|
||||
add(Pair.of(compiledClasses, forgemodstoml));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,6 +28,8 @@ import org.apache.logging.log4j.LogManager;
|
|||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
|
@ -58,8 +60,19 @@ public class FMLServerLaunchProvider extends FMLCommonLaunchHandler implements I
|
|||
};
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setup(final IEnvironment environment, final Map<String, ?> arguments) {
|
||||
final List<String> mavenRoots = new ArrayList<>((List<String>) arguments.get("mavenRoots"));
|
||||
final List<String> mods = new ArrayList<>((List<String>) arguments.get("mods"));
|
||||
mavenRoots.add(LibraryFinder.findLibsPath().toString());
|
||||
final String forgeVersion = (String) arguments.get("forgeVersion");
|
||||
final String mcVersion = (String) arguments.get("mcVersion");
|
||||
final String forgeGroup = (String) arguments.get("forgeGroup");
|
||||
mods.add(forgeGroup+":forge::universal:"+mcVersion+"-"+forgeVersion);
|
||||
// generics are gross yea?
|
||||
((Map)arguments).put("mavenRoots", mavenRoots);
|
||||
((Map)arguments).put("mods", mods);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
net.minecraftforge.fml.loading.RuntimeDistCleaner
|
||||
net.minecraftforge.common.asm.RuntimeEnumExtender
|
||||
net.minecraftforge.common.asm.ObjectHolderDefinalize
|
||||
net.minecraftforge.common.asm.CapabilityInjectDefinalize
|
||||
|
|
|
@ -26,6 +26,7 @@ import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
|||
import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext;
|
||||
import net.minecraftforge.server.command.ForgeCommand;
|
||||
import net.minecraftforge.versions.forge.ForgeVersion;
|
||||
import net.minecraftforge.versions.mcp.MCPVersion;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
@ -73,6 +74,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
|||
|
||||
public ForgeMod()
|
||||
{
|
||||
LOGGER.info("Forge mod loading, version {}, for MC {} with MCP {}", ForgeVersion.getVersion(), MCPVersion.getMCVersion(), MCPVersion.getMCPVersion());
|
||||
INSTANCE = this;
|
||||
WorldPersistenceHooks.addHook(this);
|
||||
WorldPersistenceHooks.addHook(new FMLWorldPersistenceHook());
|
||||
|
@ -82,6 +84,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
|||
MinecraftForge.EVENT_BUS.addListener(this::serverStarting);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::playerLogin);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStopping);
|
||||
ForgeConfig.load();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -74,7 +74,9 @@ public class LaunchTesting
|
|||
"--fml.mcVersion", "1.13");
|
||||
} else if (Objects.equals(target, "fmldevserver")) {
|
||||
String[] launchargs = ObjectArrays.concat(new String[] {"--launchTarget", target,
|
||||
"--gameDir", "."}, args, String.class);
|
||||
"--gameDir", ".", "--fml.forgeVersion", "24.0.0",
|
||||
"--fml.mcpVersion", "2018.11.30",
|
||||
"--fml.mcVersion", "1.13"}, args, String.class);
|
||||
Launcher.main(launchargs);
|
||||
}
|
||||
Thread.sleep(10000);
|
||||
|
|
|
@ -51,6 +51,7 @@ public class FMLModContainer extends ModContainer
|
|||
public FMLModContainer(IModInfo info, String className, ClassLoader modClassLoader, ModFileScanData modFileScanResults)
|
||||
{
|
||||
super(info);
|
||||
LOGGER.debug("Creating FMLModContainer instance for {} with classLoader {} & {}", className, modClassLoader, getClass().getClassLoader());
|
||||
this.scanResults = modFileScanResults;
|
||||
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));
|
||||
|
|
|
@ -46,6 +46,7 @@ import java.util.jar.Manifest;
|
|||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import net.minecraftforge.versions.mcp.MCPVersion;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -86,7 +87,7 @@ public class LibraryManager
|
|||
libraries_dir = Repository.get("libraries");
|
||||
|
||||
File mods = new File(minecraftHome, "mods");
|
||||
File mods_ver = new File(mods, ForgeVersion.mcVersion);
|
||||
File mods_ver = new File(mods, MCPVersion.getMCVersion());
|
||||
|
||||
ModList memory = null;
|
||||
if (!ENABLE_AUTO_MOD_MOVEMENT)
|
||||
|
@ -471,7 +472,7 @@ public class LibraryManager
|
|||
}
|
||||
}
|
||||
|
||||
for (String dir : new String[]{"mods", "mods" + File.separatorChar + ForgeVersion.mcVersion})
|
||||
for (String dir : new String[]{"mods", "mods" + File.separatorChar + MCPVersion.getMCVersion()})
|
||||
{
|
||||
File base = new File(mcDir, dir);
|
||||
if (!base.isDirectory() || !base.exists())
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraftforge.versions.mcp.MCPVersion;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
@ -66,7 +67,7 @@ public class ModList
|
|||
@SuppressWarnings("unchecked")
|
||||
public static List<ModList> getKnownLists(File mcdir)
|
||||
{
|
||||
for (String list : new String[] {"mods/mod_list.json", "mods/" + ForgeVersion.mcVersion + "/mod_list.json"/* , TODO Launch args ((Map<String, String>)Launch.blackboard.get("launchArgs")).get("--modListFile")*/})
|
||||
for (String list : new String[] {"mods/mod_list.json", "mods/" + MCPVersion.getMCVersion() + "/mod_list.json"/* , TODO Launch args ((Map<String, String>)Launch.blackboard.get("launchArgs")).get("--modListFile")*/})
|
||||
{
|
||||
if (list != null)
|
||||
{
|
||||
|
@ -87,7 +88,7 @@ public class ModList
|
|||
if (memory != null)
|
||||
lst.add(memory);
|
||||
|
||||
for (String list : new String[] {"mods/mod_list.json", "mods/" + ForgeVersion.mcVersion + "/mod_list.json"/* TODO Launch args, ((Map<String, String>)Launch.blackboard.get("launchArgs")).get("--modListFile")*/})
|
||||
for (String list : new String[] {"mods/mod_list.json", "mods/" + MCPVersion.getMCVersion() + "/mod_list.json"/* TODO Launch args, ((Map<String, String>)Launch.blackboard.get("launchArgs")).get("--modListFile")*/})
|
||||
{
|
||||
if (list != null)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package net.minecraftforge.versions.forge;
|
||||
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.fml.loading.JarVersionLookupHandler;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
@ -32,30 +33,18 @@ 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 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 String forgeVersion;
|
||||
private static final String forgeSpec;
|
||||
private static final String forgeGroup;
|
||||
|
||||
static {
|
||||
String vers = ForgeVersion.class.getPackage().getImplementationVersion();
|
||||
if (vers == null) {
|
||||
vers = System.getProperty("forge.version");
|
||||
}
|
||||
LOGGER.debug(CORE, "Forge Version package {} from {}", ForgeVersion.class.getPackage(), ForgeVersion.class.getClassLoader());
|
||||
String vers = JarVersionLookupHandler.getImplementationVersion(ForgeVersion.class).orElse(System.getProperty("forge.version"));
|
||||
if (vers == null) throw new RuntimeException("Missing forge version, cannot continue");
|
||||
String spec = ForgeVersion.class.getPackage().getSpecificationVersion();
|
||||
if (spec == null) {
|
||||
spec = System.getProperty("forge.spec");
|
||||
}
|
||||
String spec = JarVersionLookupHandler.getSpecificationVersion(ForgeVersion.class).orElse(System.getProperty("forge.spec"));
|
||||
if (spec == null) throw new RuntimeException("Missing forge spec, cannot continue");
|
||||
String group = ForgeVersion.class.getPackage().getImplementationTitle();
|
||||
if (group == null) {
|
||||
group = System.getProperty("forge.group");
|
||||
}
|
||||
String group = JarVersionLookupHandler.getImplementationTitle(ForgeVersion.class).orElse(System.getProperty("forge.group"));
|
||||
if (group == null) {
|
||||
group = "net.minecraftforge"; // If all else fails, Our normal group
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
net.minecraftforge.common.asm.RuntimeEnumExtender
|
||||
net.minecraftforge.common.asm.ObjectHolderDefinalize
|
||||
net.minecraftforge.common.asm.CapabilityInjectDefinalize
|
Loading…
Reference in a new issue