Files

52 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# KlonlanmaLal.js — spawnClones() (satır 136)
[← KlonlanmaLal.js](index.md) · [← Master](../../wiki.md)
```javascript
function spawnClones(c, owner, count, announce) {
clearClones(c, false);
var state = defaultState();
state.active = true;
state.owner = owner.getName();
state.count = count;
state.runId = nowMs();
state.tick = 0;
state.cloneIds = [];
var pos = owner.getPosition();
var world = c.getWorld();
for (var i = 0; i < count; i++) {
var spawn = offsetFor(owner, i, count, 1.2, 0);
var clone = createCloneEntity(c, owner, pos.x + spawn.x, pos.y, pos.z + spawn.z, i);
if (clone) {
state.cloneIds.push(clone.getUniqueId());
polishClone(clone, owner, i);
burst(world, pos.x + spawn.x, pos.y + 1, pos.z + spawn.z, i);
}
}
world.playSound("minecraft:entity.endermen.teleport", pos.x, pos.y + 1, pos.z, 1.8, 0.72);
world.playSound("minecraft:block.enchantment_table.use", pos.x, pos.y + 1, pos.z, 1.3, 1.55);
if (state.cloneIds.length === 0) {
state.active = false;
saveState(state);
mappet.set(RUN_KEY, String(state.runId));
owner.send("\u00a7c[Klon] Klon olusmadi. Ustteki spawn hatasini bana atarsan direkt nokta atisi duzeltirim.");
return;
}
saveState(state);
mappet.set(RUN_KEY, String(state.runId));
c.setValue("klon_run_id", state.runId);
c.scheduleScript("klonLoop", LOOP_INTERVAL);
if (announce) {
owner.send("\u00a7d[Klon] \u00a7f" + state.cloneIds.length + "\u00a77 klon aktif. \u00a78(!klon temiz)");
}
}
```