命令方块是一种帮助支持冒险模式,SMP的自动化,和自定义地图。了解更多细节,请参见命令方块页。It's a good idea to first look at 坐标 if you don't know what to set the x, y, and z values to in some commands.
Command blocks can be used, among many other things, to change the difficulty, change the state of the weather, or give you predesignated items. They are particularly useful for the /weather and /time set x commands, as they are only available in cheat mode otherwise. The /time set x command is especially useful, as it allows you to change the current time to a preset time at the press of a button.
Command blocks can also be used to make text appear in the person's chat menu. The code to do this is tell @p <message>, or tell <username> <message>. If the @p parameter is present only the nearest person will see the message. If a username was specified, the username will be sent the message. You can also type: /tell <your username> @p and whenever someone walks over it is will say: "@ whispers to you: <username>.
Changing the difficulty is accomplished by /difficulty x and x=0 to 3 or the name of the difficulty (ex. /difficulty peaceful).
Another way to use Command Blocks is to use /tp @p <coordinates> to teleport between different bases in your world.
Give a random player an item and then tell everyone
This contraption will give a random player 5 cookies and tell everyone.
make an objective called "cookie"
/scoreboard objectives add cookie dummy cookie
1st command block,
/scoreboard players set @r cookie 1
2nd and 3rd command block (at the same time)
/say @a[score_cookie_min=1] has been given 5 cookies.
/give @a[score_cookie_min=1] minecraft:cookie 5
4th command block,
/scoreboard players set @a[score_cookie_min=1] cookie 0
"I" = input.
Teleporting
You can teleport by using the /tp command, where y is the vertical difference between the upper and lower elevator entrances.
The elevator can also be made to tp a player to any x y z coordinate just by leaving out the ~ before the numbers. When ~ is left in the command, the normal x y z is set to 0 0 0 where the command was made, such as standing on a pressure plate or wherever the player is standing when the command block received power. If a pressure plate was at the x y z coordinates of -36 96 -12 that ran to a command block with a command of /tp @p ~3 ~4 ~5 it would tp the player to the coordinates of -33 100 -7. The same outcome can be achieved by having the command of /tp @p -34 100 -8 one block must be subtracted from the x and z axis to get to the right coordinates.
Security System for Players
Command blocks can also be used to make a security system. Just put a pressure plate which triggers a command block in front of an iron door, which will be the entrance to your house. Insert the command: /tp @p[r=<radius>,name=!<yourname>] <x> <y> <z>. For mobs, a simple fence or lava moat will do.
Moving Sidewalk
A similar concept to the elevator but made to move a player along the x or z coordinates.
This can be created by:
Use the /fill command with your coordinates. (/fill x y z x2 y2 z2)
For the block you fill it with, use this:
command_block 1 replace {Command:/tp @p ~-1 ~ ~}
Edit the coordinates inside the brackets to change the direction you will move
Place pressure plates on top of all the command blocks.
Step on it
You might want to turn command block output off....the chat will explode in your face.
永恒的昼/夜
通过使用蜘蛛网和一个矿车,就能使用/time set 0跳过夜晚。矿车需要31秒才能从蜘蛛网上掉下。所以,使用23个堆积起来的蜘蛛网和一个探测铁轨几个充能铁轨将会保持太阳在天上。
要制作它,你首先需要将阳光传感器放在露天场地。然后连接一条红石线。红石线的距离取决于你的所需设置的时间。最多可以放15格红石。然后,在红石线的另一端放一个实体方块,在方块的另一侧放上红石火把,然后在红石火把可以激活的范围内放置命令方块。鼠标右键单击命令方块然后以"/time set "开头然后在末尾输入一个有效的时间数字。这个数字取决于你想设定的时间。例:14000是晚上,8000是中午.
Translated by Google Translator , if there is any mistakes , report to Google Translate*
關了.
開了.
用作開啟的指令.
用作關閉的指令.
無線輸出設定.
Wireless Redstone 06.png
無線輸出指令.
Another way of having wireless redstone using the "/summon" command. The command used here is /summon FallingSand -118 150 -60.5 {TileID:76,Time:1,DropItem:0}
You can also achieve wireless redstone by using the /setblock command instead of the scoreboard system. All you have to do is let the command block set a redstone_block to the destination coordinates - together with an air block (or anything that does not output a signal) being set to the same coordinates from a command block connected to the inverted signal.
Wireless Button
This can be done with any block, technically, but buttons, levers, and other interchangeable blocks add an interesting effect. It's surprisingly simple, despite the mysteriousness on servers. It uses the 1.8 command testforblock. The setup is simply a command block, a comparator to translate the command into a redstone signal, a block to be tested for, and a clock to repeatedly activate the command block. Here's the example for a button:/testforblock 123 12 123 stone_button 10. You use the coordinates and name for the specific block you want to test for, in this case a stone button located at 123 12 123. This can be interchangeable for any block that changes data value. The number 10 after the coordinates corresponds the data value of the button that we want the command block to test for. In this case we want the command block to activate when a button facing west is pushed, so we set the value to 10.
Note: this value changes depending on which direction the button/lever is facing. The initial value for a button facing west that is not pressed is 2. When a button is pressed, it adds a value of 8 to the initial state, so a button facing west when pressed would then have a data value of 10.
Refer to: Button#Data_values & Lever#Data_values for the data values.
Starter Kits
By using m=, you can make a kit on a server/custom map that can only be obtained once! First, dig 3 squares down in the ground, then place a row of command blocks (one for each item in the kit). In the GUI, type /give[m=<starting gamemode, in number form>] <item id> <amount>. Do this for each item you wish to give. Make an extra command block that has the command /gamemode <a different gamemode than the starting mode>, then string redstone across all of the command blocks (this can be done easily by sneaking and placing). Fill in the hole and place a pressure plate over it. When players walk over it, they will get the desired kit of items and it will change their gamemode so they cannot receive it anymore (unless cheats are used) (Note: This method can also be done by using the method above only using (First name your kit do /scoreboard objectives add <kitName> dummy <kitName>) scoreboard commands! /give @p[score_<kitName>=0] <item id> <amount> for the row of command blocks giving you the items and /scoreboard players add @p <kitName> <any number greater than 0> to make it a one time use. Also you can make more than one kit if you repeat the steps and use a different <kitName>).
As a replacement for pressure plates
Don't you hate how there's only 4 materials that pressure plates blend in with? (stone, oak wood planks, iron and gold)
Now you don't have to put up with that. Pressure plates can be replaced with a command block by using the command /testfor with a range and a clock circuit. The command /testfor @p[r=2] will test to see if any players are within a range of 2 (the command block itself plus 2 more blocks in every direction). Range 2 is the range you want for a command block under a floor. Keep in mind that it will produce a globe shaped trigger area (rather than a cube), so a range of 2 makes an approximately 5x5x5 area and a range of 1 makes a 3x3x3 area (more like a + pattern with an extra block above and below the center). You can get around this by using the dx, dy and dz arguments. Alternately you can specify xyz coordinates in the code (e.g. /testfor @p[x=50,y=64,z=46,r=1] but be warned that you cannot shrink the range to the 1-block point. As with the non-xyz version range means center block plus range number of blocks around it, which makes sense from a command block (where "just the center block" would mean you have to be standing IN the command block) but doesn't make sense here. At any rate a range 1 sphere (+ pattern with an extra block on top and bottom) can be buried underground with just the top sticking out, provided you know no one will be walking through the bottom 2 layers of the globe. Trying this with the non-xyz version of the code would require the command block itself to be embedded in the surface of the floor where it can be seen.
Using Command Blocks in Single Player Non-Creative Maps
By swapping gamemode it is possible to use command blocks in single player outside of creative mode. Simply swap to creative mode with the /gamemode 1 command, set the command block command to whatever you want, then swap back to /gamemode 0. The command block only needs to be set in creative, but will still function once back in normal.
It can also be used to teleport to certain areas (for ex. a far-away Stronghold, a deep mining operation, or a floating island). If it took you a very long time to get there, and if you don't mind sort-of cheating, then you can set up a teleport system. Make sure that you are on Creative mode while setting it (use the command /gamemode 1. If you don't have cheats enabled, open the LAN and set the cheats on), but you can still activate it in Survival mode. Type this command in when having the Command Block GUI open /tp @p x y z . Then, activate the command block with redstone (including buttons, levers, and pressure plates), and you will be sent to your far-away destination. You can set up multiple different teleports. This can also be used when doing a big project that spans over a very large area or if you are transferring chests to from an old house to a newer house.
使用 /spawnpoint 可以直接设置出生点,但是要跳过白天就需要 /time set <时间> 指令,18000为夜晚(并非绝对,可以按喜好设置,不要少于12500),这样就可以模拟出睡觉的效果了。
(/time set 700 不是可以直接转为白天吗?原文意义何在?)(/spawnpoint指令和/time set 700配合不就行了么?这一条意义何在?)
Talking Adventure Map(featuring an easy Quest System!)
/say指令非常有用因为它可以直接给玩家发送消息. 用命令方块将会更好,这样你就不需要放很多的牌子和编页码长到不行的书来告诉玩家游戏规则. 你只需要把命令方块放成一条线然后在中间铺中继器来弄各个语段之间的延迟(so the player isn't spammed)接着你就可以把那堆牌子和放着书的箱子移走。
有一些是和NPC配合使用的. 想象一下你进了铁匠铺并且你想要让里面的铁匠说些什么。在命令方块出现之前, 你需要一些书和牌子来充当对话的效果, 然后在铁匠铺里造些房间并放些杂物,这样会让这个铁匠铺看起来变得非常乱,但是现在,你只需要使用/say命令来制造铁匠说话的效果. Maybe a pig behind the counter will even beg for mercy! Let's take another example: you are in a factory and an alarm suddenly rings and says that it's going to explode. Having it in the chat, especially if the text is long, keeps the stressfull mood; the same thing works for bomb timers. The player will get more into the map's mood if the chat displays '10...' '9...' '8...' also.
Last but not least, it makes it easier to create a Quest System. Let's say the player gets in a butchery. He activates through a pressure plate connected to a RS NOR Latch (so it can't be activated twice) and a command block with the /say command in which the butcher asks for the player's help: he needs to kill a pig (shame on him). The player gets to the pig that is standing on a stone pressure plate, that turns off when the pig is dead. So, when the player gets back to the butchery, he activates another circuit containing yet another RS NOR Latch and two command blocks with two commands. First, the /say command in which the butcher thanks the player, and other one, the /give command, so the player gets the reward. Along with that, don't forget to use the @p command so the butcher says the player's name. For example, if the command block is set to do this: /say Thanks, @p. You helped me a lot killing that pig., the channel will say: "@]: Thanks, <name of the player>. You helped me a lot killing that pig." This makes the map way cooler and looks like it's made for the player as it says his/her name!
Subtracting xp CAN work as a currency, by using the command /xp -3l @p[lm=3] where l (L for level) is subtracted. The minimum xp for the command to work can be listed inside the brackets, where lm is short for minimum level necessary.
You can make a Store using xp as a currency. Just place a command block before all the others with the following instructions: /testfor @p[lm=5] with a Comparator in front of the command block. That way you can only do the trade if you're at least at level 5 (in this case, but you can choose what level you want).
The last two "updates" are pointless, as the [lm=(level)] in the first post will keep players from getting the item or losing their xp unless they are that level or higher. so if the command says [lm=5], they will NOT be able to use the "store" if they are level 4 or below, but WILL be able to if they are level 5 or above.
The blocks must be in order for this to work. If the blocks are powered at the same time, the cost block will subtract as per normal, but the block giving the item will not function unless your level is double or higher what the cost of the block is. (example: item costs 5, you have 7 levels, you will lose the 5 levels, but will not gain the item. You would only receive the item if your starting level is 10 or higher) The fix for this is to power the blocks linearly, give block first followed by xp block.
Minecarts over floating rails created with the setblock command.
在1.7版本中, the command block gained an expanded potential. 也就是 /summon and /setblock 命令的添加, and can be used to automatically build structures, fill chests, 以及生成以前不能生成的实体。 下面是这些命令的语法:
setblock的使用方法:/setblock <x> <y> <z> <方块名> [数据值] [旧方块处理方式] [数据标签] summon的使用方法:/summon <实体名> [x] [y] [z] [数据标签]setblock指令也可以用于做突然消失的地板或突然出现的墙。
setblock指令的例子:
* MobSpawners pt 1: The Basics
This code will create a zombie spawner 2 blocks from you in the x direction. Note that the name given for mob spawners in this code ("minecraft:mob_spawner") is the long version and you can leave out the "minecraft:" part.
A few things to note:
A) All times are in game ticks (20ths of a second). 200-800 is 10-40 seconds.
B) Keep in mind that they are in groups of 2 and won't work if their partner is missing. SpawnRange requires RequiredPlayerRange (and vice-versa), MinSpawnDelay requires MaxSpawnDelay, and I assume SpawnCount needs MaxNearbyEntities (although I haven't actually heard confirmation on that last one).
C) There is also a parameter called "Delay" which contains the amount of time before next spawn (20 ticks for the first time, whatever random number it picks between MaxSpawnDelay and MinSpawnDelay every other time).
D) the coordinates given are ~0 ~-1 ~-3 (so 3 blocks in the negative Z direction from the commandblock's current position and 1 block down). This presumably will imbed it in the surface of the floor. Keep in mind that a spawners "SpawnRange" setting only applies horizontally not vertically. Vertically it will only spawn at the same height or 1 lower or higher, so imbedding it in the surface of the floor cuts the available spawn area by 2/3rds (but can help hide it). Naturally occuring spawners have their height cut by 1/3rd due to appearing 1 block above the floor instead of 2.
E) All the values used here are the defaults.
* MobSpawners pt 2: Custom monsters
Now we get into the SpawnData. That's the stuff that tells the spawner you want a non-standard version of a monster, like a Zombie with a Diamond Sword and a Chainmail Helmet.
Using ~ without any number after it in the coordinates counts as zero. Since none of those 6 parameters from last example are used they will all be defaults.
Note that the 5 equipment slots are: Hand, Boots, Legs, Chest, Helmet. You must even specify empty slots (the { }, parts) unless they're after the last non-empty slot. So if you want him to have a helmet you have to specify all 5 slots, but if it's just a weapon you can leave off the other 4. Or if you want him to have leg armor you have to specify weapon and boot slots but not chest and helmet slots.
By the way, creatures that burn in sunlight are safe if they have a helmet on, although it damages the helmet instead.
About the Count tag: most codes can get away with leaving it out, however it is important. An item without a count tag is a stack of zero, better known in the community as a "Ghost Item". A player trying to use a ghost item will have it disappear out of his hands with it's first use (which is a failure). While monsters can use ghost items without problem (hence why codes get away with leaving it out sometimes) if they drop the items the player who picks it up won't be able to use it, SO INCLUDE COUNT!
Next up we have a Skeleton with an enchanted bow (Flame), a custom mobhead (Spider, internet connection required or it's just steve) with Protection 2, and riding a Skeletal Horse.
Well actually sitting on a Skeletal Horse, since the lower creature controls the movement and the horse isn't hostile. Don't try zombies on horseback, they just sit there ineffectually while the horse eats grass and snorts. Luckily this is a skeleton and can shoot you from wherever the horse decides to wander.
As for the horse itself, it's type 4 (skeletal horse), Tame is set to 1 (yes), and it's got a saddle (and the fact that they make us specify which saddle hints that they may eventually have more than one type). Technically you can have multiple levels of riders, although this gets silly quickly.
MobSpawners pt 3: SpawnPotentials
Using the SpawnPotentials tag lets us create a mobspawner with multiple mobs in it. It will randomly pick one each time it resets the timer (a second after spawning the previous mobs). Since these codes contain multiple mobs they tend to be quite long codes. Thanks to some youtuber whose name escapes me (Dragnoz) the fact that you can "break up" your code is known (command blocks ignore line breaks, so you can start a new line to clarify where one section ends and another begins and it won't ruin your code). Here's a more easy on the eye version of a SpawnPotentials code
Wow that's a mouthful! But then it is 6 separate mobs. In order we have:
0) Before the "SpawnPotentials" tag: The starter, which will never pop up again after the first time. If we want to see him again we have to include him a second time under SpawnPotentials. He is just some random dude in bluejeans (blue dyed leather leg armor) and a cactus green shirt (green dyed leather tunic) with a wooden sword. He's a zombie under that random-dood-mobhead of his of course. They all are.
1) Same random dood, only this time his wooden sword is 2 hits away from breaking.
2) Hey who let a ninja into the game?!? This one is a skeleton under his mask, but he's been given an iron sword. All his leather armor is dyed ninja-black. Skeletons with swords close the gap quicker than zombies so watch out.
3) Stone Sword and Chain Armor guy. Protection II on his mobhead.
4) One of my favorites. Gold Sword, Golden Armor, Pumpkin Helmet, and ON FIRE!!! Originally I wanted to give him a flaming pumpkin helmet but I realized the Fire tag only applies to entities not armor. The pumpkin is enchanted with Protection II and Fire Resistance X (10!) in a desperate attempt to keep him on his feet and threatening the player for more than 5 seconds. It works but if the player plays keepaway then Mr Pumpkinhead does tend to burn to death. Oh his sword has fire aspect too.
5) Iron Sword and Armor guy. Sharpness II on his Sword, Protection II on his mobhead.
6) Diamond Weapons and Armor guy. Wait who is that. Is...is that...Oh Em Gee it is! Run!...No of course it's not really him. Because he doesn't exist. FakeHB here has highly enchanted Diamond Armor (Boots with Fire Protection IV and Feather Falling IV, Leggings with Blast Protection IV, Chestplate with Protection IV, Mobhead with Protection IV, Fire Protection IV, Blast Protection IV, Respiration III) and a Diamond Pickaxe enchanted with Sharpness IV, Smite IV, Bane of Arthropods IV, Looting III and Unbreaking III. He's also got the previously unseen CustomNameVisible (set to 1 for yes), a CustomName, and PersistenceRequired (set to 1 for yes). That last one will prevent him from ever despawning, although he can be killed normally. If you can get through that Diamond Armor. And level 4 resistances. Luckily he's rarer (see below).
Other than the ninja it's a straight tour of the 5 tiers of swords and armor. Note the Weight tag, used right after the mob name in each SpawnPotential. That determines how rarely it's picked. Specific numbers don't mean anything, just the ratios between the numbers. For example if you want all the potentials to have an equal chance just set all the weights to 1. Changing them all to 8 wouldn't do anything different (they're still all the same size as each other), however changing all but one to 8 would make that one 1/8th as likely as the rest. In this code 4 is the default. The ninja only has a weight of 2 (making him half as likely to be picked) and FakeHB has a weight of 1 (making him 1/4th as likely to be picked, and thank god!) * MobSpawners pt 4: Rideable Monsters
Mobs can be ridden by using Minecarts or Boats on their heads. The command is fairly simple /setblock ~ ~1 ~ mob_spawner {EntityId:MinecartRideable(or Boat), SpawnData:{Riding:{id:<Entity>}}}
Tips:
Some mobs simply can't be spawned with a spawner, sad to say, like bosses and Iron Golems. Adding a Minecart isn't going to change that.
Hostile Mobs with shooting abilities can and will use them against survival players. Watch out.
Ghasts cannot be ridden. The minecart becomes stuck in their head, no use to anyone.
Endermen cannot be walked around, but they can be forced to teleport by shooting a projectile at them (eg; snowball).
Ocelots (Ozelots in the game format) are some of the fastest mobs to ride, seeing they're trying to get away from you. They can also be partially controlled, by pointing away from the place you want to go.
Spiders are the only mobs that slow down when ridden.
Slimes and their cousins, Magma Cubes (game format LavaSlime) cannot have their sizes changed.
New 1.8 uses
New commands
There are several new commands and tags added in 1.8. One of the most useful being @e. It allows the player to target entities.
You can now teleport creepers, or kill a minecart. Others include /fill, /clone, /execute, /worldborder (set|health, etc}, /trigger, /title, /blockdata, /testforblocks, and /stats.. Check out the commands page to see how they work
Commanding Passwords
You can now create passwords with command blocks, using /testforblock. Place a command block. This will be the one you put input in. Place another command block, and type in the command /testforblock (x,y,z of first command block) command_block 0 {Command:(input)}. Here's an example: /testforblock ~2 ~ ~ command_block 0 {Command:That's Numberwang!}. Place a comparator connected to the second command block, and place a button on or next to it to power the block. Now type "That's Numberwang!" (without quotes). If the second command block properly finds the first, the comparator will activate whatever it's wired to. If you want the first command block to reset so the password isn't used by someone else, also place a command block with /setblock that activates after the /testforblock.
The Destroyer
This allows you to destroy a cube of materials around you as you walk, using /execute. Here's the command: /execute @p ~ ~ ~ fill ~1 ~2 ~1 ~-1 ~-1 ~-1 air. Attach a clock or some sort of repeating device to it, and the cube of air will follow you wherever you go. Confused? The @p specifies the player (you), and you can change it to all players, or mobs. Imagine enderman blowing holes randomly. "~" is shorthand for the place you are, and adding numbers to them adds that to the area. fill takes out a specified amount of space, similar to setblock, but it uses two xyz's and fills the space in between them with the material you choose. In this case it's air. Now, every time you move, it will fill a 3x3 cube of air around you. Great for enemy bases, or simply being a crazy griefer.
Tips:
This also deletes water, so you basically become a moving sponge.
This works in any game mode, even spectator. This means even more advantage for griefers.
Landscaper
This is a version of Destroyer. /execute @p ~ ~ ~ fill ~1 ~-1 ~1 ~-1 ~-1 ~-1 grass. This puts a 3x3 grass square under your feet. Only problem: Don't jump. It becomes a mountain of a problem.
Examples
The player can make a kind of world guard using the command block. (e.g. code: /gamemode <模式:[survival|creative|adventure|spectator]> @a[r=<radius>])
Using the radius argument with a teleporter hooked up to a clock circuit can be used to create an exclusion zone ("forcefield") around an x y z coordinate (which should not be centered on the command block itself, otherwise it will be difficult to edit or disable it later). Simply program it to teleport any player within a certain range to a further away point, or just back 10 meters using relative coordinates. Note that such a forcefield wouldn't know which direction you were approaching from, and may result in pulling a player in before pushing them back out the other side.
The commands /say Hello, @p, /tell @p Hello, @p, and /me Hello, @p will cause the command block to say user name of the nearest player in the message.
You can also clear players inventories, to prevent griefing and/or cheating: /clear <目标(玩家)> <物品> <数据> <最大量> <数据标签>
Spawners
Command Blocks can create spawners using the setblock command, eg.: /setblock ~1 ~-1 ~0 mob_spawner 0 replace {EntityId:Zombie,SpawnData:{Equipment:[{id:276,Count:1}]}} Anything that counts as an entity can be spawned (except a player), which includes all hostile, neutral and passive mobs, as well as animals, minecarts, fireballs, arrows, snowballs, ender pearls, custom thrown potions, fireworks, primed TNT, falling sand, red sand, or gravel, paintings and item frames, experience orbs, and even dropped items of any type.
Pig/Cow/Chicken spawners can be placed in the butcher's backyard in a village to create a constant meat supply. E.g.: /setblock ~1 ~-1 ~0 mob_spawner 0 replace {EntityId:Chicken,MaxNearbyEntities:10,RequiredPlayerRange:16,SpawnCount:6,SpawnRange:2,MinSpawnDelay:50,MaxSpawnDelay:200,SpawnData:{Riding:{id:"Pig"}}} Note that the spawner in the last code example will spawn a chicken riding a pig. There doesn't seem to be a limit to how many levels of riders you can use (e.g.: a chicken riding a pig riding a cow riding a horse riding a silverfish riding a villager ("Say, that's a mighty odd hat you have on, Farmer Brown")).
Please note that if you want to use the RequiredPlayerRange tag you have to use the MaxNearbyEntities tag as well. Same deal with MinSpawnDelay and MaxSpawnDelay. Lastly, note that the y value used in both of those spawner example codes was ~-1, which (assuming you're not flying) will put the spawner in the surface level of the ground at your feet.
If you don't want to target a specific player, you can use @a, @p, or @r instead of <player>. Keep in mind that you can use @p (which means "closest player") in player issued commands as an easy to type 2 character replacement for your own name as the closest player to you will always be you.
Booby traps
The most lethal booby trap would be a command block set to teleport someone into the void.
As of 1.8 you can do /kill @e[r=2] in a command block below a block with a pressure plate to make a multi-use landmine that kills all nearby entities upon stepping on it (including players, item frames, and paintings)
Note that booby traps that use @p can be dangerous due to the fact that non-player entities could trigger them (if something like a pressure plate is used), resulting in the teleportation of the nearest player, no matter how far away they are and regardless of the fact that they haven't actually stepped on the plate. To get around this, you can use the /testfor command as an invisible pressure plate. Hook a clock circuit up to a command block programmed with /testfor @p[x=1, y=2, z=3, r=radius], with the coordinates changed as appropriate. Note that as of 1.8 a range of zero can now be specified.
Teleporters
It is possible to make teleporters using the command block. (e.g. code: /tp @p x y z) Taking it one step further, a teleporting station can be made, with multiple button-activated teleporters that each teleport to different locations. Scouting and testing teleportation destinations first is advisable, to make sure players don't end up stuck inside blocks or in other unintended places. If you appear in ground while testing coordinates, use /tp @p ~0 ~8 ~0 to get out (may require multiple uses).
If you use the teleport command with the command block, you can use relative coordinates in the destination coordinates by placing an ~ in front of a Coordinate (e.g. code: /tp @p ~0 ~8 ~0 This would teleport the player 8 blocks into the air).
Commands that use coordinates (e.g. /tp or /spawnpoint) add 0.5 to whole numbers when no decimal follows. This is so you appear centered over the block you appear on instead of at the edge or corner of it. For example, the number -33 would execute as -32.5, and 187 as 187.5. To prevent this behavior, add .0 (25.3, 90.0) after them, as these values are executed left as-is.
With the 1.8 update, you can now also teleport minecarts or boats, with you in them. The command is /tp @e[type=Boat] (coordinates).