49 lines
1.8 KiB
Markdown
49 lines
1.8 KiB
Markdown
# Darklord.js — buildDomainBatch() (satır 2374)
|
||
|
||
[← Darklord.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
```javascript
|
||
function buildDomainBatch(world, domain)
|
||
{
|
||
var plan = domain.plan || [];
|
||
if (!domain.saved) domain.saved = [];
|
||
if (!domain.savedMap) domain.savedMap = {};
|
||
|
||
var changed = 0;
|
||
while (Number(domain.buildIndex || 0) < plan.length && changed < DOMAIN_BUILD_BATCH)
|
||
{
|
||
var item = plan[Number(domain.buildIndex || 0)];
|
||
domain.buildIndex = Number(domain.buildIndex || 0) + 1;
|
||
if (!item) continue;
|
||
|
||
if (item.kind === "air") domainApplyAir(world, domain, item, true);
|
||
else domainApplyBlock(world, domain, item, true);
|
||
|
||
if ((changed & 15) === 0) spawnDomainBuildFx(world, item);
|
||
changed++;
|
||
}
|
||
|
||
if (!domain.built && Number(domain.buildIndex || 0) >= plan.length)
|
||
{
|
||
domain.built = true;
|
||
play(world, "minecraft:block.beacon.power_select", domain.x, domain.y + 2.0, domain.z, 1.15, 0.55);
|
||
play(world, "minecraft:entity.enderdragon.growl", domain.x, domain.y + 2.0, domain.z, 0.42, 1.20);
|
||
play(world, "minecraft:block.glass.place", domain.x, domain.y + 2.0, domain.z, 1.0, 0.48);
|
||
}
|
||
|
||
if (changed > 0 && Number(domain.pulse || 0) <= 0)
|
||
{
|
||
play(world, "minecraft:block.glass.place", domain.x, domain.y + 1.0, domain.z, 0.88, 0.54 + Math.random() * 0.12);
|
||
play(world, "minecraft:block.stone.place", domain.x, domain.y + 1.0, domain.z, 0.62, 0.58 + Math.random() * 0.10);
|
||
play(world, "minecraft:block.beacon.ambient", domain.x, domain.y + 1.0, domain.z, 0.42, 0.92);
|
||
domain.pulse = 2;
|
||
}
|
||
else
|
||
{
|
||
domain.pulse = Number(domain.pulse || 0) - 1;
|
||
}
|
||
|
||
return changed > 0;
|
||
}
|
||
```
|