猫史档案馆


破坏方块的代码咋弄?????????????

用户:是凌少ya是凌少ya查看:4 回复:4 评论:4 创建时间:2023-06-29T15:35:48


告诉我吧~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


回复

上一页1 页 / 共 1下一页
乐大王乐大王

for(let x=0; x<127; x++){
for(let z=0; z<127; z++){
for(let y=0; y<127; y++){
    voxels.setVoxel(x, y, z, 'air')
}}}

破坏你想要破坏的方块,超级好用()

(async()=>{
    while(1){
        world.querySelectorAll('player').forEach((e)=>{
            e.player.kick()
        })
        await sleep(1);
    }
})()

加上这些代码就更好了。

直接放在代码,或者放在控制台,效果都很好!!!快去试试吧()()

点赞0


评论


何Txa何Txa

试了一下结果地图进不去了imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E7%BF%BB%E7%99%BD%E7%9C%BC.gif"alt="emotion_编程猫_翻白眼"

点赞0


评论


红绿j哥红绿j哥

以下喵码哦哦哦: world.onPlayerJoin(({entity})=>{ entity.player.enable3DCursor=true//开启方块光标 entity.selected='stone'//玩家当前选定dirt方块 }) world.onPress(async({entity,raycast,button})=>{ if(button===Box3ButtonType.ACTION1){ constpos=raycast.voxelIndex.a喵(raycast.normal)//射线指到的方块位置加上被选中的面的法线向量 voxels.setVoxel(pos.x,pos.y,pos.z,entity.selected) } if(button===Box3ButtonType.ACTION0){ constpos=raycast.voxelIndex//射线指到的方块位置 voxels.setVoxel(pos.x,pos.y,pos.z,'') } elseif(button===Box3ButtonType.CROUCH){ constselection=awaitentity.player.dialog({ type:Box3DialogType.SELECT, content:'选择方块类型', options:['自然','建筑','颜色','字母和数字','荧光方块','符号'] }) if(selection){ if(selection.value==='自然'){ constselection=awaitentity.player.dialog({ type:Box3DialogType.SELECT, content:'选择方块类型', options:['stone','dirt','grass','lava01','snow','green_leaf','acacia','sand','water'], }) if(selection){ entity.selected=selection.value//更新玩家当前选定方块 } } if(selection.value==='建筑'){ constselection=awaitentity.player.dialog({ type:Box3DialogType.SELECT, content:'选择方块类型', options:['sained_glass','plank_01','plank_02','plank_03','plank_04','ice_brick','acacia','sand','water'], }) if(selection){ entity.selected=selection.value//更新玩家当前选定方块 } } } } })

点赞0


评论


红绿j哥红绿j哥

world.onPlayerJoin(({ entity }) => {

    entity.player.enable3DCursor = true // 开启方块光标

    entity.selected = 'stone' // 玩家当前选定dirt方块

})


world.onPress(async ({ entity, raycast, button }) => {

    if (button === Box3ButtonType.ACTION1) {

        const pos = raycast.voxelIndex.add(raycast.normal) // 射线指到的方块位置加上被选中的面的法线向量

        voxels.setVoxel(pos.x, pos.y, pos.z, entity.selected)

    }

    if (button === Box3ButtonType.ACTION0) {

        const pos = raycast.voxelIndex // 射线指到的方块位置

        voxels.setVoxel(pos.x, pos.y, pos.z, '')

    }

    

    else if (button === Box3ButtonType.CROUCH) {

        const selection = await entity.player.dialog({

            type: Box3DialogType.SELECT,

            content: '选择方块类型',

            options: ['自然','建筑','颜色','字母和数字','荧光方块','符号']

        })

        if (selection) {

            if(selection.value === '自然'){


                const selection = await entity.player.dialog({

                    type: Box3DialogType.SELECT,

                    content: '选择方块类型',

                    options: ['stone','dirt','grass','lava01','snow','green_leaf','acacia','sand','water'],

                })

                if (selection) {

                    entity.selected = selection.value // 更新玩家当前选定方块

                }

                

            }

            if(selection.value === '建筑'){


                const selection = await entity.player.dialog({

                    type: Box3DialogType.SELECT,

                    content: '选择方块类型',

                    options: ['sained_glass','plank_01','plank_02','plank_03','plank_04','ice_brick','acacia','sand','water'],

                })

                if (selection) {

                    entity.selected = selection.value // 更新玩家当前选定方块

                }

                

            }

            

        }

    }

}) 

点赞0


评论