猫史档案馆


【box3】四季变换

用户:TobylaiTobylai查看:1 回复:9 评论:1 创建时间:2020-12-19T09:50:57


const seasons = ['春', '夏', '秋', '冬'];
const Springleaf = 'green_leaf'; const Summerleaf = 'leaf_05'; const Fallleaf = 'leaf_03'; const Winterleaf = 'winter_leaf'
const grass = ['grass', 'dark_grass', 'yellow_grass', 'white_grass']
async function replaceblock(a, b) { for (y = 0; y < 65; y++) { for (x = 0; x < 255; x++) { for (z = 0; z < 255; z++) { if (voxels.getVoxel(x, y, z) == voxels.id(a)) { voxels.setVoxel(x, y, z, voxels.id(b)) } } } } }
const time = 20 * (60 * 1000);
function getRndInteger(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
(async function rain() {
    world.raining = false;
    while (true) {
        await sleep(getRndInteger(1, 50) * 1000)
        world.rainDensity = 0.5;                                    // 雨的密度
        world.rainDirection = new Box3Vector3(0, 1, 0);             // 方向
        world.rainColor = new Box3RGBAColor(0, 0.89, 1, 0.4);  // 颜色
        world.rainSpeed = 1.2;                                      // 速度
        world.rainSizeLo = 0.1;                                     // 雨滴最小直径
        world.rainSizeHi = 2;
        world.raining = true;
        await sleep(getRndInteger(10, 50) * 1000)                                    // 雨滴最大直径
        world.rainSizeLo = 0;                                     // 雨滴最小直径
        world.rainSizeHi = 0;
        world.raining = false;
    }
})();
(async function changeseason() {
    while (true) {
        world.snowSizeLo = 0;                                    // 最小直径
        world.snowSizeHi = 0;
        for (x = 0; x < 255; x++) {
            for (z = 0; z < 255; z++) {//把10改成你的海平面y坐标
                if (voxels.getVoxel(x, 10, z) == voxels.id('ice')) {
                    voxels.setVoxel(x, 10, z, 'water')
                }

            }
        }
        replaceblock(Winterleaf, Springleaf); replaceblock(grass[3], grass[0]);//world.say(seasons[0]+'天到了');
        await sleep(time);
        replaceblock(Springleaf, Summerleaf); replaceblock(grass[0], grass[1]);//world.say(seasons[1]+'天到了');
        await sleep(time);
        replaceblock(Summerleaf, Fallleaf); replaceblock(grass[1], grass[2]);//world.say(seasons[2]+'天到了');
        await sleep(time);
        replaceblock(Fallleaf, Winterleaf); replaceblock(grass[2], grass[3]);//world.say(seasons[3]+'天到了');
        for (x = 0; x < 255; x++) {
            for (z = 0; z < 255; z++) {
                if (voxels.getVoxel(x, 10, z) == voxels.id('water')) {
                    voxels.setVoxel(x, 10, z, 'ice')
                }

            }
        }
        /* 雪 */
        world.snowDensity = 0.4;                                   // 雪的密度
        world.snowFallSpeed = 0.3;                                 // 下落速度
        world.snowSizeLo = 0.3;                                    // 最小直径
        world.snowSizeHi = 0.6;                                   // 最大直径
        world.snowColor = new Box3RGBAColor(1, 1, 1, 1);   // 颜色
        world.snowTexture = 'snow/snow.part';                    // 纹理
        await sleep(time)
    }
})();


回复

上一页1 页 / 共 1下一页
南方一霸南方一霸

谢谢

点赞0


评论


TobylaiTobylai

仅用于256x喵x256地形!

要用于128x128x128地形请自行改动

点赞0


评论


­­­­­­­­­­­­­­

好棒棒啊

点赞0


评论


TobylaiTobylai

aaaaaaaaaaaaa|zzzzzzzzzzzzzz

点赞0


评论


阳光的流熔怪Uyt5阳光的流熔怪Uyt5

nb!

点赞0


评论


指令者指令者

https://box3.cod喵/e/5fc6cb82b75b3bebada7帮忙云数据

点赞0


评论


IaeaIaea

666

点赞0


评论


Vicent轩Vicent轩

其实简单点来说,就是把世界属性设置为当前季节对应的季节特点

然后方块换一下,比如说秋冬换季,水(water)变成冰(ice)

点赞0


评论


夜影行者夜影行者

收藏

点赞0


评论