-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5c296f
commit 4bd8d77
Showing
11 changed files
with
136 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
theName=Stream | ||
theVersion=1.0.1 | ||
theVersion=1.0.2 | ||
theGroup=systems.conduit | ||
systemProp.file.encoding=utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/main/java/systems/conduit/stream/launcher/services/ClientLaunchHandlerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package systems.conduit.stream.launcher.services; | ||
|
||
import cpw.mods.modlauncher.api.ILaunchHandlerService; | ||
import cpw.mods.modlauncher.api.ITransformingClassLoader; | ||
import cpw.mods.modlauncher.api.ITransformingClassLoaderBuilder; | ||
import org.spongepowered.asm.mixin.Mixins; | ||
import systems.conduit.stream.Constants; | ||
import systems.conduit.stream.Logger; | ||
import systems.conduit.stream.launcher.LauncherStart; | ||
|
||
import java.io.File; | ||
import java.lang.reflect.Method; | ||
import java.nio.file.Path; | ||
import java.util.concurrent.Callable; | ||
|
||
public class ClientLaunchHandlerService implements ILaunchHandlerService { | ||
|
||
@Override | ||
public void configureTransformationClassLoader(final ITransformingClassLoaderBuilder builder) { | ||
// Add transformation paths | ||
LauncherStart.PATHS.forEach(builder::addTransformationPath); | ||
// Load Minecraft and Conduit jars if in debug | ||
if (Constants.DEBUG) { | ||
Path minecraft = getLoadedJar(Constants.MAIN_CLIENT_FILE); | ||
if (minecraft != null) { | ||
Logger.info("Transforming Minecraft remapped"); | ||
builder.addTransformationPath(minecraft); | ||
Logger.info("Transformed Minecraft remapped"); | ||
} | ||
Path conduit = getLoadedJar(Constants.MAIN_CONDUIT_FILE); | ||
if (conduit != null) { | ||
Logger.info("Transforming Conduit"); | ||
builder.addTransformationPath(conduit); | ||
Logger.info("Transformed Conduit"); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public Callable<Void> launchService(String[] args, ITransformingClassLoader launchClassLoader) { | ||
// Add mixins to configure | ||
LauncherStart.MIXINS.forEach(Mixins::addConfiguration); | ||
return () -> { | ||
final Class<?> mcClass = Class.forName(Constants.MAIN_CLIENT_FILE, true, launchClassLoader.getInstance()); | ||
final Method mcClassMethod = mcClass.getMethod("main", String[].class); | ||
mcClassMethod.invoke(null, (Object) args); | ||
return null; | ||
}; | ||
} | ||
|
||
private Path getLoadedJar(String className) { | ||
// Returns the jars from the classpath if loaded by intellij | ||
try { | ||
return new File(Class.forName(className).getProtectionDomain().getCodeSource().getLocation().toURI()).toPath(); | ||
} catch (Exception ignored) { | ||
return null; | ||
} | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return "minecraft-client"; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/main/resources/META-INF/services/cpw.mods.modlauncher.api.ILaunchHandlerService
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
systems.conduit.stream.launcher.services.ClientLaunchHandlerService | ||
systems.conduit.stream.launcher.services.ServerLaunchHandlerService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters