SteamWar/BauSystem2.0
Archiviert
12
0

Add PrototypeLoader

Add RegionLoader
Dieser Commit ist enthalten in:
yoyosource 2021-04-18 15:48:15 +02:00
Ursprung 2bac2b9fb5
Commit 72cfa5682c
4 geänderte Dateien mit 76 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.region;
import lombok.Getter; import lombok.Getter;
import yapion.hierarchy.types.YAPIONObject; import yapion.hierarchy.types.YAPIONObject;
import yapion.hierarchy.types.YAPIONType;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
@ -43,8 +44,8 @@ public class Prototype {
private final int floorOffset; private final int floorOffset;
private final int waterOffset; private final int waterOffset;
private final SubPrototype testblock; private final SubPrototype testblock; // Nullable
private final SubPrototype build; private final SubPrototype build; // Nullable
public Prototype(String name, YAPIONObject yapionObject) { public Prototype(String name, YAPIONObject yapionObject) {
PROTOTYPE_MAP.put(name, this); PROTOTYPE_MAP.put(name, this);
@ -61,10 +62,19 @@ public class Prototype {
floorOffset = yapionObject.getPlainValueOrDefault("floorOffset", 0); floorOffset = yapionObject.getPlainValueOrDefault("floorOffset", 0);
waterOffset = yapionObject.getPlainValueOrDefault("waterOffset", 0); waterOffset = yapionObject.getPlainValueOrDefault("waterOffset", 0);
testblock = new SubPrototype(yapionObject.getObject("testblock")); if (yapionObject.hasValue("testblock", YAPIONType.OBJECT)) {
build = new SubPrototype(yapionObject.getObject("build")); testblock = new SubPrototype(yapionObject.getObject("testblock"));
} else {
testblock = null;
}
if (yapionObject.hasValue("build", YAPIONType.OBJECT)) {
build = new SubPrototype(yapionObject.getObject("build"));
} else {
build = null;
}
} }
@Getter
public static class SubPrototype { public static class SubPrototype {
private final int offsetX; private final int offsetX;
@ -75,7 +85,7 @@ public class Prototype {
private final int sizeY; private final int sizeY;
private final int sizeZ; private final int sizeZ;
private final File schematicFile; private final File schematicFile; // Nullable
private final int extensionNegativeX; private final int extensionNegativeX;
private final int extensionPositiveX; private final int extensionPositiveX;
@ -93,7 +103,11 @@ public class Prototype {
sizeY = yapionObject.getPlainValue("sizeY"); sizeY = yapionObject.getPlainValue("sizeY");
sizeZ = yapionObject.getPlainValue("sizeZ"); sizeZ = yapionObject.getPlainValue("sizeZ");
schematicFile = new File(yapionObject.getValue("schematic", String.class).get()); if (yapionObject.hasValue("schematic", String.class)) {
schematicFile = new File(yapionObject.getValue("schematic", String.class).get());
} else {
schematicFile = null;
}
if (yapionObject.hasValue("extensionX", Integer.class)) { if (yapionObject.hasValue("extensionX", Integer.class)) {
extensionNegativeX = yapionObject.getPlainValue("extensionX"); extensionNegativeX = yapionObject.getPlainValue("extensionX");
@ -121,7 +135,7 @@ public class Prototype {
} }
} }
public Region generateRegion() { public static Region generateRegion(YAPIONObject regionConfig, YAPIONObject regionData) {
return null; return null;
} }

Datei anzeigen

@ -19,8 +19,11 @@
package de.steamwar.bausystem.region; package de.steamwar.bausystem.region;
import lombok.Getter;
import java.util.Set; import java.util.Set;
@Getter
public class Region { public class Region {
private Prototype prototype; private Prototype prototype;

Datei anzeigen

@ -0,0 +1,26 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.region.loader;
import lombok.experimental.UtilityClass;
@UtilityClass
public class PrototypeLoader {
}

Datei anzeigen

@ -0,0 +1,26 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.region.loader;
import lombok.experimental.UtilityClass;
@UtilityClass
public class RegionLoader {
}