TransWikia.com

How to test for a named item in an item frame? (1.16.1)

Arqade Asked by Firal on September 5, 2020

I want to make a 7×7 jigsaw puzzle. I want to know how I can use /execute (or a different command) to check for a filled map named Map#26 in an item frame at coordinates (-26, 74 -100).

Edit: Okay so, I changed locations.

execute if entity @e[type=minecraft:item_frame,nbt={Item:{id:"minecraft:filled_map"}}] run say jeff

The command above executes if there is a filled map in an item frame anywhere. Once there is a map in an item frame it will say jeff.

What I am trying to figure out is a command that executes if there is a named filled map in an item frame at a specific item frame. Once there is a map in that item frame the command will say joe."

For an example

execute if there is an item frame with a filled map named Map#24 at -26, 74, -100 run say joe.

Edit: Some success has been made with this command.

execute if entity @e[type=minecraft:item_frame,nbt={Item:{id:"minecraft:filled_map",tag:{display:{Name:'{"text":"Map#24"}'}}}}] run say jeff

The command above says jeff if there is a map named Map#24 in an item frame. The thing is, that item frame can be anywhere. So far, the only what I have tried is this command:

execute if entity @e[x=-39.5,y=63.5,z=21.96875,type=minecraft:item_frame,nbt={Item:{id:"minecraft:filled_map",tag:{display:{Name:'{"text":"Map#24"}'}}}}] run say jeff

But this command didn’t work for a specific location. Please help, thank you.

One Answer

NBT is your best friend here.

Detecting item frame position

Don’t try using the target selector arguments x, y, and z. These could have decimal parts and will definitely not work.

Instead, use the NBT tags TileX, TileY, and TileZ. These represent a block location and are integers.

/execute if entity @e[type=item_frame,nbt={TileX:12,TileY:23,TileZ:34}] run say Item frame in correct position.

Correct answer by ExpertCoder14 on September 5, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP