#Mystical Agriculture secondary seed drop

23 messages · Page 1 of 1 (latest)

frosty lance
#

Hello!
I'm using the Mystical Agriculture mod in my modpack and I don't like the fact that crops can produce extra seeds. Fortunately, this can be disabled via the config. But I also have the Botany Pots mod installed, and it has its own database of recipes. So, all crops grown in pots sometimes produce additional seeds.
For example, here is a recipe for inferium essence.

{"type":"botanypots:crop","conditions":[{"type":"forge:mod_loaded","modid":"mysticalagriculture"},{"type":"mysticalagriculture:crop_enabled","crop":"mysticalagriculture:inferium"}],"seed":{"item":"mysticalagriculture:inferium_seeds"},"categories":["inferium"],"growthTicks":1200,"display":{"block":"mysticalagriculture:inferium_crop","properties":{"age":7}},"results":[{"chance":0.75,"output":{"item":"mysticalagriculture:inferium_essence"},"minRolls":1,"maxRolls":1},{"chance":0.05,"output":{"item":"mysticalagriculture:inferium_seeds"},"minRolls":1,"maxRolls":1},{"chance":0.01,"output":{"item":"mysticalagriculture:fertilized_essence"},"minRolls":1,"maxRolls":1}]}

How can I access all MA recipes in this mod and disable the secondary seed output or make its chance equal to zero?

hollow gateBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

low jacinth
#

you can use .forEachRecipe with the type filter and edit the raw json

frosty lance
#

thats hard, when you doesn't understand what you doing))

    event.forEachRecipe({type:'botanypots:crop', seed:'mysticalagriculture:*_seeds'}, r => {
            r.json.get('results').get(1).get('chance') = 0        
        }
    )

what am I doing wrong?

low jacinth
#
  event.forEachRecipe({type:'botanypots:crop', seed:'mysticalagriculture:*_seeds'}, r => {
    if(r.json.get("results") == null) return
    let results = r.json.get("results").filter((result) => {
      return !/mysticalagriculture:.*seeds/.test(result.output)
    })
    r.json.set('results', results)
  })

try this

#

nvm

#

try it now

frosty lance
#

VS Code show syntax errors

low jacinth
#

sorry me stupid sometimes, try now

frosty lance
#

Error occurred while handling event 'recipes': TypeError: Cannot call method "filter" of null

low jacinth
#
  event.forEachRecipe({type:'botanypots:crop', seed:'mysticalagriculture:*_seeds'}, r => {
    if(r.json.get("results") == null) return
    let results = JSON.parse(r.json.get("results")).filter((result) => {
      return !/mysticalagriculture:.*_seeds/.test(result.output)
    })
    r.json.set('results', results)
  })
frosty lance
#
Error occurred while handling event 'recipes': TypeError: Cannot find function filter in object [{"chance":0.75,"output":{"item":"mysticalagriculture:llama_essence"},"minRolls":1,"maxRolls":1},{"chance":0.05,"output":{"item":"mysticalagriculture:llama_seeds"},"minRolls":1,"maxRolls":1},{"chance":0.01,"output":{"item":"mysticalagriculture:fertilized_essence"},"minRolls":1,"maxRolls":1}].
low jacinth
#

try again

frosty lance
low jacinth
#
  event.forEachRecipe({type:'botanypots:crop', seed:'mysticalagriculture:*_seeds'}, r => {
    if(r.json.get("results") == null) return
    let rObj = JSON.parse(r.json)
    rObj.results = rObj.results.filter((result) => {return !/mysticalagriculture:.*_seeds/.test(result.output)})
    r.json = rObj
  })

tried another approach now.

frosty lance
#

No errors, but jei still show seeds as a secondary output
mb it just visual, waiting while pots produce something

low jacinth
#
  event.forEachRecipe({type:'botanypots:crop', seed:'mysticalagriculture:*_seeds'}, r => {
    if(r.json.get("results") == null) return
    let rObj = JSON.parse(r.json)
    console.log("---------------------------")
    console.log(rObj)
    rObj.results = rObj.results.filter((result) => {return !/mysticalagriculture:.*_seeds/.test(result.output)})
    console.log(rObj)
    r.json = rObj
  })

It it isn't visual (which it shouldn't be), then run this and send the server.log

frosty lance
red vectorBOT
#

Paste version of server.txt from @frosty lance

low jacinth
#
  event.forEachRecipe({type:'botanypots:crop', seed:'mysticalagriculture:*_seeds'}, r => {
    if(r.json.get("results") == null) return
    let rObj = JSON.parse(r.json)
    rObj.results = rObj.results.filter((result) => {return !/mysticalagriculture:.*_seeds/.test(result.output.item)})
    r.json = rObj
  })
frosty lance
#

I think it works
No recipe in jei

#

it really works, you're a wizard Harry)))
Thank you so much

autumn portal
#

I think I need to keep it :))))