SteamWar/BauSystem
Archiviert
13
0

Add CommandTestblock.genericTestblockCommand

Dieser Commit ist enthalten in:
yoyosource 2021-04-10 20:17:20 +02:00
Ursprung 63cce8aaeb
Commit fbb0cd3f4e

Datei anzeigen

@ -19,7 +19,6 @@
package de.steamwar.bausystem.world.regions; package de.steamwar.bausystem.world.regions;
import com.google.common.collect.Sets;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
@ -64,7 +63,7 @@ class Region_15 {
static EditSession paste(Clipboard clipboard, int x, int y, int z, PasteOptions pasteOptions) { static EditSession paste(Clipboard clipboard, int x, int y, int z, PasteOptions pasteOptions) {
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) { try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) {
changeColor(clipboard, pasteOptions.getColor()); changeColor(clipboard, pasteOptions.getColor());
ClipboardHolder ch = new ClipboardHolder(clipboard); ClipboardHolder ch = new ClipboardHolder(clipboard);
BlockVector3 dimensions = clipboard.getDimensions(); BlockVector3 dimensions = clipboard.getDimensions();
BlockVector3 v = BlockVector3.at(x, y, z); BlockVector3 v = BlockVector3.at(x, y, z);
@ -78,11 +77,11 @@ 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) {
System.out.println(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());
if (pasteOptions.isReset() && pasteOptions.getWaterLevel() != 0) {
System.out.println(e.replaceBlocks(new CuboidRegion(RegionUtils_15.toBlockVector3(pasteOptions.getMinPoint()), RegionUtils_15.toBlockVector3(pasteOptions.getMaxPoint()).withY(pasteOptions.getWaterLevel())), new HashSet<>(Arrays.asList(BlockTypes.AIR.getDefaultState().toBaseBlock())), BlockTypes.WATER.getDefaultState().toBaseBlock()));
}
return e; return e;
} catch (WorldEditException e) { } catch (WorldEditException e) {
throw new SecurityException(e.getMessage(), e); throw new SecurityException(e.getMessage(), e);