Minecraft Wiki
Minecraft Wiki
This page is an archive of past discussions. Do not edit the contents of this page. 
If you wish to start a new discussion or revive an old one, please do so on the current talk page.
Archives

Comando/activadominecraft

Name?

The command block has been hinted at for being released in the creative inventory in update 1.5.1 ace25ace 10:26, 6 January 2013 (eastern time)

It should be called the Command Firer, or something. :) Sonickyle 20:56, 4 August 2012 (UTC)

This is not the forums! Noobnathan 21:32, 30 August 2012 (UTC)

Teleportation

It will FINALLY be possible with this block. YES! Xeoxer 13:09, 5 August 2012 (UTC)

Is it just me, or do some command block teleportations teleport players one block away from the real coordinates? Willco2 20:45, 14 October 2012 (UTC)


this is because commands using coordinates (eg. "/tp" or "/spawnpoint") add 0.5 to integers, like usual. To clarify, the number -33 would be interpreted as -32.5, and the number 187 would be interpreted as 187.5. -taken from command block page.

Is there any way to teleport to a player's spawnpoint? Aaronfranke 01:57, 6 February 2013 (UTC)

Be careful with teleportation command blocks. I was trying to set the command block to teleport all players to the space above the command block, but didn't realize that "tp @a ~ ~1 ~" was not the way to do it until after I had connected said command block to a comparator pulser and started rising into the sky. Fortunately for me I was using snapshot 13w27a and could use "/summon PrimedTNT ~5 3 ~5" (this was on the Classic Flat preset) to blow up the redstone powering the block. 205.134.200.53 00:41, 13 September 2013 (UTC)

smp option

yeah what is the name of the command to enable/disable command blocks in smp (cause my server was created in 1.3.1) thank you if you answer Riothegod 03:44, 11 August 2012 (UTC)

Some commands with the command block

Here are some commands I'v seen used with the command block which could be included into the main page at some point.

Note that <pra> refers to either @p, @r or @a.

Name What it does Command
Teleport Teleports to coordinates tp <pra> x y z
Set Spawn Sets a spawn point with coordinates spawnpoint <pra> x y z
Say Says something say <the message you want it to say>
Time Sets the time time set <tick number>

Updated: 01:37, 13 August 2012 (UTC)

I'll expand if I see more. NeedAGoodUsername 01:10, 13 August 2012 (UTC)

For everyone using teleportation, the teleported area must be a valid spot and not "inside" a block. 184.163.43.21 19:20, 15 August 2012 (UTC)

I can't use @p, @r, or @a in a say command to show the player(s) names w/o spaces on both sides. Here's an example: Working: /say Thanks, @p . Not Working: /say Thanks, @p. I don't know if there's a problem with my PC, or if others are having this same problem. 71.203.64.195 16:48, 5 June 2013 (UTC)

Mod commands

If there's any mods for 12w32a, or future updates, I think it would be good trivia as to whether or not commands added by mods (ex: SPC, SMP Bukkit plugins) would work with the command blocks. This would let map makers know if they can use commands from their mods such as Worldedit in use of adventure maps, or if they can't, as well as say a mod is needed to play an adventure map to its full potential as structured. Funky3000 03:16, 13 August 2012 (UTC)

That info belongs on the individual mods' pages, not here. ディノ千?!? · ☎ Dinoguy1000 03:53, 13 August 2012 (UTC)
I'm not talking each individual mod. I'm wondering if the command block can actually use mod commands in general. Not talking specifics, those couple were just examples. There are many mods out there that add commands, it would be good trivia to know if the command block can only use vanilla commands or not be able to use "chocolate" commands. This is also a good place for such generalized information, it only involves commands and besides, wouldn't want to crash the game, would we? ;) Or worse, be the cause of a crash because we didn't put information where it is centered upon AKA use of command blocks? Funky3000 04:30, 13 August 2012 (UTC)
That would probably be a question for Jeb, then; in particular, the block may not support mod commands as added by current versions of mods, but a method for adding such commands may be a part of the upcoming Mod API. ディノ千?!? · ☎ Dinoguy1000 05:04, 13 August 2012 (UTC)
It seems not to work with /pg clearPortals all, from the portalgun mod, but it may be that it will work with commands that don't need a player context.
I have tested one or two mods with this, it doesn't seem to respond. Also, certain mods like spc which replaces a command or two seems to break almost all regular commands.--108.56.200.69 18:58, 29 August 2013 (UTC)

Command Block Removed in 1.3.2

Somehow, the command block doesn't exist in 1.3.2.
Someone tell me what happened and how can I get it back?

Pikachu4170 17:04, 16 August 2012 (UTC)

Technically 12w32a was released after 1.3.2 which means all the new stuff is not included within 1.3.2. --☺ Sven ? ! 17:24, 16 August 2012 (UTC)

Schematics that use the Command Block

World Options Schematic (With Video)

Hey there, this is Tasaiala, I made a MCEdit schematic that lets you edit the gamerules commands using command blocks. This way it's prebuilt, and you don't have to set it up yourself. Just paste the .schematic into your world! Video:http://www.youtube.com/watch?v=r510tsosKlY Download: http://www.mediafire.com/?6ve861rv2fe3jhp

The bug is not a bug

The "bug" is not a bug - this will happen when changing gamemode with cheats on as well. Therefore, it isn't a bug. 60.241.224.44 10:41, 16 September 2012 (UTC)

Dinnerbone documented it

https://gist.github.com/3736487 Looks like we missed a few points. LB(T|C) 11:27, 17 September 2012 (UTC)

No more string limit?

I realized that in vanila weekly snapshot 12w38b, that string limit has been removed (or extended. Either way it got larger than 32) for Command Block. I'm not sure and want to see if someone can confirm one. If then, we should add about it on article. Kevin J Rattman 00:42, 23 September 2012 (UTC)

It is in the article. The limit is now 254 characters. See the command block wiki page. 68.69.166.115 00:39, 5 April 2013 (UTC)

The update log for 1.72 (or was it one of the other snapshots of 1.7x?) says the limit is now "many thousands" which I'm guessing is 4096 since it's a significant number in hex...or probably 4095 since mojang seems to start number ranges that don't have negatives at 0 rather than 1 (eg: the 16 colors of wool are damage values 0-15). We should take it as read that truly UNLIMITED numbers never occur in minecraft (even the "infinite" maps are only 60 thousand square km). 24.68.154.229 06:06, 11 December 2013 (UTC)

As of 14w04b (also true in 1.7.4), the maximum you can enter into the command block that it will accept in-game is 16,369. If you attempt to add more characters, clicking the "Done" button will not save your command. You can use a third-party editor to insert more text, up to a maximum of 32,767. If you insert more than 32,767 characters into the editor, the command will be trimmed at the end. So effectively, without the use of third-party editors, the max length is 16,369 characters. Skylinerw (talk) 20:33, 31 January 2014 (UTC)
60 000 km * 60 000 km = 3 600 000 000 km² --91.44.207.229 00:05, 22 February 2014 (UTC)

commandBlockOutput and doFireTIck bugged?

everytime i try to use any of these 2 commands it only seems to be toggable to an off state. is anybody else having this problem too? and if so, is there any in-game solution to it?

So, both /gamerule doFireTick true and gamerule doFireTick false do the same thing? If so please report this bug here. --☺ Sven ? ! 17:25, 6 October 2012 (UTC)

multi line?

does the command block support multi-line commands(i.e. multiple commands)? if so this should be added. Use multiple Command Blocks. 173.174.111.56 22:50, 30 November 2012 (UTC)

Singleplayer?

why can't you have the command block to make a singleplayer adventure map? –Preceding unsigned comment was added by 76.205.141.136 (talk) at 01:22, 20 October 2012 (UTC). Please sign your posts with ~~~~

you can do /give (yourname) 137
(cheats must be enabled) –Preceding unsigned comment was added by 82.101.228.155 (talk) at 18:53, 25 October 2012 (UTC). Please sign your posts with ~~~~
As of Minecraft 1.8, you MUST do /give (yourname) minecraft:command_block OR /give (yourname) command_block
Both will give you the same item –Preceding unsigned comment was added by 24.118.244.183 (talk) at 2:31, 08 January 2015 (UTC). Please sign your posts with ~~~~

enable-command-block server properties problem

evrytime i enable the command block in the server properties file (i use Bukkit) the server will start but then crash after a second. It doesnt crash when i disable command blocks, but i need to enable it. Any help?

Post the crash log on the Bukkit forums (not here); there is very little advice that can be given without it. -- Orthotope 03:03, 25 November 2012 (UTC)

Gamerule doMobSpawning

Does this gamerule disable all spawner blocks as well as random spawning of mobs in low light? (Is this "peaceful" mode?)

Also, slight clarification please. Does "False" = no spawning, while "True" = allow spawning, or the other way around? 86.25.209.30 05:41, 29 November 2012 (UTC)

If doMobSpawning is set to false, all random mob spawning is disabled. This affects animals, squid, and bats, as well as hostile mobs. Monster spawners, animal spawning when chunks generate, village iron golems, and any other method of creating mobs are not affected. -- Orthotope 08:25, 29 November 2012 (UTC)

bug singleplayer

evrytime i try to add any command on singleplayer it says: must be a opped player in creative mode.... –Preceding unsigned comment was added by 189.252.116.129 (Talk) 02:00, 31 December 2012 (UTC). Please sign your posts with ~~~~

As stated on the page, you must be in Creative mode to edit a command block; this is intentional. -- Orthotope 03:33, 31 December 2012 (UTC)

/give command

At the start of the page it says:
Only players with sufficient privileges to use the 'give' command.
What "sufficient privileges"? Emerald267 16:07, 1 January 2013 (UTC)

That typically means Op status on a server. There are custom servers out there with setups that grant/deny specific privileges with different levels of abilities, but for straight vanilla servers, there's just normal users and ops. --User:Kanegasi User_talk:KanegasiSpecial:Contributions/Kanegasi 16:19, 1 January 2013 (UTC)

NaN trick

A neat thing I found: If you assign a position a value, (eg x=), but don't say what position, it will teleport you anywhere. I have only tested this when I have a mod installed, but if someone would confirm, that would be nice. I used:

 tp @p[y=240,x=,z=,r=3] -1134 233 -979 

Pokechu22 01:15, 3 February 2013 (UTC)
EDIT: the above command actually always teleports, regardless of your position, but if you use

 tp @a[y=240,x=NaN,z=NaN,r=2] -1134 233 -979 

it works. Pokechu22 01:26, 3 February 2013 (UTC)

Oddly your description (which implies blank numbers for the DESTINATION) doesn't seem to match the code (which uses blank numbers for the argument not the destination, creating a guard above the world at height 240 that teleports the player to 1 specific point if they try to fly too high). You should've said "FROM anywhere". Here's code that matches that first description /tp @p x= y=80 z= but it doesn't work. Apparently you can't use x y z coordinates that include x= (or y= or z=) outside of the arguments. Try the non-working code /tp @p x=-10000 y=80 z=-10000 (or the same thing with commas instead of spaces between the x y z) for yourself. Trying "NaN" in that part of the code doesn't help either (in fact I couldn't get NaN working at all. Is it something from 1.5 or 1.6 that isn't in 1.7?). Pity because I'd love to be able to wield a "random destination" teleport code (I'd specify Y though, as -30 million to +30 million is a big range and just under half of it will kill you with void damage). Technically random number generator machines are possible in minecraft, but not for large numbers as far as I know. They juggle items between hoppers while drawing a power level off of them and generate random results by using items that stack to 64 items that stack to 16 and items that don't stack at all (stack to 1) so that 1 randomly chosen item leaving the hopper will cause one of 3 possible power levels. Also I have no idea how you would translate varying power levels back into numbers fed into a command block, unless you were just picking between a handful of pre-chosen spots.

Oh and to be clear, your code worked fine for me when I used @a instead of @p BUT used blank instead of NaN. Pity we can't set it for creatures too.

Why?

Why does Mojang have the server default to disabling command blocks? It seems unnecessary, as it is a extra step for maps, and most people aren't worried about the command block. Pokechu22 01:53, 3 February 2013 (UTC)

Because anybody who doesn't change the .properties file after creating a server would otherwise have the possibility of another admin/mod/op figuring it out and griefing. If someone actually plans on using the block, it's only a small effort to change the line in the .properties file anyway. --Mrkddsmn 23:32, 30 March 2013 (UTC)

Actually, I have once tried to make a server and enable command blocks on it, but the .properties files weren't communicating with the server for some reason. I couldn't change anything about the server!

108.210.92.202 14:09, 17 December 2013 (UTC)

/kill command works

On the page they said "some commands have been disabled..." well one of them is the command /kill. without knewing this info i tried it out on my server and i managed to get this working. Is this a fault on the page or is this a bug in the command blocks? pls have a look at this! –Preceding unsigned comment was added by 78.20.48.184 (Talk) 01:38, 9 March 2013‎ (UTC). Please sign your posts with ~~~~

Testing in single-player, /kill does not work. Servers often do not disclose which mods, if any, they are using, so unusual behavior should always be confirmed in single-player, or at least on a clean, completely unmodded server. -- Orthotope 07:09, 9 March 2013 (UTC)

/Kill works on most servers in vanilla, but only for killing yourself, a.k.a. suicide. 68.69.166.115 00:44, 5 April 2013 (UTC)

/kill @p hooked up to a rapid pulser worked for me in a single player LAN server... although we had to edit the map to remove it because of the pulser... not the brightest idea, but I wasn't expecting /kill to work.

Help me!

My brother has been kind enough to hack my worlds and put Command Blocks on all of them, ones I've had for a year and have irreplaceable builds on them, and set the command block on a repeating circuit and has me teleported far away. How can I fix this? Is there some other command that I can use on a new CB to stop the other one? He set it to /tp @a, so what can I do? 75.185.235.206 21:48, 15 March 2013 (UTC)

If you can host a tiny server on localhost, disable command blocks in server.properties, then find the block and destroy it! 109.156.20.183 17:44, 18 March 2013 (UTC)

Use WorldEdit and do a /replaceall on the command block data value within a large radius --Mrkddsmn 23:33, 30 March 2013 (UTC)

I have the same problem, but when i save my world in the server and copy and past the file to my saves it still doesnt work, it spawns me in the same place with the command block in tact... HELP! 82.8.158.236 19:33, 18 April 2013 (UTC)

You need to make sure command blocks are in the server.properties file in your server directory. Change the true 'enable-command-blocks=' to false. If that's already false, then you could backdate your MC to a version without command blocks so that upon loading the world all command blocks are deleted. However, this will also delete other blocks that were not in that version so be careful. Good luck! --2.221.199.161 12:30, 18 August 2013 (UTC) Simple you just use some editors and replace all those command blocks with air or anything you want. --Paidpop (talk) 21:59, 4 November 2014 (UTC)

How to exclude a player team ect from a command?

Im really wondering if there is a way to exclude a player team ect from a command. E.G. you want to exclude all admins from a game mode command by either a team or igns. 69.9.58.154 22:46, 18 March 2013 (UTC) 55555bookworm You use @a[team=!<team name here>] to identify people whose team is not the team specified --99.231.34.135 15:49, 8 June 2013 (UTC)

@-codes should be moved to Server Commands

Players (and probably server console) can also use @a, @p and @r, so it would make more sense to move information about @-codes to Server Commands. (Tested in vanilla 1.5.1, creative singleplayer with cheats enabled) 93.73.186.104 18:56, 22 March 2013 (UTC)

Tripwire activation?

Hi, I was just wondering, apart from a redstone current, can a command block be activated with a tripwire hook? -- Numbermaniac - T- C 06:35, 5 April 2013 (UTC)

A tripwire outputs a redstone current. ultradude25Talk
Contribs
06:41, 5 April 2013 (UTC)

Pickable?

Regarding this paragraph: "Considering its great power and possibilities, it can't be normally crafted. Currently, it is not available in the creative mode inventory either. Only players with sufficient privileges to use the 'give' command: /give <player_name> 137 can obtain the block. Furthermore, only players which are in Creative mode and are also an operator on the server are able to edit and successfully save the command of the block." Once placed, a command block is indeed "pickable" in Creative mode with middle-click. Should this be added, since a player who may not necessarily have access to the /give command can still get one if they are in Creative and one already exists in the world? AdmiralMemo 05:16, 29 April 2013 (UTC)

Doesn't recognize that I'm OP in Creative.

I used to be able to place and edit command blocks on my server, the old command blocks still work. I'm trying to place and edit new ones, but every time I put in the command it says "Must be an opped player in creative mode" which I am. I am the only OP on my server, and I am always in creative mode. Does anyone know what the problem might be? --Putchute 00:59, 2 May 2013 (UTC) Try to "Open To Lan and enable the cheats" if that doesnt work, report that bug.--Paidpop (talk) 22:01, 4 November 2014 (UTC)

What does the @a code turn into?

For instance, @p turns into the name of the nearest player. What about @a? -User:Munomario777

it means @all players. 64.30.14.50 15:41, 14 May 2013 (UTC)
It turns into a list, eg. playername1,playername2...playenameN 109.227.62.168 09:57, 9 July 2013 (UTC)
It does not list players. For example, if you used /tp @a Meeples10, it will teleport all players on the server to me. Using /tell @a Hi! would tell all players "Hi!", but not appear in the main chat or minecraftserver.exe. User:Meeples10 User talk:Meeples10
Special:Contributions/Meeples10
11:33, 9 July 2013 (UTC)
It does list players if used in the text area of a command. For example: /say Hi, @a returns <player> Hi, playername1,playername2...playenameN 19px Lennbot 19px (talk - contributions) 17:10, 27 October 2013 (UTC)

Random command?

Is it possible to set the command block up so it picks a random command every time it's activated? --Edendhri 20:55, 30 May 2013 (UTC)

No, at least as far as I know, but you can wire redstone to randomly pick from multiple command blocks. Rcmaehl 21:01, 30 May 2013 (UTC)


Help

Effects, i am trying to make effects affect everyone, but me who walks on them so i do /effect @p[!name=<name>} 9 30 and even without the = , but its not working. Any help? –Preceding unsigned comment was added by 174.91.35.138 (talk) 22:34, 2 June 2013‎(UTC). Please sign your posts with ~~~~

@p only targets the closest player; try using /effect @p[!name=<name>] 9 30. -- Orthotope talk 01:17, 3 June 2013 (UTC)

no, its /effect @p[name=!<name>] 9 30--99.231.34.135 20:20, 5 July 2013 (UTC)

It's /effect @a 9 30 77.164.201.232 20:38, 30 July 2013 (UTC)

Command Block on Demo

Well, i have just on July 20 2013 (7/20/13) i have just gone being crazy in my demo world beacause i got the Command Block. (Block 137)well i tried to do /tp, /testfor but nothing happens, just making me blank. (i have not got amniesia) well, im still happy about that and redstone,redstones circuts. Thanks.

                                                                               --CsJr. 00:03, 21 July 2013 (UTC) CsJr.
                                                 <hidden real name>

You have to be on creative mode to program a command block. I'm assuming that's your problem although it might be something else. Other versions of minecraft (pocket edition for example) sometimes have blocks from the PC version that don't function. Usually the functionality is added 1 major update later, although sometimes the "just a decoration" version sits for a few updates before being made into a working version. I don't know if the demo version ever updates so that probably isn't what's happening here but you never know what sort of useless junk is floating around an alternate version of minecraft. But it's probably just that you were trying it on survival mode. 24.68.154.229 04:28, 11 December 2013 (UTC)

how?!

I am a newbie to command blocks and I wanted to know how to change the game mode on a command block. –Preceding unsigned comment was added by 86.159.73.63 (talk) at 12:40, 27 July 2013‎ (UTC). Please sign your posts with ~~~~

/gamemode <survival | creative | adventure> [playername] -- see command.
This page is for discussing the Command Block article. Questions like this are better asked on the forums.
Munin295 · 16 px 16 px · 14:27, 27 July 2013 (UTC)

Also you can use numbers instead. 0 for survival, 1 for creative, 2 for adventure, as in /gamemode 1 . 24.68.154.229 04:19, 11 December 2013 (UTC)

redstone does noet activate a second command block

redstone does not activate a second command block


like this

. are command blocks - are redstonewire or capactor or repeater all in one layer or same level

.-. this is what i try 1 2

1 has a command and 2 has the second command

but it is not workin i use the bukkit server and some plugins this lpugins i use:

craftbook serverminimap simple auto save world edit 217.123.182.235 19:25, 28 July 2013 (UTC)

-Hey, it's because the command blocks, if successful, will keep the comparator on. So the first time, both command blocks will activate, but the second time, the first command block will activate but not the second unless the first command block failed (possibly by not finding the player it is looking for or the player not having a minimum requirement of a specific score or level), in which case the comparator would turn off and so the second command block could be activated if the comparator turned on again. So there lies the problem. The command block remembers if the last time it was activated output a successful command. I am currently working on a suggestion to fix this, but for now, after a lot of experimenting, I have found a temporary solution:

. |are command blocks and (1) and (2) are the command blocks in order of activation

- |are redstonewire or comparator or repeater all in one layer or same level

i |are redstone torches used in an inverser as I believe it is called (redstone leads to block, otherside has redstone torch off of block to inverse the signal, and if needed, redstone on the block. The input will be where the button or pressureplate signal is coming from)

L |are repeaters with a delay

o |are buttons or pressure plates for a temporary signal

-L-o-.(1)
-    -
i    i
--i---
  -
  .(2)

This circuit causes the first command block (1) to activate and if the command is successful, the right side of the circuit will light up, up to the right redstone torch which sends the signal off. The left side will be an on signal because of the button and the left redstone torch will invers the signal to off. This will cause the two off signals to permit the lower redstone torch to receive an off signal and invert it to an on signal, which will power the final command block. The first command block will continue to output an on signal if the command was a success, in which case, if the next time someone presses the button the command is still a success, the button being pressed will activate the second command block. If the command block has an on signal and the button isn't pressed or if the button is pressed but the command fails, the final command block will not receive an on signal and not activate. If the first command block is outputting an on signal, and a player comes to press the button who would normally (by them themselves pressing the button) cause the first command block to fail its command, the output would turn off, and the repeater delay on the left side would give enough time for the signal to reach the lower redstone torch as an on signal, so that when the left side singal reaches as off, nothing changes for the final command block, and the player will not activate the command block since the first command block's command was not successful. Shotmichael --72.181.158.88 03:06, 4 August 2013 (UTC)

How do you use 2 commands with one block?

Can you use /tp and /say in the same block? If so, how? Enderderp572 00:23, 27 August 2013 (UTC)


Enderderp572,

 I'm 99% sure that it is not possible to enter two separate commands into the same command block, but, using a few pieces of redstone dust, it's very easy to hookup two separate command blocks to one output signal. 
()-----------[]
        l----[]

(Incase you're wondering, that is supposed to be an example. :)

                                           --Ms Juiceboxe 16:34, 3 September 2013 (UTC)

You can't put 2 commands in one command block so use 2 command blocks connected by a redstone repeater.
Bubby3 (talk) 23:45, 14 October 2013 (UTC)

Integer Overflow

If a correct numerical value is used as the maximum radius, it is possible to set the radius to 0 even though it's technically not allowed. This means that the radius is only one block, and no blocks around that one block.

Should this be added as trivia?

How do you get a command block to test for a player with a certain item?

I am trying to get it so that when i hold the item, it changes the weather to clear.

You can make one that tests for the item being used. If you set one to clear a used tool then it would output comparator signal when the item is used. Connecting it to a command block that gives you an item would be a good idea. 19px Lennbot 19px (talk - contributions) 17:19, 27 October 2013 (UTC)

Not sure, but tested.

Command blocks with the "/give" command won't work if it is renamed. 13:07, 12 September 2013 (UTC)

Just tested it myself and it works fine, however I'm on 1.72 and we were still on 1.6something back in september when your message was posted. 24.68.154.229 07:07, 11 December 2013 (UTC)

Mobs riding other mobs

You can use this thing to make mobs riding other mobs. So far I have made: A chicken riding a (tame) horse A chicken riding a creeper A creeper riding a cave spider A chicken riding the ENDERDRAGON

To do this, type the command into the block like this: /summon <riding mob> ~ ~ ~ {Riding:{id:"<mob being ridden>"}} The names of the mobs must have capitals for the first letter, Including the words within the name(for example, if the mob being ridden is a cave spider, the name is typed as CaveSpider.) If the mob is riding a horse, the horse must be tame. To make the horse tame, do this. /summon <riding mob> ~ ~ ~ {Riding:{id:"EntityHorse", SaddleItem:{id:329} Tame:1}}

Custom crafting recipes

Ok I'm sure this is bad form to mention an idea before you've figured out every last detail and can do it but...
Couldn't command blocks be used to create custom crafting recipes? The testforblock command can check for a block with certain data tags, and anything with inventory slots (chest, furnace, crafting table, etc) can specify what's in each non-empty slot (like summoning a chest with specific items in it...wait is that in the examples? have to add that one!). So step 1 would be getting it to trigger when you have the right items in the right slots of the crafting table, and that's totally do-able. Let's take crafting saddles as our example, and make the recipe an upside-down hopper recipe made out of leather instead of iron ingots (so 5 leather, slots 2, 4, 6, 7 + 9). So step 1 it recognizes that you completed the recipe. Check. Step 2 would be to get the leather out of there. Can I clear the slots without just replacing the crafting table with an empty one? Not sure but I guess blinking the table out of there (contents and all) and putting a fresh empty table in it's place will be good enough if further research says I can't empty the slots. It will however instantly complete the transaction once the last ingredient is in there rather than giving you a chance to change your mind. Acceptable limitation. Step 3 would be giving the finished item to the player, and I'm pretty sure it WON'T let me place the item in the "finished item" slot of the table. No problem, just throwing the item at the player will be good enough. Another acceptable limitation.
One drawback is I think you'd have to make it only work on a crafting table at 1 specific location. It could search for a crafting table with the right items in the right slots (Step 1) in a range (globe shaped area) but it would need a specific location to do Step 2 and Step 3. So yeah I don't think the range version of this would work. However if anyone's Minecraft-Fu is better than mine please prove me wrong on that. Anyway it's just as well though as this type of thing seems right (from a storytelling point of view) to be confined to 1 crafting table in 1 location (actually it's ANY crafting table so long as it's in that location). I'll see if I can whip up a finished code example... 24.68.154.229 04:36, 18 December 2013 (UTC)
EDIT: Just realized that if Step 3 is just throwing the items at the player I could have a few different items. Like a recipe (don't know what) that gives you a wooden hoe, 5 wheat seeds and 2 water source blocks. Pity I can't throw in a wide brimmed straw hat and a pair of overalls. 24.68.154.229 05:23, 18 December 2013 (UTC)
EDIT 2: Also it wouldn't have to be a crafting table. A double chest could be used to make a insanely big 9x6 crafting area. 24.68.154.229 06:20, 18 December 2013 (UTC)
EDIT 3: Taking a lot longer than I thought. Definitely going to have to use chests (or hoppers). Also turns out there's a major bug in the testforblock command (and Mojang has offically said it's not a bug and they won't be fixing it ever...but we got a workaround that works) that requires you to specify what kind of numbers your numbers are every time (short, byte, Long, float or double), plus include everything (not just the stuff you're using). Here's working sample code from the staff at the offical bug report site: /testforblock ~ ~+1 ~ chest 0 {Items:[0:{Slot:0b,id:1s,Damage:0s,Count:1b}]} (I got it to work without the mysterious "0:". Keep in mind that the chest's damage value is direction facing, so it may not be the same for you if you try it). I say Mojang said they weren't fixing it. It was Grumm and what he actually said was "stop complaining. You have your workaround so use it." The "complaining" was asking them to include it on the confirmed bug list rather than marking it as "resolved/intended behavior" (which seems to be what 50% of the mods there do to every bug report no matter how valid it is, even if it's incapable of doing it's default behavior (coughtestforplayerwithcoordinatescough)). Anyway I got step 1 finished and am getting tripped up on step 2. Step 3 is just "give player item" which is like the first thing I ever learned with command blocks so it's a matter of 5 seconds of coding. Once I have step 2 figured out I can post finished working codes on the "example" section (I'll try to keep it concise too, something I sometimes have a problem with (really? :) )
Oh also I tried googling the basic idea and someone else has built one (but his is way more complicated than it needs to be). He solved step 2 using minecart with hoppers riding squids. And here I was thinking a regular hopper might be enough! I think I need to give up on finding a command that removes stuff from chests though. There isn't one (without mods at least). Also I guess there isn't one to add stuff to chests, just to spawn in a new one pre-filled. 24.68.154.229 04:51, 19 December 2013 (UTC)

These kinds of questions are better hashed out on the forums or reddit. This page isn't for talking about command blocks, it's for talking about the article about command blocks. Which sometimes includes talking about command blocks … but more just figuring out how they work, not every possible thing you could do with them. : )
munin · 16 px 16 px · 07:50, 19 December 2013 (UTC)

Teleport relative to specific thing?

When using ~ for relative coordinates, is there any way to specify who or what these coordinates are relative to? E.g. can hey be relative to a specific player, a specific entity, or the command block performing the command? Ideally I would like to have a command block that teleports players to coordinates that are relative to the command block itself, so I can just copy and paste it everywhere without having to adjust the coordinates all the time. Is this possible? LB(T|C) 23:28, 21 February 2014 (UTC)

Teleporting The Player Facing A Certain Direction

I wanted to know if was yet possible to teleport players, using command blocks, to a specific location, but also making them face a direction. I have tried to look this up, but so far I have found nothing useful. Can anyone help me? –Preceding unsigned comment was added by ZenBoss (talkcontribs) 01:17, 20 April 2014 (UTC). Please sign your posts with ~~~~

This is possible; see the documentation on the /tp command. -- Orthotopetalk 01:29, 20 April 2014 (UTC)

Unavailable Commands - "Unknown Reason"

I noticed that all of the commands that were listed as being unknown as to why they are disabled all have to do with spamming the players' chat in multi-player. If, for example, you could force a list of everyone on the whitelist to be brought up, and then set this command or even several similar command blocks to rapidly fire off this command, then you would effectively flood the windows of everyone on the server with chat messages. Likewise, the third category listed commands that also work in a similar fashion, but due to only outputting to only the user, they don't work well in a command block anyways.

So, I'm no wiki editor, but I thought it might be good to let someone know that there is a reason for their unavailability. It's all about preventing spamming on servers as a form of griefing. Good luck with the wiki!

If this were the case, then those commands would have to be issued to every player upon use, yet they aren't. /banlist and /whitelist list only appear to the player who initiated it (so long as they're OP'd), same as /scoreboard objectives/players/teams list. Thus chat spam is not the reason. It's possible to do with the requirement to be OP'd to begin with to use the /whitelist and /banlist commands, while you do not need to be OP'd to view the "Previous Output" tab in command blocks (in which the whitelist/banlist contents would be shown to players who are not supposed to see it). However, then the same should be the case for /scoreboard lists, yet it still shows its output. Then it could be a privacy matter. Still, a proper confirmation would be needed instead of speculation. Skylinerw (talk) 22:21, 24 June 2014 (UTC)
Without citations, all the "reasons" are speculative and probably don't belong in the article. —munin · 16 px 16 px · 02:48, 25 June 2014 (UTC)

Question

I was just wondering how to make a command block that kills every player that triggers it except 1 listed player? -reeddeer–Preceding unsigned comment was added by Reeddeer (talkcontribs) at 13:58, 6 September 2014 (UTC). Please sign your posts with ~~~~

1. Welcome to the wiki!
2. Don't write your name, sign your posts with four tildes (~~~~).
3. When adding a new topic, add a heading or use the Add Topic button at the top.
4. This page is for talking about the command block article. Ask questions like this on the forums instead.
5. This question is about commands, not about the command block.
6. /kill @a[name=!ListedPlayerName]
munin · 16 px 16 px · 15:06, 6 September 2014 (UTC)

Error Founded

In the Page there is written Some commands, such as /me, /say, /tell, and /tellraw, would be expected to require a player as the executor, but work in command blocks (and the server console) using the command block's name (which defaults to @) in their output but in the 1.8 update if you do /tellraw with a command block it don't show the @. --Masteref (talk) 09:51, 5 October 2014 (UTC)

Confirmed and fixed. —munin · 16 px 16 px · 16:56, 5 October 2014 (UTC)

Multiple commands per command block?

O.K., so I was making this huge arena with a sand wave floor & mob/fire charge/splash potion dispensers. It is being built at Y=156 and is 121 blocks in diameter as an octagon. I really wanted to put some command blocks in it to summon lightning and different points using a chicken randomizer and AND gates to make sure that it only activates when I want it, (long story), and anyway, what I wanted to know was if I can program a command block to summon multiple lightning bolts at different locations all from the same command block? If someone could tell me if this is possible and how to do it, it would be much obliged. Thank you. P.S. your wiki's log-in system isn't working properly, I logged in just before I started writing this and when I went to write this I was logged out even thought I had just logged in. Brickticks (talk) 15:55, 20 October 2014 (UTC)

From the same command block is impossible. Laura Fidalgo (Talk / Contribs) 16:00, 20 October 2014 (UTC)
Oh, OK. Brickticks (talk) 17:49, 20 October 2014 (UTC)
It's not completely impossible (depending on how you want to define "one" command block), but the method is probably pretty ridiculous for what you want to accomplish. (example) —munin · 16 px 16 px · 18:37, 20 October 2014 (UTC)

How about place another command block.but if you want one thats impossible.--Paidpop (talk) 22:08, 4 November 2014 (UTC)


Actually, its possible! watch the video of dragnoz:

www.youtube.com/watch?v=YCy3qdO4pXQ

It will allow you to summon Lightning randomly over the place, although, you will be spawning mobs with custom name with an effect of invisibility... There would be a command block who will execute the command on the mob with custom name and summon a lightning on them (e.g.: mob: Silverfish, CustomName: LightningMob... the command on the commandblock would be /execute @e[type=Silverfish,name=LightningMob] ~ ~ ~ /summon Lightning ~ ~ ~).

 112.204.222.52 08:50, 22 December 2014 (UTC)

-Satchi