/give YOUR_PLAYER_NAME_HERE command_block COUNT_DEFAULTS_TO_ONE
This gives the player listed the number of command blocks specified. If no number was specified it defaults to one.
If you wanted 47 diamonds you would do something like:
/give YOUR_PLAYER_NAME_HERE diamond 47
Once you have mastered that you can move on to the next phase.
Targeting the nearest player. Instead of targeting a specific player you can target the nearest with @p
/give @p command_block
That gives the nearest player a command block. Pretty handy.
If you place a command_block and put a button on it you execute the command with the press of the button.
I have made a command_button giver:
And the command:
So this is moderately interesting. You could use a dispenser for this but you would have to keep filling it up. This is a close enough to infinite item spawner.
You can also fill an area with an item. If you fill it with air you can clear a flat space to build a base. This is useful if you want a flat area to build on, but like the surrounding terrain, versus the super flat world.
Fill works thusly:
/fill X Y Z X Y Z ITEM_TO_FILL
Why did I put X Y Z twice? It is a range. This range can be a single block if the numbers are the same or a column, or row, or a cube.
To build my castle I cleared a bit of terrain. To find the X Y Z press "F3" on your keyboard. It shows the position of you in XYZ, and the block in Block.
To hide the debug window press "F3" again. Through a bit of trial and error you will soon be an expert in three dimensional coordinates.
This page has a pretty comprehensive list of items:
An important item to remember is "air" that lets you clear a space. I cleared a big cube to start. Then I added walls. The only bit that wasn't added was the crenellations.
Using this fill command you can make gates open and close as well as drawbridges.
You can connect the blocks together for multiple effects using redstone wire. If you want a delay use a redstone repeater.
Here is my close gate and remove the draw bridge.
You can even make a convertible castle:
Okay that was fun but what about making some monsters?
/summon CREATURE_NAME X Y Z