DragonsGateWU

Issue Creating Advanced Item Recipes

Recommended Posts

I am trying to make a recipe that requires multiple items in order to craft an item, in this case a Julbord. However, when I go to make the item in game it completes the whole thing without requiring the additional items. I can't seem to find why it is doing this, nor how to declare it to create an unfinished version of the item that needs the rest to be completed. (I am a complete beginner at coding and have been looking through code made by others trying to copy their method) Any tips or help is greatly appreciated!

package org.dragonsgatewu.wurmunlimited.mods.julbordrecipe;

import com.wurmonline.server.items.AdvancedCreationEntry;
import com.wurmonline.server.items.CreationCategories;
import com.wurmonline.server.items.CreationEntryCreator;
import com.wurmonline.server.items.CreationRequirement;

public class JulbordRecipe {

    public JulbordRecipe()
    {
        AdvancedCreationEntry julbord = CreationEntryCreator.createAdvancedEntry(10038, 22, 1173, 442, true, true, 0.0F, false, false, CreationCategories.COOKING_UTENSILS);
        julbord.addRequirement(new CreationRequirement (1, 22, 9, true));
        julbord.addRequirement(new CreationRequirement (2, 1173, 5, true));
        julbord.addRequirement(new CreationRequirement (3, 217, 10, true));
        julbord.addRequirement(new CreationRequirement (4, 258, 5, true));
        julbord.addRequirement(new CreationRequirement (5, 257, 5, true));
        julbord.addRequirement(new CreationRequirement (6, 259, 5, true));
        julbord.addRequirement(new CreationRequirement (7, 129, 50, true));
    }

}

I already have 1 + 1 = finished item working perfectly but I want this to be a more advanced recipe that requires more than a plank and plate to make, but also forks, spoons, knives, etc.
 

Edited by DragonsGateWU

Share this post


Link to post
Share on other sites

You should not do anything in the constructor of a class, constructors are only for initializing the object. This is really a bad way to mod and obviously it does not even work.

 

Use the onItemTemplateCreated listener method to call a static method which adds the AdvancedCreationEntry, that should work without any problems.

 

 

And wrong forum section....

Edited by Sklo:D

Share this post


Link to post
Share on other sites
On 8/31/2018 at 6:26 AM, Sklo:D said:

You should not do anything in the constructor of a class, constructors are only for initializing the object. This is really a bad way to mod and obviously it does not even work.

 

Use the onItemTemplateCreated listener method to call a static method which adds the AdvancedCreationEntry, that should work without any problems.

 

 

And wrong forum section....

Thank you for the reply. I will try what you suggested.

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