Target selectors do not support direct NBT data input. You must assign a label to the target using /scoreboard
first, and then target the entity based on its label.
Prerequisites:
Objective to hold the value.
/scoreboard objectives add SpecialArrow dummy
Clock commands:
The following must be run in numerical order on a clock.
Assign a score based on the arrow's NBT data. Note that you must properly declare tag-types; in this case, "damage" has a tag-type of double
, so you must include a decimal, while "inGround" has a tag-type of byte
, so its value is appended with a "b". The command assigns a score of 1 if the arrow has a particular damage as well as not being in the ground.
/scoreboard players set @e[type=Arrow] SpecialArrow 1 {damage:63.0,inGround:0b}
Perform the commands you'd like, targeting arrows with a SpecialArrow
score of exactly 1.
/execute @e[type=Arrow,score_SpecialArrow_min=1,score_SpecialArrow=1] ~ ~ ~ summon ThrownPotion ~ ~ ~ {Potion:{id:potion,Damage:8197}}
Afterwards, the score is set to 2 if that particular arrow is now in the ground.
/scoreboard players set @e[type=Arrow] SpecialArrow 2 {damage:63.0,inGround:1b}
And finally, the /kill command, targeting based on score.
/kill @e[type=Arrow,score_SpecialArrow_min=2]
Assuming you have the "sentry gun" shooting arrows, you would use the command:
/summon Arrow x y z {damage:1,Motion:[x.0,y.0,z.0]}
You would have to plug into the first set of coordinates where you want the arrows to be shooting from, and the direction the arrows are shooting in the second. TIP: The higher the number you set for your direction (second set of coordinates, the faster the arrow will travel! You can set anything for the damage (except dont get too crazy :P)
As for your "Tool Box" Idea, you can do the test for command on a redstone ticker:
testfor @e[x,y,z,r,type=Item] {Item:{id:minecraft:iron_block}}
(Unfortunately, you cant test for a custom named block/entity - at least to my knowledge) Run a comparator out of this command block, to another command block (does not NEED to be a command block). This will start a fast ticking redstone clock on another command block. This command block will have the command:
testfor @e[x,y+1,z,r,type=Item] {Item:{id:minecraft: ... }}
Make sure that the coordinates you plug into the last testfor command have y+1 the y coordinate of the testfor command before that. This means it will test for the item on top of your "tool box". Run a comparator out of that command block to start the /summon Arrow command, or in other words, start up your sentry!
(The arrows are seen only as little black dots in this photo, but thats because I have the speed ramped up :)
Basically, its a system of Testing positive for an iron block at x y z - starting ticker to test for ... entity at x y+1 z - testing positive for ... entity at x y+1 z - starting ticker to shoot "sentry gun"
Hope this helps
Best Answer
Ok so this is for summoning an immobile arrow:
Add a repeating command block (always active) with the following command:
Add a chain command block to the back of the repeating command blockthats always active and conditional
Your question is unclear
The arrow will not move. It would require hundreds, at the very least, of command blocks. Nevertheless, I wish you luck. I could try to improve it if I could get on your server but I will not be able to make it perfect.