When it comes to commands the sky's the limit as to what you can accomplish in Minecraft. When it comes to spawning certain mobs or items in game however, sometimes typing certain commands in-game might not suffice in whatever it is that you seek.
The command block can help make up for these shortcomings by allowing you to bring into your world very specific items or mobs in certain states for your own purposes and whatever it is you desire. Using them can be a bit daunting, but with some practice they can be very useful tools for whatever your creativity desires.
How To Acquire
To gain the command block you will have to use a certain console command to do so. Bring up your console command bar and enter the syntax as follows:
Syntax: /give @s command_block
If this does not work, in place of @s enter your username so that the game knows to specifically give the command block to you when playing.
Using Command Block
There are a multitude of ways to use the command block, but for today let's go over one of the basics. In order to truly use this block, you will need to fulfill certain conditions beforehand. First you need to enter a command into the block so that it has something that it can act upon. In this case lets summon a pillager captain. To summon your own pillager captain put in the console command as follows in the picture below.
Keep in mind however that the bar that you insert your command into can expand and grow larger if you press the plus sign that is right next to it.
Once you have your command to summon this illager in, you need to attach a device that will allow you to summon it in the first place. In this case we will use a wooden button.
Once you have that wooden button, make sure that you are crouching before you press the use button to attach the item properly. If you do not crouch you will instead go into the command block’s menu.
After the button is properly attached to the side of your command block, all you need to do is press the button and your pillager captain should appear in front of you.
This mob is but one example of what you can summon with this particular item, so imagine the possibilities of what else you can bring into your world. With the command block it can allow to summon certain modded enemies or enemies with mounts, weapons, enchantments or other add ons that separate them from their generic counterparts that you would normally find in their spawn egg.
Command blocks are versatile in what they can do, and should be fully taken advantage of those capabilities so you can experience the full potential of the game. Just keep in mind that if you are not spawning anything on your first try, always double and even triple check to make sure that your command is entered correctly. You may not get it right the first couple of times. Eventually however, it will become a second nature with enough practice.