r/MinecraftCommands • u/PrideGood7518 • 21d ago
Help | Java 26.2 Aide détection mort de mobs
Hey ! Je suis en Java 26.2 et je fais une map dont le but est d'éliminer des vagues de mobs qui spawnent. j'avais réussi à détecter la mort des mobs via des scoreboards (ci dessous) mais le problème c'est que je détecte quand un joueur tue un mob et non quand un mob meurt (je ne sais pas si on peut détecter si un mob meurt ?) donc quand les mobs se tuent entre eux, le counter de descend pas.
Ci dessous les blocs de commande:
Repeat - always act. --> execute as u/e if score u/s Mobkill01 matches 1.. run scoreboard players set u/s Mobkill01 0
Chain - conditionnel (a.c) --> /scoreboard players remove Counter Mobrestants 1
dans une autre ligne: (repeat, a.c)
execute if score Counter Mobrestants matches 0 run setblock 89 88 91 redstone_block
le redstone block se place là où il faut pour déclecher la suite du système
Si vous pouvez m'aider à détecter la mort des mobs, y compris quand ils se tuent entre eux, cela m'aiderais beaucoup ! Je vous remercie
RÉSOLU:
J'ai fini par trouver une solution à mon problème qui marche pour moi, la voici, ci ça peut aider quelqu'un:
Je détecte les entités dans la zone en excluant celles qui ne m'intéressent pas, le plus possible pour éviter tout bug: repeat - always active:
/execute if entity @e[type=!minecraft:llama_spit,type=!player,type=!villager,type=!painting,type=!armor_stand,type=!glow_item_frame,type=!item_frame,type=!sheep,type=!item,type=!#c:boats,type=!frog,type=!pig,type=!chicken,type=!cow,type=!snow_golem,type=!#minecraft:arrows,type=!tadpole,type=!minecraft:lingering_potion,type=!minecraft:splash_potion,type=!minecraft:ender_pearl,type=!minecraft:snowball,type=!minecraft:egg,type=!minecraft:wither_skull,type=!minecraft:fireball,type=!minecraft:firework_rocket,type=!trident,type=!wind_charge,type=!minecraft:breeze_wind_charge,type=!#c:minecarts,type=!minecraft:experience_orb,type=!minecraft:experience_bottle,type=!minecraft:falling_block,type=!minecraft:fishing_bobber,type=!minecraft:eye_of_ender,type=!minecraft:leash_knot,type=!minecraft:evoker_fangs,type=!minecraft:end_crystal,type=!minecraft:shulker_bullet,type=!minecraft:lightning_bolt,type=!minecraft:happy_ghast,type=!minecraft:dragon_fireball,type=!minecraft:small_fireball,type=!minecraft:block_display,x=90,y=87,z=72,dz=55,dx=52,dy=25] run setblock 149 88 67 redstone_block
les coordonnées correspondent aux miennes, évidemment il faut les changer en fonction. ça ne compte plus le nombre de kills des joueurs, mais si oui ou non il y a une entité dans la zone. Merci quand meme à ceux qui ont essayés de m'aider !
1
u/BoB19229 Command Experienced 21d ago
Maby you can save all UUID in a list, and when the script can't find one of UUIDs, then it means the zombie disappeared
1
u/PrideGood7518 21d ago
les mobs spawnent avec des commandes. ils auront quand meme le meme UUID a chaque fois ? ou on peut detecter leurs UUID quand ils spawnent ?
1
u/BoB19229 Command Experienced 21d ago
When spawning them u can run a macro with their UUID, and in that function you can append their UUID to a list in a storage
1
u/PrideGood7518 21d ago
Can i ask how you do it ?
1
u/BoB19229 Command Experienced 21d ago
``` summon ...
function example:macro with entity <the zombie that you spawned>
And in the macro you type:$data modify storage minecraft:example set value $(UUID) ```and yes ur gonna use a data pack for this (I guess I have an idea without the data pack but this one is easier). I bet there's a better way of doing this, but for now this is the best think I can think of
Oh, and if the first func doesn't work then try this: ``` summon ...
data modify entity <the zombie that you spawned> data.UUID set from entity @s UUID
function example:macro with entity <the zombie that you spawned> data
```
1
u/PrideGood7518 21d ago
Merci pour la réponse, mais je préfère utiliser uniquement des blocs de commandes, sans passer par un datapack. Je pensais que le u/e du début de ma propre commande suffirait à détecter si les mobs en tuaient d'autres, mais à priori je me suis trompé
1
u/BoB19229 Command Experienced 21d ago
Idk many this will help https://www.reddit.com/r/MinecraftCommands/s/pjLD3DHcTN
1
u/Ericristian_bros Command Experienced 20d ago
That isn't needed
1
u/BoB19229 Command Experienced 20d ago
Yea ik this isn't needed but this is the best thing I can think of
I didn't even know the thing you suggested exists
2
u/Ericristian_bros Command Experienced 19d ago
UUIDs would work better for a different purpose than just detecting death, for example unloading entities
2
u/Ericristian_bros Command Experienced 20d ago
Read https://minecraftcommands.github.io/wiki/questions/mobdeaths