SteamWar/BauSystem
Archiviert
13
0
Dieser Commit ist enthalten in:
Zeanon 2021-04-02 21:23:23 +02:00
Ursprung c4c785f9da
Commit 8d6806b538

Datei anzeigen

@ -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);