From 8d6806b538097423535b1aa517a6e3c122dfe6f9 Mon Sep 17 00:00:00 2001 From: Zeanon Date: Fri, 2 Apr 2021 21:23:23 +0200 Subject: [PATCH] debug output --- .../src/de/steamwar/bausystem/world/Region_15.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/BauSystem_15/src/de/steamwar/bausystem/world/Region_15.java b/BauSystem_15/src/de/steamwar/bausystem/world/Region_15.java index e4d354e..7547b24 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/world/Region_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/world/Region_15.java @@ -23,7 +23,9 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; +import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.transform.AffineTransform; @@ -42,8 +44,8 @@ class Region_15 { static EditSession paste(File file, int x, int y, int z, boolean rotate) { Clipboard clipboard; - try { - clipboard = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file)).read(); + try (ClipboardReader reader = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file))) { + clipboard = reader.read(); } catch (NullPointerException | IOException e) { throw new SecurityException("Bausystem schematic not found", e); } @@ -57,7 +59,9 @@ class Region_15 { BlockVector3 dimensions = clipboard.getDimensions(); BlockVector3 v = BlockVector3.at(x, y, z); BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()); - System.out.println(clipboard.getRegion().getMinimumPoint()); + System.out.println("min point cb: " + clipboard.getMinimumPoint()); + System.out.println("min point rg: " + clipboard.getRegion().getMinimumPoint()); + System.out.println("origin: " + clipboard.getOrigin()); if (rotate) { ch.setTransform(new AffineTransform().rotateY(180)); v = v.add(dimensions.getX() / 2 + dimensions.getX() % 2, 0, dimensions.getZ() / 2 + dimensions.getZ() % 2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);