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
-3 votes
1 answer
52 views

How to remove all trees in Minecraft Bedrock Edition?

I'm looking to remove all the trees in my creative Bedrock world. Is there a command to do so? If there is, what is it?
user avatar
0 votes
1 answer
59 views

How to clone a structure with commands? [duplicate]

I made a house, and tried to clone the whole house somewhere like 511 blocks away. I made the house inside a red line to make the cloning process easier. But as soon as I pasted the coordinates to the ...
user avatar
0 votes
0 answers
21 views

Can I clone an area to the coordinates of an armorstand in 1.18.2? [duplicate]

I am making a map where, if you walk close to an armorstand, it disappears and clones something on the armorstand coordinates. I have already figured out a way for detecting if a player is near it and ...
user avatar
  • 1
1 vote
2 answers
66 views

Need help making a ground distance detector

I'm making a data pack where some players cannot take fall damage. I don't want to use resistance 5 or jump boost 255 as there needs to be PVP and jump boost 255 will launch you in the air with PVP. ...
user avatar
  • 37
1 vote
0 answers
122 views

How to make snow golems do damage?

I have a single player world, and I'm trying to make a game in which two players try to attack and destroy each other's bases (represented by and iron golem and a ravager in cages). I'm trying to ...
user avatar
0 votes
1 answer
60 views

Teleporting players when a certain coordinate is reached [duplicate]

I am trying to teleport all players who go to the Y level 8, but this command teleports all players from Y level 8 and the command block coordinates: /execute if entity @a[y=8,distance=..10] run tp @s ...
user avatar
  • 11
-1 votes
1 answer
68 views

Why won't this execute command work?

I'm trying to make a datapack and in it you cannot sleep unless you are y 100 or above, but my command doesn't work. Can anyone explain why P.S: playerheight is a scoreboard that updates according to ...
user avatar
  • 37
3 votes
1 answer
54 views

How do I prevent other players from taking items out of a dropper? (1.18.2)

I'm currently making a trading system on my Minecraft server. You drop an item that spawns a dropper with a small UI. There are 2 empty slots where both players will put a custom player head from ...
user avatar
1 vote
2 answers
32 views

Check the block connected that an item frame is connected to

I'm trying to check the inventory of a hopper that has an item frame connecting to it, however I can't even get it to say "hi". I currently have this: execute as @e[type=minecraft:item_frame,...
user avatar
0 votes
0 answers
34 views

How to tag a #log in 1.18?

I'm working on a treeAxe using commands in 1.18, but I can't figure out how to tag items that are logs and wood. Here is what have so far: tag @e[type=item,nbt={item:{id:"minecraft:acacia_log&...
user avatar
  • 1
-1 votes
1 answer
29 views

How do I make a villager that buys a custom banner

I want to know how to make a villager buy custom banners and I also want to know what the problem with my code is so that I don't make the same mistake again. This is what I typed: /summon villager ~ ~...
user avatar
  • 1
7 votes
1 answer
2k views

Is it possible to get the angle of the Sun to a block in Minecraft?

Minecraft has shadows in some of the shaders, and the shadows are obviously created via the positon of the sun or by timing. So is there a way to actually get this angle of elevation from the ground ...
user avatar
  • 617
1 vote
1 answer
48 views

How to give a player a specific item in a specific location? (Java Edition)

I started playing Java Edition months ago after being a Bedrock player for so long. Since I'm new to Java, commands are still pretty fuzzy to me. In this question, I'm trying to reaccomplish what I've ...
user avatar
2 votes
0 answers
101 views

Proper path to modify villager anger?

I would like to make villagers angry on command. I assume I need to use /data modify, but I do not know the proper <targetPath>. I have the following so far: execute as @e[type=villager] run ...
user avatar
  • 805
1 vote
1 answer
115 views

/execute working in command line but not in command block

I'm new to commands, so it's very likely that I'm missing something obvious. I'm trying to teleport myself from the Overworld to specific coordinates in the Nether. The command works in the command ...
user avatar
-1 votes
1 answer
97 views

How to turn sand into grass in Minecraft? [duplicate]

How would I turn sand blocks into the grass block on Minecraft? Please help.
user avatar
1 vote
1 answer
114 views

How to make zombies not attack a specific person?

I want to make a role-play world with my friends and one of them wants to be somewhat immune to zombies, but I have no idea how to do that.
user avatar
1 vote
1 answer
95 views

How do I test if a player has an item with a custom name in inventory WITHOUT scoreboards?

I'm trying to test if a player has an item named "sunny", and if they do to have it turn into a shulker box. If you could include the shulker box having a torch named "sunny" that ...
user avatar
0 votes
0 answers
23 views

How do I set the players health to scoreboard value? [duplicate]

I am trying to set the player's max health to my scoreboard value, this is the command I am using but it only says "GotStung has 20 [Hearts]" /execute as @a store result entity @s minecraft:...
user avatar
2 votes
0 answers
97 views

Testing for if an item entity has an ID matching a list of item names

I am making a datapack that uses copper as a fuel, however part of that means that I need to be able to test an item when it is on the ground to see if it is one of the 37 copper items. I have already ...
user avatar
  • 101
1 vote
0 answers
31 views

Replaceitem not working on Bedrock

For some reason, if I try using /replaceitem it won't execute the command inside of a command block. This is the command I used: /replaceitem block -10 -58 -27 slot.container 1 ender_pearl 1
user avatar
  • 51
1 vote
1 answer
48 views

Red wool command not working

I am trying to make a mini-game on Minecraft bedrock. In the mini-game different blocks that you place activate different things, but when I tried using the red wool command it kept telling me there ...
user avatar
3 votes
1 answer
97 views

Tag for items not burnable in lava (like netherite)

Nice and simple. What is the tag for items to be not burnable in lava, like netherite ingots? Or how would I make other items like obsidian not burn?
user avatar
  • 805
0 votes
1 answer
76 views

Command is running weirdly from load.json (datapack)

Could someone help me? I am thoroughly confused. I have a command in my datapack that is executed from load.json function: execute unless entity @e [type=armor_stand,name=team_lives,scores={...
user avatar
3 votes
1 answer
66 views

How to make a trident reach further underwater in Java Minecraft?

I'm looking for ways to make a trident reach farther underwater in Java Minecraft. Currently, I think the grind was way too hard to get a very mediocre underwater boost, compared to just swimming with ...
user avatar
  • 193
0 votes
1 answer
219 views

How to detect a held enchanted item using commands in Minecraft 1.18.2? [duplicate]

For context, I don't think the riptide enchantment gives a player enough speed or distance underwater. I mostly wanted to use it for fast water travel without a boat. I've found that giving a player ...
user avatar
  • 193
1 vote
1 answer
462 views

How do I make a boss bar for a mob and have command blocks execute when it gets to a certain health

I'm building a boss fight for a game I'm making, I want the boss to have a health bar at the top of the screen like the Ender Dragon/wither, but the boss bar will not connect with the boss's health. ...
user avatar
0 votes
1 answer
178 views

How do I summon an enchanted item? [duplicate]

I tried this command: /summon item ~ ~ ~ {Item:{id:iron_pickaxe,Count:1,Enchantments:{id:fortune,lvl:1}}} But the Iron pickaxe was without enchantment. I'm on Minecraft java 1.18.1.
user avatar
1 vote
1 answer
182 views

How do I make a boat with no gravity and have ice appear below it every second?

All I have is: /summon Minecraft: Boat ~ ~ ~ {NoGravity:1,CustomName:Name,CustomNameVisible:1} How do I add ice under it every second?
user avatar
1 vote
1 answer
66 views

How to make a zombie killing detection scoreboard work for a certain gamemode? [duplicate]

I'm trying to make it so that when it becomes night, a zombie spawns no matter what at a certain coordinate (which I've managed to do with the simple help of the player having to press a button to ...
user avatar
-1 votes
1 answer
263 views

How do I make custom player heads have a NBT tag with commands?

I'm trying to put a CanPlaceOn NBT tag on a custom player head and I don't know where to put the tag. I tried /give @p minecraft:player_head{{CanPlaceOn:["minecraft:stone"]} display: {Name:...
user avatar
  • 1
0 votes
2 answers
74 views

How do make water poisonous, but also resistible?

I was wondering how to make all water completely poisonous in Minecraft 1.18.1; as in, give you wither. My current command (gotten from Google) is: /execute @a ~ ~ ~ detect ~ ~-1 ~ Minecraft:water 0 ...
user avatar
0 votes
2 answers
77 views

Storing a player's location and teleporting the player back to it later in Java Minecraft

I'm looking for a way to store a player's current location (probably in the scoreboard as separate X, Y and Z) and teleport the player to that location later. I'm not completely familiar with the ...
user avatar
  • 193
0 votes
1 answer
95 views

How to make a command set the time to day if it is night or night if it is day?

My friends and I are coding a sandbox game in Minecraft. Instead of using the default daylight cycle, I want to make a button that causes the time to change. Of course, I could simply make two buttons,...
user avatar
1 vote
1 answer
46 views

How to create a delay between two chain blocks? [duplicate]

My friends and I have been making a game in minecraft (java edition), and I want a title to say "Welcome", and then "To our game" after about two seconds. I created two chain ...
user avatar
1 vote
1 answer
115 views

How do I give velocity to players?

I need help with modifying the players velocity in Minecraft. I have tried: /data merge entity Bla0 {Motion:[0.0, 0.8, 0.0]} and /data modify entity Bla0 Motion[0] set value 0.001d but both give the ...
user avatar
  • 13
2 votes
0 answers
38 views

Using signs to record new joiners to realm

The idea is to automatically place sign with name of a new player to the realm. When a new player joins command blocks give a new player starter kit and add him a tag "Started" to close the ...
user avatar
2 votes
1 answer
51 views

Stop adjacent command blocks from activating?

I've got a setup where two independent command blocks must be placed next to each other. How can I stop both of them from triggering? Shown below is a minimal example.
user avatar
0 votes
0 answers
28 views

Teleport an armorstand facing another armorstand with pitch (head rotation)

I am making a one command sphere generator in Minecraft, and I am almost done, but I have one problem. I teleport all the armorstands that make up the sphere facing the middle but their head pitch ...
user avatar
1 vote
0 answers
39 views

How to enchant equipped armor using Commands? [duplicate]

Is it possible to enchant a player equipped armor using commands? I've tried this command but it is not working: /execute at @s[nbt={Inventory:[{Slot:103b}]}] run enchant @p[nbt={Inventory:[{Slot:103b,...
user avatar
  • 21
1 vote
1 answer
162 views

Remove too much sand from The End

I accidentally ran a sand duper in my world for about an hour, and I can't figure out how to fix it. I can't type any commands because my game freezes the second I enter the end. How do I remove sand ...
user avatar
1 vote
1 answer
186 views

How do I make a timer so when a player dies, they have to wait to respawn

I hope that question is good, I just want to know how if a player dies, that go into spectator mode for a certain amount of time (15 mins here). I'm using paper 1.17 and can't find any plugin for what ...
user avatar
0 votes
0 answers
18 views

How to get a knockback 1000 stick with commands on Minecraft Education Edition? [duplicate]

I have been trying to do this one can cant! Can anyone help?
user avatar
2 votes
2 answers
142 views

Too many Ender Dragons made The End very laggy

My son's friend put a pressure plate to spawn unlimited Ender Dragons. I have destroyed the plate and used the kill command /kill@e[type=ender_dragon] but the world is very laggy. Is there any way to ...
user avatar
2 votes
0 answers
44 views

Having ""strings in ""strings in a "nested" command [duplicate]

So, I am having a problem with a nested command, I made a "one command" creator a while ago and I am trying to make it work again, so what it does is: spawn a lot of minecart command blocks ...
user avatar
3 votes
2 answers
158 views

Is there a way to make a dispenser shoot out a fireball with a specific explosion power?

How do I summon a fireball with a specific explosion power in a dispenser? /summon minecraft:fireball ~ ~ ~ {ExplosionPower:200} I know how to summon one with commands, but I don't know how to make ...
user avatar
4 votes
0 answers
57 views

How do I cause a player to drop a special item when they die? [duplicate]

I'd like for a player to drop a wither skull upon death, without the player being required to have it in their inventory before they die. I have attempted using a scoreboard with the deathCount to ...
user avatar
1 vote
0 answers
27 views

How to count items in a chest in Java edition 1.18, using /execute if? [duplicate]

I am creating an escape room in Java Minecraft 1.18 and want the player to put 23 torches in a chest that's standing on top of a repeating command block. I want this command block to teleport the ...
user avatar
0 votes
0 answers
55 views

How can I make a villager sell a custom head for 10 emeralds? [duplicate]

I don't know what commands to use, but I would gladly love it if you helped!
user avatar
  • 11
0 votes
0 answers
60 views

How to generate a random number in 1.18.1? [duplicate]

I have fiddled around with a data pack which needs a random number. To get that, I have tried using emeraldfyr3's random function, which is quite outdated by now, but I have updated it to the best of ...
user avatar
  • 1

1
2
3 4 5
98