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