Commands
Minecraft commands have been a basic building block for interaction with the minecraft environment. Almost all minecraft datapacks use minecraft commands or rather known as mcfunction (Minecraft Function) files. There are many different ways to write commands and execute them in minecraft, either with the use of minecraft chat, command blocks, or datapacks.
For a basic /say hi command the process would be like this:
Player Starts Command -> Command Passes Information -> Returns To Minecraft Console
Chat commands
With minecraft you can always execute any chat commands if you have operator permissions. To enable operator permissions either enable
cheats when creating a world or have an operator use /op <Player Name> to give that person operator.
When running a minecraft command in chat you start with the slash symbol /. This gives context to minecraft that you are running a command!
Think of it like another language that the minecraft talks to, and by speaking this language you can ask it to do things.
Auto completion
Running commands like the /time brings up options like add or set which are auto completed. Minecraft offers up auto completion
when options are limited, if not then it will offer up type semantics if there is an expected output, but if all else fails then it will
give an error if the command is not built up correctly like
/give @s minecraft:acacia_log[minecraft:item_name=""].
Context situations
Usually when running commands like /say hi it outputs as the player running the command.
Without an executer to the command it will run inside the server console.
An example of a player running the /say hi command in console view would be:
[Render thread/INFO]: [CHAT] [Bob] hi
Limitations
Usually when minecraft uses the command there are certain impossible states that a player can't control, like giving yourself
zero or negative count to an item. There is a lot more imposible states like negative time and data merging of players too.
This little demo shows red if the count is invalid!
/give @s minecraft:diamond 1
Other limitations
With chat command there is an issue when running commands like how a repeating command block or datapack would run.
Think of it like running a command every 20th a second, that would be a lot of typing! So minecraft has a solution to solve the issue, and that solution is called command blocks.
There is also an issue with executing commands that are too big for normal minecraft chat, thats also where minecraft command blocks solve the issue too with their extended command output length.
There will be more information about command input into blocks further reading into the documentation.