Files

1.5 KiB
Raw Permalink Blame History

TelekinesiLal.js — breakOneBlock() (satır 414)

← TelekinesiLal.js · ← Master

function breakOneBlock(w, s, x, y, z) {
    var key = blockKey(x, y, z);
    if (s.broken[key]) return false;

    var state;
    try { state = w.getBlock(x, y, z); } catch (e1) { return false; }
    if (!state || state.isAir()) return false;

    var id = blockId(state);
    if (PROTECTED_BLOCKS[id]) return false;

    var meta = 0;
    try { meta = Number(state.getMeta()); } catch (e2) {}

    var tile = "";
    try {
        if (w.hasTileEntity(x, y, z)) {
            var te = w.getTileEntity(x, y, z);
            if (te) tile = String(te.getData());
        }
    } catch (e3) {}

    s.broken[key] = true;
    s.restores.push({
        x: x,
        y: y,
        z: z,
        id: id,
        meta: meta,
        tile: tile,
        at: safeWorldTime(w) + RESTORE_TICKS
    });

    try {
        w.setBlock(mappet.createBlockState("minecraft:air", 0), x, y, z);
    } catch (e4) {
        try { w.removeBlock(x, y, z); } catch (e5) {}
    }

    fx(w, "smokeLarge", x + 0.5, y + 0.5, z + 0.5, 7, 0.20, 0.20, 0.20, 0.025);
    fx(w, "critMagic", x + 0.5, y + 0.5, z + 0.5, 5, 0.16, 0.16, 0.16, 0.035);
    fx(w, "explode", x + 0.5, y + 0.5, z + 0.5, 1, 0.04, 0.04, 0.04, 0.02);
    w.playSound(SOUND_BREAK, x + 0.5, y + 0.5, z + 0.5, 0.35, 0.75 + Math.random() * 0.25);
    return true;
}