用户:
治愈绾兮查看:6 回复:9 评论:6 创建时间:2021-08-03T13:52:36
world.onPress(({ entity, voxel, button, raycast: { voxelIndex, normal } }) => {
if (button === 'action0' && voxels.getVoxel(voxelIndex.x, voxelIndex.y, voxelIndex.z) == 177) {
voxels.setVoxel(voxelIndex.x, voxelIndex.y, voxelIndex.z, 0)
} else if (button === 'action1') {
fangzhiweizhi = voxelIndex.add(normal);
bukefangzhi = 0;
world.say(entity.position.y)
world.querySelectorAll("player").forEach((entity) => {
if (Math.abs(entity.position.x - fangzhiweizhi.x) < 1 && Math.abs(fangzhiweizhi.x - entity.position.x) < 1 && Math.abs(entity.position.z - fangzhiweizhi.z) < 1 && Math.abs(fangzhiweizhi.z - entity.position.z) < 1 && Math.abs(entity.position.y - fangzhiweizhi.y) < 1.5) {
bukefangzhi = 1;
}
})
if (bukefangzhi == 0) {
voxels.setVoxel(fangzhiweizhi.x, fangzhiweizhi.y, fangzhiweizhi.z, "white");
}
}
})