How do I spawn a zombie with an item from a mod?
I'm trying to get every achievement related to the Inventory Pets mod but I need to kill a player holding a specific item from that mod, Is there any way I could spawn a zombie holding this item? I've already tried
/summon zombie ~ ~1 ~ {HandItems:[{id:inventorypets:cobblestone_pet}
but that returns
Data tag parsing failed: Expected '}' but got ':' at: {HandItems:[{id:inventorypets:<--[HERE]
Is there any way I could make this work?
Solution 1:
You need to put quotes around your string:
/summon zombie ~ ~1 ~ {HandItems:[{id:"inventorypets:cobblestone_pet"}]}
Since your value had a colon :
, which is a non-alphanumeric character and not an underscore (_
), it is not assumed to be a string. To make the entire thing a string, quotes must be added. Otherwise, Minecraft stops reading the string at the second colon, being invalid because it expects a comma ,
to start the next key-value pair.
It thinks the colon is something entirely different, so you have to tell it that that is part of your string by adding the quote marks.