TestBlockPaste-Without-Water #146
@ -61,6 +61,7 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@ -138,18 +139,23 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
AtomicReference<BlockVector3> pastePoint = new AtomicReference<>();
|
||||
if (!pasteBuilder.getPredicates().isEmpty()) {
|
||||
e.setMask(new Mask() {
|
||||
@Override
|
||||
public boolean test(BlockVector3 blockVector3) {
|
||||
BaseBlock block = clipboard.getFullBlock(blockVector3);
|
||||
String blockName = block.toString().toLowerCase();
|
||||
BaseBlock block = clipboard.getFullBlock(blockVector3.subtract(pastePoint.get()).add(clipboard.getRegion().getMinimumPoint()));
|
||||
String blockName = block.getBlockType().toString().toLowerCase();
|
||||
for (BiPredicate<BaseBlock, String> predicate : pasteBuilder.getPredicates()) {
|
||||
if (!predicate.test(block, blockName)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Mask copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Mask2D toMask2D() {
|
||||
@ -168,6 +174,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
||||
} else {
|
||||
v = v.subtract(dimensions.getX() / 2, 0, dimensions.getZ() / 2).subtract(offset);
|
||||
}
|
||||
pastePoint.set(v);
|
||||
|
||||
if (pasteBuilder.isReset()) {
|
||||
e.setBlocks(new CuboidRegion(toBlockVector3(pasteBuilder.getMinPoint()), toBlockVector3(pasteBuilder.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
|
||||
|
@ -67,7 +67,8 @@ public class ColorCommand extends SWCommand {
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
|
||||
.ignoreAir(true)
|
||||
.onlyColors(true);
|
||||
.onlyColors(true)
|
||||
.color(color.getColor());
|
||||
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
||||
RegionUtils.message(region, "REGION_REGION_COLORED");
|
||||
RegionUtils.message(region, "REGION_REGION_COLORED_FAILED");
|
||||
|
@ -25,6 +25,8 @@ import de.steamwar.bausystem.features.util.SelectCommand;
|
||||
import de.steamwar.bausystem.region.Prototype;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
@ -101,7 +103,8 @@ public class RegionCommand extends SWCommand {
|
||||
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
|
||||
.ignoreAir(true);
|
||||
.ignoreAir(true)
|
||||
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
||||
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
||||
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
||||
} catch (SecurityException e) {
|
||||
@ -122,7 +125,8 @@ public class RegionCommand extends SWCommand {
|
||||
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.SchematicProvider(node))
|
||||
.ignoreAir(true);
|
||||
.ignoreAir(true)
|
||||
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
||||
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
||||
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
||||
} catch (SecurityException e) {
|
||||
|
@ -25,6 +25,8 @@ import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.region.GlobalRegion;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
@ -56,7 +58,8 @@ public class ResetCommand extends SWCommand {
|
||||
Region region = regionCheck(p);
|
||||
if (region == null) return;
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)));
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
|
||||
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
||||
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
||||
RegionUtils.message(region, "REGION_RESET_RESETED");
|
||||
} catch (SecurityException e) {
|
||||
@ -84,7 +87,8 @@ public class ResetCommand extends SWCommand {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.SchematicProvider(node));
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.SchematicProvider(node))
|
||||
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
||||
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
||||
RegionUtils.message(region, "REGION_RESET_RESETED");
|
||||
} catch (SecurityException e) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren