-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fabric support #9. New asset index handler
- Loading branch information
Showing
33 changed files
with
1,549 additions
and
241 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
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,25 @@ | ||
apply plugin: 'java' | ||
apply plugin: 'maven-publish' | ||
|
||
repositories { | ||
maven { | ||
url "https://maven.fabricmc.net/" | ||
} | ||
maven { | ||
url "https://maven.glass-launcher.net/babric/" | ||
} | ||
mavenCentral() | ||
} | ||
|
||
archivesBaseName = 'launchwrapper-fabric' | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
|
||
dependencies { | ||
implementation rootProject | ||
implementation "babric:fabric-loader:0.14.24-babric.1" | ||
implementation 'org.mcphackers.rdi:rdi:1.0' | ||
implementation "org.ow2.asm:asm:${project.asm_version}" | ||
implementation "org.ow2.asm:asm-tree:${project.asm_version}" | ||
implementation "org.ow2.asm:asm-util:${project.asm_version}" | ||
} |
48 changes: 48 additions & 0 deletions
48
launchwrapper-fabric/src/main/java/org/mcphackers/launchwrapper/fabric/FabricBridge.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,48 @@ | ||
package org.mcphackers.launchwrapper.fabric; | ||
|
||
import java.security.CodeSource; | ||
|
||
import org.mcphackers.launchwrapper.Launch; | ||
import org.mcphackers.launchwrapper.LaunchConfig; | ||
|
||
public class FabricBridge extends Launch { | ||
private static final String FABRIC_KNOT_CLIENT = "net/fabricmc/loader/impl/launch/knot/KnotClient"; | ||
private static final String FABRIC_KNOT = "net/fabricmc/loader/impl/launch/knot/Knot"; | ||
|
||
private static FabricBridge INSTANCE; | ||
|
||
protected FabricBridge(LaunchConfig config) { | ||
super(config); | ||
INSTANCE = this; | ||
} | ||
|
||
private static String gameProdiverSource() { | ||
// Location of META-INF/services/net.fabricmc.loader.impl.game.GameProvider | ||
CodeSource resource = FabricBridge.class.getProtectionDomain().getCodeSource(); | ||
if(resource == null) { | ||
return null; | ||
} | ||
System.out.println("[LaunchWrapper] Fabric compat jar: " + resource.getLocation().getPath()); | ||
return resource.getLocation().getPath(); | ||
} | ||
|
||
public static void main(String[] args) { | ||
LaunchConfig config = new LaunchConfig(args); | ||
create(config).launch(); | ||
} | ||
|
||
public void launch() { | ||
CLASS_LOADER.overrideClassSource(FABRIC_KNOT, gameProdiverSource()); | ||
CLASS_LOADER.overrideClassSource(FABRIC_KNOT_CLIENT, gameProdiverSource()); | ||
CLASS_LOADER.invokeMain(FABRIC_KNOT_CLIENT, config.getArgs()); | ||
} | ||
|
||
public static FabricBridge getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
public static FabricBridge create(LaunchConfig config) { | ||
return new FabricBridge(config); | ||
} | ||
|
||
} |
Oops, something went wrong.