This one command creation allows you to fly in any direction, even upwards, yes, when holding a specific item in the offhand slot.
How to install
How to import this command into your world
First, you must give yourself a command block (If you are on a server, you must be 'OP'ed, and have access to /gamemode 1)
To get a command block, type
/give @p command_block in the chat.
Once you have a command block, right click it to open it's GUI.
Now, you must copy and paste the command from your browser into the game. Select the entire command from below, then right click and press 'copy'.
Next, go back to your minecraft world, and paste the command you just copied into the command block. There are a few different keys that may be used to do this, depending on your keyboard. The most common ones are 'CTRL + V', 'COMMAND + V', or 'STRG + V'
Finally, you can press done to exit the GUI, and execute the command block by powering it with a redstone block, a lever, or any thing you can get your grubby hands on. Just make sure you don't place it on top of the command block, or the machine will not be installed!
Show source commands
INIT:/scoreboard objectives add Flying stat.aviateOneCm
INIT:/scoreboard objectives add Sneaking stat.sneakTime
INIT:/scoreboard objectives add FlyR dummy
INIT:/gamerule doMobLoot false
/execute @a ~ ~ ~ scoreboard players set @s FlyR 0
/execute @a ~ ~ ~ scoreboard players add @s FlyR 1 {Inventory:[{Slot:102b,id:"minecraft:elytra",Count:1b},{Slot:-106b,id:"minecraft:torch",Count:1b,tag:{display:{Name:"Flight Stick"}}}]}
/execute @a ~ ~ ~ scoreboard players add @s[score_Flying_min=1] FlyR 1
/execute @a ~ ~ ~ scoreboard players set @s Flying 0
/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}
/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}
/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}
/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}
/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}
/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}
/execute @a ~ ~ ~ scoreboard players set @s Sneaking 0
/kill @e[type=Cow]
INIT:/tellraw @a ["",{"text":"Infinite Elytra Flight Installed!","color":"green"},{"text":" Hold a stick in the offhand slot and use the elytra to fly. "},{"text":"You may see flickering cows, but that matters not.","color":"gold"},{"text":" If you ever lose the Stick, just rename a torch as a \""},{"text":"Flight Stick","color":"blue"},{"text":"\" and you're off again! "},{"text":"Have fun!","color":"aqua"}]
INIT:/give @a minecraft:elytra 1 0 {Unbreakable:1b}
INIT:/give @a minecraft:torch 1 0 {display:{Name:"Flight Stick"}}
summon falling_block ~ ~1 ~ {Block:stone,Time:1,Passengers:[{id:falling_block,Block:redstone_block,Time:1,Passengers:[{id:falling_block,Block:activator_rail,Time:1,Passengers:[{id:commandblock_minecart,Command:"gamerule commandBlockOutput false"},{id:commandblock_minecart,Command:"fill ~2 ~-3 ~-2 ~8 ~-1 ~2 stained_hardened_clay 12 hollow"},{id:commandblock_minecart,Command:"fill ~2 ~-2 ~-2 ~8 ~-2 ~2 stained_glass 10 0 stained_hardened_clay"},{id:commandblock_minecart,Command:"/scoreboard objectives add Flying stat.aviateOneCm"},{id:commandblock_minecart,Command:"/scoreboard objectives add Sneaking stat.sneakTime"},{id:commandblock_minecart,Command:"/scoreboard objectives add FlyR dummy"},{id:commandblock_minecart,Command:"/gamerule doMobLoot false"},{id:commandblock_minecart,Command:"/tellraw @a [\"\",{\"text\":\"Infinite Elytra Flight Installed!\",\"color\":\"green\"},{\"text\":\" Hold a stick in the offhand slot and use the elytra to fly. \"},{\"text\":\"You may see flickering cows, but that matters not.\",\"color\":\"gold\"},{\"text\":\" If you ever lose the Stick, just rename a torch as a \\\"\"},{\"text\":\"Flight Stick\",\"color\":\"blue\"},{\"text\":\"\\\" and you're off again! \"},{\"text\":\"Have fun!\",\"color\":\"aqua\"}]"},{id:commandblock_minecart,Command:"/give @a minecraft:elytra 1 0 {Unbreakable:1b}"},{id:commandblock_minecart,Command:"/give @a minecraft:torch 1 0 {display:{Name:\"Flight Stick\"}}"},{id:commandblock_minecart,Command:"setblock ~1 ~-3 ~ wall_sign 4 0 {Text1:\"{\\\"text\\\":\\\"\\\"}\",Text2:\"{\\\"text\\\":\\\"Destroy\\\",\\\"color\\\":\\\"red\\\"}\",Text3:\"{\\\"text\\\":\\\"Machine\\\",\\\"color\\\":\\\"red\\\"}\",Text4:\"{\\\"text\\\":\\\"\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"fill ~ ~ ~-2 ~7 ~2 ~2 air\\\"}}\"}"},{id:commandblock_minecart,Command:"setblock ~1 ~-2 ~ wall_sign 4 0 {Text1:\"{\\\"text\\\":\\\"\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"scoreboard players add @e[type=armor_stand,name=TogAct,c=1] sr4ioS_A 1\\\"}}\",Text2:\"{\\\"text\\\":\\\"Activate/\\\",\\\"color\\\":\\\"green\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"execute @e[score_sr4ioS_A_min=1,score_sr4ioS_A=1] ~ ~ ~ blockdata ~ ~ ~ {auto:0}\\\"},\\\"italic\\\":true}\",Text3:\"{\\\"text\\\":\\\"Deactivate\\\",\\\"color\\\":\\\"red\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"execute @e[score_sr4ioS_A_min=2] ~ ~ ~ blockdata ~ ~ ~ {auto:1}\\\"},\\\"italic\\\":true}\",Text4:\"{\\\"text\\\":\\\"\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"scoreboard players reset @e[score_sr4ioS_A_min=2] sr4ioS_A\\\"}}\"}"},{id:commandblock_minecart,Command:"summon armor_stand ~3 ~-2 ~-1 {CustomName:TogAct,Marker:1,NoGravity:1,Invisible:1}"},{id:commandblock_minecart,Command:"scoreboard objectives add sr4ioS_A dummy"},{id:commandblock_minecart,Command:"fill ~3 ~-2 ~-1 ~7 ~-2 ~1 chain_command_block 5"},{id:commandblock_minecart,Command:"setblock ~3 ~-2 ~ chain_command_block 3"},{id:commandblock_minecart,Command:"fill ~7 ~-2 ~ ~4 ~-2 ~ chain_command_block 4"},{id:commandblock_minecart,Command:"setblock ~7 ~-2 ~-1 chain_command_block 3"},{id:commandblock_minecart,Command:"setblock ~3 ~-2 ~-1 repeating_command_block 5"},{id:commandblock_minecart,Command:"blockdata ~4 ~-2 ~1 {auto:1,Command:\"/kill @e[type=Cow]\"}"},{id:commandblock_minecart,Command:"blockdata ~3 ~-2 ~1 {auto:1,Command:\"/execute @a ~ ~ ~ scoreboard players set @s Sneaking 0\"}"},{id:commandblock_minecart,Command:"blockdata ~3 ~-2 ~ {auto:1,Command:\"/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}\"}"},{id:commandblock_minecart,Command:"blockdata ~4 ~-2 ~ {auto:1,Command:\"/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}\"}"},{id:commandblock_minecart,Command:"blockdata ~5 ~-2 ~ {auto:1,Command:\"/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}\"}"},{id:commandblock_minecart,Command:"blockdata ~6 ~-2 ~ {auto:1,Command:\"/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}\"}"},{id:commandblock_minecart,Command:"blockdata ~7 ~-2 ~ {auto:1,Command:\"/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}\"}"},{id:commandblock_minecart,Command:"blockdata ~7 ~-2 ~-1 {auto:1,Command:\"/execute @a[score_FlyR_min=2,score_Sneaking=0] ~ ~ ~ /summon cow ~ ~-0.2 ~ {NoGravity:1b,Invulnerable:1,Health:1.0f,NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:20000,ShowParticles:0b}]}\"}"},{id:commandblock_minecart,Command:"blockdata ~6 ~-2 ~-1 {auto:1,Command:\"/execute @a ~ ~ ~ scoreboard players set @s Flying 0\"}"},{id:commandblock_minecart,Command:"blockdata ~5 ~-2 ~-1 {auto:1,Command:\"/execute @a ~ ~ ~ scoreboard players add @s[score_Flying_min=1] FlyR 1\"}"},{id:commandblock_minecart,Command:"blockdata ~4 ~-2 ~-1 {auto:1,Command:\"/execute @a ~ ~ ~ scoreboard players add @s FlyR 1 {Inventory:[{Slot:102b,id:\\\"minecraft:elytra\\\",Count:1b},{Slot:-106b,id:\\\"minecraft:torch\\\",Count:1b,tag:{display:{Name:\\\"Flight Stick\\\"}}}]}\"}"},{id:commandblock_minecart,Command:"blockdata ~3 ~-2 ~-1 {auto:1,Command:\"/execute @a ~ ~ ~ scoreboard players set @s FlyR 0\"}"},{id:commandblock_minecart,Command:"setblock ~ ~ ~1 command_block 0 0 {Command:\"fill ~ ~-3 ~-1 ~ ~ ~ air\"}"},{id:commandblock_minecart,Command:"setblock ~ ~-1 ~1 redstone_block"},{id:commandblock_minecart,Command:"kill @e[type=commandblock_minecart,r=1]"}]}]}]}