Files

60 lines
1.8 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.
# Darklord.js — spreadBloodBatch() (satır 1448)
[← Darklord.js](index.md) · [← Master](../../wiki.md)
```javascript
function spreadBloodBatch(world, pool)
{
if (!pool.saved) pool.saved = [];
if (!pool.savedMap) pool.savedMap = {};
var changed = 0;
var attempts = 0;
var lastCoord = null;
var maxAttempts = BLOOD_SPREAD_BATCH * BLOOD_SPREAD_SCAN_MULT;
while (changed < BLOOD_SPREAD_BATCH && attempts < maxAttempts)
{
attempts++;
var coord = nextBloodSpreadCoord(world, pool);
if (!coord) break;
var block = null;
try { block = world.getBlock(coord.x, coord.y, coord.z); } catch (e1) {}
if (!block || isAirBlock(block)) continue;
var currentId = blockId(block);
saveBloodBlockSnapshot(world, pool, coord.x, coord.y, coord.z, block);
if (currentId !== pool.blockId)
{
if (!setBlockStateSafe(world, coord.x, coord.y, coord.z, pool.blockId, 0)) continue;
}
spawnBloodBlockFx(world, coord.x, coord.y, coord.z, false);
lastCoord = coord;
changed++;
}
if (changed > 0)
{
pool.pulse = Number(pool.pulse || 0) + changed;
pool.soundPulse = Number(pool.soundPulse || 0) - 1;
if (pool.soundPulse <= 0)
{
playBloodSpreadPulse(world, pool, lastCoord, changed);
pool.soundPulse = 2 + Math.floor(Math.random() * 3);
}
}
if (pool.generatedDone)
{
pool.spreadDone = true;
play(world, "minecraft:block.portal.trigger", pool.x, pool.y + 0.4, pool.z, 1.05, 0.38);
play(world, "minecraft:entity.wither.ambient", pool.x, pool.y + 0.4, pool.z, 0.75, 0.32);
}
return changed > 0 || pool.spreadDone;
}
```