LogBlockHeatmapperRegionTrimmer.java 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. /*
  2. * Copyright (C) 2015 iZc
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. package de.nplusc.izc.logblockheatmapper;
  18. import ar.com.hjg.pngj.ImageInfo;
  19. import ar.com.hjg.pngj.ImageLineHelper;
  20. import ar.com.hjg.pngj.ImageLineInt;
  21. import ar.com.hjg.pngj.PngWriter;
  22. import ar.com.hjg.pngj.chunks.PngChunkTextVar;
  23. import java.awt.Color;
  24. import java.awt.GradientPaint;
  25. import java.awt.Graphics2D;
  26. import java.awt.image.BufferedImage;
  27. import java.io.*;
  28. import java.util.*;
  29. import javax.imageio.ImageIO;
  30. /**
  31. *
  32. * @author iZc <nplusc.de>
  33. */
  34. enum BlockState
  35. {
  36. NONE,
  37. BUFFER,
  38. ACTIVITY,
  39. BUFFER_PURGED,
  40. ACTIVITY_PURGED,
  41. WORKBENCH_FORCED,
  42. WORKBENCH_FORCED_BUFFER,
  43. }
  44. enum RegionState
  45. {
  46. REMOVE,
  47. CORE,
  48. KEEP,
  49. WATERIZE,
  50. DROPPED
  51. }
  52. class CoordHolder
  53. {
  54. public final int x;
  55. public final int y;
  56. public final int z;
  57. public final String blocktype;
  58. CoordHolder(int x, int y, int z, String blocktype) {
  59. this.x = x;
  60. this.y = y;
  61. this.z = z;
  62. this.blocktype = blocktype;
  63. }
  64. @Override
  65. public boolean equals(Object o) {
  66. if (this == o) return true;
  67. if (o == null || getClass() != o.getClass()) return false;
  68. CoordHolder that = (CoordHolder) o;
  69. return x == that.x &&
  70. y == that.y &&
  71. z == that.z &&
  72. Objects.equals(blocktype, that.blocktype);
  73. }
  74. @Override
  75. public int hashCode() {
  76. return Objects.hash(x, y, z, blocktype);
  77. }
  78. }
  79. public class LogBlockHeatmapperRegionTrimmer
  80. {
  81. static final int treshold = 100;
  82. static final int buffer = 30;
  83. static final int workbenchbuffer = 50;
  84. static final List<String> blocktypes = Arrays.asList(
  85. "minecraft:crafting_table",
  86. "minecraft:furnace",
  87. "minecraft:barrel",
  88. "minecraft:ender_chest",
  89. "minecraft:shulker_box",
  90. "minecraft:black_shulker_box",
  91. "minecraft:gray_shulker_box",
  92. "minecraft:white_shulker_box",
  93. "minecraft:light_gray_shulker_box",
  94. "minecraft:red_shulker_box",
  95. "minecraft:pink_shulker_box",
  96. "minecraft:purple_shulker_box",
  97. "minecraft:magenta_shulker_box",
  98. "minecraft:orange_shulker_box",
  99. "minecraft:brown_shulker_box",
  100. "minecraft:cyan_shulker_box",
  101. "minecraft:light_blue_shulker_box",
  102. "minecraft:yellow_shulker_box",
  103. "minecraft:lime_shulker_box",
  104. "minecraft:green_shulker_box",
  105. "minecraft:blue_shulker_box",
  106. "minecraft:hopper",
  107. "minecraft:chest"
  108. );
  109. //x y
  110. static final Color removeA = new Color(255, 127, 39);
  111. static final Color removeB = new Color(251, 100, 0);
  112. static final Color removeA_Dropped = new Color(255, 13, 90);
  113. static final Color removeB_Dropped = new Color(255, 13, 120);
  114. static final Color keepA = new Color(128, 255, 0);
  115. static final Color keepB = new Color(0, 255, 64);
  116. static final Color waterA = new Color(0, 128, 192);
  117. static final Color waterB = new Color(0, 128, 255);
  118. static final Color keepCoreA = new Color(0, 64, 0);
  119. static final Color keepCoreB = new Color(0, 106, 0);
  120. static final Color activity = new Color(87, 87, 87);
  121. static final Color activityBuffer = new Color(157, 157, 157);
  122. static final Color activityPurged = new Color(230, 230, 230);
  123. static final Color activityBufferPurged = new Color(255, 255, 255);
  124. static final Color workbench_keep = new Color(255, 255, 0);
  125. static final Color workbench_keep_buffer = new Color(128, 128, 0);
  126. static final Color coreEdge = new Color(255, 0, 0);
  127. static int[ ][ ] dataField ;
  128. static Map<String,Integer> keepRegionsIn = new TreeMap<>();
  129. static Map<String,RegionState> keepRegions = new TreeMap<>();
  130. static Map<CoordHolder,Integer> workbenchCalculations = new HashMap<>();
  131. static int radius=0;
  132. static int coreRadius=0;
  133. static int regionRedius = 0;
  134. static int fuckyou = 0;
  135. private static void setRegion(int x,int y, int s)
  136. {
  137. int rx = (int)Math.floor((x)/512.0f);
  138. int ry = (int)Math.floor((y)/512.0f);
  139. keepRegionsIn.putIfAbsent(("r."+rx+"."+ry+".mca"),0);
  140. keepRegionsIn.put(("r."+rx+"."+ry+".mca"),keepRegionsIn.get(("r."+rx+"."+ry+".mca"))+s);
  141. }
  142. private static void setRegionFinal(int x,int y, RegionState s)
  143. {
  144. int rx = (int)Math.floor((x)/512.0f);
  145. int ry = (int)Math.floor((y)/512.0f);
  146. keepRegions.put(("r."+rx+"."+ry+".mca"),s);
  147. }
  148. /**
  149. * @param args the command line arguments
  150. * @throws java.lang.Exception
  151. */
  152. public static void main(String[] args)throws Exception
  153. {
  154. if(args.length<3)
  155. {
  156. throw new UnsupportedOperationException("not enough parameters");
  157. }
  158. /*
  159. if(args.length>2)
  160. {
  161. targetBlockID = Integer.valueOf(args[2]);
  162. if(args.length>3)
  163. {
  164. removalsOnly = Boolean.valueOf(args[3]);
  165. }
  166. }*/
  167. radius = Integer.valueOf(args[1]);
  168. dataField = new int[radius*2][radius*2];
  169. int regionBase = radius/512;
  170. int regionRemainder = radius%512;
  171. if(regionRemainder>0)
  172. {
  173. regionBase++;
  174. }
  175. coreRadius = Integer.valueOf(args[2]);
  176. int coreBase = coreRadius/512;
  177. int coreRemainder = coreRadius%512;
  178. if(coreRemainder>0)
  179. {
  180. coreBase++;
  181. }
  182. regionRedius = regionBase;
  183. for(int i=0;i<coreRadius;i++)
  184. {
  185. for(int j=0;j<coreRadius;j++)
  186. {
  187. setRegionFinal(i, j, RegionState.CORE);
  188. setRegionFinal(i, -j, RegionState.CORE);
  189. setRegionFinal(-i, j, RegionState.CORE);
  190. setRegionFinal(-i, -j, RegionState.CORE);
  191. }
  192. System.out.print(i+" Preparation Core Lines\r");
  193. }
  194. for(int i=0;i<dataField.length;i++)
  195. {
  196. for(int j=0;j<dataField.length;j++)
  197. {
  198. dataField[i][j]=BlockState.NONE.ordinal();
  199. }
  200. System.out.print(i+" Preparation Data Lines\r");
  201. }
  202. BufferedReader br = new BufferedReader(new FileReader(args[0]));
  203. PrintStream lmaa = new PrintStream(new FileOutputStream("fuckyouandeatshit.txt"));
  204. br.lines().forEach((xx)->
  205. {
  206. //4 als 5 und nen bisschen arithmetik gibt seitwärts-schnittansicht
  207. //id_0 oldblox_1 newblox_2 newdv_3 X_4 height_5 y_6
  208. //10 5 0 0 -1373 27 4008
  209. xx = xx.replace("\"", "");
  210. xx = xx.replace(",", "\t");
  211. String[] xes = xx.split("\\t");
  212. int l = Integer.parseInt(xes[0]);
  213. boolean register=false;
  214. String to = xes[2].intern();
  215. String from = xes[3].intern(); //richtigrum, verfickt und zugenäht
  216. int x= Integer.parseInt(xes[4])+radius,y= Integer.parseInt(xes[6])+radius;
  217. int z = Integer.parseInt(xes[5]);
  218. if(blocktypes.contains(from)||blocktypes.contains(to))
  219. {
  220. if(from!=to) // yes, this works since i interned the strings beforehand :P
  221. {
  222. fuckyou++;
  223. lmaa.println(xx);
  224. if(blocktypes.contains(from))
  225. {
  226. CoordHolder location = new CoordHolder(x,y,z,from);
  227. if(!workbenchCalculations.containsKey(location))
  228. {
  229. workbenchCalculations.put(location,-1);
  230. }
  231. else
  232. {
  233. workbenchCalculations.put(location,workbenchCalculations.get(location)-1);
  234. }
  235. }
  236. if(blocktypes.contains(to))
  237. {
  238. CoordHolder location = new CoordHolder(x,y,z,to);
  239. if(!workbenchCalculations.containsKey(location))
  240. {
  241. workbenchCalculations.put(location,1);
  242. }
  243. else
  244. {
  245. workbenchCalculations.put(location,workbenchCalculations.get(location)+1);
  246. }
  247. }
  248. }
  249. else
  250. {
  251. //System.out.print("Skipped Transaction due to from and to being equal");
  252. }
  253. }
  254. else
  255. {
  256. //-y=up
  257. if(x<radius*2&&x>=0&&y<radius*2&&y>=0)
  258. {
  259. for(int i=-buffer;i<buffer+1;i++)
  260. {
  261. if((x+i)<(radius*2)&&(x+i)>0)
  262. {
  263. for(int j=-buffer;j<+1;j++)
  264. {
  265. if((y+j)<(radius*2)&&(y+j)>0)
  266. {
  267. //only switching NONE to BUFFER
  268. if(dataField[y+j][x+i]==BlockState.NONE.ordinal())
  269. {
  270. dataField[y+j][x+i]=BlockState.BUFFER_PURGED.ordinal();
  271. // setRegion(x+i-radius, y+i-radius, 1);
  272. // propagating buffer markers in second pass... buffer rendering handled in same pass
  273. }
  274. }
  275. }
  276. }
  277. }
  278. dataField[y][x]=BlockState.ACTIVITY.ordinal();
  279. setRegion(x-radius, y-radius, 1);
  280. }
  281. }
  282. if(l%10000==0)
  283. {
  284. System.out.print(l+"changes so far\r");
  285. }
  286. });
  287. System.out.println("\n");
  288. System.out.println(fuckyou);
  289. System.out.println("\nDatabase crunched to 100%\n");
  290. System.out.print("\nCalculating Workbenches("+workbenchCalculations.size()+") \n");
  291. lmaa.close();
  292. workbenchCalculations.forEach((c,i) ->
  293. {
  294. if(i>0)
  295. {
  296. System.out.println("workbench at"+c.x+"|"+c.y);
  297. if(c.x<0||c.y<0||c.x>=dataField.length||c.y>=dataField.length)
  298. {
  299. return;
  300. }
  301. System.out.println("workbench kept at"+c.x+"|"+c.y+"| cnt = "+i);
  302. setRegion(c.x-radius,c.y-radius,3*treshold); // force keep
  303. dataField[c.y][c.x]=BlockState.WORKBENCH_FORCED.ordinal();
  304. }
  305. if(i<-1)
  306. {
  307. System.out.println("DAFUQ at"+c.x+"|"+c.y+"| as "+i);
  308. }
  309. });
  310. System.out.println("\nWorkbenches calculated\n");
  311. for(int i=-regionBase;i<=regionBase;i++)
  312. {
  313. for(int j=-regionBase;j<=regionBase;j++)
  314. {
  315. int current=keepRegionsIn.getOrDefault(("r."+(i)+"."+(j)+".mca"),-1);
  316. System.out.println("Processing r."+(i)+"."+(j)+".mca; ("+i+"/"+regionBase+"|"+j+"/"+regionBase);
  317. if(current<treshold)
  318. {
  319. RegionState old = keepRegions.getOrDefault(("r."+(i)+"."+(j)+".mca"),RegionState.REMOVE);
  320. System.out.println("Processing r."+(i)+"."+(j)+".mca; Is: "+old);
  321. if(((old)!=RegionState.CORE)&&(old!=RegionState.KEEP))
  322. {
  323. System.out.println("Dropping r."+(i)+"."+(j)+".mca; Is: "+old);
  324. keepRegions.put(("r."+(i)+"."+(j)+".mca"),RegionState.REMOVE);
  325. }
  326. if(current>0) // no activity inside so no need to search for activity spots
  327. {
  328. //highlighgt actively dropped ones differently...
  329. if(((old)!=RegionState.CORE)&&(old!=RegionState.KEEP))
  330. {
  331. System.out.println("Dropping r."+(i)+"."+(j)+".mca; Is: "+old);
  332. keepRegions.put(("r."+(i)+"."+(j)+".mca"),RegionState.DROPPED);
  333. }
  334. for(int pi = 0;pi<512;pi++)
  335. {
  336. for(int pj = 0;pj<512;pj++)
  337. {
  338. int kx = i*512+pi+radius+1;
  339. int ky = j*512+pj+radius+1;
  340. if(kx<0||ky<0||kx>=dataField.length||ky>=dataField.length)
  341. {
  342. continue; // coordinate not valid. can't crunch
  343. }
  344. BlockState k = BlockState.values()[dataField[ky][kx]];
  345. if(k==BlockState.ACTIVITY)
  346. {
  347. dataField[ky][kx]=BlockState.ACTIVITY_PURGED.ordinal();
  348. }
  349. }
  350. }
  351. }
  352. }
  353. else
  354. {
  355. keepRegions.put(("r."+(i)+"."+(j)+".mca"),RegionState.KEEP);
  356. for(int pi = 0;pi<512;pi++)
  357. {
  358. for(int pj = 0;pj<512;pj++)
  359. {
  360. int kx = i*512+pi+radius;
  361. int ky = j*512+pj+radius;
  362. if(kx<0||ky<0||kx>=dataField.length||ky>=dataField.length)
  363. {
  364. continue; // coordinate not valid. can't crunch
  365. }
  366. BlockState k = BlockState.values()[dataField[ky][kx]];
  367. if(k==BlockState.ACTIVITY)
  368. {
  369. if(pi<buffer&&pj<buffer)
  370. {
  371. keepRegions.put(("r."+(i-1)+"."+(j-1)+".mca"),RegionState.KEEP);
  372. }
  373. if(pi<buffer)
  374. {
  375. keepRegions.put(("r."+(i-1)+"."+(j)+".mca"),RegionState.KEEP);
  376. }
  377. if (pj<buffer)
  378. {
  379. keepRegions.put(("r."+(i)+"."+(j-1)+".mca"),RegionState.KEEP);
  380. }
  381. int max = 512-(buffer+1);
  382. if(pi>max&&pj>max)
  383. {
  384. keepRegions.put(("r."+(i+1)+"."+(j+1)+".mca"),RegionState.KEEP);
  385. }
  386. if(pi>max)
  387. {
  388. keepRegions.put(("r."+(i+1)+"."+(j)+".mca"),RegionState.KEEP);
  389. }
  390. if (pj>max)
  391. {
  392. keepRegions.put(("r."+(i)+"."+(j+1)+".mca"),RegionState.KEEP);
  393. }
  394. //propagating buffers
  395. int kxmin = Math.max(0,kx-(buffer+1));
  396. int kymin = Math.max(0,ky-(buffer+1));
  397. int kxmax = Math.min(dataField.length,kx+buffer+1);
  398. int kymax = Math.min(dataField.length,ky+buffer+1);
  399. for(int ki = kxmin;ki<kxmax;ki++)
  400. {
  401. for(int kj = kymin;kj<kymax;kj++)
  402. {
  403. int ov = dataField[kj][ki];
  404. if(ov==BlockState.NONE.ordinal()||ov==BlockState.BUFFER_PURGED.ordinal())
  405. {
  406. dataField[kj][ki] = BlockState.BUFFER.ordinal();
  407. }
  408. }
  409. }
  410. }
  411. if(k==BlockState.WORKBENCH_FORCED)
  412. {
  413. if(pi<workbenchbuffer&&pj<workbenchbuffer)
  414. {
  415. keepRegions.put(("r."+(i-1)+"."+(j-1)+".mca"),RegionState.KEEP);
  416. }
  417. if(pi<workbenchbuffer+1)
  418. {
  419. keepRegions.put(("r."+(i-1)+"."+(j)+".mca"),RegionState.KEEP);
  420. }
  421. if (pj<workbenchbuffer+1)
  422. {
  423. keepRegions.put(("r."+(i)+"."+(j-1)+".mca"),RegionState.KEEP);
  424. }
  425. int max = 512-(workbenchbuffer+1);
  426. if(pi>max&&pj>max)
  427. {
  428. keepRegions.put(("r."+(i+1)+"."+(j+1)+".mca"),RegionState.KEEP);
  429. }
  430. if(pi>max)
  431. {
  432. keepRegions.put(("r."+(i+1)+"."+(j)+".mca"),RegionState.KEEP);
  433. }
  434. if (pj>max)
  435. {
  436. keepRegions.put(("r."+(i)+"."+(j+1)+".mca"),RegionState.KEEP);
  437. }
  438. //propagating buffers
  439. int kxmin = Math.max(0,kx-(workbenchbuffer+1));
  440. int kymin = Math.max(0,ky-(workbenchbuffer+1));
  441. int kxmax = Math.min(dataField.length,kx+(workbenchbuffer+1));
  442. int kymax = Math.min(dataField.length,ky+(workbenchbuffer+1));
  443. for(int ki = kxmin;ki<kxmax;ki++)
  444. {
  445. for(int kj = kymin;kj<kymax;kj++)
  446. {
  447. int ov = dataField[kj][ki];
  448. if(ov==BlockState.NONE.ordinal()||ov==BlockState.BUFFER_PURGED.ordinal()||ov==BlockState.BUFFER.ordinal())
  449. {
  450. dataField[kj][ki] = BlockState.WORKBENCH_FORCED_BUFFER.ordinal();
  451. }
  452. }
  453. }
  454. }
  455. }
  456. }
  457. }
  458. /*for(int k=0;k<8;k++)
  459. {
  460. if((neighbors[k]==RegionState.KEEP||neighbors[k]==RegionState.CORE)&&((current!=RegionState.KEEP)&&(current!=RegionState.CORE)))
  461. {
  462. keepRegions.put(("r."+i+"."+j+".mca"),RegionState.WATERIZE);
  463. }
  464. }*/
  465. }
  466. }
  467. //max=Math.min(max, 1000);
  468. //int steps=max/256;
  469. //BufferedWriter bw = new BufferedWriter(new FileWriter(new File("D:/emc2/arca_slash/database/crunched.pgm")));
  470. //bw.write("P6");
  471. //bw.newLine();
  472. //bw.write("20000 20000");
  473. //bw.newLine();
  474. //bw.write("255");
  475. //bw.newLine();
  476. //SELECT id, replaced, `type`, `data`, x, y, z
  477. //FROM `lb-surv`
  478. //INTO OUTFILE 'D:/emc2/arca_slash/database/lbcrunchsurvival.csv';
  479. ImageInfo imi = new ImageInfo(dataField.length, dataField.length, 8, false); // 8 bits per channel, no alpha
  480. // open image for writing to a output stream
  481. PngWriter png = new PngWriter(new FileOutputStream("map_rg.png"), imi);
  482. // add some optional metadata (chunks)
  483. png.getMetadata().setDpi(100.0);
  484. png.getMetadata().setTimeNow(0); // 0 seconds fron now = now
  485. //0-49 1 stufe=1 farbschritt 50 -1049: 10 stufen pro farbschritt: rest gleichmäßig aufgeteilt bis maximum
  486. for (int i = 0; i < dataField.length; i++) {
  487. int[] is = dataField[i];
  488. ImageLineInt iline = new ImageLineInt(imi);
  489. for (int j = 0; j < is.length; j++) {
  490. int color = Color.white.getRGB();
  491. BlockState k = BlockState.values()[is[j]];
  492. switch (k) {
  493. case NONE:
  494. int rx = (int) Math.floor((j - radius) / 512.0);
  495. int ry = (int) Math.floor((i - radius) / 512.0);
  496. if ((i == radius + coreRadius || j == radius - coreRadius) ||
  497. (j == radius + coreRadius || j == radius - coreRadius)) {
  498. color = coreEdge.getRGB();
  499. } else {
  500. boolean grid = (rx + ry) % 2 == 0;
  501. RegionState s = keepRegions.get(("r." + rx + "." + ry + ".mca"));
  502. if (s == null) {
  503. s = RegionState.REMOVE;
  504. }
  505. switch (s) {
  506. case REMOVE:
  507. color = (grid ? removeA : removeB).getRGB();
  508. break;
  509. case CORE:
  510. color = (grid ? keepCoreA : keepCoreB).getRGB();
  511. break;
  512. case KEEP:
  513. color = (grid ? keepA : keepB).getRGB();
  514. break;
  515. case WATERIZE:
  516. color = (grid ? waterA : waterB).getRGB();
  517. break;
  518. case DROPPED:
  519. color = (grid ? removeA_Dropped : removeB_Dropped).getRGB();
  520. break;
  521. }
  522. }
  523. break;
  524. case BUFFER:
  525. color = activityBuffer.getRGB();
  526. break;
  527. case ACTIVITY:
  528. color = activity.getRGB();
  529. break;
  530. case BUFFER_PURGED:
  531. color = activityBufferPurged.getRGB();
  532. break;
  533. case ACTIVITY_PURGED:
  534. color = activityPurged.getRGB();
  535. break;
  536. case WORKBENCH_FORCED:
  537. color = workbench_keep.getRGB();
  538. break;
  539. case WORKBENCH_FORCED_BUFFER:
  540. color = workbench_keep_buffer.getRGB();
  541. break;
  542. }
  543. ImageLineHelper.setPixelRGB8(iline, j, color);
  544. }
  545. png.writeRow(iline);
  546. System.out.print(i + "lines rasterized\r");
  547. }
  548. png.end();
  549. System.out.println();
  550. PrintStream fileActions;
  551. try {
  552. fileActions = new PrintStream(new FileOutputStream("mergeMap.sh"));
  553. fileActions.println("mkdir oldChunks");
  554. System.out.println("mkdir oldChunks");
  555. fileActions.println("mkdir oldChunksWaterize");
  556. System.out.println("mkdir oldChunksWaterize");
  557. keepRegions.forEach((k,v)->
  558. {
  559. switch(v)
  560. {
  561. case REMOVE:
  562. case DROPPED:
  563. fileActions.println("mv "+k+" oldChunks/");
  564. System.out.println("mv "+k+" oldChunks/");
  565. break;
  566. case CORE:
  567. fileActions.println("echo "+k+" is keepCore");
  568. System.out.println("echo "+k+" is keepCore");
  569. break;
  570. case KEEP:
  571. fileActions.println("echo "+k+" is keep");
  572. System.out.println("echo "+k+" is keep");
  573. break;
  574. case WATERIZE:
  575. fileActions.println("mv "+k+" oldChunksWaterize/");
  576. System.out.println("mv "+k+" oldChunksWaterize/");
  577. fileActions.println("mv waterize/"+k+" ./");
  578. System.out.println("mv waterize/"+k+" ./");
  579. break;
  580. }
  581. });
  582. fileActions.close();
  583. } catch (FileNotFoundException e) {
  584. e.printStackTrace();
  585. }
  586. }
  587. }
  588. //use mcserver;
  589. //mysql> SELECT id,replaced,type,data,x,y,z from `lb-surv` into outfile D:\\emc2\\arca_slash\\heatmap.tsv FIELDS TERMINATED BY `\t` LINES TERMINATED BY `\n`
  590. /*
  591. SELECT blocks.id, blocks.id, blocks.type, blocks.replaced, blocks.x,blocks.y, blocks.z FROM `lb-players` as player, `lb-surv-blocks` as blocks
  592. where player.playerid = blocks.playerid
  593. AND player.UUID NOT LIKE 'l%'
  594. INTO OUTFILE 'C:/lmaa/crunchme/survival2-oct-novirt.csv'
  595. ;
  596. */
  597. /*
  598. SELECT blocks.id, blocks.id, materials.name, materials2.name, blocks.x,blocks.y, blocks.z FROM `lb-players` as player, `lb-surv-blocks` as blocks, `lb-materials` as materials, `lb-materials` as materials2
  599. where player.playerid = blocks.playerid
  600. AND player.UUID NOT LIKE 'l%'
  601. and blocks.type = materials.id
  602. and blocks.replaced = materials2.id
  603. INTO OUTFILE '/tmp/crunchy.csv';
  604. * */