import { world, system } from "@minecraft/server";
const mobcom = {
"minecraft:cow": "title @a title муу",
"minecraft:chicken": "title @a title чикен, банано",
"minecraft:cat": "title @a title мур",
"minecraft:pig": "title @a title свинота",
};
world.afterEvents.entityHitEntity.subscribe((event) => {
const { hitEntity, damagingEntity } = event;
if (damagingEntity?.typeId === "minecraft:player" && mobcom[hitEntity.typeId]) {
try {
damagingEntity.runCommandAsync(mobcom[hitEntity.typeId]);
} catch (error) {
console.error("Ошибка выполнения команды:", error);
}
}
}); Post #57
147
Скрипт удар по определенному мобу