#Some general code help

9 messages · Page 1 of 1 (latest)

trim cloak
#

Currently, I have some recipes that have some requirements randomized per-seed. However, some recipes fail to create as some requires end up being null.

Here are the revelant code

ars_nouveau.js - server script, handles the recipes and the randomized picking.
worldseed.js - startup script, handles getting the worldseed before actually starting so it doesn't error on start.

The actual error (actually, warn):

[17:04:40] [WARN ] Error creating recipe malum:kjs_6hr0tunv21f5lvtn9yopidsrt[malum:spirit_infusion]: {"type":"malum:spirit_infusion","input":{"item":"ars_nouveau:relay"},"output":{"item":"ars_nouveau:relay_collector"},"extra_items":[{"tag":"forge:chests","count":4}],"spirits":[{"type":"infernal","count":3},{"type":"arcane","count":6},{"count":2}]}: java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonElement.getAsString()" because the return value of "com.google.gson.JsonObject.get(String)" is null

Formatted:

{
    "type": "malum:spirit_infusion",
    "input": {
        "item": "ars_nouveau:relay"
    },
    "output": {
        "item": "ars_nouveau:relay_collector"
    },
    "extra_items": [
        {
            "tag": "forge:chests",
            "count": 4
        }
    ],
    "spirits": [
        {
            "type": "infernal",
            "count": 3
        }, {
            "type": "arcane",
            "count": 6
        }, {
         "count": 2 //Here, "type" is missing.
        } 
    ]
}```
narrow ridgeBOT
#

Paste version of ars_nouveau.js, worldseed.js from @trim cloak

storm hollowBOT
#

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

trim cloak
#

Ok, I realized one change I did fixes this without needing to make the multiplier stuff, here's the fixed code.

narrow ridgeBOT
#

Paste version of ars_nouveau.js from @trim cloak

trim cloak
#

(with some code improvements)

trim cloak
#

Hey guess what it's happening agian aaaaaaaaaaaaaaaa

trim cloak
#

I'm just gonna rework this and call it a day :D