Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
Move classpath modifiers to before creating classloader, change README
Browse files Browse the repository at this point in the history
  • Loading branch information
comp500 committed Feb 10, 2020
1 parent fcc9274 commit 16eca48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Jumploader is a mod that allows the use of Fabric mods in Twitch modpacks, by lo

## What it doesn't do
- Jumploader doesn't let you run Fabric mods in tandem with Forge mods - it hijacks the launching process so that Forge never loads. See [Patchwork](https://github.com/PatchworkMC) for a project aiming to do this.
- Jumploader doesn't currently work very well on the client for loading a Minecraft game with a different major version (including snapshots) to the currently loaded game, as supplementary assets (such as sounds) are downloaded separately by the game launcher.
- Jumploader doesn't currently work very well on the client for loading a Minecraft game with a different major version (including snapshots) to the currently loaded game, as supplementary assets (such as sounds) are downloaded separately by the game launcher. It may be possible, however, to make a Fabric mod that fixes this issue.

## Requirements
Requires a Forge version that uses ModLauncher (or ModLauncher on it's own, without Forge) - this usually means 1.13 or newer.
14 changes: 7 additions & 7 deletions src/main/java/link/infra/jumploader/Jumploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ public void onLoad(@Nonnull IEnvironment env, @Nonnull Set<String> set) {
SpecialCaseHandler specialCaseHandler = new SpecialCaseHandler();
specialCaseHandler.filterAppliedCases(loadUrls, config.launch.mainClass, argsParsed);

// Apply the classpath modifiers
for (ClasspathModifier modifier : specialCaseHandler.getImplementingCases(ClasspathModifier.class)) {
if (modifier.shouldApply(loadUrls, config.launch.mainClass, argsParsed)) {
modifier.modifyClasspath();
}
}

// Create the classloader with the found JARs
URLClassLoader newLoader = new JumploaderClassLoader(loadUrls.toArray(new URL[0]), specialCaseHandler);
Thread.currentThread().setContextClassLoader(newLoader);
Expand All @@ -134,13 +141,6 @@ public void onLoad(@Nonnull IEnvironment env, @Nonnull Set<String> set) {
}
}

// Apply the classpath modifiers
for (ClasspathModifier modifier : specialCaseHandler.getImplementingCases(ClasspathModifier.class)) {
if (modifier.shouldApply(loadUrls, config.launch.mainClass, argsParsed)) {
modifier.modifyClasspath();
}
}

int preLaunchRunningThreads = Thread.currentThread().getThreadGroup().activeCount();

LOGGER.info("Jumping to new loader, main class: " + config.launch.mainClass);
Expand Down

0 comments on commit 16eca48

Please sign in to comment.