How do I test for two items in one Command Block?

I want to test for two items in one Command Block. I tried this command:

execute if entity @e[type=item,dx=-2,dy=6,dz=-2,nbt={Item:{id:"minecraft:quartz"}}]

That is for just one item. How do I add a second one?


Add another if clause to your /execute:

execute
  if entity @e[type=item,dx=-2,dy=6,dz=-2,nbt={Item:{id:"minecraft:quartz"}}]
  if entity @e[type=item,dx=-2,dy=6,dz=-2,nbt={Item:{id:"minecraft:gold_block"}}]
run …