TestBlockPaste-Without-Water #146
@ -43,6 +43,7 @@ import com.sk89q.worldedit.session.ClipboardHolder;
|
|||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.region.Color;
|
import de.steamwar.bausystem.region.Color;
|
||||||
import de.steamwar.bausystem.region.PasteOptions;
|
import de.steamwar.bausystem.region.PasteOptions;
|
||||||
import de.steamwar.bausystem.region.Point;
|
import de.steamwar.bausystem.region.Point;
|
||||||
@ -143,8 +144,9 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
|||||||
changeColor(clipboard, pasteOptions.getColor());
|
changeColor(clipboard, pasteOptions.getColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Set<String> blocks = new HashSet<>();
|
Set<String> blocks = new HashSet<>();
|
||||||
if (pasteOptions.isOnlyColors()) {
|
{
|
||||||
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_wool");
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_wool");
|
||||||
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_terracotta");
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_terracotta");
|
||||||
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_glazed_terracotta");
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_glazed_terracotta");
|
||||||
@ -154,13 +156,15 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
|||||||
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_concrete_powder");
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_concrete_powder");
|
||||||
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_carpet");
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_carpet");
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
String blockName = block.toString().toLowerCase();
|
String blockName = block.toString().toLowerCase();
|
||||||
if (pasteOptions.isTestBlock() && blockName.equals("minecraft.water")) return true;
|
if (blocks.contains(blockName) && pasteOptions.isOnlyColors()) return true;
|
||||||
return blocks.contains(blockName);
|
if (pasteOptions.isTestBlock() && blockName.startsWith("minecraft:water")) return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -168,6 +172,9 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
|||||||
public Mask2D toMask2D() {
|
public Mask2D toMask2D() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
public Mask copy() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
||||||
@ -182,7 +189,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pasteOptions.isReset()) {
|
if (pasteOptions.isReset()) {
|
||||||
e.setBlocks((Region) new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
|
e.setBlocks(new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
|
||||||
if (pasteOptions.getWaterLevel() != 0) {
|
if (pasteOptions.getWaterLevel() != 0) {
|
||||||
e.setBlocks((Region) new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint()).withY(pasteOptions.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
|
e.setBlocks((Region) new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint()).withY(pasteOptions.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren