Minecraft – How to make an enderdragon in a minecart face west instead of north

minecraft-commandsminecraft-java-edition

I'm making a fantasy place in Minecraft and I want the dragons to be facing the castle, but they're facing to the right of the castle instead of the front.

I've used the Enderdragon in a minecart trick but I don't know how to make it face the right way. How do I change the direction the dragon is facing?

Best Answer

The Rotation NBT tag must be edited to change this:

/summon ender_dragon ~ ~ ~ {Rotation:[yRot,xRot],NoAI:1}

In your case:

/summon ender_dragon ~ ~ ~ {Rotation:[0f,270f],NoAI:1} 

This command will summon a dragon facing straight west. Other increments of 90 will give one of the remaining cardinal directions. Changing yRot changes the up/down angle.
If you already have a spawned Ender dragon, you can edit its NBT by the entitydata command:

/entitydata @e[type=ender_dragon,limit=1,sort=nearest] {Rotation:[0f,270f]}