/summon FallingSand ~ ~1 ~ {Block:redstone_block,Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:fill ~ ~0 ~1 ~ ~-8 ~1 redstone_block},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:setblock ~ ~3 ~1 stone},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:setblock ~ ~4 ~ command_block 0 replace {Command:fill ~ ~2 ~ ~ ~-12 ~1 air}},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:/summon FallingSand ~2 ~ ~-1 {Block:command_block,TileEntityData:{Command:execute @e[type=Item,score_MagicSeed_min=1] ~ ~ ~ detect ~ ~-1 ~ dirt 2 kill @e[type=Item,score_MagicSeed_min=1,r=1]},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:execute @e[type=Item,score_MagicSeed_min=1] ~ ~ ~ detect ~ ~-1 ~ dirt 2 summon Bat ~ ~-1 ~ {CustomName:"Beanstalk",Invulnerable:1b}},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:execute @e[type=Item,score_MagicSeed_min=1] ~ ~ ~ detect ~ ~-1 ~ dirt 2 summon Bat ~ ~-1 ~ {CustomName:"Beanstalk",Invulnerable:1b}},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:execute @e[type=Item,score_MagicSeed_min=1] ~ ~ ~ detect ~ ~-1 ~ dirt 2 summon Bat ~ ~-1 ~ {CustomName:"Beanstalk",Invulnerable:1b}},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:scoreboard objectives add MagicSeed dummy},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:tp @e[type=Bat,name=Beanstalk] ~ ~0.23 ~},Time:1,}}}}}}},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:/summon FallingSand ~2 ~ ~1 {Block:command_block,TileEntityData:{Command:execute @e[type=Item,score_MagicSeed_min=1] ~ ~ ~ detect ~ ~-1 ~ dirt 2 summon Bat ~ ~-1 ~ {CustomName:"Beanstalk",Invulnerable:1b}},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:execute @e[type=Item,score_MagicSeed_min=1] ~ ~ ~ detect ~ ~-1 ~ dirt 2 summon Bat ~ ~-1 ~ {CustomName:"Beanstalk",Invulnerable:1b}},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:effect @e[type=Bat,name=Beanstalk] minecraft:invisibility 1 0 true},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:scoreboard players set @e[type=Item] MagicSeed 1 {Item:{id:"minecraft:melon_seeds"}}},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:execute @e[type=Bat,name=Beanstalk] ~ ~ ~ setblock ~ ~ ~ leaves 3 replace air},Time:1,}}}}}},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:gamerule commandBlockOutput false},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:fill ~2 ~-2 ~ ~2 ~4 ~ redstone_block},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:setblock ~2 ~-1 ~-1 command_block 0 replace {Command:fill ~ ~ ~1 ~ ~6 ~1 stone 0 replace redstone_block}},Time:1,Riding:{id:FallingSand,Block:command_block,TileEntityData:{Command:setblock ~2 ~ ~1 command_block 0 replace {Command:fill ~ ~ ~-1 ~ ~6 ~-1 redstone_block 0 replace stone}},Time:1,Riding:{id:FallingSand,Block:stone,Time:1}}}}}}}}}}}