Questions tagged [minecraft-commands]

Anything related to the usage of commands, command blocks and functions in the Minecraft game series. If you're building a redstone device without commands, use the "minecraft-redstone" tag instead. Always use this tag together with the "minecraft-java-edition" or "minecraft-bedrock-edition" tag.

Filter by
Sorted by
Tagged with
17
votes
2answers
36k views

Is it possible to use NBT tags in commands in Minecraft: Bedrock Edition?

This question was recently split into different questions for each workaround. See these two meta posts for more information. Can you use NBT tags in commands? I’ve tried commands that normally work ...
19
votes
2answers
4k views

How can I fix “unbalanced brackets” in my data tag?

Often, when making a command block contraption, you need to set an entity's data tag. These tags can sometimes be very long, with many layers of nested curly and square brackets. For example, this is ...
8
votes
2answers
563 views

Why are my quotation marks causing an “unexpected token” error with this command?

I need help with a specific command that I am using in a new game that I am creating inside of Minecraft. The command is: /give @p sign 1 0 {BlockEntityTag:{Text1:"{"text":" [MF2]","color":"gold","...
6
votes
1answer
841 views

Where do I put item tags on items inside a chest or your inventory?

I am making a Minecraft Mini Game adventure map, and one of the levels has a /setblock command, I am using the command in a way to spawn an item in a chest (Wooden Button) I need the wooden button to ...
10
votes
2answers
7k views

How to delay or slowly loop commands?

I found 11 questions like this on gamingSE already, but none of them have proper and up-to-date answers. So I'm creating this Q&A: How do you either activate a command x seconds/minutes/hours/… ...
9
votes
2answers
189k views

How do I give players already enchanted Tools/Armour/Weapons

I'm making a map where I want players to be able to choose there kits/classes. The problem I'm having with it though is giving players already enchanted Tools/Armour/Weapons. I'm not sure if you can ...
6
votes
2answers
5k views

How do I give a player an item with custom properties?

I'm used to creating Java Edition Minecraft maps, where NBT can be used to set many different block, item, and entity properties, like an item's CanPlaceOn/CanDestroy list, a chest's items, and more! ...
9
votes
9answers
54k views

What sources of randomness can be made with commands in Minecraft?

I want to make a mini game in Minecraft were I need a random command generator for 9 commands. I need a random command to give the player a random item. I can't do the command block in the dispenser ...
4
votes
3answers
5k views

How can I apply an effect when a player left-clicks/right-clicks with an item in hand?

Is there a way so that I make make it when I left click/right click with a certain item it applies an effect? I know that you can apply attributes to wearing armor and things but I want it so when you ...
4
votes
2answers
10k views

How to count entities with commands/check if there are only one or a certain number of entities or players left?

I want to run a command when there are only 10 entities left. I know you can use /execute unless entity to detect when all matching mobs have died, but it doesn't work if you want to run a command ...
40
votes
1answer
5k views

What are the basics of commands in Minecraft Java Edition?

What are the basics of Minecraft commands? If I were to start from scratch, with no knowledge on the topic, what are some things that I need to know?
11
votes
4answers
15k views

Is there a way to set an “Adventure Mode Boundary” in Minecraft?

Is there a way to set an "Adventure Mode Boundary" in Minecraft? I am trying to create this village where players can spawn in, and then set out to explore the world and build and do normal minecraft ...
17
votes
9answers
35k views

How do I select all but two types of entities in Minecraft with the type selector?

I've asked this question towards a developer for Minecraft and I thought I'd ask here too since they might not see the question. How do I select all but two types of entities in Minecraft? For ...
5
votes
3answers
104k views

How to test for an hold item name in Minecraft?

I'm trying to make a command block that spawns an item in front of you if you are holding an item with a specific name. I've got these two working scripts; /testfor @p[r=10] {Inventory:[{tag:{display:...
25
votes
3answers
6k views

How do I fix 'Invalid JSON' errors?

I've been at this for almost two hours and no one seems to have the same problem as I and I doubt this will be solved but I'll try anyway. this is the code /tellraw @p ["Would you like to teleport?",...
8
votes
4answers
66k views

Why does my item name not show up in 1.13?

I am in 1.13 Pre-Release 7 trying to make a one command creation and I need an item with a specific name. The command I use is /give @p diamond_sword{display:{Name:"Sword of Power"}} and it gives my a ...
11
votes
7answers
25k views

I've lost a command block, how can I find it?

I've placed a command block making it day all the time. I want to turn it off, but I've lost it. What's the quickest way to find it?
4
votes
3answers
36k views

Can you use /testfor to detect the death of a player?

Can you use the /testfor command in minecraft 1.8 to find out if a player has died ? I need it for my map, where 2 players (Only) are pitted against eachother. I want it so that when one of them dies,...
3
votes
1answer
1k views

How to test for minimum amount of items in inventory and execute a command if true

I am using the AmazingKit plugin on my Minecraft server to make inventory kits for players. In a command block I have the following command: /tellraw @p ["",{"text":"Iron","clickEvent":{"action":"...
44
votes
2answers
1.7m views

Keep items in inventory on death in Minecraft

I once played a vanilla Minecraft adventure map (called "Herobrine's Mansion") that prevented the player from losing their items on death. Which commands can be used to prevent the player from losing ...
2
votes
1answer
2k views

How can I use CanPlaceOn and CanDestroy in Bedrock Edition?

Java Edition has the CanPlaceOn and CanDestroy NBT tags, which are used to restrict the blocks an item can be placed on and destroy respectively (in adventure mode). For example, the following ...
1
vote
1answer
2k views

How can I trigger a command when a player is hit by a Snowball?

I am trying to make a snowball that triggers a command when it hits a player in 1.15, but I don't know how to do that. When I do execute at @e[type=snowball] run gamemode spectator @a[distance=..2] it ...
18
votes
3answers
94k views

How can I make a block only be placed on certain other blocks

I want people to only be able to place TNT on only Quartz Blocks and I've see this done before where you can only place blocks on certain other blocks but I'm not sure of the command used to do that. ...
4
votes
1answer
1k views

How do I give myself an item that can only be placed on a block with a certain damage value?

I'm currently in the process of making a custom map and I want to add blocks that can only be placed on a certain colour clay. This is the command I tried using. /give @p cobblestone 1 0 {CanPlaceOn:...
5
votes
1answer
3k views

How do I use an NBT editor to modify item properties?

In Minecraft, the NBT (Named Binary Tag) format is used to store data of our Minecraft worlds, including block, entity, and item properties. In the Java Edition of Minecraft, you can modify this data ...
4
votes
1answer
7k views

How to use ^^^ coordinate systems for motion nbt

Since we can use ^ ^ ^ for relative coordinates with 1.13 like /execute as Asaf31214 run summon lightning_bolt ^ ^ ^10 (Summons a lightning at 10 blocks from me to the direction I look. By the way, ...
16
votes
1answer
14k views

How do I make a setblock or a fill clock?

Often, when asking about command block contraptions, people suggest using a "setblock" or "fill" clock? What are those and how do I make them?
2
votes
1answer
987 views

How do I combine the NBT tags from two separate commands? [duplicate]

I have two commands I'd like to combine into one, but I'm not sure how to go about combining them. Is this possible? Here are the commands. They work individually, I just can't seem to get them to ...
14
votes
2answers
1k views

Why remove redstone dust from my command block contraptions?

Whenever I show my command block contraptions to my friends, they always comment that I should remove the redstone dust from them. They say it causes lag and that redstone can be unpredictable, but I'...
6
votes
1answer
6k views

How do I create a villager with custom trade offers?

I'm trying to set up a shop system in a vanilla minecraft realm and villagers seem like the most streamlined method of doing so, however I'd also like to make it so that other players on the server ...
4
votes
2answers
3k views

How to use exclamation marks in Minecraft commands?

I know that you can use exclamation marks in Minecraft commands to check for an entity that does not have a specific tag. For example, you can use /kill @e[type=!Player] to kill all entities except ...
1
vote
1answer
606 views

How can I filter items with a certain enchantement?

I am trying to build a custom Adventure Island. At this moment I am trying to limit the allowed items on this island. I'm trying to do this by filtering on a certain enchantment which is not item-...
26
votes
5answers
238k views

Is it possible in Minecraft to switch over from survival to creative in single player?

This question is regarding the minecraft Beta 1.8 prerelease -- I have a beautiful house in single player survival which I'd like to record while flying. I want to be able to change the game mode of ...
12
votes
1answer
67k views

How to set a command block with a command inside using the setblock command

Does someone know how to set a command block with a command inside using the setblock command? I have created this code /setblock <x> <y> <z> command_block {TileEntityData:{Command:"...
7
votes
3answers
23k views

Run command whenever someone joins a Minecraft server

Is there any way to run a command automatically when a player joins the server? I need to do this without the use of a Bukkit plugin. I think it's possible with MCP but I want to know how!
14
votes
3answers
149k views

Syntax to add multiple commands to a single command block

I am looking to try and set multiple commands in a single command block, but so far everything I have tried just returns "Unknown Command". What is the format for writing multiple commands in a ...
8
votes
4answers
14k views

How can I detect if a player has a specific item with a specific datavalue in their inventory?

Let's say I want to track a group of players to see which one of them (if any) have a specific block type in their inventory that's of a specific datavalue; for instance Red Wool (minecraft:wool with ...
4
votes
5answers
110k views

How do I test for a player at specific coordinates?

If I do: /testfor @p[x=,y=,z=,r=] It says: The entity UUID is in an invalid format.
2
votes
6answers
19k views

Is it possible to spawn mobs in random places?

I was wondering if it is possible for you to make a command block spawn hostile mobs in random places in a specified area? I need the mobs spawned on different Y coordinates too because you need to ...
6
votes
4answers
674 views

How do I create tools with multiple properties?

I'm trying to create an item that can break certain blocks, but also has a colored name in 1.13.2 Here's the command I'm using. /give iAugust minecraft:shears{display:{Name:"[{\"text\":\"Arcane ...
2
votes
2answers
7k views

Can't Use /Summon Command

Recently I've been messing around with making a few minigames, and have used a few plugins to help make it easier to create and run them. However, a newer one I'm making requires me to use the /summon ...
4
votes
5answers
3k views

Is it possible to mark or modify a player with a specific item in their inventory

I'm building a CTF map of sorts, using command blocks in vanilla 1.8. I've discovered two commands for detecting if an item is in a players inventory: /clear @a[team=Red] banner 4 0 /testfor @a[team=...
2
votes
2answers
17k views

Can i use the /testfor command to check for certain words in chat?

I want to be able to detect if a certain word in chat is said like: Console: Please say yes to be teleported or no to remain Player1: yes Player1 teleported to [insert random coordinates here] ...
2
votes
1answer
393 views

Why is my command throwing a 'data tag parsing failed' error?

I am trying to lock some boxes in a map of mine, and I used this command: /blockdata 10 4 9 {Lock:Elyiana's Mage Key} At first it worked, but then when I logged back on the next day it gave me this ...
1
vote
1answer
931 views

How can I determine that I am looking at the block I need?

I want to execute a command if I am looking at a specific block. A command should only be executed if it is targeted.
4
votes
1answer
4k views

Mob Arena - Mob vs. Mob

I want to make an arena where mobs will fight each other and a player can bet on one side or the other. For example: There are 2 skeletons in dyed armor; red and blue. Each color representing a team. ...
3
votes
2answers
3k views

Is it possible to disable the 'Block Placed' message when using tellraw /setblock?

I want to make a tellraw shop but to activate command blocks I want to use /setblock command when clicked on a text. Is it possible to disable "Block placed" text showing up?
2
votes
2answers
2k views

How can I let player click text to use a command?

I want players to be able to click text to run an OP command even if that player is not an OP. For example something like: Console: Do you want to enable Fly? [If you do, Please click here] *Player1 ...
4
votes
1answer
10k views

Would someone give a thorough explanation of 1.14 Minecraft's /data modify?

Okay, so I've been searching all over the internet for an explanation of data modify ever since I heard Sethbling passively mention it in one of his videos. The only thing I could find on it was the ...
2
votes
3answers
7k views

How to set Command Block(s) to test for a particular time and output a message?

I simply want one command block to test for the time of day or night (e.g. time = 18000) and output a message in the chat to everyone if that time returns true. I was trying a simple set-up with two ...

1
2 3 4 5
11