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
29k views

Is it possible to use NBT tags in commands in Minecraft Pocket/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 ...
7
votes
2answers
446 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
594 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 ...
7
votes
1answer
3k 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/… ...
8
votes
6answers
46k views

How can I make a random number generator with command blocks in Minecraft? [duplicate]

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 ...
11
votes
4answers
12k 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 ...
5
votes
3answers
91k 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:...
16
votes
8answers
31k 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 ...
4
votes
1answer
946 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! ...
4
votes
3answers
4k 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 ...
18
votes
3answers
84k 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. ...
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
2answers
139k 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 ...
3
votes
3answers
29k 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,...
2
votes
2answers
2k 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 ...
0
votes
1answer
735 views

Snowball executing command in 1.15

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 ...
11
votes
7answers
20k 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?
2
votes
1answer
313 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 ...
37
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?
7
votes
4answers
57k views

Minecraft 1.13 display:{Name:“”} NBT tag

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 ...
42
votes
2answers
1.6m 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 ...
16
votes
1answer
13k 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?
12
votes
1answer
64k 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:"...
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:...
2
votes
1answer
594 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 ...
1
vote
1answer
559 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
234k 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 ...
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'...
3
votes
1answer
4k 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, ...
2
votes
1answer
341 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 ...
14
votes
3answers
131k 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
13k 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
104k 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
5answers
15k 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 ...
4
votes
2answers
2k 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 ...
6
votes
3answers
19k 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!
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
16k 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
2answers
53k views

How can I obtain items that exceed their maximum enchantment level?

I'm on Bedrock Edition (Windows 10, same as PE) and was wondering if there was any way to go above max on enchanting. For example, if I type /enchant ExamplePlayerName sharpness 10 it would just say ...
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
1answer
847 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":"...
2
votes
2answers
6k 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 ...
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 ...
2
votes
3answers
6k 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 ...
4
votes
1answer
7k 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 ...
1
vote
1answer
315 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.
20
votes
5answers
11k views

How do I kill mobs using /kill without them dropping loot?

I have a spawn area I am hoping to make a safe haven, so I have a command block on a clock that kills each hostile mob type. This works to keep the place free of any hostile mobs, however every night ...
8
votes
6answers
72k views

How do I remove a summoned Ender Dragon with no AI?

So I used the command /summon EnderDragon ~ ~ ~ {NoAI:1} so that I would have an Ender Dragon that would just sit there. I then wanted to get rid of it, but doing /killall EnderDragon didn't work, ...
6
votes
1answer
5k 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 ...

1
2 3 4 5
10