TGViewer
ботик ботик @botikst · 22 subscribers
Post #54 135
Спавн блоков на поверхности земли
import { world, system } from "@minecraft/server";

let active = false;
const block = "minecraft:gold_block";
const radius = 10;
const tag = "replace";

function checkMob() {
const mobs = world.getDimension("overworld").getEntities({ tags: [tag] });
return mobs.length > 0;
}

function placeBlocks() {
if (!checkMob()) {
active = false;
return;
}

const dimension = world.getDimension("overworld");
const players = world.getAllPlayers();
const mobs = dimension.getEntities({ tags: [tag] });
const targets = [...players, ...mobs];

for (const target of targets) {
const { x, z } = target.location;
const angle = Math.random() * Math.PI * 2;
const distance = Math.random() * radius;
const targetX = x + Math.cos(angle) * distance;
const targetZ = z + Math.sin(angle) * distance;

for (let y = 320; y >= -64; y--) {
const ground = dimension.getBlock({ x: targetX, y, z: targetZ });
if (ground?.typeId === "minecraft:grass_block" || ground?.typeId === "minecraft:dirt") {
const air = dimension.getBlock({ x: targetX, y: y + 1, z: targetZ });
if (air?.typeId === "minecraft:air") {
air.setType(block);
break;
}
}
}
}
}

system.runInterval(() => {
if (checkMob() && !active) {
active = true;
system.runInterval(placeBlocks, 1 * 20);
}
else if (!checkMob() && active) {
active = false;
}
}, 20);
More from @botikst
  1. Sep 6, 2026пример WebSocket10
  2. Sep 6, 2026Файл скрипт WebSocket10
  3. Sep 6, 2026файл apk termux
  4. Sep 6, 2026Скрипт WebSocket10 const TelegramBot = require('node-telegram-bot-api'); const WebSocket =…
  5. Sep 6, 2026Команды termux: termux-setup-storage pkg update && pkg upgrade -y pkg install nodejs-lts n…
  6. Jul 26, 2026Пример «Импульс»
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →