SteamWar/BauSystem2.0
Archiviert
12
0

Fix Region Testblock paste

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-09-18 14:23:52 +02:00
Ursprung 689bc52e2f
Commit 8bf95a273b

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.region; package de.steamwar.bausystem.region;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode; import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode; import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
@ -392,6 +393,7 @@ public class Region {
Point pastePoint; Point pastePoint;
File tempFile = null; File tempFile = null;
Clipboard clipboard = null;
switch (regionType) { switch (regionType) {
case BUILD: case BUILD:
pastePoint = minPointBuild.add(prototype.getBuild().getSizeX() / 2, 0, prototype.getBuild().getSizeZ() / 2); pastePoint = minPointBuild.add(prototype.getBuild().getSizeX() / 2, 0, prototype.getBuild().getSizeZ() / 2);
@ -400,9 +402,17 @@ public class Region {
} }
break; break;
case TESTBLOCK: case TESTBLOCK:
pastePoint = minPointTestblock.add(prototype.getTestblock().getSizeX() / 2, 0, prototype.getTestblock().getSizeZ() / 2); pastePoint = minPointTestblock.add(prototype.getTestblock().getSizeX() / 2, 0, 0);
if (schematic == null) { if (schematic == null) {
tempFile = prototype.getTestblock().getSchematicFile(); tempFile = prototype.getTestblock().getSchematicFile();
pastePoint = pastePoint.add(0, 0, prototype.getTestblock().getSizeZ() / 2);
} else {
clipboard = schematic.load();
if (clipboard.getDimensions().getZ() != prototype.getTestblock().getSizeZ()) {
pastePoint = pastePoint.add(0, 0, clipboard.getDimensions().getZ() / 2 - (clipboard.getOrigin().getZ() - clipboard.getMinimumPoint().getZ()) - 1);
} else {
pastePoint = pastePoint.add(0, 0, prototype.getTestblock().getSizeZ() / 2);
}
} }
break; break;
default: default:
@ -416,7 +426,7 @@ public class Region {
EditSession editSession = null; EditSession editSession = null;
if (schematic != null) { if (schematic != null) {
editSession = paste(schematic.load(), pastePoint, pasteOptions); editSession = paste(clipboard != null ? clipboard : schematic.load(), pastePoint, pasteOptions);
} else { } else {
editSession = paste(tempFile, pastePoint, pasteOptions); editSession = paste(tempFile, pastePoint, pasteOptions);
} }