1.5 KiB
1.5 KiB
Darklord.js — restoreBloodSpreadBatch() (satır 1526)
function restoreBloodSpreadBatch(world, pool)
{
if (!pool.saved || pool.saved.length === 0)
{
pool.active = false;
return true;
}
if (pool.restoreIndex === undefined || pool.restoreIndex === null || isNaN(Number(pool.restoreIndex)))
{
pool.restoreIndex = pool.saved.length - 1;
}
var changed = 0;
var lastRestored = null;
while (pool.restoreIndex >= 0 && changed < BLOOD_RESTORE_BATCH)
{
var b = pool.saved[pool.restoreIndex--];
if (!b) continue;
restoreBloodBlock(world, b);
spawnBloodBlockFx(world, b.x, b.y, b.z, true);
lastRestored = b;
changed++;
}
if (changed > 0)
{
pool.restoreSoundPulse = Number(pool.restoreSoundPulse || 0) - 1;
if (pool.restoreSoundPulse <= 0)
{
playBloodReturnPulse(world, pool, lastRestored, changed);
pool.restoreSoundPulse = 2 + Math.floor(Math.random() * 3);
}
}
if (pool.restoreIndex < 0)
{
pool.active = false;
pool.restoring = false;
play(world, "minecraft:block.lava.extinguish", pool.x, pool.y + 0.2, pool.z, 1.05, 0.52);
play(world, "minecraft:block.portal.trigger", pool.x, pool.y + 0.2, pool.z, 0.65, 0.42);
}
return changed > 0;
}