SteamWar/BauSystem2.0
Archiviert
12
0

Fix Region.reset

Initial fix for Region.inRegion one off
Dieser Commit ist enthalten in:
yoyosource 2021-04-21 14:13:01 +02:00
Ursprung 1c91105367
Commit f0fa92f5ca

Datei anzeigen

@ -20,15 +20,12 @@
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;
import de.steamwar.bausystem.region.loader.RegionLoader;
import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.shared.SizedStack; import de.steamwar.bausystem.shared.SizedStack;
import de.steamwar.core.VersionedCallable;
import de.steamwar.sql.Schematic; import de.steamwar.sql.Schematic;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
@ -194,9 +191,9 @@ public class Region {
} }
private boolean inRegion(Location location, Point minPoint, Point maxPoint) { private boolean inRegion(Location location, Point minPoint, Point maxPoint) {
return location.getBlockX() >= minPoint.getX() && location.getBlockX() < maxPoint.getX() && return location.getBlockX() >= minPoint.getX() && location.getBlockX() <= maxPoint.getX() &&
location.getBlockY() >= minPoint.getY() && location.getBlockY() < maxPoint.getY() && location.getBlockY() >= minPoint.getY() && location.getBlockY() <= maxPoint.getY() &&
location.getBlockZ() >= minPoint.getZ() && location.getBlockZ() < maxPoint.getZ(); location.getBlockZ() >= minPoint.getZ() && location.getBlockZ() <= maxPoint.getZ();
} }
public boolean hasType(RegionType regionType) { public boolean hasType(RegionType regionType) {
@ -356,35 +353,37 @@ public class Region {
PasteOptions pasteOptions = new PasteOptions((schematic != null && (schematic.getSchemType().fightType() || schematic.getSchemType().check())), ignoreAir, getPlain(Flag.COLOR, ColorMode.class).getColor(), regionExtensionType == RegionExtensionType.EXTENSION, getMinPoint(regionType, regionExtensionType), getMaxPoint(regionType, regionExtensionType), waterLevel); PasteOptions pasteOptions = new PasteOptions((schematic != null && (schematic.getSchemType().fightType() || schematic.getSchemType().check())), ignoreAir, getPlain(Flag.COLOR, ColorMode.class).getColor(), regionExtensionType == RegionExtensionType.EXTENSION, getMinPoint(regionType, regionExtensionType), getMaxPoint(regionType, regionExtensionType), waterLevel);
EditSession editSession = null; Point pastePoint;
File tempFile = null;
switch (regionType) { switch (regionType) {
case BUILD: case BUILD:
System.out.println(schematic + " " + prototype.getBuild().getSchematicFile() + " " + regionType + " " + regionExtensionType + " " + minPointBuild); pastePoint = minPointBuild.add(prototype.getBuild().getSizeX() / 2, 0, prototype.getBuild().getSizeZ() / 2);
if (schematic != null) { if (schematic == null) {
editSession = paste(schematic.load(), minPointBuild, pasteOptions); tempFile = prototype.getBuild().getSchematicFile();
} else {
editSession = paste(prototype.getBuild().getSchematicFile(), minPointBuild, pasteOptions);
} }
break; break;
case TESTBLOCK: case TESTBLOCK:
System.out.println(schematic + " " + prototype.getBuild().getSchematicFile() + " " + regionType + " " + regionExtensionType + " " + minPointTestblock); pastePoint = minPointTestblock.add(prototype.getTestblock().getSizeX() / 2, 0, prototype.getTestblock().getSizeZ() / 2);
if (schematic != null) { if (schematic == null) {
editSession = paste(schematic.load(), minPointTestblock, pasteOptions); tempFile = prototype.getTestblock().getSchematicFile();
} else {
editSession = paste(prototype.getTestblock().getSchematicFile(), minPointTestblock, pasteOptions);
} }
break; break;
default: default:
case NORMAL: case NORMAL:
System.out.println(schematic + " " + prototype.getBuild().getSchematicFile() + " " + regionType + " " + regionExtensionType + " " + minPoint); pastePoint = minPoint.add(prototype.getSizeX() / 2, 0, prototype.getSizeZ() / 2);
if (schematic != null) { if (schematic == null) {
editSession = paste(schematic.load(), minPoint, pasteOptions); tempFile = prototype.getSchematicFile();
} else {
editSession = paste(prototype.getSchematicFile(), minPoint, pasteOptions);
} }
break; break;
} }
EditSession editSession = null;
if (schematic != null) {
editSession = paste(schematic.load(), pastePoint, pasteOptions);
} else {
editSession = paste(tempFile, pastePoint, pasteOptions);
}
initSessions(); initSessions();
undoSessions.push(editSession); undoSessions.push(editSession);
} }