RockinChaos / ItemJoin

Get custom items on join.
https://www.craftationgaming.com/
GNU Lesser General Public License v3.0
137 stars 35 forks source link

Assistance with NBT #549

Open labmonjos opened 11 months ago

labmonjos commented 11 months ago

Server Version

paper 1.20.1 build 169

Resource Version

6.0.2

Dump Information

https://pastebin.com/j2WPhBMn

Describe The Problem

I need help creating a NBT tag for the following vanilla tag: CanDestroy

The behavior i'm seeing is that Itemjoin doesnt like brackets in it's properties field. This particular tag requires brackets to look like the following: tag: {CanDestroy: ["minecraft:dirt"]}

since this doesnt work, the whole tag disappears from ./data get entity @s BUT modifying the properties field to say: 'eebydeeby: ["minecraft:dirt"]' (even though this is wrong) shows that an extra pair of ' is added when doing a /data get entity @s.

Is there a way to format this properly?

Additional Context

No response

Checklist

labmonjos commented 11 months ago

The current config: image

the eebydeeby: image

I have tried the following for 'properties' with no success: CanDestroy:dirt CanDestroy:["minecraft:dirt"] CanDestroy:"minecraft:dirt" CanDestroy:"dirt"

labmonjos commented 11 months ago

I was able to work around this by not used the 'properties' field but instead using a repeating command block and a datapack with a item_modifiers json file:

Command block: execute as @a[nbt={Inventory: [{tag: {"ItemJoin Name": "master-shovel"}}]},nbt=!{Inventory: [{tag: {"ItemJoin Name": "master-shovel", CanDestroy: ["minecraft:snow_block"]}}]}] run item modify entity @s hotbar.0 lobbykit:mastershovel

mastershovel.json file in datapacks\lobbykit\data\lobbykit\item_modifiers

{
  "function": "minecraft:set_nbt",
  "tag": "{CanDestroy:[\"minecraft:snow_block\"]}"
}

These two steps will force the CanDestroy tag on slot0 if the name of the itemjoin name is what you set up in the items.yml file (and will do it once). Kinda janky but it works. let me know if theres a more elegant way to do this thru the plugin's config. Otherwise close as solved?

image

RockinChaos commented 2 months ago

I apologize for taking so long to respond to this issue, I had done some testing previously but couldn't figure out why it wasn't functioning properly.

It turns out this type of NBT data is on a different "branch" (list) than where I set the custom nbt data so it's a bit different than custom properties.

I will need to move this to a feature request.

Again I apologize for being so slow on this.