debug output
Dieser Commit ist enthalten in:
Ursprung
d0372d86e9
Commit
c4c785f9da
@ -28,14 +28,15 @@ import com.sk89q.worldedit.function.operation.Operations;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
|
||||||
class Region_15 {
|
class Region_15 {
|
||||||
|
|
||||||
private Region_15() {
|
private Region_15() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,20 +52,37 @@ class Region_15 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static EditSession paste(Clipboard clipboard, int x, int y, int z, boolean rotate) {
|
static EditSession paste(Clipboard clipboard, int x, int y, int z, boolean rotate) {
|
||||||
BlockVector3 dimensions = clipboard.getDimensions();
|
|
||||||
BlockVector3 v = BlockVector3.at(x, y, z);
|
|
||||||
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
|
||||||
AffineTransform aT = new AffineTransform();
|
|
||||||
if (rotate) {
|
|
||||||
aT = aT.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);
|
|
||||||
} else {
|
|
||||||
v = v.subtract(dimensions.getX() / 2 - dimensions.getX() % 2, 0, dimensions.getZ() / 2 - dimensions.getZ() % 2).subtract(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) {
|
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) {
|
||||||
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
||||||
ch.setTransform(aT);
|
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());
|
||||||
|
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);
|
||||||
|
} else {
|
||||||
|
v = v.subtract(dimensions.getX() / 2 - dimensions.getX() % 2, 0, dimensions.getZ() / 2 - dimensions.getZ() % 2).subtract(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
Operations.completeBlindly(ch.createPaste(e).to(v).build());
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static EditSession pasteNew(Clipboard clipboard, int x, int y, int z, boolean rotate) {
|
||||||
|
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) {
|
||||||
|
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
||||||
|
BlockVector3 dimensions = clipboard.getDimensions();
|
||||||
|
BlockVector3 v = BlockVector3.at(x, y, z);
|
||||||
|
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(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);
|
||||||
|
} else {
|
||||||
|
v = v.subtract(dimensions.getX() / 2 - dimensions.getX() % 2, 0, dimensions.getZ() / 2 - dimensions.getZ() % 2).subtract(offset);
|
||||||
|
}
|
||||||
|
|
||||||
Operations.completeBlindly(ch.createPaste(e).to(v).build());
|
Operations.completeBlindly(ch.createPaste(e).to(v).build());
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren