MrGarretto's One-Command Creations

Giving the modded minecraft feeling to vanilla

Cannons command (1.10.2)
About this command
This command adds a new block to the game, cannons! They can launch 2 different tiers of cannonballs! Watch the video below for crafting recipes and instructions on how to use the cannons in your own world!
Show source commands

INIT:/scoreboard objectives add CA_Block dummy
INIT:/scoreboard objectives add CA_Pickup dummy
INIT:/scoreboard objectives add CA_Core dummy
INIT:/scoreboard objectives add CA_Shoot dummy
INIT:/scoreboard objectives add CA_Explode dummy
INIT:/scoreboard objectives add CA_Invalid dummy
INIT:/tellraw @a [{"color":"green","bold":true,"text":"The Cannons "},{"color":"dark_aqua","text":"command block module has been "},{"color":"green","bold":true,"text":"installed!"}]
INIT:/tellraw @a [{"color":"dark_aqua","text":"Command created by "},{"color":"green","bold":true,"text":"MrGarretto"}]
INIT:/tellraw @a [{"text":"Click here for all crafting recipes and instructions!","color":"dark_aqua","italic":"true","clickEvent":{"action":"open_url","value":"https://youtu.be/TxT-oJttMMU"}}]
# Crafting the cannon
/scoreboard players set @e[type=Item] CA_Block 1 {Item:{id:"minecraft:dispenser"}}
/scoreboard players set @e[type=Item] CA_Block 2 {Item:{id:"minecraft:hopper"}}
/scoreboard players set @e[type=Item] CA_Block 3 {Item:{id:"minecraft:string"}}
/scoreboard players set @e[type=Item] CA_Block 4 {Item:{id:"minecraft:tnt"}}
/scoreboard players set @e[type=Item] CA_Block 5 {Item:{id:"minecraft:iron_ingot"}}
/scoreboard players set @e[type=Item] CA_Block 6 {Item:{id:"minecraft:firework_charge",tag:{display:{Name:"Cannonball"}}}}
/scoreboard players set @e[type=Item] CA_Block 7 {Item:{id:"minecraft:fire_charge",tag:{display:{Name:"FragmentationCannonball"}}}}
/execute @e[score_CA_Block_min=4,score_CA_Block=4] ~ ~ ~ execute @e[score_CA_Block_min=6,score_CA_Block=6,r=1,c=1] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:fire_charge",Count:1,tag:{display:{Name:"FragmentationCannonball"}}}}
/execute @e[score_CA_Block_min=4,score_CA_Block=4] ~ ~ ~ execute @e[score_CA_Block_min=6,score_CA_Block=6,r=1,c=1] ~ ~ ~ kill @e[score_CA_Block_min=4,score_CA_Block=6,r=3]
/execute @e[score_CA_Block_min=4,score_CA_Block=4] ~ ~ ~ execute @e[score_CA_Block_min=5,score_CA_Block=5,r=1,c=1] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:firework_charge",Count:4,tag:{display:{Name:"Cannonball"}}}}
/execute @e[score_CA_Block_min=4,score_CA_Block=4] ~ ~ ~ execute @e[score_CA_Block_min=5,score_CA_Block=5,r=1,c=1] ~ ~ ~ kill @e[score_CA_Block_min=4,score_CA_Block=5,r=3]
/execute @e[score_CA_Block_min=1,score_CA_Block=1] ~ ~ ~ execute @e[score_CA_Block_min=2,score_CA_Block=2,r=1,c=1] ~ ~ ~ execute @e[score_CA_Block_min=3,score_CA_Block=3,r=1,c=1] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:spawn_egg",Count:1,tag:{EntityTag:{id:Silverfish},display:{Name:"Cannon"}}}}
/execute @e[score_CA_Block_min=1,score_CA_Block=1] ~ ~ ~ execute @e[score_CA_Block_min=2,score_CA_Block=2,r=1,c=1] ~ ~ ~ execute @e[score_CA_Block_min=3,score_CA_Block=3,r=1,c=1] ~ ~ ~ particle smoke ~ ~ ~ 0 0 0 0.05 500
/execute @e[score_CA_Block_min=1,score_CA_Block=1] ~ ~ ~ execute @e[score_CA_Block_min=2,score_CA_Block=2,r=1,c=1] ~ ~ ~ execute @e[score_CA_Block_min=3,score_CA_Block=3,r=1,c=1] ~ ~ ~ execute @a[r=12] ~ ~ ~ playsound mob.chicken.plop @a ~ ~ ~ 1 1
/execute @e[score_CA_Block_min=1,score_CA_Block=1] ~ ~ ~ execute @e[score_CA_Block_min=2,score_CA_Block=2,r=1,c=1] ~ ~ ~ execute @e[score_CA_Block_min=3,score_CA_Block=3,r=1,c=1] ~ ~ ~ execute @a[r=12] ~ ~ ~ playsound random.fizz @a ~ ~ ~ 1 1
/execute @e[score_CA_Block_min=1,score_CA_Block=1] ~ ~ ~ execute @e[score_CA_Block_min=2,score_CA_Block=2,r=1,c=1] ~ ~ ~ execute @e[score_CA_Block_min=3,score_CA_Block=3,r=1,c=1] ~ ~ ~ kill @e[score_CA_Block_min=1,score_CA_Block=3,r=3]
# Placing the cannon
/scoreboard players add @e[type=Silverfish] CA_Invalid 0
/execute @a ~ ~ ~ execute @e[type=ArmorStand,name=CannonPart] ~ ~ ~ scoreboard players set @e[type=Silverfish,r=2,score_CA_Invalid=0] CA_Invalid 1
/execute @e[type=Silverfish,score_CA_Invalid_min=1,score_CA_Invalid=1] ~ ~ ~ tellraw @p {color:red,text:"That cannon is too close to another one!"}
/execute @e[type=Silverfish,score_CA_Invalid_min=1,score_CA_Invalid=1] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:spawn_egg",Count:1,tag:{EntityTag:{id:Silverfish},display:{Name:"Cannon"}}}}
/tp @e[type=Silverfish,score_CA_Invalid_min=1,score_CA_Invalid=1] ~ ~-500 ~
/scoreboard players set @e[type=Silverfish,score_CA_Invalid_min=1] CA_Invalid 2
/scoreboard players
/execute @a[rym=46,ry=135] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~ ~ {Marker:1,Invisible:1,NoGravity:1,CustomName:"CAWest"}
/execute @a[rym=136,ry=-135] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~ ~ {Marker:1,Invisible:1,NoGravity:1,CustomName:"CANorth"}
/execute @a[rym=-134,ry=-45] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~ ~ {Marker:1,Invisible:1,NoGravity:1,CustomName:"CAEast"}
/execute @a[rym=-44,ry=45] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~ ~ {Marker:1,Invisible:1,NoGravity:1,CustomName:"CASouth"}
/scoreboard players set @e[name=CAWest,type=ArmorStand] CA_Core 1
/scoreboard players set @e[name=CANorth,type=ArmorStand] CA_Core 1
/scoreboard players set @e[name=CAEast,type=ArmorStand] CA_Core 1
/scoreboard players set @e[name=CASouth,type=ArmorStand] CA_Core 1
/execute @e[type=Silverfish,name=Cannon] ~ ~ ~ particle smoke ~ ~ ~ 0 0 0 0.05 500
/execute @e[type=Silverfish,name=Cannon] ~ ~ ~ summon ArmorStand ~ ~-1.349 ~ {CustomName:"CannonPart",Invisible:1,NoGravity:1,ArmorItems:[{},{},{},{id:cobblestone_wall,tag:{display:{Name:"CAPickup"}}}]}
/execute @e[type=Silverfish,name=Cannon] ~ ~ ~ summon ArmorStand ~ ~-0.8 ~ {CustomName:"CannonPart",Invisible:1,NoGravity:1,ArmorItems:[{},{},{},{id:stained_hardened_clay,Damage:9,tag:{display:{Name:"CAPickup"}}}]}
# Directional parts of the cannon
/execute @a[rym=46,ry=135] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~-0.6 ~-0.8 ~ {CustomName:"CannonPart",Invisible:1,NoGravity:1,ArmorItems:[{},{},{},{id:stained_hardened_clay,Damage:9,tag:{display:{Name:"CAPickup"}}}]}
/execute @a[rym=136,ry=-135] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~-0.8 ~-0.6 {CustomName:"CannonPart",Invisible:1,NoGravity:1,ArmorItems:[{},{},{},{id:stained_hardened_clay,Damage:9,tag:{display:{Name:"CAPickup"}}}]}
/execute @a[rym=-134,ry=-45] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~0.6 ~-0.8 ~ {CustomName:"CannonPart",Invisible:1,NoGravity:1,ArmorItems:[{},{},{},{id:stained_hardened_clay,Damage:9,tag:{display:{Name:"CAPickup"}}}]}
/execute @a[rym=-44,ry=45] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~-0.8 ~0.6 {CustomName:"CannonPart",Invisible:1,NoGravity:1,ArmorItems:[{},{},{},{id:stained_hardened_clay,Damage:9,tag:{display:{Name:"CAPickup"}}}]}
# Tip of the cannon
/execute @a[rym=46,ry=135] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~-1 ~ ~ {CustomName:"CannonPart",Invisible:1,Small:1,NoGravity:1,ArmorItems:[{},{},{},{id:stained_hardened_clay,Damage:9,tag:{display:{Name:"CAPickup"}}}]}
/execute @a[rym=136,ry=-135] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~ ~-1 {CustomName:"CannonPart",Invisible:1,Small:1,NoGravity:1,ArmorItems:[{},{},{},{id:stained_hardened_clay,Damage:9,tag:{display:{Name:"CAPickup"}}}]}
/execute @a[rym=-134,ry=-45] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~1 ~ ~ {CustomName:"CannonPart",Invisible:1,Small:1,NoGravity:1,ArmorItems:[{},{},{},{id:stained_hardened_clay,Damage:9,tag:{display:{Name:"CAPickup"}}}]}
/execute @a[rym=-44,ry=45] ~ ~ ~ execute @e[type=Silverfish,name=Cannon,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~ ~1 {CustomName:"CannonPart",Invisible:1,Small:1,NoGravity:1,ArmorItems:[{},{},{},{id:stained_hardened_clay,Damage:9,tag:{display:{Name:"CAPickup"}}}]}
/tp @e[type=Silverfish,name=Cannon] ~ ~-500 ~
# Removing the cannon
/scoreboard players reset @a CA_Pickup
/scoreboard players set @a CA_Pickup 1 {Inventory:[{tag:{display:{Name:"CAPickup"}}}]}
/clear @a[score_CA_Pickup_min=1] stained_hardened_clay 9 1 {display:{Name:"CAPickup"}}
/clear @a[score_CA_Pickup_min=1] cobblestone_wall 0 1 {display:{Name:"CAPickup"}}
/execute @a[score_CA_Pickup_min=1] ~ ~ ~ execute @e[score_CA_Core_min=1,c=1] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:spawn_egg",Count:1,tag:{EntityTag:{id:Silverfish},display:{Name:"Cannon"}}}}
/execute @a[score_CA_Pickup_min=1] ~ ~ ~ execute @e[score_CA_Core_min=1,c=1] ~ ~ ~ particle smoke ~ ~ ~ 0 0 0 0.05 500
/execute @a[score_CA_Pickup_min=1] ~ ~ ~ execute @e[score_CA_Core_min=1,c=1] ~ ~ ~ execute @a[r=12] ~ ~ ~ playsound mob.chicken.plop @a ~ ~ ~ 1 1
/execute @a[score_CA_Pickup_min=1] ~ ~ ~ execute @e[score_CA_Core_min=1,c=1] ~ ~ ~ kill @e[type=ArmorStand,c=5,r=4]
# Shooting the cannon
/scoreboard players reset @e CA_Shoot
/execute @e[score_CA_Block_min=6,score_CA_Block=6] ~ ~ ~ scoreboard players set @e[score_CA_Core_min=1,c=1,r=1] CA_Shoot 1
/execute @e[score_CA_Block_min=7,score_CA_Block=7] ~ ~ ~ scoreboard players set @e[score_CA_Core_min=1,c=1,r=1] CA_Shoot 2
/execute @e[score_CA_Shoot_min=1] ~ ~ ~ execute @a[r=12] ~ ~ ~ playsound random.break @a ~ ~ ~ 1 0.5
/execute @e[score_CA_Shoot_min=1,score_CA_Shoot=1] ~ ~ ~ kill @e[type=Item,score_CA_Block_min=6,score_CA_Block=6,r=3]
/execute @e[name=CAWest,score_CA_Shoot_min=1,score_CA_Shoot=1] ~ ~ ~ summon PrimedTnt ~ ~ ~ {Fuse:55,Motion:[-1.0,1.0,0.0]}
/execute @e[name=CANorth,score_CA_Shoot_min=1,score_CA_Shoot=1] ~ ~ ~ summon PrimedTnt ~ ~ ~ {Fuse:55,Motion:[0.0,1.0,-1.0]}
/execute @e[name=CAEast,score_CA_Shoot_min=1,score_CA_Shoot=1] ~ ~ ~ summon PrimedTnt ~ ~ ~ {Fuse:55,Motion:[1.0,1.0,0.0]}
/execute @e[name=CASouth,score_CA_Shoot_min=1,score_CA_Shoot=1] ~ ~ ~ summon PrimedTnt ~ ~ ~ {Fuse:55,Motion:[0.0,1.0,1.0]}
# Frag cannonballs
/execute @e[name=CAWest,score_CA_Shoot_min=2,score_CA_Shoot=2] ~ ~ ~ summon PrimedTnt ~ ~2 ~ {CustomName:"FragCannonball",Fuse:127,Motion:[-1.0,1.0,0.0]}
/execute @e[name=CANorth,score_CA_Shoot_min=2,score_CA_Shoot=2] ~ ~ ~ summon PrimedTnt ~ ~2 ~ {CustomName:"FragCannonball",Fuse:127,Motion:[0.0,1.0,-1.0]}
/execute @e[name=CAEast,score_CA_Shoot_min=2,score_CA_Shoot=2] ~ ~ ~ summon PrimedTnt ~ ~2 ~ {CustomName:"FragCannonball",Fuse:127,Motion:[1.0,1.0,0.0]}
/execute @e[name=CASouth,score_CA_Shoot_min=2,score_CA_Shoot=2] ~ ~ ~ summon PrimedTnt ~ ~2 ~ {CustomName:"FragCannonball",Fuse:127,Motion:[0.0,1.0,1.0]}
/execute @e[score_CA_Shoot_min=2,score_CA_Shoot=2] ~ ~ ~ kill @e[type=Item,score_CA_Block_min=7,score_CA_Block=7,r=3]
/scoreboard players set @e[name=FragCannonball] CA_Explode 1
/execute @e[name=FragCannonball] ~ ~ ~ detect ~ ~-1 ~ air 0 scoreboard players set @e[name=FragCannonball,c=0] CA_Explode 0
/execute @e[type=PrimedTnt,name=!FragCannonball] ~ ~ ~ kill @e[name=FragCannonball,c=1,r=6]
/execute @e[name=FragCannonball,score_CA_Explode_min=1] ~ ~ ~ summon PrimedTnt ~-1 ~ ~ {Fuse:8,Motion:[-0.4,0.3,0.0]}
/execute @e[name=FragCannonball,score_CA_Explode_min=1] ~ ~ ~ summon PrimedTnt ~ ~ ~-1 {Fuse:8,Motion:[0.0,0.3,-0.4]}
/execute @e[name=FragCannonball,score_CA_Explode_min=1] ~ ~ ~ summon PrimedTnt ~1 ~ ~ {Fuse:8,Motion:[0.4,0.3,0.0]}
/execute @e[name=FragCannonball,score_CA_Explode_min=1] ~ ~ ~ summon PrimedTnt ~ ~ ~1 {Fuse:8,Motion:[0.0,0.3,0.4]}

For Minecraft version 1.10.2
Click here for other versions of this command!
How to use
Give yourself a command block with /give @p command_block. Place it then paste the command from below into it. One command creations are similar to Minecraft mods, but are much easier to add to your world!
Click here for other versions of this command!