Minecraft testforblock command problem

minecraft-commandsminecraft-java-edition

I need help specifying a command! Right now I have the following command:

/testforblock -565 18 -1357 chest 3 {Items:[{id:sapling}]} 

How can I specify the sapling to a dark oak sapling? Also once it found the sapling how can I remove only 1 sapling from the chest?

Best Answer

Saplings use the Damage tag to store their type. Dark Oak's value is 5 and Damage is a short type, hence the s.

This command should test for a dark oak sapling in the chest.

/testforblock -565 18 -1357 chest 3 {Items:[{id:"sapling", Damage:5s}]}