From dce3e96abfca07d267a6fda11af601c1e3d2b488 Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 6 Feb 2021 13:17:42 +0100 Subject: [PATCH 1/5] Add Region.Prototype.extensionFront Add Region.Prototype.extensionBack Add Region.Prototype.extensionUp Add Region.Prototype.extensionSides --- .../src/de/steamwar/bausystem/world/Region.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java index 28552ac..cf7b8ff 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java @@ -240,6 +240,11 @@ public class Region { private final int offsetY; private final int offsetZ; + private final int extensionFront; + private final int extensionBack; + private final int extensionUp; + private final int extensionSides; + private final String schematic; private final boolean rotate; @@ -256,6 +261,10 @@ public class Region { offsetX = config.getInt("offsetX", 0); offsetY = config.getInt("offsetY", 0); offsetZ = config.getInt("offsetZ", 0); + extensionFront = config.getInt("extensionFront", 0); + extensionBack = config.getInt("extensionBack", 0); + extensionUp = config.getInt("extensionUp", 0); + extensionSides = config.getInt("extensionSides", 0); rotate = config.getBoolean("rotate", false); ConfigurationSection testblockSection = config.getConfigurationSection("testblock"); -- 2.39.5 From 863f06673f5476ba43fc78ea66bce72ab7561a3a Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 6 Feb 2021 13:26:52 +0100 Subject: [PATCH 2/5] Add Region.ExtensionDirection Add Region.Prototype.extensionFrontDirection --- .../de/steamwar/bausystem/world/Region.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java index cf7b8ff..45db098 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java @@ -229,6 +229,15 @@ public class Region { } + public enum ExtensionDirection { + + PositiveZ(), + NegativeZ(), + PositiveX(), + NegativeX() + + } + public static class Prototype{ private static final Map prototypes = new HashMap<>(); @@ -240,6 +249,7 @@ public class Region { private final int offsetY; private final int offsetZ; + private final ExtensionDirection extensionFrontDirection; private final int extensionFront; private final int extensionBack; private final int extensionUp; @@ -261,6 +271,28 @@ public class Region { offsetX = config.getInt("offsetX", 0); offsetY = config.getInt("offsetY", 0); offsetZ = config.getInt("offsetZ", 0); + String extDir = config.getString("extensionFrontDirection", null); + if (extDir == null) extensionFrontDirection = null; + else { + ExtensionDirection extDirection = null; + switch (extDir.toLowerCase()) { + case "positivex": + extDirection = ExtensionDirection.PositiveX; + break; + case "negativex": + extDirection = ExtensionDirection.NegativeX; + break; + case "positivez": + extDirection = ExtensionDirection.PositiveZ; + break; + case "negativez": + extDirection = ExtensionDirection.NegativeZ; + break; + default: + break; + } + extensionFrontDirection = extDirection; + } extensionFront = config.getInt("extensionFront", 0); extensionBack = config.getInt("extensionBack", 0); extensionUp = config.getInt("extensionUp", 0); -- 2.39.5 From 9d07f192a770e6af376980191cd959614053446a Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 6 Feb 2021 15:15:52 +0100 Subject: [PATCH 3/5] Simplify Region --- .../de/steamwar/bausystem/world/Region.java | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java index 45db098..39eb0ce 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java @@ -231,10 +231,25 @@ public class Region { public enum ExtensionDirection { - PositiveZ(), - NegativeZ(), - PositiveX(), - NegativeX() + PositiveZ("positivez", "z+"), + NegativeZ("negativez", "z-"), + PositiveX("positivex", "x+"), + NegativeX("negativex", "x-"); + + private Set values; + + ExtensionDirection(String... values) { + this.values = new HashSet<>(Arrays.asList(values)); + } + + public static ExtensionDirection getByString(String value) { + if (value == null) return null; + value = value.toLowerCase(); + for (ExtensionDirection extensionDirection : values()) { + if (extensionDirection.values.contains(value)) return extensionDirection; + } + return null; + } } @@ -271,28 +286,7 @@ public class Region { offsetX = config.getInt("offsetX", 0); offsetY = config.getInt("offsetY", 0); offsetZ = config.getInt("offsetZ", 0); - String extDir = config.getString("extensionFrontDirection", null); - if (extDir == null) extensionFrontDirection = null; - else { - ExtensionDirection extDirection = null; - switch (extDir.toLowerCase()) { - case "positivex": - extDirection = ExtensionDirection.PositiveX; - break; - case "negativex": - extDirection = ExtensionDirection.NegativeX; - break; - case "positivez": - extDirection = ExtensionDirection.PositiveZ; - break; - case "negativez": - extDirection = ExtensionDirection.NegativeZ; - break; - default: - break; - } - extensionFrontDirection = extDirection; - } + extensionFrontDirection = ExtensionDirection.getByString(config.getString("extensionFrontDirection", null)); extensionFront = config.getInt("extensionFront", 0); extensionBack = config.getInt("extensionBack", 0); extensionUp = config.getInt("extensionUp", 0); -- 2.39.5 From 7cfc8a959488c6bf64e206851d3399b118786056 Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 6 Feb 2021 15:18:28 +0100 Subject: [PATCH 4/5] Simplify Region --- .../src/de/steamwar/bausystem/world/Region.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java index 39eb0ce..ee0907a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java @@ -230,21 +230,17 @@ public class Region { } public enum ExtensionDirection { - PositiveZ("positivez", "z+"), NegativeZ("negativez", "z-"), PositiveX("positivex", "x+"), NegativeX("negativex", "x-"); private Set values; - ExtensionDirection(String... values) { this.values = new HashSet<>(Arrays.asList(values)); } - public static ExtensionDirection getByString(String value) { - if (value == null) return null; - value = value.toLowerCase(); + private static ExtensionDirection getByString(String value) { for (ExtensionDirection extensionDirection : values()) { if (extensionDirection.values.contains(value)) return extensionDirection; } @@ -286,7 +282,7 @@ public class Region { offsetX = config.getInt("offsetX", 0); offsetY = config.getInt("offsetY", 0); offsetZ = config.getInt("offsetZ", 0); - extensionFrontDirection = ExtensionDirection.getByString(config.getString("extensionFrontDirection", null)); + extensionFrontDirection = ExtensionDirection.getByString(config.getString("extensionFrontDirection", "").toLowerCase()); extensionFront = config.getInt("extensionFront", 0); extensionBack = config.getInt("extensionBack", 0); extensionUp = config.getInt("extensionUp", 0); -- 2.39.5 From 2950ddda36b63a841eb36c5279b296a23b951dfd Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 6 Feb 2021 15:36:23 +0100 Subject: [PATCH 5/5] Simplify Region --- .../de/steamwar/bausystem/world/Region.java | 38 ++++--------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java index ee0907a..101eeba 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java @@ -229,26 +229,6 @@ public class Region { } - public enum ExtensionDirection { - PositiveZ("positivez", "z+"), - NegativeZ("negativez", "z-"), - PositiveX("positivex", "x+"), - NegativeX("negativex", "x-"); - - private Set values; - ExtensionDirection(String... values) { - this.values = new HashSet<>(Arrays.asList(values)); - } - - private static ExtensionDirection getByString(String value) { - for (ExtensionDirection extensionDirection : values()) { - if (extensionDirection.values.contains(value)) return extensionDirection; - } - return null; - } - - } - public static class Prototype{ private static final Map prototypes = new HashMap<>(); @@ -260,11 +240,10 @@ public class Region { private final int offsetY; private final int offsetZ; - private final ExtensionDirection extensionFrontDirection; - private final int extensionFront; - private final int extensionBack; - private final int extensionUp; - private final int extensionSides; + private final int extensionPositiveZ; + private final int extensionNegativeZ; + private final int extensionPositiveY; + private final int extensionAxisX; private final String schematic; private final boolean rotate; @@ -282,11 +261,10 @@ public class Region { offsetX = config.getInt("offsetX", 0); offsetY = config.getInt("offsetY", 0); offsetZ = config.getInt("offsetZ", 0); - extensionFrontDirection = ExtensionDirection.getByString(config.getString("extensionFrontDirection", "").toLowerCase()); - extensionFront = config.getInt("extensionFront", 0); - extensionBack = config.getInt("extensionBack", 0); - extensionUp = config.getInt("extensionUp", 0); - extensionSides = config.getInt("extensionSides", 0); + extensionPositiveZ = config.getInt("extensionPositiveZ", 0); + extensionNegativeZ = config.getInt("extensionNegativeZ", 0); + extensionPositiveY = config.getInt("extensionPositiveY", 0); + extensionAxisX = config.getInt("extensionAxisX", 0); rotate = config.getBoolean("rotate", false); ConfigurationSection testblockSection = config.getConfigurationSection("testblock"); -- 2.39.5