Skip to content

Commit 44dbaa3

Browse files
committed
Merge branch 'cross-pack-loading-3' of https://github.com/bdew-wurm/WurmClientModLauncher into develop
2 parents b8be4c3 + b8aa20d commit 44dbaa3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • modules/mods/serverpacks/src/main/java/org/gotti/wurmonline/clientmods/serverpacks

modules/mods/serverpacks/src/main/java/org/gotti/wurmonline/clientmods/serverpacks/ServerPacksMod.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.io.UnsupportedEncodingException;
1010
import java.lang.reflect.InvocationHandler;
1111
import java.lang.reflect.Method;
12+
import java.lang.reflect.Modifier;
1213
import java.net.MalformedURLException;
1314
import java.net.URL;
1415
import java.net.URLDecoder;
@@ -90,6 +91,8 @@ public void preInit() {
9091
);
9192
ctResources.addMethod(findPackMethod);
9293

94+
ctPackResourceUrl.getDeclaredField("rawFilePath").setModifiers(Modifier.PUBLIC);
95+
9396
ctPack.getMethod("init", "(Lcom/wurmonline/client/resources/Resources;)V")
9497
.instrument(new ExprEditor() {
9598
@Override
@@ -101,12 +104,12 @@ public void edit(MethodCall m) throws CannotCompileException {
101104
});
102105

103106
ctPack.getMethod("getResource", "(Ljava/lang/String;)Lcom/wurmonline/client/resources/ResourceUrl;")
104-
.insertAfter("if ($_ != null && $_.getFilePath().startsWith(\"~\")) {" +
107+
.insertAfter("if ($_ != null && ($_ instanceof com.wurmonline.client.resources.PackResourceUrl) && $_.getFilePath().startsWith(\"~\")) {" +
105108
" int sep = $_.getFilePath().indexOf('/');" +
106109
" com.wurmonline.client.resources.Pack pack = com.wurmonline.client.WurmClientBase.getResourceManager()" +
107110
" .findPack($_.getFilePath().substring(1,sep));" +
108111
" if (pack!=null)" +
109-
" $_ = new com.wurmonline.client.resources.PackResourceUrl(pack, $_.getFilePath().substring(sep+1));" +
112+
" $_ = new com.wurmonline.client.resources.PackResourceUrl(pack, ((com.wurmonline.client.resources.PackResourceUrl)$_).rawFilePath.substring(sep+1).replace(\"~[local]/\",\"~\"+this.name+\"/\"));" +
110113
" };");
111114

112115
ctPackResourceUrl.getMethod("derive", "(Ljava/lang/String;)Lcom/wurmonline/client/resources/PackResourceUrl;")

0 commit comments

Comments
 (0)