猫史档案馆


一个大屑的第一个速建代码

用户:AokenAoken查看:0 回复:2 评论:0 创建时间:2023-05-14T21:35:19


大佬勿喷

Wall=(height,voxel,top_voxel)=>{
    height+=9;
    /* 制作墙体 */
    for(let x=127;x>-1;x--){
        for(let y=8;y<height;y++){
            voxels.setVoxel(x,y,126,voxel);
        }
    };
    for(let y=8;y<height;y++){
        for(let z=127;z>-1;z--){
            voxels.setVoxel(126,y,z,voxel);
        }
    };
    for(let x=127;x>-1;x--){
        for(let y=8;y<height;y++){ 
            voxels.setVoxel(x,y,0,voxel);
        }
    };
    for(let y=8;y<height;y++){
        for(let z=127;z>-1;z--){
            voxels.setVoxel(0,y,z,voxel);
        }
    };
    /* 制作顶 */
    top_height = height++
    for(let x=0;x<127;x++){
        for(let z=0;z<127;z++){
            voxels.setVoxel(x,top_height,z,top_voxel);
        }
    }
}

Wall(/*墙壁高度*/,/*墙壁方块*/,/*顶的方块*/);// 制作墙壁

欢迎大家提建议


回复

上一页1 页 / 共 1下一页
AokenAoken

V 0.0.2版本:

修剪了点

变得更简单,更多功能

SetVoxel_xy=(x_pos,x_,y_pos,y_,z_pos,voxel)=>{
    for(let x=x_pos;x>x_;x--){for(let y=y_pos;y<y_;y++){voxels.setVoxel(x,y,z_pos,voxel);}};
}
SetVoxel_yz=(y_pos,y_,z_pos,z_,x_pos,voxel)=>{
    for(y=y_pos;y<y_;y++){for(let z=z_pos;z>z_;z--){voxels.setVoxel(x_pos,y,z,voxel);}};
}
SetTB_xz=(x_pos,x_,z_pos,z_,y_pos,voxel)=>{
    for(x=x_pos;x<x_;x++){for(z=z_pos;z<z_;z++){voxels.setVoxel(x,y_pos,z,voxel);}};
}

Wall=(start_y=9,end_y=20,wall_voxel='brick_red',top_voxel='water',botton_voxel='stone')=>{
    /* 制作墙体 */
    SetVoxel_xy(127,-1,start_y,end_y,126,wall_voxel);
    SetVoxel_yz(start_y,end_y,127,-1,126,wall_voxel);
    SetVoxel_xy(127,-1,start_y,end_y,0,wall_voxel);
    SetVoxel_yz(start_y,end_y,127,-1,0,wall_voxel)
    /* 制作顶 */
    top_y = end_y++ // 设置顶的yy坐标
    SetTB_xz(0,127,0,127,top_y,top_voxel)
    /* 制作底 */
    botton_y = start_y // 设置底的yy坐标
    SetTB_xz(0,127,0,127,botton_y,botton_voxel)
}
Wall();// 制作墙壁

点赞0


评论


无尽之海无尽之海

啊啊啊啊羽岚我想你了

点赞1


评论