The-Nexus-Project / Limitless-3

Limitless 3 modpack maintained and developed by Gbergz.
11 stars 4 forks source link

Rogue Commas In KubeJS Script: hammer_andesite_to_rockpile3x.json #142

Closed r-mc2 closed 3 years ago

r-mc2 commented 3 years ago

Describe your issue, what happened?

Was watching my server console as it booted and noticed a KubeJS error go by. Went to check the file and there were indeed a few rogue commas preventing it from being parsed correctly.

Affected Version

Updated Script

Click to Show/Hide Updated Script
{ "type": "forge:conditional", "recipes": [
  {
    "conditions": [
      {
        "type": "engineerstools:optional",
        "result": "extcaves:rockpile_three_andesite",
        "requires": ["engineerstools:crushing_hammer", "minecraft:andesite"]
      }
    ],
    "recipe": {
      "type": "engineerstools:crafting_extended_shapeless",
      "group": "grit",
      "ingredients": [
        {
          "item": "minecraft:andesite"
        },
        {
          "item": "engineerstools:crushing_hammer"
        }
      ],
      "result": {
        "item": "extcaves:rockpile_three_andesite",
        "count": 12
      },
      "aspects": {
        "tool": "engineerstools:crushing_hammer",
        "tool_damage": 3
      }
    }
  },
  {
    "conditions": [
      {
        "type": "engineerstools:optional",
        "result": "extcaves:rockpile_three_andesite",
        "requires": ["engineerstools:crushing_hammer", "minecraft:andesite"]
      }
    ],
    "recipe": {
      "type": "engineerstools:crafting_extended_shapeless",
      "group": "grit",
      "ingredients": [
        {
          "item": "minecraft:andesite"
        },
        {
          "item": "engineerstools:crushing_hammer"
        }
      ],
      "result": {
        "item": "extcaves:rockpile_three_andesite",
        "count": 12
      },
      "aspects": {
        "tool": "engineerstools:crushing_hammer",
        "tool_damage": 3
      }
    }
  },
  {
    "conditions": [
      {
        "type": "engineerstools:optional",
        "result": "extcaves:rockpile_three_andesite",
        "requires": ["engineerstools:crushing_hammer", "minecraft:andesite", "extcaves:rockpile_three_andesite"]
      }
    ],
    "recipe": {
      "type": "engineerstools:crafting_extended_shapeless",
      "group": "grit",
      "ingredients": [
        {
          "item": "minecraft:andesite"
        },
        {
          "item": "engineerstools:crushing_hammer"
        }
      ],
      "result": {
        "item": "extcaves:rockpile_three_andesite",
        "count": 12
      },
      "aspects": {
        "tool": "engineerstools:crushing_hammer",
        "tool_damage": 3
      }
    }
  }
]}

(Was just the few commas after the item: "minecraft:andesite" lines in the ingredient lists)

Gbergz commented 3 years ago

This is normal.

r-mc2 commented 3 years ago

Forgive me as I am only new to this pack about a week ago, but normal in which meaning? Is this Kube recipe intended to be broken?

[07Mar2021 20:03:46.593] [Worker-Main4/ERROR] [net.minecraft.client.resources.JsonReloadListener/]: Couldn't parse data file engineerstools:crushing/rockpiles3x/hammer_andesite_to_rockpile3x from engineerstools:recipes/crushing/rockpiles3x/hammer_andesite_to_rockpile3x.json
com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Expected name at line 16 column 10 path $.recipes[0].recipe.ingredients[0].item
    at net.minecraft.util.JSONUtils.func_188173_a(SourceFile:495) ~[?:?]
    at net.minecraft.util.JSONUtils.func_193839_a(SourceFile:532) ~[?:?]
    at net.minecraft.client.resources.JsonReloadListener.func_212854_a_(JsonReloadListener.java:48) ~[?:?]
    at net.minecraft.client.resources.JsonReloadListener.func_212854_a_(JsonReloadListener.java:22) ~[?:?]
    at net.minecraft.client.resources.ReloadListener.func_215270_b(SourceFile:11) ~[?:?]
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source) [?:1.8.0_271]
    at java.util.concurrent.CompletableFuture$AsyncSupply.exec(Unknown Source) [?:1.8.0_271]
    at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) [?:1.8.0_271]
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source) [?:1.8.0_271]
    at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) [?:1.8.0_271]
    at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) [?:1.8.0_271]

In many cases dangling commas are desired in a JSON format, but the default JSON parser here is expecting a more "pure" syntax: image

Gbergz commented 3 years ago

It's not a KubeJS script it's just KubeJS detecting that in a datapack. It's an error but nothing pack breaking. I'll see if I can fix it.

Thanks for the report either way.

r-mc2 commented 3 years ago

Awesome, thank you! And I'd like to apologize if I came off too harsh before, I should have had that log and screenshot in my initial report, that was my bad.

Also good to know that's the name (datapack), I'm so used to seeing JSON and my brain just says "script" 😆