99import java .io .UnsupportedEncodingException ;
1010import java .lang .reflect .InvocationHandler ;
1111import java .lang .reflect .Method ;
12+ import java .lang .reflect .Modifier ;
1213import java .net .MalformedURLException ;
1314import java .net .URL ;
1415import 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