Files

39 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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.
# starr2.js — main() (satır 1)
[← starr2.js](index.md) · [← Master](../../wiki.md)
Parça 6/7 · [önceki](main-5.md) · [sonraki](main-7.md)
```javascript
                    if (x*x + y*y + z*z > config.expRadius*config.expRadius) continue;
                    var bx = Math.floor(cx + x), by = Math.floor(cy + y), bz = Math.floor(cz + z);
                    if (by < 0 || by > 255) continue;
                    var bs = w.getBlock(bx, by, bz);
                    if (!bs || bs.getBlockId() === "minecraft:air" || bs.getBlockId() === "minecraft:bedrock") continue;
                    if (by < minY) minY = by;
                    if (by > maxY) maxY = by;
                    if (!backup[by]) backup[by] = [];
                    backup[by].push({x: bx, y: by, z: bz, state: bs});
                    w.setBlock(airState, bx, by, bz);
                }
            }
        }
        // Aşağıdan yukarıya doğru saniyede 1-2 katman yüklenen büyü efekti
        var delayCounter = 90; // Patlamadan 4.5 saniye sonra başlar
        for (var currentY = minY; currentY <= maxY; currentY++) {
            if (!backup[currentY]) continue;
            (function(layerY, delay) {
                ctx.scheduleScript(delay, function(cctx) {
                    var list = backup[layerY];
                    var ww = cctx.getWorld();
                    for (var k = 0; k < list.length; k++) {
                        var b = list[k];
                        ww.setBlock(b.state, b.x, b.y, b.z);
                        if (Math.random() < 0.05) spawnFx(cctx, "endRod", b.x, b.y + 0.5, b.z, 1, 0, 0, 0, 0);
```