forked from mmccoo/minecraft_mmccoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
type_mst.cpp
61 lines (43 loc) · 1.52 KB
/
type_mst.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include <map>
#include <MinecraftWorld.h>
#include <parse_bedrock.h>
#include <compute_mst.h>
int
main(int argc,char* argv[])
{
MinecraftWorld world;
//std::string dbpath = "/bubba/electronicsDS/minecraft/sampledata/2019.11.26.04.00.53/worlds/Bedrock level/db";
std::string dbpath = "/bubba/electronicsDS/minecraft/gfhtx2/gfHTXZk9AQA/db";
parse_bedrock(dbpath, world);
std::map<std::string, std::string> layers = {
{"diamond.vtk", "minecraft:diamond_ore ()"},
{"lapis.vtk", "minecraft:lapis_ore ()"},
{"iron.vtk", "minecraft:iron_ore ()"},
{"redstone.vtk", "minecraft:redstone_ore ()"},
{"spawner.vtk", "minecraft:mob_spawner ()"},
};
for(auto layer : layers) {
int ore_id = BlockType::get_block_type_id_by_name(layer.second);
std::cout << "filtering by " << ore_id << "\n";
std::vector<std::tuple<int, int, int> > ores;
for (auto scix : world.theworld) {
//int chunkx = scix.first;
for (auto sciy : scix.second) {
//int chunky = sciy.first;
for (auto sciz : sciy.second) {
//int chunkz = sciz.first;
auto sc = sciz.second;
for (auto iter=sc->begin(ore_id); iter!=sc->end(); ++iter) {
auto loc = *iter;
ores.push_back({loc.x, loc.y, loc.z});
}
}
}
}
compute_mst(ores, 4, layer.first);
}
}