Files

811 B
Raw Permalink Blame History

ezoic_fly.js — spawnSafeFallingBlock() (satır 45)

← ezoic_fly.js · ← Master

function spawnSafeFallingBlock(ctx, x, y, z, blockId, meta, vx, vy, vz) {
    var w = ctx.getWorld();
    var fb = null;
    try {
        var nbt = mappet.createCompound(
            '{Block:"' + blockId + '",Data:' + meta +
            ',Time:1,DropItem:0b,HurtEntities:0b,NoGravity:1b}'
        );
        fb = w.spawnEntity("minecraft:falling_block", x, y, z, nbt);
    } catch (e) { return null; }
    if (!fb) return null;
    try { fb.addMotion(vx, vy, vz); } catch (e) {}
    (function(entity) {
        ctx.scheduleScript(FB_LIFETIME, function() {
            try { entity.remove(); } catch (e) {}
        });
    })(fb);
    return fb;
}