Talk:Command Block/Archive 1

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 refers to either @p, @r or @a.

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)

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 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)

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  and   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?

you can.do /give (yourname) 137 (cheats must be enabled)

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.  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  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  (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)

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=! ] 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. –ultradude25 ᐸ Talk 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  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)

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, it will teleport all players on the server to me. Using would tell all players "Hi!", but not appear in the main chat or minecraftserver.exe. Meeples10 signature.png ᐸ Talk  Contribs  11:33, 9 July 2013 (UTC)


 * It does list players if used in the text area of a command. For example: returns Hi, playername1,playername2...playenameN Redstone_(Dust).png Lennbot Redstone_(Dust).png ( 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= } 9 30 and even without the =, but its not working. Any help? –Preceding unsigned comment was added by 174.91.35.138 (talk)&#32;22:34, 2 June 2013‎(UTC). Please sign your posts with


 * @p only targets the closest player; try using . -- Orthotope talk 01:17, 3 June 2013 (UTC)

no, its --99.231.34.135 20:20, 5 July 2013 (UTC)

It's  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.

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.


 * -- see command.


 * This page is for discussing the Command Block article. Questions like this are better asked on the [//www.minecraftforum.net/ forums].


 * &mdash;Munin295 &middot; Grid_Book_and_Quill.png Grid_Stone_Pickaxe.png &middot; 14:27, 27 July 2013 (UTC)

Also you can use numbers instead. 0 for survival, 1 for creative, 2 for adventure, as in. 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. Redstone_(Dust).png Lennbot Redstone_(Dust).png ( 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:{id:" "}} 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:{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)