From 8dbcc3c2e23cda5ce9cf61afac7089fe35fb1c2d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 9 Apr 2021 11:55:10 +0200 Subject: [PATCH] Fix rotateted schematics Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/fight/FightTeam_14.java | 5 ++++- .../src/de/steamwar/fightsystem/fight/FightTeam_8.java | 5 ++++- .../src/de/steamwar/fightsystem/listener/PrepareSchem.java | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/FightSystem_14/src/de/steamwar/fightsystem/fight/FightTeam_14.java b/FightSystem_14/src/de/steamwar/fightsystem/fight/FightTeam_14.java index 403ecc1..17bfbbe 100644 --- a/FightSystem_14/src/de/steamwar/fightsystem/fight/FightTeam_14.java +++ b/FightSystem_14/src/de/steamwar/fightsystem/fight/FightTeam_14.java @@ -123,7 +123,7 @@ public class FightTeam_14 { return block.getType() == Material.MOVING_PISTON; } - public static void saveSchem(Schematic schem, Region region, int minY) { + public static void saveSchem(Schematic schem, Region region, int minY, boolean rotate) { World w = new BukkitWorld(Bukkit.getWorlds().get(0)); BlockVector3 min = BlockVector3.at(region.getMinX(), minY, region.getMinZ()); CuboidRegion cuboidRegion = new CuboidRegion(w, min, BlockVector3.at(region.getMaxX(), region.getMaxY(), region.getMaxZ())); @@ -132,6 +132,9 @@ public class FightTeam_14 { ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(editSession, cuboidRegion, clipboard, min); forwardExtentCopy.setCopyingEntities(false); + if(rotate){ + forwardExtentCopy.setTransform(new AffineTransform().rotateY(180)); + } try{ Operations.complete(forwardExtentCopy); }catch(WorldEditException e){ diff --git a/FightSystem_8/src/de/steamwar/fightsystem/fight/FightTeam_8.java b/FightSystem_8/src/de/steamwar/fightsystem/fight/FightTeam_8.java index 54812ff..64f7c70 100644 --- a/FightSystem_8/src/de/steamwar/fightsystem/fight/FightTeam_8.java +++ b/FightSystem_8/src/de/steamwar/fightsystem/fight/FightTeam_8.java @@ -125,7 +125,7 @@ public class FightTeam_8 { return block.getType() == Material.PISTON_MOVING_PIECE; } - public static void saveSchem(Schematic schem, Region region, int minY) { + public static void saveSchem(Schematic schem, Region region, int minY, boolean rotate) { World w = new BukkitWorld(Bukkit.getWorlds().get(0)); Vector min = new Vector(region.getMinX(), minY, region.getMinZ()); CuboidRegion cuboidRegion = new CuboidRegion(w, min, new Vector(region.getMaxX(), region.getMaxY(), region.getMaxZ())); @@ -133,6 +133,9 @@ public class FightTeam_8 { EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1); ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(editSession, cuboidRegion, clipboard, min); + if(rotate){ + forwardExtentCopy.setTransform(new AffineTransform().rotateY(180)); + } try{ Operations.complete(forwardExtentCopy); }catch(WorldEditException e){ diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/PrepareSchem.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/PrepareSchem.java index 5cf1c2d..7f2d203 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/PrepareSchem.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/PrepareSchem.java @@ -73,8 +73,8 @@ public class PrepareSchem implements Listener { try{ VersionedRunnable.call( - new VersionedRunnable(() -> FightTeam_8.saveSchem(schem, region, minY), 8), - new VersionedRunnable(() -> FightTeam_14.saveSchem(schem, region, minY), 14)); + new VersionedRunnable(() -> FightTeam_8.saveSchem(schem, region, minY, Config.BlueRotate), 8), + new VersionedRunnable(() -> FightTeam_14.saveSchem(schem, region, minY, Config.BlueRotate), 14)); }catch(IllegalStateException e){ FightSystem.shutdown(FightSystem.PREFIX + "§cDie Schematic konnte nicht gespeichert werden, Einsenden wird abgebrochen."); return; -- 2.39.5