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
-4
votes
2answers
4k views

How do I kill a specific item with a command block

I want to kill a specific item using a command block. If this is possible, how do I do this. Can you kill 2 specific items using a single command block. If yes, how? I tried killing a gold ingot but ...
6
votes
7answers
20k views

Test if player is holding something but the specified item [duplicate]

So I'm making a command block mechanism, but I need to test if the player is carrying something other than a specified item like testfor @p {SelectedItem:{id:minecraft:stick}}, whereas this instance ...
6
votes
7answers
28k views

How do I create unbreakable blocks?

I am creating a map on Minecraft, and I want the players to break certain blocks like trees, but I don't want them to break other blocks like stone bricks. Is there any command that can help me?
6
votes
3answers
4k views

How can I teleport to an unloaded entity?

I am using invisible invulnerable ArmorStands to create "warps" and "homes" in a map. The idea is that I can spawn them in with a specific name, and then teleport a player back to them like this: /tp ...
3
votes
3answers
41k views

How do I delay a command [duplicate]

I tried: /tp @e[type=ArmorStand,T=100] ~ ~1 ~ Then: /tp @e[type=ArmorStand,Time=100] ~ ~1 ~ I'm stuck. I am looking for a command-block only solution.
2
votes
3answers
13k views

Is there a way to set up a shop with scoreboard commands, that you can sell items at?

I'm aware of a way to buy items with a Money system with couple commands. But can you sell items to gain money? Here is what I used for a buying system: /scoreboard objectives add Money dummy (...
1
vote
1answer
4k views

Commands not working on Minecraft Realms?

I am an operator (OP) on my friends Realm. Today I tried to play and noticed that no commands would work for me, or anyone else granted OP. They only worked for the owner of said realm. He has de-...
0
votes
3answers
3k views

Bypass maximum level on item enchant [duplicate]

I want to enchant an item with Smite level 100 with commands, but i cant get past the maximum level. I searched for solutions, and tried them out, but it still won't work. I'm using Minecraft Pocket ...
17
votes
4answers
14k views

How can I block people from my Minecraft world?

Every time I open my world to LAN, people join and start destroying stuff. I want to ban them, but every time I ask someone for help they can't ban them.
10
votes
1answer
3k views

How to hide the [@] in a Minecraft command block [duplicate]

As most Minecraft command blocks makers know, if we use the /say command to output text, this will happen: [@]Lorem ipsum The [@] is actually very annoying, how can I remove it?
4
votes
4answers
10k views

How to detect if a mob has been hit in minecraft with command blocks?

i am making a boss battle for my minecraft adventure map, and using a mob spawned with commands as the boss. When the mob gets hit, some command blocks will give the player a potion effect, but I can'...
2
votes
1answer
9k views

Minecraft Test If A Chest Contains An Item

I've seen a lot of questions for finding specific items in chests using commands using testforblock but how would you test if any block/item has been placed in a chest? Thanks
6
votes
4answers
2k views

Copying & pasting multiple commands to Minecraft terminal

I wanted to compose a bunch of commands in an external editor and then paste them all to execute in the Minecraft console (chat window). But if you paste multiple lines, it seems to just ignore the ...
5
votes
2answers
68k views

Is it possible to add multiple enchantments in one try?

I'm making a mini game (bomb squad) and the armor needs to be enchanted. I know that armor can be enchanted through command blocks and that is what I intend to do. I am wondering if it is possible to ...
5
votes
1answer
158 views

Can you tell if a specific item is dropped? What about its name?

. In Java Edition, I can test for a dropped item on the floor by using NBT: /execute if entity @e[type=item,nbt={Item:{id:"minecraft:green_wool"}}] But in Bedrock Edition, NBT is ...
4
votes
5answers
5k views

How can I get a command block?

I know how to enable cheats, but when I search command block in my creative inventory, I can't find it. Where do I get it?
4
votes
1answer
376 views

What is the difference between the single dot, double dot and triple dot operators in Minecraft commands

I've been using the double dot (..) operator in commands ever since they were introduced but I've recently noticed that I can use just a single dot, double dot and a triple dot as well. What is the ...
3
votes
4answers
8k views

How can I check if a player is in the air with /testfor?

I'm interested in negating fall damage with command blocks by giving players Resistance as they're falling. How can I use /testfor to tell whether a player is on the ground or in the air?
3
votes
2answers
2k views

/testfor at least 10 specific items in the Inventory

This is the command I entered in the command block: testfor @p {Inventory:[{id:minecraft:diamond,Count:10}]} But it doesn't seem to work. What am I doing wrong?
2
votes
3answers
4k views

How do I create a random team chooser for Minecraft?

How do I create a random team chooser for a Minecraft server? For example: When you step on a block, you are automatically assigned to a random team: transported to that team's side of the building, ...
2
votes
2answers
2k views

How can I detect if a player is wearing a specific piece of armour?

How can I detect if a player is wearing a piece of armour? Let's say it was leather and named bob with a single lapis dye added to it. what would I do? I can't use comparators and such, only command ...
1
vote
2answers
244 views

how do you use /fill command

I would like to know how to use the /fill command to reset my spleef arena. the corners are located at (536.464 17.00000 157.521) and (509.405 17.00000 184.541)
1
vote
1answer
3k views

In minecraft, how to make everyone in gamemode 1 except yourself gamemode 2

I'm trying to make a minecraft map and to prevent cheating i want to run a command on a clock that sets everyone in creative mode except myself back to adventure mode.
1
vote
3answers
15k views

How can I make my far away command blocks work

I have command blocks on my adventure map, the map is partially parkour and has no ground just floating islands, I don't want people too see the command blocks so I put them 200 blocks away and they'...
1
vote
2answers
3k views

How to tell when a player isn't moving?

Is there a away to test if a player isn't moving? At the moment I have put this command on a hopper clock: /scoreboard players set @a sneak 3 But that doesn't seem to work because in another ...
0
votes
1answer
632 views

(Java Minecraft 1.14) How to detect when a spash potion explodes, and it's position when it explodes?

I'd like to summon a fuse 0 creeper at the position of a splash potion when the splash potion hits something. What I need to know is how to detect when it hits something. I have three ideas currently: ...
0
votes
1answer
885 views

How to name an item in a pre-filled chest [duplicate]

I want have the item in the chest (the dye) to have a custom name, I have tried very hard to do so. Here is what I have so far (it works but I need the item to have a name as said before): /give @p ...
0
votes
1answer
2k views

How can I detect if a player steps on a certain block in vanilla 1.13?

So say I want to make a portal, but want whoever steps in it to go to a specific location, without going to another dimension. How could I do that in vanilla Minecraft?
0
votes
2answers
7k views

How do I make a Lightning Bow in vanilla Minecraft?

I'm trying to make a setup with command blocks that summons lightning at the location of a shot arrow. The setup should recognize the arrow that is shot or the bow that is used by its name or another ...
0
votes
1answer
528 views

Minecraft 1.10.2 command block doesn't activate other command block

So I am trying to do some stuff with command blocks in 1.10.2 . But I have come to a problem. To make things more compact I have placed command blocks like a tower. The bottom command block checks for ...
-5
votes
2answers
12k views

How to turn all stone to TNT in Minecraft [duplicate]

I really want to do a prank where I turn all stone to TNT. That way, in lava lakes the TNT will blow up. I just need to figure out how to do it. Which would it be best to use? /fill /replaceitem /...
15
votes
5answers
588k views

How do I use the /kill command to ONLY kill mobs?

I have a Redstone Power loop that connects to a Command Block that is set to kill all entities except for myself (/kill @e[type=!Player]), because I'm building a creative map, but don't want slimes ...
18
votes
2answers
86k views

How to disable command block logging into the log files in minecraft

Hi, I have a single player world which is opened to LAN to let my friends play while I am AFK. I have a lot of command blocks running in that world and those commands are all logged in the log files. ...
10
votes
3answers
4k views

Do Minecraft functions have inputs and outputs like conventional functions?

Now I know that technically in theory one could just use blocks to convey values in and out of any body of code. What I'm asking is whether or not a built-in syntax exists for input parameters and ...
8
votes
1answer
27k views

How can I change my name using command blocks?

Is there any command in Minecraft where I can change my username in the chat, tab and my name tag above my skin? And no I'm not noob, I know I can change it on mojangs service, what I mean is like I'm ...
2
votes
3answers
2k views

How do i testfor a item a player is holding? [duplicate]

I am trying to testfor a player holding a diamond sword named Notch's Legendary Sword. How can I do that? Who ever gets the best answer will be able to get the first look at my NEW adventure map!
5
votes
2answers
3k views

Switch Item Slots in Minecraft using a Command Block

I want to be able to set the active hotbar slot with a command instead of the mouse wheel or keyboard shortcuts (1 through 9). I don't need to move items around in the hotbar, I just need to be able ...
3
votes
4answers
16k views

How to test for time of day with command block in Minecraft

I'm trying to setup something similar to the MindCrack team's current server set up for my single player world so that the world border expands slowly as I play the game. I already know how to work ...
2
votes
3answers
627 views

How can I make a tool drop blocks with CanPlaceOn tag

In Adventure mode, I'm trying to let a player get blocks that he can place later, is there a way to do it directly or do I have to change them in his inventory? Situation: The player gets a tool that ...
14
votes
8answers
25k views

How can I use Command Blocks to keep players from placing blocks on a vanilla server?

I want to know how to keep players from placing blocks in a certain area on my Minecraft server using Command Blocks. I already know how to keep them from breaking anything via [effect player 'mining ...
6
votes
3answers
35k views

Minecraft command to clear all but one item entity (tile) type

I've got a capture the flag arena. One issue we keep running into during play, is that of clutter. We have /gamerule keepInventory false, so the pitch gets rather cluttered with armor, weapons and ...
6
votes
2answers
2k views

A Minecraft poison sword

I'm not the most experienced person when it comes to commands. I worked out how to do stuff like when holding x you have y effect. I wanted to think of something that gave other people an effect when ...
4
votes
4answers
9k views

Is there a way to test if someone has said something in chat? [duplicate]

What I want to do is make a command that allows me to say something like "home" in the chat, and have a command block teleport me to my house. Is there a way to test for a word in chat?
3
votes
1answer
13k views

Minecraft ArmorStand Teleportation

So I'm using SethBling's armorstand posing help and I'm trying to teleport an invisible stand to an already set stand but I'm having troubles understanding how the teleports work. I know the commands ...
3
votes
1answer
2k views

Variables in Minecraft?

I would have a lot more possibilities if I could add variables to my commands. Is there anyway to do this? I have tried to use armor stands but it requires a command block for every single ...
3
votes
1answer
638 views

How to tag two Players in one /testfor command? [duplicate]

I'm searching how to tag two Players using one /testfor command. I'm actually using this command which works for one person : /testfor @a[name=!<pseudo>,r=15] But it doesn't work for two ...
2
votes
2answers
293 views

How do I test if all minecraft players on a server are in a radius?

This has got me. I need a command that tells me if all players on a server are in a radius of a command block. If one of them isn't in the radius, the command will be false. Any ideas? Thanks!
2
votes
1answer
601 views

How to Testfor Players with more than 100 of a Specific Item [duplicate]

So I'm using the testfor command to find near players with a item with a custom name and a specific amount. The issues I'm having is how to search for more than 1 stack of items like 100 items total. ...
2
votes
3answers
10k views

How To Make Bow / Snowball that shoots Custom Named Arrows / Snowballs

I decided to make a Snowball that summons lightning bolts along. Well I already did one half - With the @e[type=Snowball] (or Arrow, depending if I use a bow). But with @e I will target all the ...
2
votes
1answer
20k views

How do I detect if players have sufficient EXP levels?

I want to make an XP shop but I'm not sure about how to detect if people have sufficient XP Levels. Can anyone help me?

1 2
3
4 5
10