Files

49 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 1/7 · [sonraki](main-2.md)
```javascript
function main(c) {
    var player = c.getPlayer();
    if (!player) return;
    var world = c.getWorld();
    var look = player.getLook();
    var pPos = player.getPosition();
    var eyeH = player.getEyeHeight();
    var startX = pPos.x;
    var startY = pPos.y + eyeH - 0.4;
    var startZ = pPos.z;
    function spawnFx(ctx, name, x, y, z, count, dx, dy, dz, speed) {
        var type = mappet.getParticleType(name);
        if (type) ctx.getWorld().spawnParticles(type, true, x, y, z, count, dx, dy, dz, speed);
    }
    var cfg = {
        absorbRadius: 25,
        expRadius: 12,
        damage: 100.0,
        launchForce: 2.6,
        chargeTicks: 25
    };
    var lightBlocks = ["minecraft:torch", "minecraft:wall_torch", "minecraft:glowstone", "minecraft:sea_lantern", "minecraft:lantern"];
    var airState = mappet.createBlockState("minecraft:air", 0);
    var absorbed = 0;
    // --- 1. AŞAMA: ULTRA IŞIK EMİLİMİ ---
    for (var x = -cfg.absorbRadius; x <= cfg.absorbRadius; x++) {
        for (var y = -cfg.absorbRadius; y <= cfg.absorbRadius; y++) {
            for (var z = -cfg.absorbRadius; z <= cfg.absorbRadius; z++) {
                if (x*x + y*y + z*z > cfg.absorbRadius*cfg.absorbRadius) continue;
                var tx = Math.floor(startX + x), ty = Math.floor(startY + y), tz = Math.floor(startZ + z);
                var bs = world.getBlock(tx, ty, tz);
                if (bs && lightBlocks.indexOf(bs.getBlockId()) !== -1) {
                    world.setBlock(airState, tx, ty, tz);
                    absorbed++;
```