1

I am making a mini-game map, items will appear in invisible item frames. I'm going to use this command

/item replace entity @e[type=minecraft:item_frame,nbt=!{Item:{}},limit=1,sort=random] container.0 with minecraft:arrow

to fill random item frames with random items.

I would like to make these item frames unbreakable and able to take any item in it. Is there any chance to allow players only to take items in it, not to place it? How can I do that?

1 Answer 1

1

I'm pretty sure you can add the nbt tag of unbreakable:1b and that should stop it. I'm not currently able to fully verify this, though. Edit: you can get it working with execute as @e[type=minecraft:item_frame,nbt=!{Item:{id:"minecraft:INSERT ITEM HERE"}}] run data modify entity @s {Invulnerable:1b} to make it so you can remove the item and execute as @e[type=minecraft:item_frame,nbt={Item:{id:"minecraft:INSERT ITEM HERE"}}] run data modify entity @s {Invulnerable:0b} to make it breakable if there is an item in it. also they are both in repeating command blocks.

2
  • Definitely come back when you're able and give it a test to confirm the validity of this answer. :)
    – Spevacus
    Dec 13, 2022 at 23:03
  • Definitely feel free to edit that in. If it's a solution, it's definitely worthy of being in the answer's content, elegant or no.
    – Spevacus
    Dec 14, 2022 at 23:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .