Sign in to follow this  
Webba

[RELEASED] Moon Metal Mining and Home Server Mining

Recommended Posts

This mod was designed to do 2 things and then one extra feature was added due to a request:
1) Remove the hard cap of 50 actions on glimmer/ada veins this is enabled or disabled using  changeVeinCap and the new action cap on these veins is changed to  newVeinCap this will not override the vein quantity just removes the check for glimmer / ada that then resets the vein to 50 actions. It does not change the spawning of veins, however it could be used to make them useless by setting the newVeinCap to 1, as was said previously setting it to 0 could have odd side effects.

 

2) Adding random drops for moon metal ores when mining like gems, this is enabled or disabled using randomMoonMetalDrops and the drop chance of each metal can be customised.

 

3) Removing the quality cap on home server veins, this is enabled or disabled using  changeHomeVeinCap and it can be changed using  newHomeVeinCap this sets the max quality of ore avaliable on home servers, again this doesn't change spawning mechanics only changes hard caps when the mining action happens.

Share this post


Link to post
Share on other sites

Awesome Mod, but what i'am missing is (For the randomMoonMetalDrops action) is it seems to be that these random drops aren't affected by a Rare Pickaxe... do you think it is possible to implement this?

Share this post


Link to post
Share on other sites

I'm getting an error with WU 1.5, here is the server log:

 

Spoiler

[05:40:35 PM] INFO com.webbrar.wurm.mods.moonmetalmining.MoonMetalMiningMod: Changing Moon Metal vein ammount cap
[05:40:35 PM] SEVERE org.gotti.wurmunlimited.serverlauncher.DelegatedLauncher: 22
java.lang.ArrayIndexOutOfBoundsException: 22
    at javassist.bytecode.ByteArray.readU16bit(ByteArray.java:27)
    at javassist.bytecode.CodeIterator.u16bitAt(CodeIterator.java:145)
    at com.webbrar.wurm.mods.moonmetalmining.MoonMetalMiningMod.removeMoonMetalVeinCap(MoonMetalMiningMod.java:137)
    at com.webbrar.wurm.mods.moonmetalmining.MoonMetalMiningMod.preInit(MoonMetalMiningMod.java:61)
    at org.gotti.wurmunlimited.modloader.ModLoaderShared.lambda$loadModsFromModDir$4(ModLoaderShared.java:103)
    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:101)
    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)

 

Share this post


Link to post
Share on other sites

Random moonmetal will still work but vein cap is broken. You can disable vein cap until a fix is made.

Share this post


Link to post
Share on other sites

The method signature appears to have changed. I made the following changes locally and they worked for me.

 

 

//private String actionMethodDesc = "(Lcom/wurmonline/server/behaviours/Action;Lcom/wurmonline/server/creatures/Creature;Lcom/wurmonline/server/items/Item;IIZIISF)Z";
    private String actionMethodDesc = "(Lcom/wurmonline/server/behaviours/Action;Lcom/wurmonline/server/creatures/Creature;Lcom/wurmonline/server/items/Item;IIZIIISF)Z";

and to harden against the out of bounds exception:

            /*
            while(codeIterator.hasNext()) {

                int pos = codeIterator.next();
                int op = codeIterator.byteAt(pos);
                int siPusharg = codeIterator.u16bitAt(pos+1);
                
                //bipush(2) if_icmple(3) iload(2)  <pos>sipush(3) if_icmpeq(3) iload(2) sipush(3) if_icmpne(3) TOOVERWRITE(bipush(2) to iload(2)) TOGET(istore(2)) overwritepos: 14-15 getpos = 17
                
                if (op == CodeIterator.SIPUSH && siPusharg == 693){
                    logger.log(Level.INFO, "Found bytecode pattern for moon metal veins");
                    codeIterator.insertGap(pos+14, 1);
                    codeIterator.writeByte(CodeIterator.LDC_W, pos+14);
                    codeIterator.write16bit(capRef, pos+15);
                    codeIterator.insertGap(pos-7, 1);
                    codeIterator.writeByte(CodeIterator.LDC_W, pos-7);
                    codeIterator.write16bit(capRef, pos-6);
                    logger.log(Level.INFO, "Moon metal vein cap changed");
                    break;
                }
            }
            */
            
            while(codeIterator.hasNext()) {

                int pos = codeIterator.next();
                int op = codeIterator.byteAt(pos);
                if (op == CodeIterator.SIPUSH)
                {
                	int siPusharg = codeIterator.u16bitAt(pos+1);
                	if (siPusharg == 693)
                	{
                		logger.log(Level.INFO, "Found bytecode pattern for moon metal veins");
                        codeIterator.insertGap(pos+14, 1);
                        codeIterator.writeByte(CodeIterator.LDC_W, pos+14);
                        codeIterator.write16bit(capRef, pos+15);
                        codeIterator.insertGap(pos-7, 1);
                        codeIterator.writeByte(CodeIterator.LDC_W, pos-7);
                        codeIterator.write16bit(capRef, pos-6);
                        logger.log(Level.INFO, "Moon metal vein cap changed");
                        break;
                	}
                }
            }

 

Edited by Vakt
  • Like 1

Share this post


Link to post
Share on other sites

any chance of posting an edited version of the mod that does work, with your fix above?  I don't know the first thing about where to add in those lined of code on my own.  good work!

Share this post


Link to post
Share on other sites

We've been unable to use this mod since the 1.6 update, even if we disable the vein cap. Is it working for anyone else?

 

Edited by Batta

Share this post


Link to post
Share on other sites

Hey Batta,

 

Sindusk put in a fix for the vein cap for Moon Metals in his ServerTweaks mod.  It doesn't however include the feature where moon metal lumps could drop like gems when mining.  

 

Share this post


Link to post
Share on other sites
11 hours ago, Asperis said:

Hey Batta,

 

Sindusk put in a fix for the vein cap for Moon Metals in his ServerTweaks mod.  It doesn't however include the feature where moon metal lumps could drop like gems when mining.  

 

 

Thanks @Asperis  Since we have a custom map with moonmetals, the one thing we wanted this for was the seryll drops. On our server, there is no other way to get seryll.

Share this post


Link to post
Share on other sites
1 hour ago, Webba said:

I've updated this, I won't promise to keep it maintained as I don't currently play any form of wurm but if there are issues with any of my mods github issues will get to me and if I have time I will try to update  them. https://github.com/webba/moonmetalminingmod/releases

 

This appears to be just a jar file. Do we keep the old folder and properties files, and just replace the current jar with this one?

Share this post


Link to post
Share on other sites
5 minutes ago, Batta said:

 

This appears to be just a jar file. Do we keep the old folder and properties files, and just replace the current jar with this one?

Properties file is unchanged yes

  • Like 1

Share this post


Link to post
Share on other sites

Still no fix for the seryll drops?  Just wondering if it happened and I missed it. We would really love to have them, as we have no other way of getting seryll on our server.

Share this post


Link to post
Share on other sites

nvm

Edited by Elsa

Share this post


Link to post
Share on other sites

@sidhosWeird, it used to come with a properties file.   You can make your own, though.  Just copy the following into a Notepad++ (or Notepad) doc, configure, and drop it into the mods folder.  The name needs to be moonmetalminingmod.properties

 

Spoiler

classname=com.webbrar.wurm.mods.moonmetalmining.MoonMetalMiningMod
classpath=moonmetalminingmod.jar

# Mod Enabled?
useMoonMetalMiningMod=true


# Random Moon Metal Drops
# Enabled default:false
randomMoonMetalDrops=true
# Drop each metal chance on mining action (1 in x) default:3000
# If set to 0 the metal will not drop
randomGlimmersteelDropChance=6000
randomAdamantiteDropChance=6000
randomSeryllDropChance=4500

# Change the hard cap of 50 ores in glimmersteel and adamantite veins
# Do not set this value higher than 65535
# Enabled default:false
#changeVeinCap=true
#newVeinCap=500

# Change the qualtiy cap on home servers
# Enabled default:false
changeHomeVeinCap=true
# New quality cap default: 100
newHomeVeinCap=100

 

Share this post


Link to post
Share on other sites

@Batta.  Thank you. I will see if that works, or if I have done something else wrong along the way.  Appreciate the help.  :)

 

My notepad only makes it as a Txt document. Looking at the other mods files, I suppose it needs to be a properties file. I have no idea how to do that.  

 

Update: got it.  :)

Edited by sidhos

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