SteamWar/BauSystem2.0
Archiviert
12
0

Add option for tnt less pasting
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
zOnlyKroks 2023-07-27 01:08:55 +02:00
Ursprung 2f66580e60
Commit 1fe2394e01
4 geänderte Dateien mit 16 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -147,7 +147,6 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
changeColor(clipboard, pasteOptions.getColor()); changeColor(clipboard, pasteOptions.getColor());
} }
Set<String> blocks = new HashSet<>(); Set<String> blocks = new HashSet<>();
{ {
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_wool"); blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_wool");
@ -174,6 +173,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
} catch (WorldEditException ex) { } catch (WorldEditException ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
if (blockName.startsWith("minecraft:tnt")) return false;
} }

Datei anzeigen

@ -57,7 +57,7 @@ public class TestblockCommand extends SWCommand {
Region region = regionCheck(p); Region region = regionCheck(p);
if (region == null) return; if (region == null) return;
try { try {
region.reset(RegionType.TESTBLOCK, regionExtensionType); region.reset(RegionType.TESTBLOCK, regionExtensionType, regionExtensionType == null);
RegionUtils.message(region, "REGION_TB_DONE"); RegionUtils.message(region, "REGION_TB_DONE");
} catch (IOException e) { } catch (IOException e) {
BauSystem.MESSAGE.send("REGION_TB_ERROR", p); BauSystem.MESSAGE.send("REGION_TB_ERROR", p);
@ -86,7 +86,7 @@ public class TestblockCommand extends SWCommand {
} }
try { try {
region.reset(node, RegionType.TESTBLOCK, regionExtensionType); region.reset(node, RegionType.TESTBLOCK, regionExtensionType,true);
RegionUtils.message(region, "REGION_TB_DONE"); RegionUtils.message(region, "REGION_TB_DONE");
} catch (IOException e) { } catch (IOException e) {
BauSystem.MESSAGE.send("REGION_TB_ERROR", p); BauSystem.MESSAGE.send("REGION_TB_ERROR", p);
@ -101,6 +101,8 @@ public class TestblockCommand extends SWCommand {
showModeParameterTypesMap.put("-n", RegionExtensionType.NORMAL); showModeParameterTypesMap.put("-n", RegionExtensionType.NORMAL);
showModeParameterTypesMap.put("-extension", RegionExtensionType.EXTENSION); showModeParameterTypesMap.put("-extension", RegionExtensionType.EXTENSION);
showModeParameterTypesMap.put("-e", RegionExtensionType.EXTENSION); showModeParameterTypesMap.put("-e", RegionExtensionType.EXTENSION);
showModeParameterTypesMap.put("-t", null);
showModeParameterTypesMap.put("-tnt", null);
List<String> tabCompletes = new ArrayList<>(showModeParameterTypesMap.keySet()); List<String> tabCompletes = new ArrayList<>(showModeParameterTypesMap.keySet());
return SWCommandUtils.createMapper(s -> showModeParameterTypesMap.getOrDefault(s, null), s -> tabCompletes); return SWCommandUtils.createMapper(s -> showModeParameterTypesMap.getOrDefault(s, null), s -> tabCompletes);

Datei anzeigen

@ -45,4 +45,6 @@ public class PasteOptions {
private final int waterLevel; private final int waterLevel;
private final boolean testBlock; private final boolean testBlock;
private final boolean removeTNT;
} }

Datei anzeigen

@ -421,25 +421,25 @@ public class Region {
reset(schematic, regionType, RegionExtensionType.NORMAL, false); reset(schematic, regionType, RegionExtensionType.NORMAL, false);
} }
public void reset(RegionType regionType, RegionExtensionType regionExtensionType) throws IOException { public void reset(RegionType regionType, RegionExtensionType regionExtensionType,boolean removeTNT) throws IOException {
reset(null, regionType, regionExtensionType); reset(null, regionType, regionExtensionType,removeTNT);
} }
public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType) throws IOException { public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType,boolean removeTNT) throws IOException {
reset(schematic, regionType, regionExtensionType, false); reset(schematic, regionType, regionExtensionType, false,removeTNT);
} }
public void reset(File file) { public void reset(File file) {
EditSession editSession = paste(file, minPoint.add(prototype.getSizeX() / 2, 0, prototype.getSizeZ() / 2), new PasteOptions(false, false, Color.YELLOW, false, false, getMinPoint(RegionType.NORMAL, RegionExtensionType.NORMAL), getMaxPoint(RegionType.NORMAL, RegionExtensionType.NORMAL), waterLevel, false)); EditSession editSession = paste(file, minPoint.add(prototype.getSizeX() / 2, 0, prototype.getSizeZ() / 2), new PasteOptions(false, false, Color.YELLOW, false, false, getMinPoint(RegionType.NORMAL, RegionExtensionType.NORMAL), getMaxPoint(RegionType.NORMAL, RegionExtensionType.NORMAL), waterLevel, false,false));
initSessions(); initSessions();
undoSessions.push(editSession); undoSessions.push(editSession);
} }
public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir) throws IOException { public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir, boolean removeTNT) throws IOException {
reset(schematic, regionType, regionExtensionType, ignoreAir, false); reset(schematic, regionType, regionExtensionType, ignoreAir, false,removeTNT);
} }
public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir, boolean onlyColors) throws IOException { public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir, boolean onlyColors,boolean removeTNT) throws IOException {
if (!hasReset(regionType)) { if (!hasReset(regionType)) {
return; return;
} }
@ -447,7 +447,7 @@ public class Region {
regionExtensionType = RegionExtensionType.NORMAL; regionExtensionType = RegionExtensionType.NORMAL;
} }
PasteOptions pasteOptions = new PasteOptions((schematic != null && (schematic.getSchemtype().fightType() || schematic.getSchemtype().check())), ignoreAir, getPlain(Flag.COLOR, ColorMode.class).getColor(), onlyColors, regionExtensionType == RegionExtensionType.EXTENSION, getMinPoint(regionType, regionExtensionType), getMaxPoint(regionType, regionExtensionType), waterLevel, regionType == RegionType.TESTBLOCK); PasteOptions pasteOptions = new PasteOptions((schematic != null && (schematic.getSchemtype().fightType() || schematic.getSchemtype().check())), ignoreAir, getPlain(Flag.COLOR, ColorMode.class).getColor(), onlyColors, regionExtensionType == RegionExtensionType.EXTENSION, getMinPoint(regionType, regionExtensionType), getMaxPoint(regionType, regionExtensionType), waterLevel, regionType == RegionType.TESTBLOCK,removeTNT);
Point pastePoint; Point pastePoint;
File tempFile = null; File tempFile = null;