Adding NBT tags into Scriptcraft
nanocodex opened this issue ยท 2 comments
If I wanted to summon a skeleton wearing an iron helmet with Fire Protection 2 that could pick up loot using vanilla Minecraft 1.15.1 commands, I would type something like this :
/summon minecraft:skeleton ~ ~1 ~ {CanPickUpLoot:1b,ArmorItems:[{},{},{},{id:"minecraft:iron_helmet",Count:1,tag:{Enchantments:[{id:fire_protection,lvl:2}]}}]}
And if I wanted to give myself a custom head with a custom texture applied to it in the same version, I would type something like this :
/give @p minecraft:player_head{display:{display:{Name:"{\"text\":\"nanocode's head\"}"}},SkullOwner:{Id:"11f6d4f9-05f6-4770-9dd1-509bf16f2a6b",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWUxM2M1MmViNzBkZmY0Njc5ZTM5OGY3N2M3MDFhZGNiOTVjOThiN2ZhMWYwYjI0YzFmNTRiNTNkMWUzYzExNyJ9fX0="}]}}} 1
Is it possible to do this using Scriptcraft as well?
Yes it is. I did it just now in Magikcraft to check it, and it works.
There are two ways to do it in Scriptcraft code.
One is to call the Bukkit API method to spawn a new entity.
The other way to do it is to call the Bukkit API method to execute a command on the server.