用户:Tobylai查看: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)
}
})();