Can't get a datapack to work when creating a new condition (with logs)
RichardPaulAstley opened this issue ยท 3 comments
Hi,
So it's really noob, but i'm not sure if it's a fail from my end or if i'm doing something that breaks everything.
I'm quite new with datapacks, so bear with me haha.
I've a cobblemon map that I wanted to customize with BotanyPots. I downloaded a datapack. Works flawless. Then I wanted to add more Minecraft conditions. For the example i'm using diamond to be simple even if my final plans are quite differents.
Here's what i've done :
- data => botanypots => recipes. There were a cobblemon folder. I created a minecraft one.
- crop => diamond.json
{
"type": "botanypots:crop",
"seed": {
"item": "minecraft:diamond"
},
"categories": [
"dirt",
],
"growthTicks": 1200,
"display": {
"type": "botanypots:aging",
"block": "minecraft:wheat"
},
"drops": [
{
"chance": 1.00,
"output": {
"item": "minecraft:diamond"
},
"minRolls": 1,
"maxRolls": 2
},
]
}
The code. I used the example one with the new type to make it working.
When I run the game nothing. Cobblemon ones load fine.
I'm getting this error for the diamond one in the logs :
[01:34:23] [Worker-Main-4/ERROR]: Couldn't parse data file botanypots:minecraft/crop/diamond from botanypots:recipes/minecraft/crop/diamond.json com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 8 column 4 path $.categories[1]
But i can't find anything bad here ?
Any tip ?
Thanks o/
Hello @RichardPaulAstley I am not sure if I understand what you're trying to accomplish but I can see the issue with your file. JSON expects the file to be formatted in a very specific way so that it's easy for computers to read and process. In this case a comma ,
should only be used to indicate there is another entry directly afterwards. For example on line 7 you have "dirt",
which tells the program it should expect a second category. There are similar issues with the drops on line 22. If you're stuck you can use a website like JSONLint to validate your file and show you where the error is. Here is a corrected version of the file, however I would recommend trying to fix it yourself first.
{
"type": "botanypots:crop",
"seed": {
"item": "minecraft:diamond"
},
"categories": [
"dirt"
],
"growthTicks": 1200,
"display": {
"type": "botanypots:aging",
"block": "minecraft:wheat"
},
"drops": [
{
"chance": 1,
"output": {
"item": "minecraft:diamond"
},
"minRolls": 1,
"maxRolls": 2
}
]
}
Hi !
Thanks a lot for your answer. I feel so dumb right now. I fixed the second ,
in drops. But my eyes didn't see the one in the dirt part. Holy. And i deal with json too much these days.
Sorry it works !