命令方块可以使用在许多事情,改变难度,改变天气的状态,或者给你预先指定的物品。他们在这些领域特别有用:/weather 和 /time set x 命令。他们只能在作弊模式之外。 /time set x 命令很有用,它允许你改变当前预定时间再按下一个开关。
命令方块也可以被用来使文本出现在人的聊天菜单。命令是 tell @p <message>, 或者 tell <username> <message>.如果加上@p在tell的后面,那么只有最近的玩家会看到信息 If a username was specified, the username will be sent the message. 你也可以输入: /tell <your username> @p and whenever someone walks over it is will say: "@ whispers to you: <username>.
你可以用已下命令去改变难度 /difficulty x 0=和平,1=简单,2=普通,3=困难,或者在后面直接打上难度的名字。(例如:/difficulty peaceful)
另外一种使用命令方块的方法是使用代码/tp @p <目的地坐标>在两个不同的基地之间传送。
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).
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).