Hello, i have some troubles to add NBT Tags as custom as I woud like...
For instant with the procedure system you are able to add Boolean, String or number NBTags but i didnt find any soluce/tricks to generate an Array of string inside an NBTags....
The goal would be to make an equivalent of the command when the user craft a new pickaxe, to set the CanDestroy Tag to an array of string with all the blocks that he can destroy. (for adventure mod). When you use command below, there is not trouble but when i try to make it with your procedures or with my own code, it doesn't work...
/give PLAYER minecraft:diamond_pickaxe{CanDestroy:["mod:specialblock"]} 1
On the minecraft.gamepedia page, i didn't find anything about a tag for array of string (same in forge source code)... So i don't know if it would be possible to add a feature to make those NBTags. And for the moment, would someone be able to help me how to handle this issue? I'll continue to try and find soluce and responses. But last night and couple of hours today made me be so mad. :D
Issue comments
This plugin might help you in the meantime: https://mcreator.net/forum/60135/plugin-hashmaps
I tried to use the plugin but the porblem is that in the best case (when I replace the code that the export send back as string) is that in any case, the result is a string and not an array. And about the related issue, it's not the same question... I'm trying to find a way to put an array to an NBT tag and not simply to use it in procedure.
So it give ingame NBT like this: {CanDestroy: "["elem1","elem2"]"}
Instead of {CanDestroy: ["elem1","elem2"]}
(So the same result that when i tried by my self to put a string or anything like it inside.
And this change everything about how minecraft understant it... Any tips or recommandation?
OKay, i found a soluce which was not so complicated... --' just not used to develop on minecraft (and/or with the Forge API)
Those 4 lines are enough to make exactly what i was looking for. I only need to put it in the onCreated event (or in a procedure called from this event and everything is fine...)
ListNBT list = new ListNBT();
StringNBT st = StringNBT.valueOf("eyatsu:test_block");
list.add(st);
(itemstack).getOrCreateTag().put("CanDestroy", list);
To properly implement this in the procedure editor, this ticket still depends on array support in procedures to properly support this, though. https://mcreator.net/tracker/issue/48235
Migrated to https://github.com/MCreator/MCreator/issues/109
If you need something like this for a command, you can assemble this using strings.
Complete array support is planned for the future updates too: https://mcreator.net/tracker/issue/48235