Minecraft wiki entry for Defeating_the_ender_dragon, associated text: The sword (ideally diamond or netherite) is used to damage the dragon on its perch as it is immune to arrows at this time. A secondary use is for provoked endermen.