WIP minetest <-> laby import/export

- currently possible to export a laby into minetest
- start of a lua content parser to import .we into lab
This commit is contained in:
philippe lhardy
2020-11-03 23:21:29 +01:00
parent 41067707bc
commit 9355fd8b6d
11 changed files with 424 additions and 10 deletions

View File

@@ -0,0 +1,24 @@
package org.artisanlogiciel.games.minetest;
public class Material {
public static final String GRASS_MATERIAL = "default:dirt_with_grass";
public static Material DEFAULT = new Material(GRASS_MATERIAL);
private String name;
public Material(String name) {
this.name = name;
}
public static Material getMaterialByName(String name)
{
return DEFAULT;
}
@Override
public String toString() {
return "name";
}
}

View File

@@ -4,15 +4,22 @@ public class Node {
int x;
int y;
int z;
String material;
Material material;
public Node(int x, int y, int z, String material) {
public Node(int x, int y, int z, Material material) {
this.x = x;
this.y = y;
this.z = z;
this.material = material;
}
public Node(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
this.material = Material.DEFAULT;
}
public int getX() {
return x;
}
@@ -25,7 +32,7 @@ public class Node {
return z;
}
public String getMaterial() {
public Material getMaterial() {
return material;
}
}

View File

@@ -51,7 +51,7 @@ public class WorlEditGenerator
addIntMember("x", node.getX() - refNode.getX());
addIntMember("y", node.getY() - refNode.getY());
addIntMember("z", node.getZ() - refNode.getZ());
addStringMember("name",node.getMaterial());
addStringMember("name",node.getMaterial().toString() );
luaNode.append("}");
start=false;
}