INIT:scoreboard objectives add ROB_I dummy
INIT:scoreboard objectives add ROB_Dir dummy
INIT:scoreboard objectives add ROB_For dummy
INIT:scoreboard objectives add ROB_Contr dummy
INIT:scoreboard objectives add ROB_Mine dummy
INIT:scoreboard objectives add ROB_Grab dummy
INIT:scoreboard objectives add ROB_Vert dummy
INIT:scoreboard objectives add ROB_Cam dummy
INIT:scoreboard objectives add ROB_Pickup dummy
INIT:tellraw @a [{"color":"green","bold":true,"text":"Remote Control Robots "},{"color":"dark_aqua","text":"has been installed!"}]
INIT:tellraw @a {"color":"red","text":"Command created by MrGarretto"}
INIT:tellraw @a {"color":"dark_aqua","text":"To craft a robot, throw an iron block, a repeater, and a gold ingot on the ground together!"}
INIT:gamerule sendCommandFeedback false
/scoreboard players reset @a ROB_Contr
/scoreboard players set @a ROB_Contr 1 {SelectedItem:{id:"minecraft:netherbrick",tag:{display:{Name:"RobotControl"}}}}
/scoreboard players set @e[type=Item] ROB_I 1 {Item:{id:"minecraft:iron_block"}}
/scoreboard players set @e[type=Item] ROB_I 2 {Item:{id:"minecraft:repeater"}}
/scoreboard players set @e[type=Item] ROB_I 3 {Item:{id:"minecraft:gold_ingot"}}
# Controls
/tellraw @a[score_ROB_Contr_min=1] [{"text":"\n\n\n\n\n\n\n\n\n\n\n\n\n"}]
/tellraw @a[score_ROB_Contr_min=1] [{"text":"Robot Controls: ","color":"green","bold":"true","clickEvent":{"action":"run_command","value":""}},{"text":" < ","color":"dark_aqua","bold":"true","clickEvent":{"action":"run_command","value":"/scoreboard players remove @e[type=ArmorStand,name=Robot,c=1] ROB_Dir 1"}},{"text":" ^ ","color":"dark_aqua","bold":"true","clickEvent":{"action":"run_command","value":"/scoreboard players set @e[type=ArmorStand,name=Robot,c=1] ROB_For 1"}},{"text":" > ","color":"dark_aqua","bold":"true","clickEvent":{"action":"run_command","value":"/scoreboard players add @e[type=ArmorStand,name=Robot,c=1] ROB_Dir 1"}},{"text":" [Break Block] ","color":"green","clickEvent":{"action":"run_command","value":"/scoreboard players set @e[type=ArmorStand,name=Robot,c=1] ROB_Mine 1"}},{"text":" [Pickup Items] ","color":"red","clickEvent":{"action":"run_command","value":"/scoreboard players set @e[type=ArmorStand,name=Robot,c=1] ROB_Grab 1"}},{"text":" [Camera] ","color":"light_purple","clickEvent":{"action":"run_command","value":"/scoreboard players tag @e[type=ArmorStand,name=Robot,c=1] add ROB_camswitch"}},{"text":"[X]","color":"dark_red","clickEvent":{"action":"run_command","value":"/kill @e[type=ArmorStand,name=Robot,c=1]"}}]
/tellraw @a[score_ROB_Contr_min=1] [{"text":""}]
/tellraw @a[score_ROB_Contr_min=1] [{"text":""}]
# Crafting
/execute @e[score_ROB_I_min=1,score_ROB_I=1] ~ ~ ~ execute @e[r=1,score_ROB_I_min=2,score_ROB_I=2] ~ ~ ~ execute @e[r=1,score_ROB_I_min=3,score_ROB_I=3] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:spawn_egg",Count:1,tag:{EntityTag:{id:Endermite},display:{Name:"Robot"}}}}
/execute @e[score_ROB_I_min=1,score_ROB_I=1] ~ ~ ~ execute @e[r=1,score_ROB_I_min=2,score_ROB_I=2] ~ ~ ~ execute @e[r=1,score_ROB_I_min=3,score_ROB_I=3] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:netherbrick",Count:1,tag:{display:{Name:"RobotControl"}}}}
/execute @e[score_ROB_I_min=1,score_ROB_I=1] ~ ~ ~ execute @e[r=1,score_ROB_I_min=2,score_ROB_I=2] ~ ~ ~ execute @e[r=1,score_ROB_I_min=3,score_ROB_I=3] ~ ~ ~ particle smoke ~ ~ ~ 0 0 0 0.05 500
/execute @e[score_ROB_I_min=1,score_ROB_I=1] ~ ~ ~ execute @e[r=1,score_ROB_I_min=2,score_ROB_I=2] ~ ~ ~ execute @e[r=1,score_ROB_I_min=3,score_ROB_I=3] ~ ~ ~ execute @a[r=12] ~ ~ ~ playsound mob.chicken.plop @a ~ ~ ~ 1 1
/execute @e[score_ROB_I_min=1,score_ROB_I=1] ~ ~ ~ execute @e[r=1,score_ROB_I_min=2,score_ROB_I=2] ~ ~ ~ execute @e[r=1,score_ROB_I_min=3,score_ROB_I=3] ~ ~ ~ kill @e[type=Item,r=3,score_ROB_I_min=1,score_ROB_I=3]
# Placing a robot
/execute @e[type=Endermite,name=Robot] ~ ~ ~ summon ArmorStand ~ ~-1.349 ~ {CustomName:"Robot",Invisible:1,NoGravity:1,ArmorItems:[{},{},{},{id:skull,Damage:3,tag:{SkullOwner:Addelburgh}}]}
/execute @e[type=Endermite,name=Robot] ~ ~-1.349 ~ scoreboard players set @e[r=5,type=ArmorStand,c=1] ROB_Dir 1
/tp @e[type=Endermite,name=Robot] ~ ~-500 ~
/scoreboard players set @e[type=ArmorStand,name=Robot,score_ROB_Dir=0] ROB_Dir 4
/scoreboard players set @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=5] ROB_Dir 1
/entitydata @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=1,score_ROB_Dir=1] {Rotation:[0f]}
/entitydata @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=2,score_ROB_Dir=2] {Rotation:[90f]}
/entitydata @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=3,score_ROB_Dir=3] {Rotation:[180f]}
/entitydata @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=4,score_ROB_Dir=4] {Rotation:[270f]}
# Moving the robot forward
/tp @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=1,score_ROB_Dir=1,score_ROB_For_min=1] ~ ~ ~1
/tp @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=2,score_ROB_Dir=2,score_ROB_For_min=1] ~-1 ~ ~
/tp @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=3,score_ROB_Dir=3,score_ROB_For_min=1] ~ ~ ~-1
/tp @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=4,score_ROB_Dir=4,score_ROB_For_min=1] ~1 ~ ~
/scoreboard players reset @e[type=ArmorStand,name=Robot] ROB_For
# Mining blocks
/execute @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=1,score_ROB_Dir=1,score_ROB_Mine_min=1] ~ ~ ~ setblock ~ ~2 ~1 air 0 destroy
/execute @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=2,score_ROB_Dir=2,score_ROB_Mine_min=1] ~ ~ ~ setblock ~-1 ~2 ~ air 0 destroy
/execute @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=3,score_ROB_Dir=3,score_ROB_Mine_min=1] ~ ~ ~ setblock ~ ~2 ~-1 air 0 destroy
/execute @e[type=ArmorStand,name=Robot,score_ROB_Dir_min=4,score_ROB_Dir=4,score_ROB_Mine_min=1] ~ ~ ~ setblock ~1 ~2 ~ air 0 destroy
/scoreboard players reset @e[type=ArmorStand,name=Robot] ROB_Mine
# Picking up items
/execute @e[type=ArmorStand,name=Robot,score_ROB_Grab_min=1] ~ ~ ~ tp @e[type=Item,r=4] @p[score_ROB_Contr_min=1]
/scoreboard players reset @e[type=ArmorStand,name=Robot] ROB_Grab
# Moving up and down based on terrain
/scoreboard players set @e[type=ArmorStand,name=Robot] ROB_Vert 1
/execute @e[type=ArmorStand,name=Robot] ~ ~ ~ detect ~ ~1.349 ~ air 0 scoreboard players set @e[type=ArmorStand,name=Robot,r=5,c=1] ROB_Vert 0
/tp @e[type=ArmorStand,name=Robot,score_ROB_Vert_min=1] ~ ~1 ~
/execute @e[type=ArmorStand,name=Robot] ~ ~ ~ detect ~ ~0.349 ~ air 0 tp @e[type=ArmorStand,name=Robot,r=5,c=1] ~ ~-1 ~
# Cameras
/scoreboard players add @e[type=ArmorStand,name=Robot] ROB_Cam 0
/scoreboard players set @e[tag=ROB_camswitch,score_ROB_Cam_min=1] ROB_Cam 3
/scoreboard players set @e[tag=ROB_camswitch,score_ROB_Cam=0] ROB_Cam 1
/scoreboard players tag @e[tag=ROB_camswitch] remove ROB_camswitch
/execute @e[type=ArmorStand,name=Robot,score_ROB_Cam_min=1,score_ROB_Cam=1] ~ ~ ~ execute @p ~ ~ ~ summon ArmorStand ~ ~ ~ {Marker:1,Invisible:1,CustomName:"RobotCamPlaceholder"}
/execute @e[type=ArmorStand,name=Robot,score_ROB_Cam_min=1,score_ROB_Cam=1] ~ ~ ~ gamemode 3 @p
/execute @e[type=ArmorStand,name=Robot,score_ROB_Cam_min=2,score_ROB_Cam=2] ~ ~ ~ tp @p @e[type=ArmorStand,name=Robot,c=0]
/execute @e[type=ArmorStand,name=Robot,score_ROB_Cam_min=2,score_ROB_Cam=2] ~ ~ ~ tp @p ~ ~1 ~
/scoreboard players set @e[type=ArmorStand,name=Robot,score_ROB_Cam_min=1,score_ROB_Cam=1] ROB_Cam 2
/execute @e[type=ArmorStand,name=Robot,score_ROB_Cam_min=3,score_ROB_Cam=3] ~ ~ ~ tp @p @e[c=1,type=ArmorStand,name=RobotCamPlaceholder]
/execute @e[type=ArmorStand,name=Robot,score_ROB_Cam_min=3,score_ROB_Cam=3] ~ ~ ~ gamemode 0 @p
/execute @e[type=ArmorStand,name=Robot,score_ROB_Cam_min=3,score_ROB_Cam=3] ~ ~ ~ execute @p ~ ~ ~ kill @e[type=ArmorStand,name=RobotCamPlaceholder,c=1]
/scoreboard players set @e[type=ArmorStand,name=Robot,score_ROB_Cam_min=3,score_ROB_Cam=3] ROB_Cam 0
# Picking up the robot
/scoreboard players reset @a ROB_Pickup
/scoreboard players set @a ROB_Pickup 1 {Inventory:[{tag:{SkullOwner:Addelburgh}}]}
/clear @a[score_ROB_Pickup_min=1] skull 3 1 {SkullOwner:Addelburgh}
/execute @a[score_ROB_Pickup_min=1] ~ ~ ~ execute @e[type=ArmorStand,name=Robot,c=1] ~ ~ ~ summon Item ~ ~ ~ {Item:{id:"minecraft:spawn_egg",Count:1,tag:{EntityTag:{id:Endermite},display:{Name:"Robot"}}}}
/execute @a[score_ROB_Pickup_min=1] ~ ~ ~ kill @e[type=ArmorStand,name=Robot,c=1]