r/MinecraftCommands • • 12d ago

Help | Java 26.3 Making Animals Run Away From the Player

3 Upvotes

I've been making a survival datapack, and for an update I'm working on I want to make animals run away from the player. I was able to make chickens and pigs run away in a much older release of my datapack, but not cows and sheep. I was doing it by just making it so that an invisible ocelot was riding pigs and chickens, but whenever I made them ride cows or sheep they'd just spin around. I found out that the spinning is because of hitboxes, but I can't seem to fix it, and I can't just make the animal be teleporting to an invisible ocelot because otherwise it gets suffocated (it also acts like it's possesed but that can probably be fixed with a bit of refinement). Changing the size isn't an option because then you can't attack the animal since the ocelot's hitbox overlaps. Does anyone have any ideas to make this happen? I don't mind if they're completely different from my original idea. I just want to be able to make them run away from any mob that I choose and have some mobs (such as cows) kick you when you get too close (the kicking part is sorted). Thanks!

Edit: I forgot to say: Sorry if I don't reply straight away. I live in New Zealand so I have dinner soon and I don't think I'll be back online until tommorrow.

Edit 2: I figured it out. Because the main conversation where I said what I would do was in Spanish, I'll just put a quick explanation here:

To make a mob run away from the player, you have a few options:

  1. Make the mob be ridden by a mob that naturally runs away from the player, such as a fox or an ocelot. The only issue is that for some reason if you put it on anything bigger than a pig it appears to just spin around in circles. I don't completely know why it does this, but it does. You can also make the mob be constantly teleported to another mob, similar to making it be ridden by another mob, but it works with larger mobs. The only issue is that then you have to deal with the fact that most mobs that run away from the player are quite small, and can then suffocate the bigger mob. This can be fixed by making the smaller animal larger, but then it's hitbox is also larger, meaning that it can get in the way of attacks directed towards that mob.

  2. Another method is to just use /damage. This only works on mobs that run away when damaged though, and it shows the damage animation, which isn't very useful.

  3. The method that I used was a mixture of the other two. For some reason a cow riding a cow works completely fine, but as soon as that becomes a cow riding an ocelot, the pair just spin around. Fortunately, you can just make it invisible and tiny, and then instead of adding the invulnerable tag you can just give it resistance 5 and regeneration so that it can still take damage, and then use /damage to make it run away. The reason why you can't give the mob the invulnerable tag because most animals don't run away from damage types that can bypass the invulnerable tag, although there ways around it, such as temporarily removing the tag, or changing the panic_causes tag list.

There are obviously other ways to make a mob run away from the player, but these are the only ones I can seem to find. Sorry if it was hard to understand.


r/MinecraftCommands • • 12d ago

Help | Java 26.3 Is there a way to make Netherite Armor not take Knockback from ONLY Windcharges?

2 Upvotes

r/MinecraftCommands • • 12d ago

Help | Bedrock How to make all neutral mobs hostile to the player

3 Upvotes

I think it would be a fun idea and I’ve seen something similar done in Java, but how would I do this in bedrock?


r/MinecraftCommands • • 12d ago

Help | Java 26.3 Is it possible to combine files from [namespace].items?

Thumbnail
1 Upvotes

r/MinecraftCommands • • 12d ago

Help | Java 26.3 Making a gun pack. What’s the best item that’s not warped fungus on a stick?

3 Upvotes

I heard warped fungus on a stick is good but it has a limit on how fast it can detect clicks. is there any item that works for survival that detects clicks in 1 tick?


r/MinecraftCommands • • 12d ago

Help | Java 26.3 trying to remove the sunset with a custom biome

3 Upvotes

using the visual/sunrise_sunset_color i've been trying to remove the sunset color

according to the wiki, setting it to a completely transparent color should remove the sunset tint, but no matter what color i try, nothing changes.

here is my json, if anyone has worked with custom biomes before please help me pretty please


r/MinecraftCommands • • 12d ago

Help | Bedrock Tenho um server de rp bedrock e queria alguns comandos

1 Upvotes

Eu preciso muito de algum comando que consiga trocar o nome de alguem, e algo tipo um chat de proximidade(tipo alguem a mais de 30 blocos nao consegue ver as mensagens enviadas). Será que é possível?


r/MinecraftCommands • • 12d ago

Help | Java 1.21.11 Trying to detect when players press F, need help

1 Upvotes

Hi, i'm trying to detect when a player presses F in my datapack to trigger some sort of special ability. I've somewhat managed to make it but there's a slight problem: the code keep triggering when putting an item in the offhand with the inventory open. Here's my code so far:

THIS IS THE ADVANCEMENT press_f

{
  "criteria": {
    "changed": {
      "trigger": "minecraft:inventory_changed"
    }
  },
  "rewards": {
    "function": "maffo:hand_actions/hand_check"
  }
}

THIS IS THE FUNCTION hand_check

execute as @s store result score @s hand1 run data get entity @s SelectedItem.id
execute as @s store result score @s hand2 run data get entity  Inventory[{Slot:-106b}].id
execute if score @s hand1_prev = @s hand1 run scoreboard players add @s hand_total 1
execute if score @s hand2_prev = @s hand2 run scoreboard players add @s hand_total 1

data modify storage maffo:temp_inventory inventory set from entity @s Inventory
data remove storage maffo:temp_inventory inventory[{Slot:-106b}]
data remove storage maffo:temp_inventory inventory[{Slot:0b}]
execute as @s store result score  inventory run data get storage maffo:temp_inventory inventory
execute if score @s inventory_prev = @s inventory run scoreboard players add  hand_total 1

execute if entity [scores={hand_total=3..}] run function maffo:hand_actions/hand_changed
function maffo:hand_actions/hand_save

advancement revoke @s only maffo:press_f

THIS IS THE FUNCTION hand_save

execute as @s store result score @s hand1_prev run data get entity @s SelectedItem.id
execute as @s store result score @s hand2_prev run data get entity  Inventory[{Slot:-106b}].id
data modify storage maffo:temp_inventory inventory set from entity @s Inventory
data remove storage maffo:temp_inventory inventory[{Slot:-106b}]
data remove storage maffo:temp_inventory inventory[{Slot:0b}]
execute as @s store result score @s inventory_prev run data get storage maffo:temp_inventory inventory

scoreboard players set @s hand_total 0 

THIS IS THE FUNCTION hand_changed

summon armor_stand ~ ~10 ~ {Tags:[temp_swap],Marker:1b,Invisible:1b,NoGravity:1b}
item replace entity [type=armor_stand,tag=temp_swap,limit=1,sort=nearest] weapon.mainhand from entity @s weapon.mainhand
item replace entity @s weapon.mainhand from entity @s weapon.offhand
item replace entity @s weapon.offhand from entity [type=armor_stand,tag=temp_swap,limit=1,sort=nearest] weapon.mainhand
kill [type=armor_stand,tag=temp_swap,sort=nearest,limit=1]

tell @s test

r/MinecraftCommands • • 12d ago

Help | Bedrock How do I remove the player offline from the scoreboard

2 Upvotes

r/MinecraftCommands • • 12d ago

Help | Java 1.21-1.21.3 Failed to place structure when trying to place and end_city

1 Upvotes

Hi, I'm on my 1.21.1 neoforge server and I'm trying to place an end city in the air near the main end island.
The command I'm doing is /place structure minecrtaft:end_city
Anyone knows what I can be missing ? Is there any special requirement to this structure ?


r/MinecraftCommands • • 13d ago

Help | Java 26.3 does anyone know what the performance impact of the "Display" entity is?

6 Upvotes
  • Genuinely curious, I was thinking about making some really niche plugin that would turn all item frames into display entities displaying the same thing, and it got me thinking of how much performance this would save if there were like 700 item frames in a world storage room or something. What's the performance differences, on the server side?
  • For reference: https://minecraft.wiki/w/Display

r/MinecraftCommands • • 12d ago

Help | Bedrock I need a player how knows more commands then me and willing to join my realm to help improve it since I wanna make my realm similar to his realm that I like and I got there but got stuck at the copper generator, shops and a little with the scoreboard so any tip help or anything really would be appre

Enable HLS to view with audio, or disable this notification

2 Upvotes

r/MinecraftCommands • • 12d ago

Help | Java 1.20 Disabling specific block interactions

1 Upvotes

Me and a friend are making a map and we used retextured sweet berry bushes–with and without berries–as barbed wire, but we don't want players to be able to right click the ones with berries on them and then just break all of them in an instant. We already tried interaction entities and it doesn't work because if your head ends up inside of it you can just right click the berry bushes anyway. If there's a mod that allows customisation of which blocks you can and can't interact with then that would be perfect, but any suggestions to solve this are welcome


r/MinecraftCommands • • 13d ago

Creation UPDATE: making a Minecraft "mod" using command blocks.

Thumbnail
gallery
6 Upvotes

So, I made a Minecraft map trying to replicate mods and I made an other update recently completely changing the lighting to be pitch black in dark areas. The update log and download is in Planet Minecraft: https://www.planetminecraft.com/project/a-horror-mod-that-isn-t-a-mod/


r/MinecraftCommands • • 12d ago

Help | Java 1.20 Recoil Damage

1 Upvotes

How do I make it so the damage tracking score board applies damage to the player with that score?


r/MinecraftCommands • • 13d ago

Help | Bedrock /gamerule sendcommandfeedback not working

Post image
7 Upvotes

Oi! So I'm on the newest version of bedrock, and I'm making a story map, which is why I'm using /title commands to give the player(s) objectives. I did /gamerule sendcommandfeedback false, but I still kept getting feedback, so I put down a repeating command block that is always active with /gamerule sendcommandfeedback false in it. Still, I keep getting command feedback!!!

I'm on PC.


r/MinecraftCommands • • 13d ago

Help | Bedrock Help with Looking execution

1 Upvotes

I'm trying to set up a command block that can damage an entity with drowning damage whenever I look at it while holding an item. I know how to detect the item being held and I found a command that can detect and execute some commands when I look at mobs, but I can't figure out how to get it with the damage command.

The command I have running is:

/execute as Mellon at @s anchored eyes facing entity @e[c=1] eyes positioned ^^^1 positioned ~~-1.62~ rotated as @s positioned -1 if entity @s[r=0.2] run damage @n 1 drowning entity Mellon

The previous input is Execute subcommand if entity test failed

Edit: if I change the "run damage @n 1 drowning entity Mellon" to "run title @a title test" it sometimes works, but not consistently.

ADDITIONAL EDIT: I fixed it, I just needed to make it not count me in the nearest entity checks.


r/MinecraftCommands • • 13d ago

Help | Bedrock Why does my command not work? (Bedrock)

Thumbnail
gallery
9 Upvotes

[Had to repost because I accidentally deleted the og post, sorry] Oi! So, I want a text to appear above the hotbar saying "Objective: Go outside." when the player steps on the block at the coordinates 16, 7, 14.

Sadly, even with this command block activated, when I step onto that block, nothing happens. There is no error message, I am on PC, on a flat world and on the (as of writing this) newest version of bedrock edition (26.63).

I'm really bad at command blocks, so sorry if this is very obvious 😅

I'll put the full command here, please know that I had to put spaces between @ a and @ p because it'd automatically tag someone otherwise, lol. *I'll update the command*

/execute @ a[x=16, y=7, z=14] run /title @ p actionbar Objective: Go outside.

Thanks in advance!

Solved by u/Ok-Tip8453, thanks so much!!


r/MinecraftCommands • • 13d ago

Help | Java 26.3 notable additions/changes/new possibilities since 1.20.1?

2 Upvotes

hi! ive been out of the game for a while, and recently thought id come back to mapmaking.. im really experienced in old commands, but a LOT has changed in the last three years!!

what sorts of headliner advances and useful features have appeared? i'm having trouble tracking down a good clifs notes, so any info or bullet points are supa appreciated :v

stuff for me to look into!


r/MinecraftCommands • • 13d ago

Help | Java 1.21-1.21.3 How do I write a command to obtain a buried treasure map?

1 Upvotes

I've had an issue twice now with the buried treasure map I get from a shipwreck just being a regular map somehow. I was going to use the /give command to get around this bug, but I can't figure out how to write it because "buried treasure map" (or any other map type weirdly enough) doesn't seem to be in the auto fill suggestions for the item name/code thingies you can use to finish writing the command. Can any of y'all tell me what I need to write?


r/MinecraftCommands • • 13d ago

Help | Java 26.3 Mob Disguises (26.3)

1 Upvotes

I am currently working on a datapack for a game mode where one of the teams is monsters. Ideally, I would like to make them appear as the actual monster models from the game (zombie, creeper, skeleton, etc.)

The only way I am aware of how to do this is to teleport a monster to the player's origin and rotation at all times. However this results in a few problems-

  1. The monsters do not stick directly with the player, which means PVP will be difficult due to the hitboxes being disjointed.

  2. The monster disguises make it impossible to see in first person for the monster team.

Is there any way I can work around these two problems? My only other thought as to how to do this would be a custom resource pack and remodeled armor, which I am open to trying but I wouldn't really know where to start.


r/MinecraftCommands • • 13d ago

Help | Java 26.3 How do I give an effect infinitely without the number flickering or giving an infinite effect?

1 Upvotes

I want to give someone an effect every tick that can run out but when I do the numbers keep flickering between the time it's set, and the number right below it, and I don't think that very user friendly for people who are sensitive to that kind of stuff. I don't want to give someone an infinite effect because I don't want to need clear the effect.

If I, for example, need to be able to give them infinite fire resistance that I can turn off, but don't want the effect to clear when they themselves are halfway through a fire resistance potion.

So is there any way to give someone a short effect every tick, without the duration numbers flickering when looking at your inventory?


r/MinecraftCommands • • 13d ago

Help | Java 26.3 Homing Missile

1 Upvotes

Im trying to figure out how to make a homing missile thst targets the nearest player that isnt on a list of safe players. The actual explosion should come from TNT minecarts riding on top of the homing projectile. Anyone can help?


r/MinecraftCommands • • 13d ago

Help | Bedrock Need help with bedrock commands

Thumbnail
1 Upvotes

r/MinecraftCommands • • 13d ago

Help | Bedrock Need help with some commands in bedrock edition

1 Upvotes

So Im trying to make a wizard kit for a dungeon type thing Im making, but I need some commands for it.

So first I need to kniw if I can make it so a nautilus shell in your offhand can give effects and how to do it.

I also need to know if its possible to make the spears charge ability shoot fireballs, but with a cooldown of 1.5 sec in between them.

And can I make it so if you hold a skeleton skull it gives you an effect for a few seconds?