2

I am kind of new to using command blocks (especially NBT tags) but i want a thrown item to follow me and i tried to make an item (stone) have passenger XPOrb but i kept getting unbalanced square brackets and curly brackets and the command block is confusing me. Here's the command :

summon Item ~ ~1 ~ {CustomName:"Bob",CustomNameVisible:1,Item:{id:stone,Count:1},PickupDelay:1000,{Passengers:[{id:"XPOrb"}]}

I believe its just the end bracket but when i activate the command block i get this error :

[13:13:30] Data tag parsing failed: Unbalanced brackets: {CustomName:"Bob",CustomNameVisible:1,Item:{id:stone,Count:1},PickupDelay:1000,{Passengers:[{id:"XPOrb"}]}

I am very confused but i understand the problem it's just that the fix isn't working. The command itself may even be corrupt for all i know.

  • 2
    Just one } at end. Btw. the entity will behave depending on the main entity, thus if you want to have it following as xp orb does, then the stone has to be passenger. However if you stop moving, you will probably eat it :D – Antoine Hejlík Dec 13 '16 at 12:33
  • 1
    XD Thanks ! I will probably turn the XpOrb into a hostile mob so it follows! – Reflexive Dec 13 '16 at 12:39
  • 5
    Does this answer your question? How can I fix "unbalanced brackets" in my data tag? – pppery Jun 18 at 16:24
3

You got it almost right, you just have a small syntax error. Here's how to find it. First, let's highlight it a bit:

enter image description here

Now, while the mistake may be visible, we will unroll the code, with each bracket ending at the same indent level as the opening bracket:

enter image description here

And here we see that an ending bracket is missing you have an unused { bracket just before Passengers:. Your code should be such:

summon Item ~ ~1 ~ {CustomName:"Bob",CustomNameVisible:1,Item:{id:stone,Count:1},PickupDelay:1000,Passengers:[{id:"XPOrb"}]}

Edit: As requested in the comments, here is the command (unfolded version), just with an invsible Zombie instead of a Item:

summon Zombie ~ ~1 ~ {CustomName:"Bob",CustomNameVisible:1,ActiveEffects:[{Id:14,Amplifier:1,Duration:999999}],Item:{id:stone,Count:1},PickupDelay:1000,Passengers:[{id:"XPOrb"}]}

To help find the error next time, you can use an online1 unfolding tool, eg. JSBeautifier. A online2 highlighter is also good to use, QuickHighliter suits this purpose very well.

Thanks to @Skylinerw for pointing out my mistake!


1, 2: Or, if you have, use an offline one for reliability.

| improve this answer | |
  • 1
    An unnamed compound was also opened before Passengers, breaking syntax. – Skylinerw Dec 13 '16 at 17:18
  • @user143228 thanks your answer really helped me understand it alot better. The sites that you suggested are something that i didnt think of and glad you told me they exist :D . – Reflexive Dec 13 '16 at 20:22
  • If you could tell me how to replace the item with an invisible zombie that would be handy (upwards comments are correct i ate it ). I have tried active effects and it keeps telling me that it cannot summon object . If not tthanks anyway :P – Reflexive Dec 13 '16 at 20:30
  • 1
    @CaolanMC Done, this command should work: summon Zombie ~ ~1 ~ {CustomName:"Bob",CustomNameVisible:1,ActiveEffects:[{Id:14,Amplifier:1,Duration:999999}],Item:{id:stone,Count:1},PickupDelay:1000,Passengers:[{id:"XPOrb"}]}. – RudolfJelin Dec 14 '16 at 12:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.