SteamWar/BauSystem
Archiviert
13
0

TestblockReset #247

Manuell gemergt
YoyoNow hat 5 Commits von TestblockReset nach master 2021-04-10 20:40:58 +02:00 zusammengeführt
4 geänderte Dateien mit 14 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -75,6 +75,9 @@ class Region_15 {
if (pasteOptions.isReset()) { if (pasteOptions.isReset()) {
e.setBlocks(new CuboidRegion(RegionUtils_15.toBlockVector3(pasteOptions.getMinPoint()), RegionUtils_15.toBlockVector3(pasteOptions.getMaxPoint())), BlockTypes.AIR.getDefaultState().toBaseBlock()); e.setBlocks(new CuboidRegion(RegionUtils_15.toBlockVector3(pasteOptions.getMinPoint()), RegionUtils_15.toBlockVector3(pasteOptions.getMaxPoint())), BlockTypes.AIR.getDefaultState().toBaseBlock());
if (pasteOptions.getWaterLevel() != 0) {
e.setBlocks(new CuboidRegion(RegionUtils_15.toBlockVector3(pasteOptions.getMinPoint()), RegionUtils_15.toBlockVector3(pasteOptions.getMaxPoint()).withY(pasteOptions.getWaterLevel())), BlockTypes.WATER.getDefaultState().toBaseBlock());
}
} }
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(pasteOptions.isIgnoreAir()).build()); Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(pasteOptions.isIgnoreAir()).build());
return e; return e;

Datei anzeigen

@ -59,6 +59,11 @@ public class PasteOptions {
*/ */
private Point maxPoint = null; private Point maxPoint = null;
/**
* Used in 1.15
*/
private int waterLevel = 0;
public PasteOptions(boolean rotate) { public PasteOptions(boolean rotate) {
this.rotate = rotate; this.rotate = rotate;
} }

Datei anzeigen

@ -64,17 +64,12 @@ public class CommandTestblock extends SWCommand {
} }
@Register @Register({"schem"})
public void schematicTestblockCommand(Player p, String s) { public void schematicTestblockCommand(Player p, String s) {
schematicTestblockCommand(p, s, RegionExtensionType.NORMAL); schematicTestblockCommand(p, s, RegionExtensionType.NORMAL);
} }
@Register @Register({"schem"})
public void schematicTestblockCommand(Player p, RegionExtensionType regionExtensionType, String s) {
schematicTestblockCommand(p, s, regionExtensionType);
}
@Register
public void schematicTestblockCommand(Player p, String s, RegionExtensionType regionExtensionType) { public void schematicTestblockCommand(Player p, String s, RegionExtensionType regionExtensionType) {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;
Region region = regionCheck(p); Region region = regionCheck(p);

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.world.regions;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.world.Color; import de.steamwar.bausystem.world.Color;
import de.steamwar.core.VersionedCallable; import de.steamwar.core.VersionedCallable;
import de.steamwar.sql.NoClipboardException; import de.steamwar.sql.NoClipboardException;
@ -151,7 +152,7 @@ public class Prototype {
public EditSession reset(Region region, Schematic schem, boolean ignoreAir, Color color, boolean reset) throws IOException, NoClipboardException { public EditSession reset(Region region, Schematic schem, boolean ignoreAir, Color color, boolean reset) throws IOException, NoClipboardException {
PasteOptions pasteOptions; PasteOptions pasteOptions;
if (reset) { if (reset) {
pasteOptions = new PasteOptions(rotate ^ (schem != null && (schem.getSchemType().fightType() || schem.getSchemType().check())), ignoreAir, color, true, getMinPoint(region, RegionExtensionType.EXTENSION), getMaxPoint(region, RegionExtensionType.EXTENSION)); pasteOptions = new PasteOptions(rotate ^ (schem != null && (schem.getSchemType().fightType() || schem.getSchemType().check())), ignoreAir, color, true, getMinPoint(region, RegionExtensionType.EXTENSION), getMaxPoint(region, RegionExtensionType.EXTENSION), waterLevel);
} else { } else {
pasteOptions = new PasteOptions(rotate ^ (schem != null && (schem.getSchemType().fightType() || schem.getSchemType().check())), ignoreAir, color); pasteOptions = new PasteOptions(rotate ^ (schem != null && (schem.getSchemType().fightType() || schem.getSchemType().check())), ignoreAir, color);
} }
@ -186,7 +187,7 @@ public class Prototype {
} }
public EditSession resetTestblock(Region region, Schematic schem, Color color, boolean reset) throws IOException, NoClipboardException { public EditSession resetTestblock(Region region, Schematic schem, Color color, boolean reset) throws IOException, NoClipboardException {
return testblock.reset(region, schem, false, color, reset); return testblock.reset(region, schem, false, color, reset && waterLevel == 0);
} }
private static boolean inRange(double l, int min, int size) { private static boolean inRange(double l, int min, int size) {