Files

1.9 KiB
Raw Permalink Blame History

pirt3.js — restoreLayerStep() (satır 470)

← pirt3.js · ← Master

Parça 1/3 · sonraki

function restoreLayerStep(c) {
    var world = c.getWorld();
    var restoreId = c.getValue("restoreId");
    var currentY = c.getValue("currentRestoreY");
    var maxY = c.getValue("maxRestoreY");
    var cx = c.getValue("hitCx");
    var cy = c.getValue("hitCy");
    var cz = c.getValue("hitCz");
    var radius = c.getValue("craterRadius");

    if (restoreId === null || currentY === null || maxY === null || cx === null || cy === null || cz === null) {
        return;
    }

    var serverStates = c.getServer().getStates();
    var blocksKey = restoreId + "_blocks";
    var idListKey = restoreId + "_idList";

    if (!serverStates.has(blocksKey) || !serverStates.has(idListKey)) {
        return;
    }

    var blocks = JSON.parse(serverStates.getString(blocksKey));
    var idList = JSON.parse(serverStates.getString(idListKey));

    if (blocks === null || idList === null) {
        return;
    }

    if (currentY > maxY) {
        // Tamamen bittiğinde zafer sesleri ve görkemli bitiş partikülleri
        world.playSound("minecraft:entity.player.levelup", cx, cy + 2.0, cz, 2.5, 1.25);
        world.playSound("minecraft:block.portal.travel", cx, cy + 2.0, cz, 1.5, 1.45);
        
        var pType = mappet.getParticleType(SPELL_CONFIG.PARTICLE_HEAL_2);
        if (pType !== null) {
            world.spawnParticles(pType, false, cx, cy + 1.0, cz, 150, radius * 0.7, 4.0, radius * 0.7, 0.15);
        }

        // Geçici sunucu verilerini temizle
        serverStates.reset(blocksKey);
        serverStates.reset(idListKey);
        return;
    }

    var countThisLayer = 0;
    var len = blocks.length;
    for (var i = 0; i < len; i += 5) {