When working with commands and command blocks, there are a few useful tips that can spare you from many headaches and rage-quits. Starting with the basics, I'll outline some advice that I've gradually accumulated in my exploration of the great commands. Because commands are such a robust topic, this series will be broken into several parts to make it more digestible. The other benefit of this technique is that more advanced readers can easily skip the parts they are comfortable with. However, I aim to reach people of all experience levels with these writings - there should be something for everyone!
BasicsAs you likely know, you can access the chat menu in Minecraft by typing the forward-slash "/" key. Anything typed after this forward-slash key will be interpreted as a command by Minecraft. Typing in this box without the forward-slash will broadcast your message to the global chat. You can type many useful commands directly into Minecraft by using this chat menu, but the length of the command or text you enter is limited to about 99 characters. As you will soon learn, commands can and often need to be much longer than this. Fortunately, command blocks have a command character limit of nearly 33,000 and this allows us to do some really fun things!
To work with commands, you must first make sure that cheats are enabled. When you create a new save file, you will have the option to turn on cheats. If the save file that you are playing does not have cheats enabled, you have two options. The first is to open the game to your LAN or Local Area Network. This is accomplished by pressing escape and clicking the OPEN TO LAN button. Here you will have the option to set gamemode and whether or not cheats are allowed. An alternative method is to download a program such as NBTExplorer that allows you to edit the NBT data for the save files and manually change whether or not cheats are allowed. Once cheats are allowed, you can use commands to change all of the other gamerules.
Getting Command BlocksIf you're ready to dive in to the world of commands, the first command you should use is the one that gives you a command block. Once you have cheats enabled, simply type
- /give @p command_block
|The /give command is a Classic!|
Minecraft has a feature which makes it easier to program commands and reduces the probability of programming errors being made. Once you are in either a chat box or a command block, hit the TAB key. You will be presented with a list of possible commands that you can scroll through with tab. Even better, the TAB key will auto-complete any command that you start to type, at least as much as it can. You will still have to enter some parts manually and have some idea of what the syntax of a given command is, but if you make a mistake with a command you will be reminded of the syntax by Minecraft. It is very forgiving in this way, and makes the world of commands much more accessible for beginners.
You can work with command blocks in survival and creative mode, but not in adventure or spectator mode. Personally, I recommend being in creative mode (/gamemode 1) if you are doing a substantial amount of programming. Although command blocks do not show up in the creative inventory, they are easy to obtain once you have one when you're in creative. You can click the middle mouse button (usually the scroll wheel) and whatever block you are looking at will appear in your hand. This way you can avoid typing the /give command again and again to get more command blocks. If you're needing to program command blocks, you're probably already playing creative in the first place.
Let me give some words of caution about creative mode: When you left-click a single time on a block in creative mode, the block gets destroyed. This isn't a big deal if it is just a standard block, but when the block that is accidentally destroyed stores an elaborate command that you don't have recorded elsewhere, the rage-quit desire builds. The best scenario is that you are able to figure out what the command was without too much effort and reprogram it. The worst scenario is that you don't have any backups and your map no longer works. What is a cautious command block programmer to do?
|Destroy Them All!|