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.

518 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
1answer
47 views

Minecraft target selector select by built-in tag | e.g. Inventory item with tag “wool”

We want to check whether someone has wool in their Inventory. We can test if they have minecraft:white_wool or minecraft:pink_wool etc etc with : /data get entity @s[nbt={Inventory:[{id:"...
6
votes
1answer
659 views

Summoning enderpearls on arrows with custom name shot by a player

I want to shoot an arrow named "GreenArrow" that constantly summons enderpearls named "GreenPearl". Those pearls should execute a command at armorstands within 1 block. That command is /setblock ~ ~-...
5
votes
0answers
351 views

minecraft command block problem “snowball”

I'm trying to execute this code: execute @a[score_HoldSnowball_min=1] ~ ~ ~ scoreboard players set @e[type=Snowball,rm=3,r=4] Snowball 1 but it doesn't execute the code and instead says: [13:59:43]...
5
votes
1answer
928 views

What is the Java Edition method of Bedrock Edition's /ride command?

Story We all know that for the most part, the Bedrock Edition of Minecraft has a very limited command supply, and no NBT access from commands. However, Bedrock Edition has gained a unique trick as of ...
4
votes
0answers
44 views

Removing Tag/Scoreboard Value from Offline Players

For my Minecraft: Bedrock Edition Realm, I am creating a system where players can purchase access to a certain area for 24 hours. So far, I have created the purchasing system and 24-hour timer. When a ...
4
votes
1answer
64 views

How can I make it so players can't destroy farmland by jumping on it?

How can I make it so players can't destroy farmland by jumping on it? I am using java edition 1.16. I need this for my Minecraft map where I don't want players to be able to destroy farmland.
4
votes
0answers
58 views

Is it possible to move a boat with commands with a player in it?

I want to move a boat up/down while a player is in it with commands. I tried to teleport the boat and change the Motion NBT, both worked... while there was no player in it... Somehow, there being a ...
4
votes
1answer
103 views

Prevent Villager from restocking in Vanilla game?

Is it possible to (and, if so, how do you) spawn in a villager which is incapable of restocking? I'm going to make a guided Skyblock-like map, with the villager's trades representing different ...
4
votes
1answer
5k views

Summoning an arrow aimed at a mob

I want to summon an arrow that is fired in the same direction as the player that it is summoned closest to, is this possible with just commands and as minimal command blocks as possible? (not one ...
4
votes
2answers
635 views

Vertically stacked armor stands should have increasing scores, but don't

I'm trying to make a goalpost system for a custom map I'm designing. The idea is that a goalpost--consisting of a tall stack of iron bars--would have variable height, and at each block up and down the ...
4
votes
1answer
182 views

How do I make this contraption multiplayer?

I made a grappling hook in Minecraft and put it into a structure. However, I want to use it in a multiplayer map where multiple people may be using it at one time. I believe the way it is currently ...
4
votes
2answers
2k views

Change players health based on scoreboard objectives

I have a custom map in which I have a scoreboard objective. Is there any way to change a player's health based on this scoreboard objective? The only thing I could find was putting a button on a ...
3
votes
1answer
70 views

Only arrows with names fly straight

Does anyone know how to make only named arrows fly without an arc in Minecraft? I have the command: execute as @e[type=arrow] run data merge @s {NoGravity:1b} working great, but I'm trying to make ...
3
votes
0answers
39 views

Spawn Mobs With Specific Items Equipped

Hi All, In MCPE 1.16.2, I want to create a way in which when I eat a specific item (call that ‘alpha’), it spawns 4 mobs with a helmet equipped. And also would it be possible to make the mobs work for ...
3
votes
0answers
42 views

Test For A Specific Item In Head Slot & Then Activate Something Else

Hi All, I’m trying to create an addon in MCPE 1.16.2 but I’m struggling to do one thing. I want to be able to detect a player with an item on his head and then follow on with another command like ...
3
votes
1answer
109 views

How can I make a tool unbreakable?

I have looked everywhere for a command that does the same thing as: /give @s netherite_sword{unbreakable:1} 1 but for Bedrock Edition instead of Java Edition. But I just can't seem to find an answer ...
3
votes
0answers
87 views

Why is Player's generic.movementSpeed Attribute listed on Wiki as lower than ALL Mobs, yet you can clearly outrun all of them?

EDIT: Player's generic.movementSpeed SPRINTING Attribute is listed as 0.15, their WALK speed is listed as even slower (0.1) Original Post: A Player's generic.movementSpeed Attribute is listed as 0.15 ...
3
votes
1answer
145 views

Is there a way to put conditionals in functions?

Is there a way to make something conditional in a function? For example setblock 5 10 5 air tellraw @a {"rawtext":[{"text":"Placed!"}]} # <--- Make this command ...
3
votes
1answer
98 views

Hiding team colors in usernames

I'm working on a minigame in Minecraft that is built upon not knowing what role other people are (kind of like a social deduction game). However, since teams are required for the game to function, a ...
3
votes
1answer
114 views

How can I increase the knockback of a slime in minecraft?

I'm using command blocks to make a custom slime, I've tried using the command: /summon slime ~ ~ ~ {Size:3b,Attributes:[{Name:"generic.attack_knockback", Base:8.0,}]} but it doesn't work. ...
3
votes
1answer
251 views

How do I use a target selector to output the nearest player's UUID?

I want to be able to use a target selector to select all of a player's tamed wolves. It's easy to do that with this target selector: @e[type=wolf,nbt={"OwnerUUID":"<Player UUID>"}] When I try ...
3
votes
2answers
622 views

How can I add one enchant level?

I want to with every command add one enchantment level like this: /replaceitem entity {player} slot.armor.head chainmail_helmet 1 0 {ench:[{id:0,lvl:+1}] Level: +1 Or If I have a helmet with ...
3
votes
3answers
1k views

Minecraft how to testfor if a mob is looking at the player

Is there a way I can testfor if a mob is looking at the player? I know there is a way to testfor a certain rotation, but is there a way to test if the mob is looking in the general location of the ...
2
votes
0answers
37 views

How to give a mob smooth custom motion in MCJE 1.16

I want to make a boss battle, and I wanted the boss to walk smoothly in a certain direction. I have tried: /summon zombie ~ ~1 ~ {CustomName:"Zombo",CustomNameVisible:1,Motion:[0.0,0.0,-12.0]...
2
votes
0answers
102 views

How do you stop a creeper from exploding via commands?

I have built a structure in creative mode that is filled with creepers. The problem is I want to go to survival mode without blowing up the structure or myself. I don't know anything about commands ...
2
votes
0answers
54 views

How to teleport every player to a different location?

I’m working on a Minecraft map. My plan is to teleport everybody (at the "event") to a different location. So the problem is that I cannot do: /minecraft:tp @a[team=event] ~ ~ ~ because it ...
2
votes
0answers
32 views

How to spawn a mob that takes extra knockback regardless the weapon used?

I am planning to do a manhunt with lots of things as twists (Video title would be:"Minecraft Manhunt but Buttons, Pressure plates, and Trapdoors are OP) so if you hold a blackstone button, it ...
2
votes
1answer
44 views

How do I make a tellraw command say someone's name?

I need help here, I am making a map called "The Firing". I want it to say: Welcome to The Firing, [USERNAME] What I had was /tellraw @a {"rawtext":[{"text":"Welcome ...
2
votes
0answers
33 views

How do I tag this specific entity? (Go to description for info)

I want to merge the snowball/FallingSand passenger nbt tag with FallingSand/snowball. So, I have two commands set up: data merge @e[type=snowball] {Passengers:falling_block, tag:{BlockState:{Name:&...
2
votes
0answers
27 views

How can you detect when a player hits a block in Adventure Mode [version 1.16.5] in Minecraft?

In Minecraft, I am trying to make a map in Adventure Mode where you sell/buy trees. I want to be able to detect whenever a player has punched an oak log in Adventure Mode, and then it would ...
2
votes
1answer
23 views

Check to see if only 1 player on team - Minecraft 1.12

I was making a game in MC using Command Blocks on my friend's server (which is in 1.12). I was wondering if there was a way to determine if there was only 1 person left on a team. All of the other ...
2
votes
0answers
61 views

How can I make a smithing table recipe that yields a named item?

I am trying to make a datapack where you can combine a turtle shell and a netherite ingot in a smithing table to get a turtle shell with knockback resistance and armor toughness. I have figured out ...
2
votes
0answers
41 views

Why won't my location predicate run?

I have followed several tutorials to the letter, and got the "player is_sprinting:true" predicate to work. So I know my fresh new datapack is working. There are no examples of location ...
2
votes
0answers
73 views

Nether Portal Doesn't Work With Small World Border

Context: I'm making one of those maps where you start with a world border of 1 and it expands each time you get an achievement to play with a couple of my friends. I was going to do a nether section ...
2
votes
0answers
46 views

Executing 1 million commands

I have 6 million setblock/fill commands in store (mostly for setting command blocks/repeaters) that I would like to execute in my world, so as to cover 36 chunks. Mcfunctions are not very efficient as ...
2
votes
1answer
65 views

How to view the contents of another persons enderchest?

I am using 1.12. /data get entity @p EnderItems doesn't work as it isn't seen as a command.
2
votes
2answers
48 views

I'm trying to find a way to log the command block output on a Minecraft Bedrock Realm

I've been messing around with command blocks recently, and I need to be able to 'log' my command block output. I can see the last output it had 'Gave 1 diamond to JackOBoi04' (example) but I am ...
2
votes
1answer
62 views

How do I summon something with velocity in Minecraft?

How do I summon something with velocity in Minecraft? I tried searching it on google and click the links I can find. When I tried them, it didn't work. How do I do it?
2
votes
1answer
48 views

Minecraft scoreboards: how do I track how many times a player kills another specific player?

So I'm trying to create a scoreboard that tracks the kills of players, but I only want it to increase when they kill a specific player, in this case just the player IGN would do. I was thinking it ...
2
votes
0answers
42 views

Commands still run from killed armor stand

I have the following commands run by an armor stand in a function say Hello. I'm here! kill @s execute as @s run say Still here When I run it on an armor stand I get [Armor Stand] Hello. I'm here! [...
2
votes
1answer
71 views

Problem with RequiredPlayerRange on spawners

This is on the latest Minecraft version, 1.16.4 I have been trying to figure out how to get it to work with NBTEexplorer. I changed the RequiredPlayerRange to higher then default amount which was 16 ...
2
votes
1answer
42 views

How would I copy data from a chest to my inventory?

So, I could only find explanations on how to copy a player's inventory into a chest, but I'm wondering how I would copy the chest's contents to the player's inventory. Not necessary to read, just some ...
2
votes
1answer
63 views

Made my first server and I need help with the scoreboard

I know how scoreboards work, and i have one set up already. the thing is, its set to totalKillCount and give 1 point for each kill. I want to give more points for killing tougher mobs. How do I make ...
2
votes
0answers
32 views

Detecting if a player is using the spyglass

I am playing in the latest java snapshot (20w46a) and was trying to create costum enchantments for the spyglass; I tried using the scoreboard command, but for some reason it doesn't seem to work; is ...
2
votes
1answer
188 views

Why does /execute store refuse to update an NBT number when provided with a scoreboard value?

Here are some commands for you to try in MCJE 1.16. Run the following commands in the chat: Set up a scoreboard objective. (or use an existing test objective if you hate piling them up, like me) /...
2
votes
0answers
41 views

How to detect an entity with same name as player?

I want to make a map where you can morph into entities and fight other players with that, and for this map I need a way to teleport an entity that has the same name as a player to said player. How can ...
2
votes
1answer
430 views

How do I make an item where when a player holds it, it runs a slash command or function in a Minecraft bedrock addon?

I am trying to make a paintbrush to assist me and my friends build a city. My idea for the paintbrush is when held, it uses raycasting to place blocks where the entity is looking. I can't use ...
2
votes
0answers
29 views

How can I use [Motion] to make an entity follow a path based on the player?

I get the way the question is formatted, it may sound as if this question has been asked before, and if it has, I'd love to see where I can find it. What I'm struggling with is being able to summon an ...
2
votes
0answers
38 views

How can I join multiple teams with different rules?

I want an Iron Golem, Zombie A, and Zombie B to be on a same team so they wouldn't attack each other but I want Zombie B to have a no collision rule. If I let Zombie B join another team with a ...
2
votes
1answer
341 views

Copy player's armor and offhand items into a chest

I have tried to copy all items from a player's inventory into a chest in 1.16. I have used this command for the hot bar and the 2 first rows in the inventory: /data modify block 227 76 77 Items set ...

1
2 3 4 5
11