• Announcements

    • Retrograde

      Forum update completed   04/24/17

      We are aware of issues with Firefox and Edge, if you are having issues you can use Chrome in the meantime. Continuing on from the migration of the forums, todays update addressed a few bugs such as changing profile pictures and account settings. Other bugs with posting and such will continue to be worked on.
joedobo

[WIP] Farm barrel mod

18 posts in this topic

I'm working on a mod to add ways to do farming on an area instead of single tiles:

* Sow a square shaped area with seeds. Do this one tile at a time for the action's duration.
* The seeds used for sowing will come from a "Seed barrel" and its a portable bulk storage type container. It can hold any bulk item but it may not work if something other then seeds are in it.
* The seed barrel's weight will change as it's contents change.
* The max size of the square changes with skill: sowRadius=1,2,3,4,5; skillUnlockPoints=0,50,70,90,100. yes, at 100 skill you can sow an 11x11 area (assuming you got enough stamina to do that). And there will be a way to set the size for a seed barrel.
* Harvest crops directly into something like the seed barrel, I'll call it a harvest barrel for now. You activate it and use it on the crop tile to harvest and put the crops directly in the barrel. Given that its a bulk storage bin you can harvest as much as you can carry.
* Change skill gain so the potential skill gain (crop difficulty, skill and tool quality) is the same for sow, rake, and harvest.

 

I'm not sure about these:

* Harvesting an area has an issue I'm not sure how to deal with. Crops don't get ripe at the same time always. I could make it so the harvest barrel only harvests ripe crops...idk
* Raking an area could be done but it's likely the toon would often run out of stamina. I could extend the rake times for area rake to offset the times we'd wait for stamina regeneration...idk.
* I'd like to figure out a way to harvest crops and put them directly into a harvest barrel that is inside a dragged vehicle. Likewise, it would be good if the same thing could be done for the seed barrel, sow with seeds that are in a barrel that's inside a dragged vehicle.

 

 

source: https://github.com/Joedobo27/FarmBarrelMod/blob/master/src/com/Joedobo27/farmbarrelmod/FarmBarrelMod.java

Edited by joedobo

Share this post


Link to post
Share on other sites

I tried to add a new action, Propagate, instead of extending the "Sow" action. This didn't work either.

 

error log:

Spoiler

[02:47:11 PM] INFO com.Joedobo27.clayshards4concrete.ClayNShards4ConcreteMod: Mortar + Lye removed and Concrete creation modded.
[02:47:11 PM] SEVERE org.gotti.wurmunlimited.modloader.server.Listeners: ServerStartedListener handler for mod FarmBarrelMod failed
java.lang.RuntimeException: java.lang.IllegalAccessException: Can not set static final [Lcom.wurmonline.server.behaviours.ActionEntry; field com.wurmonline.server.behaviours.Actions.actionEntrys to [Lcom.wurmonline.server.behaviours.ActionEntry;
    at org.gotti.wurmunlimited.modsupport.actions.ModActions.registerAction(ModActions.java:51)
    at com.Joedobo27.farmbarrelmod.PropagateAction.<init>(PropagateAction.java:44)
    at com.Joedobo27.farmbarrelmod.FarmBarrelMod.onServerStarted(FarmBarrelMod.java:110)
    at org.gotti.wurmunlimited.modloader.server.ServerHook.lambda$fireOnServerStarted$2(ServerHook.java:45)
    at org.gotti.wurmunlimited.modloader.server.Listeners.lambda$fire$0(Listeners.java:35)
    at java.util.concurrent.CopyOnWriteArrayList.forEach(Unknown Source)
    at org.gotti.wurmunlimited.modloader.server.Listeners.fire(Listeners.java:33)
    at org.gotti.wurmunlimited.modloader.server.ServerHook.fireOnServerStarted(ServerHook.java:45)
    at org.gotti.wurmunlimited.modloader.server.ProxyServerHook$1$1.invoke(ProxyServerHook.java:56)
    at org.gotti.wurmunlimited.modloader.classhooks.HookManager.invoke(HookManager.java:302)
    at com.wurmonline.server.ServerLauncher.runServer(ServerLauncher.java)
    at com.wurmonline.server.gui.WurmServerGuiController.StartOfflineButtonClicked(WurmServerGuiController.java:341)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.reflect.misc.Trampoline.invoke(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source)
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown Source)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
    at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at javafx.event.Event.fireEvent(Unknown Source)
    at javafx.scene.Node.fireEvent(Unknown Source)
    at javafx.scene.control.Button.fire(Unknown Source)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(Unknown Source)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown Source)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown Source)
    at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
    at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at javafx.event.Event.fireEvent(Unknown Source)
    at javafx.scene.Scene$MouseHandler.process(Unknown Source)
    at javafx.scene.Scene$MouseHandler.access$1500(Unknown Source)
    at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$355(Unknown Source)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
    at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
    at com.sun.glass.ui.View.notifyMouse(Unknown Source)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$149(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalAccessException: Can not set static final [Lcom.wurmonline.server.behaviours.ActionEntry; field com.wurmonline.server.behaviours.Actions.actionEntrys to [Lcom.wurmonline.server.behaviours.ActionEntry;
    at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(Unknown Source)
    at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(Unknown Source)
    at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(Unknown Source)
    at java.lang.reflect.Field.set(Unknown Source)
    at org.gotti.wurmunlimited.modloader.ReflectionUtil.setPrivateField(ReflectionUtil.java:58)
    at org.gotti.wurmunlimited.modsupport.actions.ModActions.registerAction(ModActions.java:49)
    ... 81 more

[02:47:11 PM] INFO com.Joedobo27.fishingignoresrange.FishingIgnoresRange: Disabling fishing targeting proximity requirements SUCCESS

 

Has anyone got these interfaces to work in server modLoader: ModAction, BehaviourProvider, ActionPerformer?

 

I'm about ready to give up on them and insert code with JA.

 

 

edit...

I needed "ModActions.init();" in the init() section of the main class.

Edited by joedobo

Share this post


Link to post
Share on other sites

i haven't a clue on any of this, but I just wanted to say thanks for your mods, it sure is making life a lot simpler,

 

so just a note of gratitude that's all.

Share this post


Link to post
Share on other sites

Noob mistake on my part. I didn't take into consideration the entire class structure for the examples on Ago's actiondemo. I just took the action class and didn't look at the mod's main class. Its necessary to do a "ModActions.init();" and a "ModActions.registerAction(new PropagateAction());" in main because it won't work otherwise.

 

Getting familiar with using the BehaviourProvider and ActionPerformer will greatly expand what's possible.

 

@ozmodsThank you.

And I'd like to thank Ago. Without modlauncher we'd still be changing decompiled code (kinda-source) and dropping modified java files into the server/client.jar files.

1 person likes this

Share this post


Link to post
Share on other sites

@joedoboHow is this mod coming along? I would love to have it on the server I am on. Thank you in advance for making it.

Share this post


Link to post
Share on other sites

On hold until 1.3 is out and It's a high priority to finish. I'll likely have to fix my other mods first. I updated the github with my most recent changes.

It's missing some code regarding this:

private static WeakHashMap<Action, SowActionData> actionListener;

Which is a way to remember data for the whole action's duration.

 

 

Share this post


Link to post
Share on other sites

I'm stuck on the ConfigureSeedBarrelQuestion.class and that the answer() method never gets called. I know the question is asked because the UI pops up in game. The log file printing in the question constructor are the only ones that print:

[12:17:09 AM] INFO com.wurmonline.server.questions.Question: construct Item [ID: 12883496594178, name: seed barrel, QL: 76.716446, Tile: 491,767]
[12:17:09 AM] INFO com.wurmonline.server.questions.Question: id 501

 

Here is the question class:

https://github.com/Joedobo27/FarmBarrelMod/blob/master/src/com/wurmonline/server/questions/ConfigureSeedBarrelQuestion.java

 

Here is the action performer that calls it:

https://github.com/Joedobo27/FarmBarrelMod/blob/master/src/com/joedobo27/farmbarrelmod/ConfigureSeedBarrelAction.java

 

Thank you, if someone want's to take a look at this.

 

Share this post


Link to post
Share on other sites

Sorry, i don't see anything that would cause it to not work at a quick glance... did you try using the new ModQuestions stuff ago added?

 

Also your decoding in decodeRadius and decodeSupplyQuantity is wrong, you need to shift the bits right, or you'll always get 0 from the second &.

Share this post


Link to post
Share on other sites

Thanks @bdew

 

I've started to convert this over to use the ModQuestions modloader tools. I feel bad asking for examples because Ago already does so much with writing the tools. It's just hard for me to understand things without examples. Anyone know of  some examples that use the ModQuestions tools?

 

Everything except the answer part seems to be working. 

Share this post


Link to post
Share on other sites

Joe I put a note for you on discord. I don't see a sendQuestion in your answer, and everything I can rip outa the wurm code questions has a sendQuestion at the end of the answers.

Share this post


Link to post
Share on other sites

Awesome Idea! Hope it goes well

Share this post


Link to post
Share on other sites

I'm stuck again...

When using the ActionPerformer isn't it possible to have the mod add to an existent action? I want to add another sow type action but doing so bugs out the old way of sowing with seeds.

Here is code for my sow action:

https://github.com/Joedobo27/FarmBarrelMod/blob/master/src/com/joedobo27/farmbarrelmod/SowAction.java

 

Right now my mod lets me start the sow action when using seed on dirt tile but it seems to get ended right away. I get a start event message and then nothing.

 

I read the wiki for the this: https://github.com/ago1024/WurmServerModLauncher/wiki/Mods-ActionDemo. I see that it says ActionPerformer  replaces WU action but I thought Ago updated this tool to make it possible to add to WU actions with new ones.

 

Any thoughts on this?

Share this post


Link to post
Share on other sites

I'm not sure why it's not working for you, it looks to me like you're chaining correctly to ActionPerformer.super.action. Maybe setting a breakpoint on that call and tracing where it goes with a debugger will show why it's going wrong.

 

But why are you using the vanilla sow action id anyway? You could just make your own sow action (that will be used only with the barrel), and leave vanilla to do it's own thing when seeds are activated.

Share this post


Link to post
Share on other sites

@bdew

"try a debugger", I've never been able to get a debugger to work. For intelliJ one needs to run the project from the IDE and I can't get that to work. I'll look into putting a stack trace through the Logger.

 

"make a new actionId", I thought the word "sow" must be unique. It seems I can make a new actionId # and also call it "Sow".

 

Thank you for the advise! I was starting to give up on WU as it's surprisingly discouraging when there doesn't seem to be anyone around to ask for help or bounce ideas off of.

 

 

Share this post


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

@bdew

"try a debugger", I've never been able to get a debugger to work. For intelliJ one needs to run the project from the IDE and I can't get that to work. I'll look into putting a stack trace through the Logger.

 

 

Same here with intelliJ and Netbeans.  I'd be happy to work in any IDE if I could get a debugger to work and see some of the internals in action.

Share this post


Link to post
Share on other sites

So the easiest way to get a debugger to work in intellij:

 

  1. Go to run configurations
  2. Add a "Remote" config,
  3. Switch "transport" to "shared memory" (you can leave this on socket, but i've ran into windows not closing the socket when restarting debug sessions)
  4. Write something unique in "shared memory address" (if you are debugging multiple instances, or client+server, etc.) 
  5. Copy the text from "command line arguments blah blah blah" box (the first one)
  6. Paste it somewhere in the command line in modlauncher.bat, e.g. 
    %JAVA% "-Dworkdir=%CD%" "-Djava.library.path=%CD%\nativelibs" %LOGGING% -Xmn256M -Xms512m -Xmx2048m -XX:+OptimizeStringConcat -XX:+AggressiveOpts -agentlib:jdwp=transport=dt_shmem,server=y,suspend=n,address=youradresshere -jar modlauncher.jar  %*

     

  7. Run modlauncher.bat
  8. Make sure your new remote profile is selected in IDEA
  9. Click debug

The first 6 steps need only be done once, for future use just repeat 7-9.

 

Also, if for debugging vanilla code - don't attach sources decompiled by an external decompiler (procyon/jd/whatever), let intellij use it's internal decompiler, or your debugging will be wonky due to line number mismatches.

1 person likes this

Share this post


Link to post
Share on other sites

Those debug instruction are easy to use. Guess it's all about knowing how to use the IDE tool. Now with my action performer problem, all the jumping around with action performer is a bit confusing but the simple fact the debugger works now is just too cool!

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