Skip to content

Instantly share code, notes, and snippets.

@VideoCarp
Last active July 7, 2023 22:57
Show Gist options
  • Save VideoCarp/eeaf915a2361d93f0fd8cf2c72d6db64 to your computer and use it in GitHub Desktop.
Save VideoCarp/eeaf915a2361d93f0fd8cf2c72d6db64 to your computer and use it in GitHub Desktop.
Useful guide for Minecraft Bedrock Commands and MCFunction

What is this?

readtime
This is a documentation for Bedrock Minecraft commands, which is unofficial, written by VideoCarp.
Visit Navigate for easy navigation between commands.
Are you a beginner?
If you've not been redirected from my other guide, click here for my beginner's guide.
To show your appreciation, you can star this gist, or comment with feedback.
Hate? Give me feedback in the comments, or by contacting me through my server (check below headline)

Can I distribute this guide?

Please don't. Always put the link to this direct gist, otherwise contact me on discord, at my server.

Unofficial Mcfunction Documentation

This is also for commands, so do take it for that reason, this is not an official guide.
A dictionary is at the lowest part of the documentation, take a look at that if you do not
understand some words.

Navigate

Fully Entity Related Commands:

Execute

The execute command is used to force entities to run commands. The command’s syntax is as the following without detect.
/execute <target> <location> <command> <selected command syntax>
The syntax with a detect is as the following:
execute <origin: target> <position: x y z> detect <detectPos: x y z> <block> <data: int> <command>
If the entity detects the block to detect on the detect position, the command will be executed.
Gamepedia: Click here to see gamepedia.

Testfor

This command tests for entities, it can be used to activate conditional command blocks. If the testfor command finds the entity, the command is successful.
This command can also be used to count entities.
Command syntax:
/testfor <target>

Spreadplayers

This command teleports entities to surface within a specified area.
Syntax:
/spreadplayers <x: value> <z: value> <spreadDistance: float> <maxRange: float> <victim: target>

Tag

Controls scoreboard tags for entities.
Other Info regarding ”tag”:
This can also be used to add certain tags on entities in the [tag=tagname] entity selecting part.
Syntax:
tag <entity: targets> <add|remove> <name: string><br> tag <entity: targets> list
This command could be used to set-up a restriction for users other than OP. However, regular commands cannot change
permissions

Block Related Commands

Testforblock

This command tests for whether a certain block is in a specific location. See testforblocks
(with an S) for multiple block testfor. This command can be used to activate conditional command blocks.

Command syntax:
testforblock <position: x y z > <Block> [dataValue]

Testforblocks

This command tests whether the blocks in two regions match.You can use this for conditional command blocks.
Command syntax:
testforblocks <begin: x y z> <end: x y z> <destination: x y z> [masked|all]
Arguments in masked/all.
Specifies how to match blocks. Must be one of:
all — every block in the source and destination regions must match exactly.
masked — air blocks in the source region will match any block in the destination region.
If not specified, defaults to all.

Setblock

Setblock is a command that places a block at the specified location.
Syntax:
/setblock <location> <block> [data]}

Fill

Fill is a command that places blocks from a specified location to another. /fill <from: x y z> <to: x y z> <block> [data].

Other

Effect

This command can add or remove status effects on players and other entities.
You know what effects are, they’re just potion stuff.
Syntax:
Clear Effects
effect <player: target> clear
Add or remove an effect
effect <player: target> <effect: Effect> [seconds: int] [amplifier: int] [hideParticles: true/false]
Amplifier is the level of the effect. eg: strength 5 (amplifier).



Teleport

The teleport command teleports entities to a specified location, or another entity.
Syntax Laws:
Entity/ies can be teleported at once to one target.
If an entity is requested to teleport to more than one target, the condition will fail.
This can be used to determine if a mob has died.
Multiple entities can teleport to one coordinate.

Command Syntax:
teleport <victim> (location | target)
Advanced usage of the syntax is very complicated, click here
for more information regarding advanced usage of the syntax.

Summon

The summon command is used to spawn in new entities into the world.
Entities such as TNT can also be summoned with the /summon command.

Syntax:
With spawn event

summon <entityType: EntityType> [spawnPos: x y z] [spawnEvent: string] [nameTag: string]
Without spawn event

summon <entityType: EntityType> [nameTag: string] [spawnPos: x y z]

Clear

The clear command is a command used to remove items from a player’s inventory.
Syntax:

/clear <target> <item name> <data: integer> <maxCount>
The data interval makes sure that the item matches the data interval, or the command will fail, this will not a trigger a
conditional command block.
To test for an item in a player’s inventory, use the following syntax:

/clear <target> <item name> <data> 0

The 0 will replace the command instead of deleting an item from a player’s inventory, it will check for one.



Give

The give command allows users to obtain items normally unobtainable, or items that already
are through commands.

Syntax:
give <player: target> <itemName: Item> [amount: int] [data: int] [components: json]
The cans for that are: (on bedrock)
{“can_place_on”:{“blocks”:[“BLOCK”]}}
{“can_destroy”:{“blocks”:[“BLOCK”]}}
Available arguments (gamepedia)

Tellraw

This command sends a raw json message to the specified target. This appears without any external text, the message appears in chat alone, unlike a /say message. Command Syntax (bedrock): /tellraw <target> <raw json message> The raw json message field is to be filled with something like this {“rawtext”:[{“text”:”your text”}]}

Title

The title command shows text onto the middle of the player’s screen, their action bar or under it as a subtitle. Syntax:
/title <target> (title | subtitle | actionbar) <text>
View gamepedia syntax

Particle

Particle is an extremely useful and decorative command in Minecraft. It just adds cool particles and overall
adds character. The syntax for it is:
/particle <effect> <location>.
But what if you wanted to use the location as a target entity? You can use the execute command for that.
You can see a list of effects you can use here.

Scoreboard

Scoreboard is an interesting command. It's also a very confusing one. Scoreboard is used to store the score of
players in Minecraft, or maybe even entities if that's possible.
To add an objective, use:
/scoreboard objectives add <objective: string> dummy [displayName: string]
and to change the value of an objective, use:
scoreboard players <set|add|remove> <player: target> <objective: string> <count: int>.
There are a lot of things, but those are the most basic.
See gamepedia for more information.

Non-Commands

Conditional

Conditional command blocks are command blocks usually used in chains are command blocks that
only work if the condition is met.
These can be used in chains for shop systems and such.

Scroll down in official gamepedia a little bit
until the Condition headline.

Manifest

The manifest is a key file in all resource packs, worlds, behavior packs, etc. The manifest is what allows the pack to show on the list. Sources:
Bedrock Manifests
Bedrock Resources Manifest
Bedrock Behaviors Manifest

Functions

Functions are a way to kinda import a ton of commands into new worlds easily, unlike command blocks however, they cannot be conditional.
When you run the function command, it executes the .mcfunction file named by your argument.

For example, a file named cool_file.mcfunction will execute if you return the argument as cool_file in other words,
/function cool_file , however, if a different argument is written, the game will search for the .mcfunction named by
that, if none, the command will fail.

.mcfunction files are always filled with nothing but commands.

Now for the folder setup.

Bedrock Edition:

(your pack name)📂

(functions)📂, <manifest.json>📄 , <pack_icon.png>📄

<filename.mcfunction>📄

Don't understand what each bracket means? Read the dictionary at the bottom.

Dictionary

How to Read Guide:
1. Syntax
This means the format the command is used in.
2. Manifest
This is the file in which you’ll have for things such as texture packs or bedrock edition addons.
3. <> bracketing in syntax
This means that this part of the command is required for the specified use.
4. () bracketing in syntax
Separated by |, this means that this part of the syntax must be one of the things within the brackets.
5. [] bracketing in syntax
This means that the part of the syntax is optional.
6. Target
This is the entity the command is being executed on.
7. Entity
An entity is a mob, a player, a dropped item, an armor stand, falling gravel/sand or anything in the game
that isn’t in a completely solid state and fixed to it’s location.
This may not be the best explanation for an entity, but you get the point.
8. File Bracketing
I use this to define a folder. Eg: <file>, (folder)
In some cases I may also have an icon. ":page_facing_up:" means file, :open_file_folder: means folder.
9. Integer Normal integers are really just digits. In this case, integers are numbers still, but must be valid data values.

Tags

Google search tags: gist github mcfunction minecraft commands bedrock edition mcpe mcbe mc pe pocket edition learn commands function-pack videocarp guide syntax execute documentation docs carp video game minecraft learn commands syntax bedrock minecraft

@VideoCarp
Copy link
Author

Hey, I see you’ve made it to the comment section, I’d love some feedback, please put some.

@birv2
Copy link

birv2 commented Mar 16, 2021

Not too many comments here, which is too bad! I'm finding your info super helpful. I teach middle school computer science and do a bit with introductory command blocks. I was trying to level up my own knowledge in the hopes of incorporating more stuff into my classes. So I'm taking a look at functions. I like how you can put a whole string of commands into one function, but I really wish that there was a way to add conditionals in the code. Can you point me in a direction? Thanks!

@VideoCarp
Copy link
Author

I like how you can put a whole string of commands into one function, but I really wish that there was a way to add conditionals in the code. Can you point me in a direction? Thanks!
I can't recall any way to do any conditions using functions, but you could try setblocking comparators and filling redstone. It’ll detect command success, but you won't exactly be able to execute a command based on another.
You could use a chain conditional command block, that will get activated when the previous command block successfully executed its command. You might be able to use behavior packs or the scripting API (it uses JS), but I'm not quite certain.

This is as far as I know.

@birv2
Copy link

birv2 commented Mar 17, 2021

Thanks for the reply. All good suggestions! I think I was just kinda hoping that functions in this context would give more flexibility than just listing commands. Clearly not. But that's OK. Probably chaining conditional command blocks is the best solution in-game. Just bulky in the Minecraft world! Thanks again. Do you post updates of your work on YT or elsewhere?

@VideoCarp
Copy link
Author

Well, my other tutorial got added to https://wiki.bedrock.dev
But I don't exactly update this document often.

@birv2
Copy link

birv2 commented Mar 18, 2021

Thanks! Bookmarked for later.

@BradMarr
Copy link

Not too many comments here, which is too bad! I'm finding your info super helpful. I teach middle school computer science and do a bit with introductory command blocks. I was trying to level up my own knowledge in the hopes of incorporating more stuff into my classes. So I'm taking a look at functions. I like how you can put a whole string of commands into one function, but I really wish that there was a way to add conditionals in the code. Can you point me in a direction? Thanks!

man I wish I had a teacher like you in middle school!

@birv2
Copy link

birv2 commented Oct 19, 2022

Not too many comments here, which is too bad! I'm finding your info super helpful. I teach middle school computer science and do a bit with introductory command blocks. I was trying to level up my own knowledge in the hopes of incorporating more stuff into my classes. So I'm taking a look at functions. I like how you can put a whole string of commands into one function, but I really wish that there was a way to add conditionals in the code. Can you point me in a direction? Thanks!

man I wish I had a teacher like you in middle school!

I know! Me too! I always tell my students how lucky they are to have a teacher like me. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment