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], [minecraft-bedrock-edition], or [minecraft-education-edition] tag.

Filter by
Sorted by
Tagged with
20 votes
2 answers
45k views

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

This question was 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 in Java ...
user avatar
6 votes
1 answer
1k 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 ...
user avatar
  • 133
19 votes
2 answers
5k 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 ...
user avatar
  • 17.1k
9 votes
2 answers
971 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 I have so far is: /give @p sign 1 0 {BlockEntityTag:{Text1:"{"text":...
user avatar
13 votes
2 answers
14k views

How to delay or 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 ticks/seconds/minutes/...
user avatar
11 votes
2 answers
281k 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 ...
user avatar
6 votes
2 answers
10k 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! ...
user avatar
5 votes
2 answers
26k 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 ...
user avatar
10 votes
9 answers
66k 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 ...
user avatar
4 votes
3 answers
6k 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 ...
user avatar
43 votes
1 answer
6k 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?
user avatar
  • 2,425
11 votes
4 answers
20k 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 ...
user avatar
  • 111
13 votes
7 answers
32k 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?
user avatar
  • 195
19 votes
4 answers
301k views

How can I replace all blocks of one type with a different type of block, within a certain region?

I'd like to be able to select a region, either with an outside graphical utility or command line, or with native Minecraft commands, and be able to replace all blocks of one block type with another ...
user avatar
  • 53k
6 votes
3 answers
45k views

How do you detect a player's death?

Can you use the /testfor command in Minecraft to detect if a player has died? I need it for my map, where two players are pitted against each other. I want it so that when one of them dies, it will ...
user avatar
25 votes
3 answers
7k 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?",...
user avatar
  • 281
17 votes
9 answers
40k 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 ...
user avatar
  • 1,274
5 votes
4 answers
120k 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:...
user avatar
6 votes
1 answer
11k 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 ...
user avatar
  • 5,031
7 votes
5 answers
1k 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 ...
user avatar
5 votes
1 answer
7k 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 ...
user avatar
18 votes
3 answers
109k 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. ...
user avatar
8 votes
4 answers
69k 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 ...
user avatar
  • 97
3 votes
1 answer
2k 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":"...
user avatar
45 votes
2 answers
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 ...
user avatar
8 votes
4 answers
97k views

An item to break only specified blocks?

I know that I can make certain blocks only placeable on a specified block, but what is the command to give an item that can only break certain blocks?
user avatar
1 vote
1 answer
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 ...
user avatar
8 votes
1 answer
8k 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 ...
user avatar
4 votes
1 answer
2k 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:...
user avatar
  • 49
5 votes
1 answer
10k 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, ...
user avatar
4 votes
2 answers
4k 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 ...
user avatar
17 votes
1 answer
16k 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?
user avatar
  • 17.1k
4 votes
5 answers
4k 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=...
user avatar
1 vote
1 answer
692 views

How can I filter items with a certain enchantement? [duplicate]

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-...
user avatar
  • 23
14 votes
2 answers
2k 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'...
user avatar
  • 16.2k
12 votes
1 answer
71k views

Using /setblock, how do I set a command block with a prefilled command?

Using /setblock, I'd like to set a command block with a command already pre-filled inside of it. My current code looks like this, but it doesn't seem to work: setblock <x> <y> <z> ...
user avatar
  • 297
10 votes
3 answers
31k 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!
user avatar
7 votes
3 answers
30k views

How do I allow other players on my server to use commands like teleport, but not spawn in items?

I play on the DivineJourney modpack with a friend, but he wants to constantly spawn things in. Is there any way to allow him to be able to use the teleport command, but not be able to spawn in items? ...
user avatar
  • 79
2 votes
0 answers
1k 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 ...
user avatar
  • 51
29 votes
5 answers
241k 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 ...
user avatar
  • 538
4 votes
1 answer
13k 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 ...
user avatar
  • 369
3 votes
1 answer
2k views

How do I detect what block type that the player's crosshairs are targeting?

I want to execute a command if I am looking at a specific block type, for example, stone. How can I detect which block type is being targeted by the player's crosshairs?
user avatar
2 votes
2 answers
18k 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] ...
user avatar
  • 21
2 votes
2 answers
385 views

Why am I getting an 'unexpected token' error with this Minecraft /give command?

I'm trying to make a sign that you can right click and it will clear cacti from your inventory, then give you 18 cookies named "$100 Cookie" with the lore "$100". But when I put it ...
user avatar
15 votes
3 answers
172k 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 ...
user avatar
  • 40.1k
9 votes
4 answers
15k 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 ...
user avatar
  • 16.2k
3 votes
5 answers
117k 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.
user avatar
2 votes
6 answers
25k 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 ...
user avatar
  • 404
6 votes
1 answer
7k views

How to make your player invincible / undetectable by zombies?

Ok, I want my character to either be ignored by zombies or unable to die (invincible). I've tried: Adding a health scoreboard but this is uneditable A repeating command block that gives the player ...
user avatar
  • 3,949
3 votes
2 answers
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?
user avatar

1
2 3 4 5
13