/r/MinecraftCommands

Photograph via snooOG

A place for all things about commands, command blocks and data-packs in vanilla Minecraft; to share, to question, to discuss, and more!

Please read the pinned post before posting.

Discuss, share, and ask questions about Minecraft commands and command blocks. Have fun and don't be afraid to ask questions!

Please read the pinned post before posting.

Feel free to join and ask questions on our community Discord server.

The links and pages on the subreddit wiki might help you.

If you have any questions or issues about the subreddit, you can contact the Moderators for assistance.

Rules of the subreddit:

  • No spamming comments, posts, or links.

  • Do not post inappropriate content.

  • Be respectful: Do not use offensive language, especially directed towards others.

  • Use common sense.

If you may fail to follow these rules on a constant basis, and ignore a moderator's warnings, you may be banned!

ENJOY!

This subreddit uses a custom version of /r/Naut.

You can follow the design development of the subreddit at /r/MCCDesign.

/r/MinecraftCommands

282,053 Subscribers

1

Unique loot table item limiting?

Ive been trying for a few days to make my datapack that adds lore books to chest loot tables only spawn one of each book. Frankly I'm stumped. I have lore books written up, I have them included in chest loot tables, propagating perfectly fine. However I want to limit it so that there is only ever one of each lore book. I cannot figure out how to A) remove it from the pool once one has been found, or B) how to just delete them as they are generated after one has been found (and marked safe from deletion?)

Any help is appreciated.

0 Comments
2024/12/01
23:05 UTC

1

Life System Help

I am making my own variant of '3rd life' and have come across some issues, the premise is that you start on 1 heart and every time you die you gain 1 heart until you reach 10 hearts, the if you die, you are out. I am able to easily make a system that determines how many lives you have but i am struggling with a system that sets your hearts amount to 'deathCount + 1'. is there any quick command i can chuck in a command block to do this?

0 Comments
2024/12/01
22:59 UTC

1

How to make a command block(s) detect when a player eats a specific item

I need it so that when a player eats a specific food it detects it and uses a command to place a block for a certain amount of time

2 Comments
2024/12/01
22:37 UTC

1

how do i put a scoreboard into the macro thing

tellraw @a {"text": "hello im on"}
scoreboard objectives add x dummy
scoreboard objectives add y dummy
scoreboard objectives add z dummy

execute store result score @a x run random value 900..1876
execute store result score @a y run random value 900..1876
execute store result score @a z run random value 900..1876

tellraw @a [{"bold":true,"color":"blue","text":"X="},{"bold":false,"italic":true,"score":{"name":"@a","objective":"x"}}]
tellraw @a [{"bold":true,"color":"yellow","text":"Y="},{"bold":false,"italic":true,"score":{"name":"@a","objective":"y"}}]
tellraw @a [{"bold":true,"color":"aqua","text":"Z="},{"bold":false,"italic":true,"score":{"name":"@a","objective":"z"}}]

function macro:summon_gravity {"x":"score.x","y":"score.y","z":"score.z"}

like i have this function and i want to have a thing that places a armor stand with high gravity in the world at a random location and spawns a structure at that location cause for some reason data pack dose not want to use my structure in world gen

0 Comments
2024/12/01
21:54 UTC

1

why doesn't /damage command work with thorns

I am working on a custom enchantment and I wanted to use /damage to trigger the enchantment through commands but it doesn't seem to work, is there other ways I can trigger enchantment effects through commands?

0 Comments
2024/12/01
21:50 UTC

1

I'm trying to make a funny trap, and don't wanna use elder guardians, but the command won't work, and I have no idea why.

2 Comments
2024/12/01
21:25 UTC

1

Working on Custom Map

Hi! im still very new to command blocks and how they work. im currently trying to work on a Stardew Valley custom map and i need help. im trying to seperate the exteriors and interiors so that when you "enter" a building, it takes you to the actual interior ive built elsewhere. is there any sorta of command that can make it to where i can send someone to another area when they walk in? or maybe when they interact with the door? any help would be appreciated thank you!!

2 Comments
2024/12/01
20:43 UTC

2

How to do this?

Have villagers explode when I'm close to them I'm a command block expert I'd say and I cannot have this happen without going near one and them all exploding.

8 Comments
2024/12/01
19:17 UTC

1

Adventure map with survival zones

Hello, I'm pretty new to using commands/command block and can't figure this out.

What I'm trying to do is..

The world will be set to adventure mode, but each player will have their "base area" that changes them to survival mode. When they leave their base area, they go back into adventure mode even if they enter another player's base area.

Any help would be greatly appreciated

2 Comments
2024/12/01
19:03 UTC

1

Timing for effects

Why when I put 1 second for effects it makes it 20 and when I put 20 seconds it becomes 400 seconds, basically it is multiplying by 20. Why?

5 Comments
2024/12/01
18:46 UTC

1

Issue with saving blocks with commands. Any suggestions?

Hey! Recently, i've been working on a save system for maps, where the idea's that you can run a function command to save & load savestates. I've already completed inventory saving, but i've hit a wall when it comes to saving the actual blocks themselves. I've discovered that structure blocks powered by redstone don't save the structure to disk as they do when you open the gui and press SAVE manually, and beyond that i can't think of any more solutions. Any ideas i can try? Thanks!

2 Comments
2024/12/01
18:36 UTC

1

Function to test if a player has thrown a trident?

I am trying to set a cooldown for when a player throws a trident. I had a function that did this using the "used.trident" objective, but it seems that 1.21.2/3 has made it so throwing it no longer counts the score up.

How else can I test this?
Thanks

2 Comments
2024/12/01
18:16 UTC

1

A way to keep the enchants/potion level cap at level 1?

Yeah that's pretty much it, if there is any way that all enchants and potion levels cap at level 1? whether that be from enchanting/brewing, or finding it in a loot chest. I want to keep them at level 1

1 Comment
2024/12/01
17:16 UTC

1

Is there a way to truly detect crits

3 Comments
2024/12/01
17:09 UTC

1

problems with data pack

I'm trying to create a data pack for minecraft 1.21.3 that changes the mushroom island to a tropical island, but I can't remove the mycelium, what can I do?

https://preview.redd.it/3rch1ym2r94e1.png?width=1920&format=png&auto=webp&s=9352a19e62b56c576a36362ad9c391feb4a64f1b

0 Comments
2024/12/01
17:08 UTC

1

Help with a command

I need help a command. Imagine 3 locations, 1,2, and 3. What I want is a button at lactation 1 which teleports you to location 2 where you stay for 10 minutes and then automatically got to location 3 -!: visa versa.

So 1 and 3 are start and destinations and 2 is the middle point. Is this possible?

5 Comments
2024/12/01
17:00 UTC

1

Wither skull firing help

https://preview.redd.it/68uxcgxid94e1.png?width=1837&format=png&auto=webp&s=705ce63cf3dde79e85425686fe2b986d3d6562e3

so i got a structure block to save these skulls from the wither and they are named wither_skull_dangerous for those who don't know and im trying to make it lock in on the player when spawned any idea how to do that?

2 Comments
2024/12/01
15:51 UTC

1

Dispense armour using commands

Help, I'm trying to make a Despenser that automatically puts armour on a player, I also need it to infinity refill. Im Basing this on a scp like map that also uses this method to equip armour when spawning in.

5 Comments
2024/12/01
15:00 UTC

1

Title not working on my command blocks

my command blocks keep saying my title command works but nobody sees it

currently i have
/title @ a[tag=####] subtitle "#####"
/title @ a[tag=####] title "#####"

whenever the command blocks are activated it says in chat

title command successfully executed

but nothing comes up

4 Comments
2024/12/01
14:55 UTC

1

Is there a way to make bundles store more items? Like different weapons

Skibidi

4 Comments
2024/12/01
14:00 UTC

1

hello i need help with generating custom grass in my biome

hello i need help, i tried to make custom grass in my biome to generate naturally, but it gives me an error pls check, i double checked everything, i think it could be the custom function or the configured feature that uses the function pls help here is the datapack and resourcepack

0 Comments
2024/12/01
13:36 UTC

1

Can't change tick rate with a datapack

I want a funtction to cange the tick rate but when i try to execute the funtion to test it, just doesn't show up.

I have no other commands on the funtion other than "tick rate 40", i have saved changes, reloaded the world, checked that the datapack is enabled and all the other function work

Can you just not modify tickrate on a datapack?

5 Comments
2024/12/01
13:05 UTC

1

trying to creating a frost arrow

is there a way to create an arrow that can give you freezing damage as well as display the frost screen affect without needing the interaction with a power snow block?

5 Comments
2024/12/01
12:57 UTC

1

Use bow without arrows (1.21.2+)

How can I do that?

2 Comments
2024/12/01
12:22 UTC

1

How can I summon an armor stand that breaks in 1 hit and does not drop its items?

5 Comments
2024/12/01
11:25 UTC

1

Will December 3rds update break my datapacks?

Pretty much the title.

Running a server with a few friends on 1.21.3, we have the pale garden turned on but it's pretty limited compared to what will be in the update this week.

There is a handful of datapacks on the server, are they likely to all break if I update the server to whatever this update is 1.21.4? Or do we need to wait for the update to release to know?

Examples of packs in use - Vanilla Tweaks, Mob Heads, Dungeons and Taverns, Trimsfault

1 Comment
2024/12/01
11:14 UTC

1

How can i give effects to an entity (could be a mob or a player) when hitting it?

I want to make a command where every time i hit an enemy they get slowness 1 but i cant get the command to work. Can someone help me?

4 Comments
2024/12/01
08:53 UTC

2 Comments
2024/12/01
06:38 UTC

3

Datapack Recipe Help

Is it possible to add nbt data to items used in a recipe? If so I would like to detect if the apple has custom data of "cursedapple:true"

Code:

{
    "type": "minecraft:crafting_shapeless",
    "ingredients": [
      {
        "item": "minecraft:glass_bottle"
      },
      {
        "item": "minecraft:apple"
      }
    ],
    "result": {
      "id": "minecraft:splash_potion",
      "components": {
        "minecraft:custom_name": "{\"text\":\"Cursed Potion\",\"color\":\"gray\",\"bold\":true,\"italic\":false}",
        "minecraft:potion_contents": {
          "potion": "minecraft:water",
          "custom_color": 0,
          "custom_effects": [
            {
              "id": "minecraft:unluck",
              "amplifier": 0,
              "duration": 21,
              "ambient": false,
              "show_particles": false,
              "show_icon": false
            }
          ]
        },
        "minecraft:hide_additional_tooltip": {}
      }
    }
  }
1 Comment
2024/12/01
06:01 UTC

1

How to teleport when touching a certain block

I am trying to make a parkour map when you try and beat the game in parkour style and I was wondering is there a command that lets you teleport back to spawn when touching a block.

7 Comments
2024/12/01
04:36 UTC

Back To Top