#Saving storage
1 messages · Page 1 of 1 (latest)
if the shulker box is deleted, how will the player place it again?
like - does the item drop? Are all shulker boxes of a certain color linked?
it's a datapack with magic wands, one of the abilities places down a "Null Storage" (the shulker box)
ah okay, then it's probably easiest to store the item's in the wand item
how would I do that?
If a player casts the spell
- summon a marker at that location
- setblock a shulker box
- copy the contents from your wand item to the shulker box using data modify (empty on the first go)
If the player leaves the vicinity of the shulker box (probably easiest to track with id) - copy the contents of the box into the item using an item modifier
- also break the shulker box
- you might have to kill the shulker box item that drops (not sure)
- then you kill the marker
what's the command for storing/putting in the items
im not good with the data command
copying from item to shulker box, executed as the player with the wand in the mainhand and at the shulker box
data modify block ~ ~ ~ Items set from entity @s SelectedItem.tag.<NAMESPACE>.Items
copying items from the box to the player, again as player and at box
the commands:
item modify entity @s weapon.mainhand <YOUR_ITEM_MODIFIER>
the item modifier (<YOUR_ITEM_MODIFIER>) is something like:
{
"function": "minecraft:copy_nbt",
"source": "block_entity",
"ops": [
{
"source": "Items",
"target": "<NAMESPACE>.Items",
"op": "replace"
}
]
}
so yea, it's just copying. Both are doing the same in reverse - it's just more complicated doing it for players since we can't edit their NBT directly