From cee693e44e86894df03659b3fedb263de36fa89d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 18 May 2022 17:33:25 +0200 Subject: [PATCH] Fix rg color in 1.18 --- .../bausystem/utils/FlatteningWrapper15.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java b/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java index a1579c29..71a4325e 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java @@ -30,13 +30,14 @@ import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; -import com.sk89q.worldedit.function.mask.AbstractExtentMask; +import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask2D; import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.world.World; @@ -167,10 +168,10 @@ public class FlatteningWrapper15 implements FlatteningWrapper.IFlatteningWrapper blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_concrete_powder"); blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_carpet"); - e.setMask(new AbstractExtentMask(clipboard) { + e.setMask(new Mask() { @Override public boolean test(BlockVector3 blockVector3) { - BaseBlock block = getExtent().getFullBlock(blockVector3); + BaseBlock block = clipboard.getFullBlock(blockVector3); String blockName = block.toString().toLowerCase(); return blocks.contains(blockName); } @@ -180,6 +181,10 @@ public class FlatteningWrapper15 implements FlatteningWrapper.IFlatteningWrapper public Mask2D toMask2D() { return null; } + + public Mask copy() { + return this; + } }); } System.out.println("ChangeColor: " + stop("changeColor")); @@ -199,9 +204,9 @@ public class FlatteningWrapper15 implements FlatteningWrapper.IFlatteningWrapper start("reset"); if (pasteOptions.isReset()) { - e.setBlocks(new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock()); + e.setBlocks((Region) new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock()); if (pasteOptions.getWaterLevel() != 0) { - e.setBlocks(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()); } } System.out.println("Reset: " + stop("reset")); -- 2.39.5