You can set a /kill
command on a command block, I know that, but how do I do it? I am making a map, so please help!
2 Answers
This is pretty lacking in detail, so I'll give you an overview.
First off, you need a command block (Directly from the wiki):
Command blocks can be obtained by using the pick block control or with various commands, such as
/give <player> minecraft:command_block <amount>
.Command blocks are not available in the creative inventory, cannot be broken in survival mode or if you do not have operator permissions (1.9[upcoming]), are not flammable, and have the same blast resistance as bedrock. Command blocks cannot be moved by a piston.
Then enter your desired kill command into the command block, e.g.
/kill Name
where "Name" is a players name, will kill that player/kill @e
To kill everything/kill @e[type=Sheep]
To kill all sheep/kill @e[type=!Player]
Will kill anything which isn't a player (Including de-spawning dropped items)
You then activate the command block in a normal way, the easiest of which is either directly from a switch/lever, or a redstone current.
You can't exactly /kill
a block (at least I don't think), as blocks are notentities. However there are some exceptions including Item Frames and Minecarts. What you can do as an alternative is /setblock x y z air
for example, to set a block to air (basically removing it completely).
With Item Frames, you can do /kill @e[type=ItemFrame]
. Same with minecarts (just making the ItemFrame
into a MinecartRidable
-
Blocks are not entities while item frames/minecarts are entities. As well, /kill does not support NBT data. It's only:
/kill <target>
Commented Dec 6, 2015 at 19:25 -
2@Skylinerw my mistake. I do know that blocks are not entities, I just forgot to add don't :D. Can be interpretable since I said you cannot kill a block– John KCommented Dec 6, 2015 at 19:26
-
He's not asking to kill a block. He asked how to put a
kill
command on a command block.– mbomb007Commented Dec 2, 2016 at 14:41 -
-
1@JohnSmith Yeah, I think he was asking for the syntax, but all he would've had to do is do some searching on the MC wiki. Idk.– mbomb007Commented Dec 2, 2016 at 16:36