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
-2 votes
0 answers
17 views

How do I make a command test for a specific set of armor on someone? [duplicate]

I want to set a command block or chain of command blocks to test for when someone is wearing a set of golden armor and each armor piece is named something different. Helmet name: Belleroprhon's ...
user avatar
0 votes
0 answers
14 views

How to give a player a named item with attributes using command blocks?

I am trying to figure out how to give a player a named item with attributes using command blocks but every time I try it, there is either an error or it doesnt give the custom name. My code that doesn'...
user avatar
1 vote
0 answers
21 views

Is it possible to add components/bars to the HUD Minecraft Java 1.19.x

I am trying to make a survival datapack that would require you to drink water. Is it possible to add an element to the HUD to indicate how much water you need based on a scoreboard value? I did some ...
user avatar
0 votes
1 answer
46 views

How can I lock the player to the X or Z axis?

It's a command that locks players to a axis but allows them to move their heads. I've tried execute positioned as @a run tp @a ~ ~ 1, but it does not support multiple players.
user avatar
  • 1
0 votes
0 answers
22 views

Command block to get rid of the "Player Offline" message

I have this command set up in a command block to get rid of the "Player Offline" message on my scoreboard display: execute @a ~~~ scoreboard players operation @s moneydis = @s money And in ...
user avatar
-1 votes
0 answers
32 views

How to identify a chest when opened by a certain player and then changing all chest slots to air?

I'm trying to figure out how to identify a chest AS SOON as a player (with a certain tag) opens it. Then set all chest slots to air. I am NEW to commands but I think the '/item' command is involved? ...
user avatar
2 votes
1 answer
42 views

Why do I have to put at @s in a execute command?

Here is my command block so far: execute as @a at @s if block ~ ~-1 ~ minecraft:diamond_block Then a comparator going into a command block: say hi In the first code, if I don't put at @s it doesn't ...
user avatar
0 votes
0 answers
36 views

How Do I Remove Minecraft IFrames (Invincibility Frames) 1.16.5 (Fabric/Datapack) [closed]

I made a mod that adds laser eyes to Minecraft but unfortunately it doesn't ignore iFrames which I need to make the lasers perfect. Does anyone know how to do this? This is Fabric btw, Datapacks will ...
user avatar
0 votes
0 answers
24 views

How do I make a command run every other tick? [duplicate]

I have a right-click detection but when I reset it to 0 every tick so that it only goes off once, even though I see it change on the scoreboard it doesn't activate my execute command when it works ...
user avatar
0 votes
0 answers
20 views

How do I summon a fireball that is immediately moving in the direction I'm looking? [duplicate]

I'm trying to make a mage staff and I have right-click detection all figured out but I need to summon something that moves in the direction I'm facing. I was originally using a fireball because the ...
user avatar
-2 votes
0 answers
19 views

How to give an item in minecaft java editon affect? [closed]

I want to create talisman that give someone that old it in his off hand affect pls help me
user avatar
0 votes
0 answers
28 views

Issue with a pixelmon extras mod command when I use the command blocks

I have a problem with some commands from the pixelmon extras mod. I want to add in my server the possibility, for non op players, to use the commands to view Ivs and Evs of their pokemon. I tried many ...
user avatar
2 votes
1 answer
32 views

How to check the value of a Tag and execute another command when equal to a desired value?

I'm trying to have a lectern teleport me when I place the correctly named book on its top. So far, I've tried using this command: /execute if data block 50005 10 50009 Book.tag[{title:"Bookname&...
user avatar
  • 21
1 vote
2 answers
32 views

How do I make something summon when I use a fishing rod?

I was trying to use the execute command but I was never able to find something where I could trigger it at the use of the fishing rod. I'm trying to make my own weapon using commands and I want to ...
user avatar
2 votes
1 answer
179 views

How do I use data tags to make a sign glow?

How do I use /setblock to make glow signs as if I were using a glow ink sac? I am trying to make a machine with signs telling you what you can do. But I want glowing signs with color. The text is &...
user avatar
-1 votes
0 answers
36 views

How to setblock a command block with command inside but with a " before last part [duplicate]

I know how to /setblock a command block with a command inside, its: /setblock ~ ~ ~ command_block{Command:"Say Hello"} But I want to know how to fix this: execute at @e[name=alzjsd] run ...
user avatar
1 vote
1 answer
62 views

How do I clear inventories of unobtainable blocks?

I am trying to make commmand blocks that clear my players inventories of unobtainable blocks. I am trying to do tile.moving_block.name at the moment because that can be used for the horion ...
user avatar
  • 101
0 votes
2 answers
90 views

How to make creepers scared of the player?

I want to make creepers scared of the player. The problem is, creepers don't seem to be scared of cats anymore. What can I do?
user avatar
  • 37
3 votes
2 answers
63 views

How to teleport only unemployed villagers

How does one teleport only unemployed villagers in Minecraft 1.18.2 java edition? I have tried the following: tp @e[type=villager, nbt={VillagerData:{profession:"minecraft:unemployed"}}, ...
user avatar
  • 171
0 votes
1 answer
52 views

How do I replace spruce leaves with oak leaves in Minecraft?

I'm unhappy with the way I built something in Minecraft, and want to replace the spruce leaves with oak leave to match the rest of the build, but I do not know how to. Can someone tell me what the ...
user avatar
3 votes
1 answer
51 views

I have a scoreboard that shows a player's health below their name. Is it possible to change the color of that?

Basically, what I'm trying to say is, if a player drops below a certain number of HP, can I make it so that the color of the HP display (below their name) changes color? I want to have it so as long ...
user avatar
0 votes
2 answers
26 views

How to detect if an item is dropped near an armor stand?

I'm trying to make a sort of shrine system where a player can drop a set number of items, say five gold ingots near a shrine, which is a block with an armor stand inside of it, and be given a ...
user avatar
  • 101
1 vote
1 answer
43 views

How to print the name of the block under me in Minecraft?

If wanted to make a data pack that takes the block under me and then says: "The block under me is [block]". How would I do that? If this was like a mix between Java and Minecraft then it ...
user avatar
0 votes
1 answer
46 views

How can I reach a lore text?

I've been trying to get the text from the lore of the item in the main hand and store it as a score value: execute as @p store result score @s kC run data get entity @s SelectedItem.tag.display.Lore .....
user avatar
0 votes
1 answer
55 views

How to spawn items from command blocks with special names?

I've tried so many things to get this to work so: I'm trying to make this Minecraft map where one of the objectives is to collect a bunch of a renamed item, specifically raw gold, I want to rename ...
user avatar
1 vote
0 answers
52 views

Summon/data merge villager with Explorer Map trade

As the title states, I would like to add an explorer map to a summon villager command but nothing seems to be working. More specifically, I would like to append that trade to an existing villager. Is ...
user avatar
  • 805
6 votes
2 answers
110 views

How to calculate the area of a region of any shape (Minecraft Java Edition 1.18)

There is an armorstand on one of the red regions. How to count blocks that are including to the region the armorstand stands on? The result has to be stored to a scoreboard. Red regions can have any ...
user avatar
1 vote
0 answers
60 views

How to use Minecraft bedrock command block output as a variable?

I am very familiar with Minecraft bedrock's command code, and I've used it for a long time. Although, I can't seem to figure out how to store the output from a command block into some kind of variable....
user avatar
1 vote
1 answer
68 views

Command block says "get off the grass" if a player is on grass next to it

I want to make it so when any player comes onto the grass block the command block tells them to get off I think my problem is a misunderstanding of how the syntax works and how command blocks "...
user avatar
0 votes
1 answer
57 views

How to make an armor that gives you potion effects?

I'm confused about the tag part of the command, I don't know what tag my item has. The item has been renamed. This is the command I'm using: execute as @a if entity @s [nbt={Inventory:[{Slot:102b,id:...
user avatar
3 votes
0 answers
47 views

Is it possible to locate the position of a specific block in Minecraft Java

I am building a datapack and I want to replace how diamonds and emeralds function by modifying their generation behavior. But I don't know if this is A : possible and B : worth my time looking in to. ...
user avatar
0 votes
1 answer
28 views

How to summon lightning bolt at normal (and not charged) creepers only?

I currently have this command: execute at @e[type=minecraft:creeper] run summon minecraft:lightning_bolt; but I have no idea where I should put the "{}" to check for the NBTs.
user avatar
2 votes
1 answer
92 views

Is it possible to create a custom ore and add it to world generation with a Datapack?

As the title suggests, I am wanting to add custom ores to the game (I.E. new gemstones like ruby, sapphire, topaz, etc), but I have no clue how to control world generation to add such a thing. I tried ...
user avatar
0 votes
1 answer
45 views

Is there a way to keep playing sound at zombie's location?

How do I make it so a sound will play only once and won't repeat when a player gets 10 blocks near a zombie? But I want the sound to play AT The location of the zombie, so it will be like 3D sound. I ...
user avatar
-1 votes
1 answer
51 views

What's wrong with my Minecraft command? [1.18+] [duplicate]

This is my Minecraft command and I want to give the deity sword a name but my command doesn't work. Can you fix it? /give @p netherite_sword{Enchantments:[{id:sharpness,lvl:5},{id:knockback,lvl:2},{id:...
user avatar
2 votes
1 answer
26 views

How to increment potion effects?

I want to figure out how to make it so that, instead of giving a new potion effect, I could add to the previous ones, i.e. 2 + 3 = 5. How can I do this?
user avatar
  • 37
0 votes
1 answer
28 views

Incrementing attributes in Minecraft

I want to figure out how to increment a player's health without writing 225 lines of Datapack code. I cannot find any way to do this. I've tried : execute at @a run execute unless score @p custHealth ...
user avatar
  • 37
0 votes
1 answer
44 views

How to stop the killed entities message in Minecraft Java using a command block? [duplicate]

I am working on one of my Minecraft maps and I set up a repeating command block to kill the slimes but in the chat, it just says it killed entities repeatedly and I think that would annoy the people ...
user avatar
1 vote
0 answers
34 views

Can I use command blocks to automatically spawn all filled maps that exist in my world?

I have used an online map-art creator to create map art. I downloaded the map files and there are a total of 134. I know that I can get maps by using the following command: /give [playername | @p] ...
user avatar
  • 11
0 votes
0 answers
45 views

Command for magic items in Minecraft Education Edition

I'm creating a game for my school on Minecraft Education Edition, which is Bedrock based. At a point in the game, the players will collect items I rename on an anvil that will give special abilities, ...
user avatar
  • 1
0 votes
1 answer
92 views

How can you make a ghost block in minecraft?

So, I forgot how to summon falling blocks, and all the videos were not helping. I'm not very good with the commands which involve using [, so if I could get an answer, that would be nice.
user avatar
  • 1
1 vote
1 answer
65 views

How can I swap between offhand and mainhand with commands?

Of course I know that if I press F key, offhand and mainhand's item swaps. But I want to do this with command. I tried: execute as @a[nbt={Inventory:[{id:"minecraft:snowball",Slot:-106b}]}] ...
user avatar
0 votes
0 answers
38 views

Show scoreboard belowname without a value

In my server I have set up a scoreboard system to show a staff tag under the staffs name, however, it doesnt quite look right with "1 Staff" under our names. Is there any way to remove the ...
user avatar
0 votes
0 answers
23 views

Is there a way to make a zombie that doesnt attack you but it attacks other players on java? [duplicate]

I like playing OP PVP with things like protection 22 armour and sharpness 25 swords, things like that, I like developing the armour sets more than actually using them, I was making a Kings Set that ...
user avatar
0 votes
0 answers
128 views

How to lock items into inventory/chest slots using NBT data in Java Edition?

It's a bit like Changing the NBT data of a variable amount of items in a chest inventory? but I want to do it using NBT data (like possible in Bedrock Edition) and without the need to set up a ...
user avatar
-1 votes
1 answer
42 views

Potion effect Giver from item frames

I remember doing this a long time ago with armor stands as it was the only entity to easily do it. I wanted to make an invisible item frame that gives the player jump boost when under the item frame. ...
user avatar
0 votes
0 answers
17 views

Is it possible to make using an item summon an entity in 1.17? (Java) [duplicate]

I'm planning on making an RPG game for my friends and I with custom items, but I'm not sure if it is possible to use the /execute command (or any command) to summon an entity when you right click with ...
user avatar
1 vote
1 answer
74 views

Stop a thief in Vanilla Minecraft: Detect if player is x distance from y,z coordinates

I'm trying to catch a thief in 1.19 Minecraft. I had one set of commands to see if items were taken out of a chest, but that was defeated -- I suspect they used X-ray hacked client to disable the ...
user avatar
  • 135
2 votes
2 answers
52 views

Can you make Ender Crystals do less damage?

I have been trying to find a way around Ender Crystal damage in my map I have been making. I want to make the Ender Crystals do less damage while keeping the overall player damage the same. My first ...
user avatar
1 vote
1 answer
33 views

How to set other player's armor in Minecraft

I'm making an MCBE behavior pack which adds kits via functions (functions are to be executed by command blocks). I want to make it so that the player doesn't have to equip armor; instead, it ...
user avatar

1
2 3 4 5
98