Fixing offset
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
083936434a
Commit
6d86a32b49
@ -18,14 +18,14 @@ import java.io.IOException;
|
||||
class WorldEdit_14 {
|
||||
private WorldEdit_14(){}
|
||||
|
||||
static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
||||
static EditSession pasteSchematic(Player player, Schematic schematic) throws IOException, NoClipboardException {
|
||||
World weWorld = new BukkitWorld(player.getWorld());
|
||||
Location playerLocation = player.getLocation();
|
||||
Clipboard clipboard = schematic.load();
|
||||
BlockVector3 vector = BlockVector3.at(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ());
|
||||
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
BlockVector3 dimensions = clipboard.getDimensions();
|
||||
BlockVector3 v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset);
|
||||
BlockVector3 v = vector.subtract(dimensions.getX()/2, 0, dimensions.getZ()).subtract(offset);
|
||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
|
||||
Operations.completeBlindly(new ClipboardHolder(clipboard).createPaste(e).to(v).build());
|
||||
e.flushSession();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren