read a .we minetest schema

- use ground has maze walls
This commit is contained in:
philippe lhardy
2020-11-04 22:12:17 +01:00
parent 6402766371
commit 52a2d3f1e3
13 changed files with 430 additions and 16 deletions

View File

@@ -1,5 +1,7 @@
package org.artisanlogiciel.games.minetest;
import java.util.HashMap;
public class Node {
int x;
int y;
@@ -20,6 +22,16 @@ public class Node {
this.material = Material.DEFAULT;
}
public Node(HashMap<String, Object> map)
throws ClassCastException, NullPointerException
{
// FIXME WARNING HACK reverse x and z ...
x = ((Integer) map.get("x")).intValue();
y = ((Integer) map.get("z")).intValue();
z = ((Integer) map.get("y")).intValue();
material = Material.getMaterialByName( (String) map.get("name"));
}
public int getX() {
return x;
}
@@ -35,4 +47,14 @@ public class Node {
public Material getMaterial() {
return material;
}
@Override
public String toString() {
return "Node{" +
"x=" + x +
", y=" + y +
", z=" + z +
", material=" + material +
'}';
}
}