INIT:/tellraw @a[r=300] {"color":"green","bold":true,"text":"The Spy Gear command has been installed!"}
INIT:/tellraw @a[r=300] {"color":"red","text":"Command by MrGarretto"}
INIT:/scoreboard objectives add SpGe_isCrawling dummy
INIT:/scoreboard objectives add SpGe_Crawl dummy
INIT:/scoreboard objectives add SpGe_PlayerTick dummy
INIT:/scoreboard objectives add SpGe_isLaser dummy
INIT:/scoreboard objectives add SpGe_Tick dummy
INIT:/scoreboard objectives add SpGe_Sneak stat.crouchOneCm
INIT:/scoreboard objectives add SpGe_Wear dummy
INIT:/scoreboard objectives add SpGe_RemLas dummy
INIT:/scoreboard objectives add SpGe_LasDet dummy
INIT:/scoreboard objectives add SpGe_Walk stat.walkOneCm
INIT:/scoreboard objectives add SpGe_I dummy
/scoreboard players set @e[type=Item] SpGe_I 1 {Item:{id:"minecraft:compass"},OnGround:1b}
/scoreboard players set @e[type=Item] SpGe_I 2 {Item:{id:"minecraft:leather_boots"},OnGround:1b}
/execute @e[score_SpGe_I_min=1,score_SpGe_I=1] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=2,score_SpGe_I=2] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:leather_boots",Count:1,tag:{display:{Name:"SpyBoots",color:8026746}}}}
/execute @e[score_SpGe_I_min=1,score_SpGe_I=1] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=2,score_SpGe_I=2] ~ ~ ~ particle smoke ~ ~ ~ 0 0 0 0.2 50
/execute @e[score_SpGe_I_min=1,score_SpGe_I=1] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=2,score_SpGe_I=2] ~ ~ ~ kill @e[type=Item,r=3,score_SpGe_I_min=1,score_SpGe_I=2]
/scoreboard players set @e[type=Item] SpGe_I 3 {Item:{id:"minecraft:dispenser"},OnGround:1b}
/scoreboard players set @e[type=Item] SpGe_I 4 {Item:{id:"minecraft:redstone"},OnGround:1b}
/execute @e[score_SpGe_I_min=3,score_SpGe_I=3] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=4,score_SpGe_I=4] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:spawn_egg",Count:1,tag:{EntityTag:{id:Silverfish},display:{Name:"LaserBeam"},ench:[{id:34,lvl:1}]}}}
/execute @e[score_SpGe_I_min=3,score_SpGe_I=3] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=4,score_SpGe_I=4] ~ ~ ~ particle smoke ~ ~ ~ 0 0 0 0.2 50
/execute @e[score_SpGe_I_min=3,score_SpGe_I=3] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=4,score_SpGe_I=4] ~ ~ ~ kill @e[type=Item,r=3,score_SpGe_I_min=3,score_SpGe_I=4]
/scoreboard players set @e[type=Item] SpGe_I 5 {Item:{id:"minecraft:coal"},OnGround:1b}
/scoreboard players set @e[type=Item] SpGe_I 6 {Item:{id:"minecraft:gunpowder"},OnGround:1b}
/execute @e[score_SpGe_I_min=5,score_SpGe_I=5] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=6,score_SpGe_I=6] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:spawn_egg",Count:1,tag:{EntityTag:{id:Skeleton},display:{Name:"FootprintDust"},ench:[{id:34,lvl:1}]}}}
/execute @e[score_SpGe_I_min=5,score_SpGe_I=5] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=6,score_SpGe_I=6] ~ ~ ~ particle smoke ~ ~ ~ 0 0 0 0.2 50
/execute @e[score_SpGe_I_min=5,score_SpGe_I=5] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=6,score_SpGe_I=6] ~ ~ ~ kill @e[type=Item,r=3,score_SpGe_I_min=5,score_SpGe_I=6]
/scoreboard players set @e[type=Item] SpGe_I 8 {Item:{id:"minecraft:string"},OnGround:1b}
/scoreboard players set @e[type=Item] SpGe_I 9 {Item:{id:"minecraft:lever"},OnGround:1b}
/execute @e[score_SpGe_I_min=8,score_SpGe_I=8] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=9,score_SpGe_I=9] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:spawn_egg",Count:1,tag:{EntityTag:{id:Squid},display:{Name:"SpyGrapple"},ench:[{id:34,lvl:1}]}}}
/execute @e[score_SpGe_I_min=8,score_SpGe_I=8] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=9,score_SpGe_I=9] ~ ~ ~ particle smoke ~ ~ ~ 0 0 0 0.2 50
/execute @e[score_SpGe_I_min=8,score_SpGe_I=8] ~ ~ ~ execute @e[r=1,score_SpGe_I_min=9,score_SpGe_I=9] ~ ~ ~ kill @e[type=Item,r=3,score_SpGe_I_min=8,score_SpGe_I=9]
# Spy Boots
/scoreboard players set @a SpGe_Wear 0
/scoreboard players set @a SpGe_Wear 1 {Inventory:[{Slot:100b,id:"minecraft:leather_boots",tag:{display:{Name:"SpyBoots",color:8026746}}}]}
# Hide in leaves
/execute @a[score_SpGe_Wear_min=1,score_SpGe_Wear=1] ~ ~ ~ detect ~ ~-0.51 ~ leaves -1 tp @a[c=0] ~ ~-0.52 ~
/execute @a[score_SpGe_Wear_min=1,score_SpGe_Wear=1] ~ ~ ~ detect ~ ~-0.51 ~ leaves -1 playsound dig.grass @a ~ ~ ~ 0.4 0.6
/execute @a[score_SpGe_Wear_min=1,score_SpGe_Wear=1] ~ ~ ~ detect ~ ~ ~ leaves -1 effect @a[c=0] invisibility 1 1 true
# Crawling
/scoreboard players add @a SpGe_PlayerTick 1
/scoreboard players set @a[score_SpGe_PlayerTick_min=5] SpGe_PlayerTick 1
/scoreboard players set @a[score_SpGe_Sneak=0] SpGe_Crawl 0
/scoreboard players add @a[score_SpGe_Sneak_min=1] SpGe_Crawl 1
/scoreboard players set @a[score_SpGe_Wear_min=1] SpGe_isCrawling 1
/execute @a[score_SpGe_Wear_min=1] ~ ~ ~ detect ~ ~ ~ air 0 scoreboard players set @a[c=0] SpGe_isCrawling 0
/execute @a[score_SpGe_Crawl_min=1,score_SpGe_Crawl=1] ~ ~ ~ detect ~ ~ ~ air 0 tp @a[c=0] ~ ~-0.15 ~
/tp @a[score_SpGe_PlayerTick_min=1,score_SpGe_PlayerTick=1,score_SpGe_isCrawling_min=1] ~0.01 ~ ~
/tp @a[score_SpGe_PlayerTick_min=2,score_SpGe_PlayerTick=2,score_SpGe_isCrawling_min=1] ~-0.01 ~ ~
/tp @a[score_SpGe_PlayerTick_min=3,score_SpGe_PlayerTick=3,score_SpGe_isCrawling_min=1] ~ ~ ~0.01
/tp @a[score_SpGe_PlayerTick_min=4,score_SpGe_PlayerTick=4,score_SpGe_isCrawling_min=1] ~ ~ ~-0.01
/scoreboard players set @a[score_SpGe_Sneak_min=1] SpGe_Sneak 0
# Make the ground beneath any crawling player solid with barriers
/execute @a ~ ~ ~ fill ~-3 ~-3 ~-3 ~3 ~3 ~3 air 0 replace barrier
/execute @a[score_SpGe_isCrawling_min=1] ~ ~ ~ fill ~ ~-1 ~ ~ ~-1 ~ barrier 0 replace air
# Laser beams
# Placing laser beams
/execute @a[rym=46,ry=135] ~ ~ ~ execute @e[type=Silverfish,name=LaserBeam,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~-1.2 ~ {ArmorItems:[{},{},{},{id:anvil,Count:1,tag:{display:{Name:"SPGERemLaser"}}}],Invisible:1,NoGravity:1,CustomName:"SPGEWest",Rotation:[90.0f,0.0f]}
/execute @a[rym=136,ry=-135] ~ ~ ~ execute @e[type=Silverfish,name=LaserBeam,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~-1.2 ~ {ArmorItems:[{},{},{},{id:anvil,Count:1,tag:{display:{Name:"SPGERemLaser"}}}],Invisible:1,NoGravity:1,CustomName:"SPGENorth",Rotation:[180.0f,0.0f]}
/execute @a[rym=-134,ry=-45] ~ ~ ~ execute @e[type=Silverfish,name=LaserBeam,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~-1.2 ~ {ArmorItems:[{},{},{},{id:anvil,Count:1,tag:{display:{Name:"SPGERemLaser"}}}],Invisible:1,NoGravity:1,CustomName:"SPGEEast",Rotation:[270.0f,0.0f]}
/execute @a[rym=-44,ry=45] ~ ~ ~ execute @e[type=Silverfish,name=LaserBeam,c=3,r=12] ~ ~ ~ summon ArmorStand ~ ~-1.2 ~ {ArmorItems:[{},{},{},{id:anvil,Count:1,tag:{display:{Name:"SPGERemLaser"}}}],Invisible:1,NoGravity:1,CustomName:"SPGESouth",Rotation:[0.0f,0.0f]}
/execute @e[type=Silverfish,name=LaserBeam] ~ ~-1 ~ scoreboard players set @e[type=ArmorStand,r=1] SpGe_isLaser 1
/execute @e[type=Silverfish,name=LaserBeam] ~ ~ ~ playsound entity.item.pickup neutral @a ~ ~ ~ 1 0.8
/tp @e[type=Silverfish,name=LaserBeam] ~ ~-500 ~
# Create lasers
/scoreboard players add @e[type=ArmorStand,score_SpGe_isLaser_min=1] SpGe_Tick 1
/scoreboard players set @e[type=ArmorStand,score_SpGe_isLaser_min=1,score_SpGe_Tick_min=4] SpGe_Tick 0
/execute @e[type=ArmorStand,score_SpGe_isLaser_min=1] ~ ~ ~ summon ArmorStand ~ ~0.8 ~ {Marker:1,Invisible:1,NoGravity:1,CustomName:"SPGELaser"}
/execute @e[type=ArmorStand,name=SPGEWest] ~ ~ ~ tp @e[type=ArmorStand,name=SPGELaser,r=10] ~-0.7 ~ ~
/execute @e[type=ArmorStand,name=SPGENorth] ~ ~ ~ tp @e[type=ArmorStand,name=SPGELaser,r=10] ~ ~ ~-0.7
/execute @e[type=ArmorStand,name=SPGEEast] ~ ~ ~ tp @e[type=ArmorStand,name=SPGELaser,r=10] ~0.7 ~ ~
/execute @e[type=ArmorStand,name=SPGESouth] ~ ~ ~ tp @e[type=ArmorStand,name=SPGELaser,r=10] ~ ~ ~0.7
/execute @e[type=ArmorStand,name=SPGELaser] ~ ~1 ~ particle reddust ~ ~ ~ 2.3 0 0 10
# Remove laser beams that are more than 10 blocks from source
/scoreboard players set @e[type=ArmorStand,name=SPGELaser] SpGe_Crawl 1
/execute @e[type=ArmorStand,score_SpGe_isLaser_min=1] ~ ~ ~ scoreboard players set @e[type=ArmorStand,name=SPGELaser,r=10] SpGe_Crawl 0
/kill @e[type=ArmorStand,name=SPGELaser,score_SpGe_Crawl_min=1]
# Destroy the laser beam when it collides with a block
/scoreboard players set @e[type=ArmorStand,name=SPGELaser] SpGe_isCrawling 1
/execute @e[type=ArmorStand,name=SPGELaser] ~ ~ ~ detect ~ ~1 ~ air 0 scoreboard players set @e[c=1,type=ArmorStand,name=SPGELaser] SpGe_isCrawling 0
/execute @e[type=ArmorStand,name=SPGELaser] ~ ~ ~ detect ~ ~1 ~ glass 0 scoreboard players set @e[c=1,type=ArmorStand,name=SPGELaser] SpGe_isCrawling 0
/kill @e[type=ArmorStand,name=SPGELaser,score_SpGe_isCrawling_min=1]
# Make the laser output a redstone signal when someone touches it
execute @e[type=ArmorStand,score_SpGe_isLaser_min=1] ~ ~ ~ fill ~-1 ~ ~-1 ~1 ~ ~1 redstone_wire 0 replace redstone_wire 15
/execute @e[type=ArmorStand,score_SpGe_isLaser_min=1] ~ ~1.2 ~ setblock ~ ~ ~ air 0 replace
/scoreboard players set @a SpGe_LasDet 0
/execute @e[type=ArmorStand,name=SPGELaser] ~ ~1 ~ scoreboard players set @a[r=1] SpGe_LasDet 1
/execute @e[type=ArmorStand,name=SPGELaser] ~ ~ ~ scoreboard players set @a[r=1] SpGe_LasDet 1
/execute @a[score_SpGe_LasDet_min=1] ~ ~ ~ execute @e[type=ArmorStand,score_SpGe_isLaser_min=1,c=1] ~ ~1.2 ~ detect ~ ~ ~ air 0 fill ~ ~ ~ ~ ~ ~ redstone_torch 0 replace air
/execute @a[score_SpGe_LasDet_min=1] ~ ~ ~ execute @e[type=ArmorStand,score_SpGe_isLaser_min=1,c=1] ~ ~1.2 ~ playsound entity.arrow.hit_player neutral @a[r=16] ~ ~ ~ 0.7 1
# Removing lasers
/scoreboard players set @a SpGe_RemLas 0
/scoreboard players set @a SpGe_RemLas 1 {Inventory:[{id:"minecraft:anvil",tag:{display:{Name:"SPGERemLaser"}}}]}
/execute @a[score_SpGe_RemLas_min=1] ~ ~ ~ execute @e[c=1,type=ArmorStand,score_SpGe_isLaser_min=1] ~ ~ ~ summon Item ~ ~1 ~ {Item:{id:"minecraft:spawn_egg",Count:1,tag:{EntityTag:{id:Silverfish},display:{Name:"LaserBeam"},ench:[{id:34,lvl:1}]}}}
/execute @a[score_SpGe_RemLas_min=1] ~ ~ ~ execute @e[c=1,type=ArmorStand,score_SpGe_isLaser_min=1] ~ ~ ~ playsound entity.item.pickup neutral @a ~ ~ ~ 1 0.8
/execute @a[score_SpGe_RemLas_min=1] ~ ~ ~ kill @e[c=1,type=ArmorStand,score_SpGe_isLaser_min=1]
/clear @a anvil 0 1 {display:{Name:"SPGERemLaser"}}
# Footprint dust
# Placing footprint dust
/execute @e[type=Skeleton,name=FootprintDust] ~ ~ ~ summon ArmorStand ~ ~ ~ {CustomName:"SPGEDust",Marker:1,Invisible:1}
/execute @e[type=Skeleton,name=FootprintDust] ~ ~ ~ particle smoke ~ ~ ~ 1 0 1 0.05 250
/execute @e[type=Skeleton,name=FootprintDust] ~ ~ ~ playsound entity.ghast.shoot neutral @a[r=16] ~ ~ ~ 1 1.5
/tp @e[type=Skeleton,name=FootprintDust] ~ ~-500 ~
# Making the footprints
/execute @e[type=ArmorStand,name=SPGEDust] ~ ~ ~ execute @a[score_SpGe_Walk_min=120,r=4] ~ ~ ~ particle footstep ~ ~0.02 ~ 0 0 0 1 1
/execute @e[type=ArmorStand,name=SPGEDust] ~ ~ ~ execute @a[score_SpGe_Walk_min=120,r=4] ~ ~ ~ particle smoke ~ ~ ~ 0 0 0 0.01 2
/scoreboard players set @a[score_SpGe_Walk_min=120] SpGe_Walk 0
# Removing the footprint dust
/execute @e[type=ArmorStand,name=SPGEDust] ~ ~ ~ detect ~ ~ ~ water -1 kill @e[r=1,type=ArmorStand,name=SPGEDust]
/execute @e[type=ArmorStand,name=SPGEDust] ~ ~ ~ detect ~ ~ ~ water -1 playsound block.fire.extinguish neutral @a ~ ~ ~ 0.7 1
# Grapple hook
# Placing a grapple hook
/execute @e[type=Squid,name=SpyGrapple] ~ ~ ~ summon ArmorStand ~ ~-.65 ~ {CustomName:"SPGEGrappleBase",Small:1,ArmorItems:[{},{},{},{id:dispenser,Count:1,tag:{display:{Name:"SPGERemGrapple"}}}],Invisible:1,NoGravity:1}
/execute @e[type=Squid,name=SpyGrapple] ~ ~ ~ summon ArmorStand ~ ~-.65 ~ {CustomName:"SPGEGrappleHook",Invisible:1,NoGravity:1}
/execute @e[type=Squid,name=SpyGrapple] ~ ~ ~ summon MinecartRideable ~ ~-.65 ~ {CustomName:"SPGEMinecart",Invulnerable:1}
/tp @e[type=Squid,name=SpyGrapple] ~ ~-500 ~
# Removing the grapple hook
/scoreboard players set @a SpGe_RemLas 0
/scoreboard players set @a SpGe_RemLas 1 {Inventory:[{id:"minecraft:dispenser",tag:{display:{Name:"SPGERemGrapple"}}}]}
/execute @a[score_SpGe_RemLas_min=1] ~ ~ ~ execute @e[c=1,type=ArmorStand,name=SPGEGrappleBase] ~ ~ ~ summon Item ~ ~1.5 ~ {Item:{id:"minecraft:spawn_egg",Count:1,tag:{EntityTag:{id:Squid},display:{Name:"SpyGrapple"},ench:[{id:34,lvl:1}]}}}
/execute @a[score_SpGe_RemLas_min=1] ~ ~ ~ execute @e[c=1,type=ArmorStand,name=SPGEGrappleBase] ~ ~ ~ playsound entity.item.pickup @a ~ ~ ~ 1 0.8
/execute @a[score_SpGe_RemLas_min=1] ~ ~ ~ kill @e[c=1,type=ArmorStand,name=SPGEGrappleBase]
/execute @a[score_SpGe_RemLas_min=1] ~ ~ ~ kill @e[c=1,type=ArmorStand,name=SPGEGrappleHook]
/execute @a[score_SpGe_RemLas_min=1] ~ ~ ~ kill @e[c=1,type=MinecartRideable,name=SPGEMinecart]
/clear @a dispenser 0 1 {display:{Name:"SPGERemGrapple"}}
# Making the grapple string
/execute @e[type=ArmorStand,name=SPGEGrappleBase] ~ ~ ~ summon ArmorStand ~ ~1.4 ~ {CustomName:"SPGEGrappleString",Marker:1,Invisible:1,NoGravity:1}
/tp @e[type=ArmorStand,name=SPGEGrappleString] ~ ~-1 ~
/scoreboard players set @e[type=ArmorStand,name=SPGEGrappleString] SpGe_isCrawling 1
/execute @e[type=ArmorStand,name=SPGEGrappleString] ~ ~ ~ detect ~ ~ ~ air 0 scoreboard players set @e[type=ArmorStand,name=SPGEGrappleString,r=1] SpGe_isCrawling 0
/execute @e[type=ArmorStand,name=SPGEGrappleHook] ~ ~ ~ scoreboard players set @e[type=ArmorStand,name=SPGEGrappleString,r=1] SpGe_isCrawling 1
/kill @e[type=ArmorStand,name=SPGEGrappleString,score_SpGe_isCrawling_min=1]
/execute @e[type=ArmorStand,name=SPGEGrappleString] ~ ~ ~ particle crit ~ ~ ~ 0 0.3 0 0.0001 6
# Connecting to the grapple hook
/execute @e[type=MinecartRideable,name=SPGEMinecart] ~ ~ ~ tp @e[type=MinecartRideable,c=0] @e[type=ArmorStand,name=SPGEGrappleHook,r=3,c=1]
/execute @a[rxm=-90,rx=-88] ~ ~ ~ tp @e[type=ArmorStand,name=SPGEGrappleHook,r=3,c=1] ~ ~0.09 ~
/execute @a[rxm=88,rx=90] ~ ~ ~ execute @e[type=ArmorStand,name=SPGEGrappleHook,r=3,c=1] ~ ~ ~ detect ~ ~-1.5 ~ air 0 tp @e[type=ArmorStand,name=SPGEGrappleHook,c=0] ~ ~-0.09 ~
/execute @e[type=ArmorStand,name=SPGEGrappleBase] ~ ~2.4 ~ tp @e[type=ArmorStand,name=SPGEGrappleHook,r=1] ~ ~-0.09 ~
/execute @a[rxm=-90,rx=-88] ~ ~ ~ execute @e[type=ArmorStand,name=SPGEGrappleHook,r=3,c=1] ~ ~ ~ playsound item.flintandsteel.use neutral @a ~ ~ ~ 0.8 2
/execute @a[rxm=88,rx=90] ~ ~ ~ execute @e[type=ArmorStand,name=SPGEGrappleHook,r=3,c=1] ~ ~ ~ playsound entity.item.pickup @a ~ ~ ~ 1 2