Sign in to follow this  
RipPeralT

Couple of Errors while trying to update an abandoned mod.

Recommended Posts

Heya, was working on updating Schmois SurfaceMiningFix mod, all went well until i tried to start up the modloader server.

 

Error log below:
 

Spoiler

 

[03:52:55 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: ModLoader version v0.26.2-b72960b
[03:52:55 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Loading mods\surfaceminingfixmod.properties
[03:52:55 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Classpath: [mods\surfaceminingfixmod\SurfaceMiningFixMod.jar]
[03:52:56 PM] SEVERE org.gotti.wurmunlimited.serverlauncher.DelegatedLauncher: javassist.NotFoundException: chance
org.gotti.wurmunlimited.modloader.classhooks.HookException: javassist.NotFoundException: chance
    at com.schmois.wurmunlimited.mods.surfaceminingfix.SurfaceMiningFixMod.preInit(SurfaceMiningFixMod.java:314)
    at org.gotti.wurmunlimited.modloader.ModLoaderShared.lambda$loadModsFromModDir$3(ModLoaderShared.java:109)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.gotti.wurmunlimited.modloader.ModLoaderShared.loadModsFromModDir(ModLoaderShared.java:107)
    at org.gotti.wurmunlimited.serverlauncher.DelegatedLauncher.main(DelegatedLauncher.java:18)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at javassist.Loader.run(Loader.java:288)
    at org.gotti.wurmunlimited.serverlauncher.ServerLauncher.main(ServerLauncher.java:33)
Caused by: javassist.NotFoundException: chance
    at org.gotti.wurmunlimited.modloader.classhooks.LocalNameLookup.get(LocalNameLookup.java:23)
    at com.schmois.wurmunlimited.mods.surfaceminingfix.SurfaceMiningFixMod.replaceMineSlopeCondition(SurfaceMiningFixMod.java:378)
    at com.schmois.wurmunlimited.mods.surfaceminingfix.SurfaceMiningFixMod.preInit(SurfaceMiningFixMod.java:312)
    ... 18 more


 

 

Share this post


Link to post
Share on other sites

It can't find "chance". I'm not sure if you're looking for a field or a method. I see local variable in TileRockBehaviour.mine() named "chance" which is where surface mining is handled. I not familiar with the Hook manager so I don't know if you can alter local variables like that.

 

You could use javassist and the expression editor to change what value is returned from Math.max.

final float chance = Math.max(0.2f, (float)mining.getKnowledge(0.0) / 200.0f);
if (Server.rand.nextFloat() < chance) {...}

 

Share this post


Link to post
Share on other sites

They made changes to TileRockBehaviour which broke this mod. They changed public action to public final static mine, they probably changed chance from a standard variable to final. The mod now needs a full rewrite. it used a lot of bytecode stuff where it coulda just used the reflection utility for fields, and with the static changes and such it makes many of the original ways it was done need adjustments. I feel like it could be done in a more mod kinda way that won't break so often, but at this point a complete rewrite is suggested if you really wanted to fix this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this