#Setting Merchant recipe

1 messages · Page 1 of 1 (latest)

pearl frost
#

Why set ingredients of merchant recipe (from SkBee) doesn't work without TradeManager plugin? I am using Purpur 1.21.4?
This line is working only if TradeManager is installed, without this plugin, SkBee doesn't change ingredients of merchant recipe of villager and doesn't show any errors

#

i tried to use skript-reflect, but have this issue

pearl frost
#

PLS Help, I can't understand, how to solve this problem

rancid zinc
pearl frost
# rancid zinc can u send the whole code and explain what exactly is the problem
function changeRecipe(e: entity):
    
    set {_file_location} to "./plugins/Skript/json/trades.json"
    set {_reader} to new FileReader({_file_location})
    set {_parser} to new JSONParser()
    set {_jsonObj} to {_parser}.parse({_reader})
    set {_villager} to {_e}
    set {_profession} to {_villager}.getProfession()
    set {_json} to {_jsonObj}.get("%{_profession}%")
    set {_trades::*} to ...{_villager}.getRecipes()
    loop {_trades::*}:
        set {_result} to loop-value.getResult() 
        set {_ingr::*} to ...loop-value.getIngredients()
        set {_json_book::*} to ...{_json}.get("%{_result}%")
        
        if {_result} is enchanted book:
            set {_enchants::*} to stored enchants of {_result}
        else:
            
            set {_enchants::*} to enchantments of {_result}
            
        loop {_enchants::*}:
            set {_enchant} to enchantment of loop-value-2
            set {_level} to enchantment level of loop-value-2
            
            loop {_json_book::*}:
                
                set {_json_ench} to loop-value-3.get("Enchantment")
                if "%{_enchant}%" is "%{_json_ench}%":
                    set {_json_level} to loop-value-3.get("Level")
                    
                    if "%{_level}%" is "%{_json_level}%":
                        
                        set {_price} to 0
                        add loop-value-3.get("Price") to {_price}
                        
                        loop {_ingr::*}:
                            
                            if type of loop-value-4 is emerald:
                                
                                set {_key} to 2
                                set {_diamonds} to diamonds
                                set item amount of {_diamonds} to {_price}
                                set {_a} to {_ingr::%{_key}%}
                                
                                if {_ingr::%{_key}%} is set:
                                    
                                    if type of {_a} isn't diamond:
                                        
                                        set ingredients of merchant recipe loop-value-1 to {_diamonds} and {_ingr::%{_key}%}
                                        
                                    else:
                                        
                                        set ingredients of merchant recipe loop-value-1 to {_diamonds}
                                        
                                else:
                                    
                                    set ingredients of merchant recipe loop-value-1 to {_diamonds}

I create the function to change trades recipe from JSON, but it works (set ingredients of merchant recipe (from SkBee)) only if I install plugin TradeManager, I cant find solution to change ingredients without this plugin

rancid zinc
#

and why wont u use the plugin?

pearl frost