Ma Essentials

Ma Essentials

2M Downloads

Help with giving a book using /kit?

katubug opened this issue · 4 comments

commented

Hi, this isn't a bug report per se because I think the issue is just with me. I want my players to start with a handful of items, and wanted to give them a book explaining what each item does. However, I can't seem to figure out how to get the NBT to work properly.

I used a generator to create a command to give me the book, so I have the item correctly. Then I used CraftTweaker's /ct hand function to copy the item with NBT to the clipboard. I then pasted just the NBT portion into the config and escaped all the quotation marks with single slashes, but I still seem to be doing something wrong.

Here's an excerpt from the JSON:

{
          "name": "minecraft:written_book",
          "quantity": 1,
          "nbt": ".withTag({pages: [\"{\"extra\":[{\"text\":\"Welcome, weary traveler!\\n\\nYou may use your new \"},{\"color\":\"red\",\"text\":\"Sleeping Bag\"},{\"color\":\"reset\",\"text\":\" to pass the night without setting your spawn point.\\n\\nThe \"},{\"color\":\"dark_green\",\"text\":\"Recall Potion\"},{\"color\":\"reset\",\"text\":\" is a single-use item that returns you to World Spawn instantly.\"}],\"text\":\"\"}\" as string, \"{\"extra\":[{\"text\":\"The \"},{\"color\":\"dark_purple\",\"text\":\"Teleport Potion\"},{\"color\":\"reset\",\"text\":\" is a single-use item which will bring you to a random point in the world, to help you discover new places!\\n\\nThe \"},{\"color\":\"blue\",\"text\":\"Ring of Teleport\"},{\"color\":\"reset\",\"text\":\" will allow you to set your home and access it at any time. View the item for usage details.\"}],\"text\":\"\"}\" as string], title: \"Welcome\" as string, author: \"Utak the great\" as string, display: {Lore: [\"Click this to learn important things.\" as string]}, resolved: 1})"
        }

And the error I get is:

[15:59:26] [Server thread/ERROR]: maessentials com.mojang.brigadier.exceptions.CommandSyntaxException: Unknown item 'minecraft:written_book.with' at position 0: <--[HERE]
[15:59:26] [Server thread/ERROR]: maessentials Failed to load kits!
[15:59:26] [Server thread/ERROR]: maessentials com.google.gson.JsonParseException: Failed to parse item for kit. Item: {"name":"minecraft:written_book","quantity":1,"nbt":".withTag({pages: [\"{\"extra\":[{\"text\":\"Welcome, weary traveler!\\n\\nYou may use your new \"},{\"color\":\"red\",\"text\":\"Sleeping Bag\"},{\"color\":\"reset\",\"text\":\" to pass the night without setting your spawn point.\\n\\nThe \"},{\"color\":\"dark_green\",\"text\":\"Recall Potion\"},{\"color\":\"reset\",\"text\":\" is a single-use item that returns you to World Spawn instantly.\"}],\"text\":\"\"}\" as string, \"{\"extra\":[{\"text\":\"The \"},{\"color\":\"dark_purple\",\"text\":\"Teleport Potion\"},{\"color\":\"reset\",\"text\":\" is a single-use item which will bring you to a random point in the world, to help you discover new places!\\n\\nThe \"},{\"color\":\"blue\",\"text\":\"Ring of Teleport\"},{\"color\":\"reset\",\"text\":\" will allow you to set your home and access it at any time. View the item for usage details.\"}],\"text\":\"\"}\" as string], title: \"Welcome\" as string, author: \"Utak the great\" as string, display: {Lore: [\"Click this to learn important things.\" as string]}, resolved: 1})"}

Sorry if this is a silly question, but I am very new to this version and I'm still learning NBT syntax in general, much less JSON. xD Thanks for your time!

commented

Oh uh, I didn't mean to add that label. I guess saying "bug" in the initial post triggered an auto label xD

commented

I'll soon add GUI creator for kits and it should be much easier.

commented
commented

On 1.16 but you will be able to copy kit file to 1.15 and it will work.