Implement Prototype creation
Dieser Commit ist enthalten in:
Ursprung
6a625d657d
Commit
0f07baefdd
@ -19,5 +19,93 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.region;
|
package de.steamwar.bausystem.region;
|
||||||
|
|
||||||
|
import yapion.hierarchy.types.YAPIONObject;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class Prototype {
|
public class Prototype {
|
||||||
|
|
||||||
|
private final int sizeX;
|
||||||
|
private final int sizeY;
|
||||||
|
private final int sizeZ;
|
||||||
|
|
||||||
|
private final File schematicFile;
|
||||||
|
|
||||||
|
private final int floorOffset;
|
||||||
|
private final int waterOffset;
|
||||||
|
|
||||||
|
private final SubPrototype testblock;
|
||||||
|
private final SubPrototype build;
|
||||||
|
|
||||||
|
public Prototype(YAPIONObject yapionObject) {
|
||||||
|
sizeX = yapionObject.getPlainValue("sizeX");
|
||||||
|
sizeY = yapionObject.getPlainValue("sizeY");
|
||||||
|
sizeZ = yapionObject.getPlainValue("sizeZ");
|
||||||
|
|
||||||
|
schematicFile = new File(yapionObject.getValue("schematic", String.class).get());
|
||||||
|
|
||||||
|
floorOffset = yapionObject.getPlainValueOrDefault("floorOffset", 0);
|
||||||
|
waterOffset = yapionObject.getPlainValueOrDefault("waterOffset", 0);
|
||||||
|
|
||||||
|
testblock = new SubPrototype(yapionObject.getObject("testblock"));
|
||||||
|
build = new SubPrototype(yapionObject.getObject("build"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SubPrototype {
|
||||||
|
|
||||||
|
private final int offsetX;
|
||||||
|
private final int offsetY;
|
||||||
|
private final int offsetZ;
|
||||||
|
|
||||||
|
private final int sizeX;
|
||||||
|
private final int sizeY;
|
||||||
|
private final int sizeZ;
|
||||||
|
|
||||||
|
private final File schematicFile;
|
||||||
|
|
||||||
|
private final int extensionNegativeX;
|
||||||
|
private final int extensionPositiveX;
|
||||||
|
private final int extensionNegativeY;
|
||||||
|
private final int extensionPositiveY;
|
||||||
|
private final int extensionNegativeZ;
|
||||||
|
private final int extensionPositiveZ;
|
||||||
|
|
||||||
|
private SubPrototype(YAPIONObject yapionObject) {
|
||||||
|
offsetX = yapionObject.getPlainValueOrDefault("offsetX", 0);
|
||||||
|
offsetY = yapionObject.getPlainValueOrDefault("offsetY", 0);
|
||||||
|
offsetZ = yapionObject.getPlainValueOrDefault("offsetZ", 0);
|
||||||
|
|
||||||
|
sizeX = yapionObject.getPlainValue("sizeX");
|
||||||
|
sizeY = yapionObject.getPlainValue("sizeY");
|
||||||
|
sizeZ = yapionObject.getPlainValue("sizeZ");
|
||||||
|
|
||||||
|
schematicFile = new File(yapionObject.getValue("schematic", String.class).get());
|
||||||
|
|
||||||
|
if (yapionObject.hasValue("extensionX", Integer.class)) {
|
||||||
|
extensionNegativeX = yapionObject.getPlainValue("extensionX");
|
||||||
|
extensionPositiveX = yapionObject.getPlainValue("extensionX");
|
||||||
|
} else {
|
||||||
|
extensionNegativeX = yapionObject.getPlainValueOrDefault("extensionNegativeX", 0);
|
||||||
|
extensionPositiveX = yapionObject.getPlainValueOrDefault("extensionPositiveX", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (yapionObject.hasValue("extensionY", Integer.class)) {
|
||||||
|
extensionNegativeY = yapionObject.getPlainValue("extensionY");
|
||||||
|
extensionPositiveY = yapionObject.getPlainValue("extensionY");
|
||||||
|
} else {
|
||||||
|
extensionNegativeY = yapionObject.getPlainValueOrDefault("extensionNegativeY", 0);
|
||||||
|
extensionPositiveY = yapionObject.getPlainValueOrDefault("extensionPositiveY", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (yapionObject.hasValue("extensionZ", Integer.class)) {
|
||||||
|
extensionNegativeZ = yapionObject.getPlainValue("extensionZ");
|
||||||
|
extensionPositiveZ = yapionObject.getPlainValue("extensionZ");
|
||||||
|
} else {
|
||||||
|
extensionNegativeZ = yapionObject.getPlainValueOrDefault("extensionNegativeZ", 0);
|
||||||
|
extensionPositiveZ = yapionObject.getPlainValueOrDefault("extensionPositiveZ", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren