Minecraft – How to use /setblock to put down a flower pot with an Oxeye Daisy in it

minecraft-java-edition

I've been working a lot with DataValues and Entity IDs, doing mostly stuff with the /summon command, but i'm getting more into learning how to manipulate the world with Essentials and the Minecraft base commands. I'm trying to place a flowerpot with an Oxeye Daisy (or any flower) in it, but I can only seem to spawn in empty pots, or ones with dandelions, poppies or saplings. How do I put one down with /setblock?

Best Answer

The command to spawn in a flower pot with an Oxeye Daisy at your feet is:

/setblock ~ ~ ~ flower_pot 0 destroy {Item:38,Data:8}

A flower pot's plant is stored in an associated tile entity, which is described by the {stuff in curly braces}.

An Oxeye Daisy is block 38 with a data value of 8. Block 38 encompasses all one-block flowers except for Dandelions (which are 37 for historical reasons). Check the wiki for a hopefully up-to-date list on all the different values.

Planting other supported items works pretty much the same. For example, an Acacia Sapling would be:

{Item:6,Data:4}