private void LoadModel(string file) { viewer.Clear(); curPath = file; BlockData.Model model = ModelSerializer.LoadModel(file); VecInt3 offset = new VecInt3(viewer.GetPivot().x - model.pivotX, viewer.GetPivot().y - model.pivotY, viewer.GetPivot().z - model.pivotZ); int index = 0; for (int i = 0; i < model.blocks.Count; i++) { short blockType = (short)model.blocks[i].type; for (int j = 0; j < model.blocks[i].lenght; j++) { int y = index % model.sizeY; int x = (index / model.sizeY) % model.sizeX; int z = index / (model.sizeX * model.sizeY); viewer.blockManager.setBlock(x + offset.x, y + offset.y, z + offset.z, blockType); index++; } } viewer.SetDirty(); commandManager.Clear(); }