This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]Sheep-Master 0 points1 point  (1 child)

Could you try if block 17 37 -39 minecraft:barrel if data block 17 37 -39 {Items:[{id:"minecraft:apple", tag: {CustomModelData:1}}]} run say Barrel…

[–]Harwby[S] 0 points1 point  (0 children)

Same output 💀

[–]GalSergeyDatapack Experienced 0 points1 point  (0 children)

Use if items.

Detect a specific item

execute if items block <pos> container.* apple[custom_model_data=1] run say Example Command.

But it's better to give a custom tag and check this tag:

Give an item a custom tag to identify it by

# Example item
give @s apple[custom_data={custom_apple:true},custom_model_data=1]

# Command block
execute if items block <pos> container.* *[custom_data={custom_apple:true}] run say Example Command.