From b9aa99b52cf2815ebe53e4fdd8e65b5eea69cc98 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 9 Apr 2021 15:44:54 +0200 Subject: [PATCH] Fix Region_15.changeColor --- .../steamwar/bausystem/world/regions/Region_15.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/BauSystem_15/src/de/steamwar/bausystem/world/regions/Region_15.java b/BauSystem_15/src/de/steamwar/bausystem/world/regions/Region_15.java index b4d47c2..20177e8 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/world/regions/Region_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/world/regions/Region_15.java @@ -30,6 +30,7 @@ import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.session.ClipboardHolder; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import java.io.File; @@ -84,17 +85,18 @@ class Region_15 { for (int y = 0; y < clipboard.getDimensions().getY(); y++) { for (int z = 0; z < clipboard.getDimensions().getZ(); z++) { BlockVector3 blockPointer = clipboard.getMinimumPoint().add(x, y, z); - clipboard.setBlock(blockPointer, mapColor(clipboard.getFullBlock(blockPointer).getBlockType(), color).getDefaultState().toBaseBlock()); + BaseBlock baseBlock = clipboard.getFullBlock(blockPointer); + BlockType blockType = baseBlock.getBlockType(); + if (blockType != BlockTypes.YELLOW_CONCRETE && blockType != BlockTypes.YELLOW_STAINED_GLASS) { + continue; + } + clipboard.setBlock(blockPointer, mapColor(blockType, color).getDefaultState().toBaseBlock()); } } } } private static BlockType mapColor(BlockType original, Color color) { - if (original != BlockTypes.YELLOW_CONCRETE && original != BlockTypes.YELLOW_STAINED_GLASS) { - return original; - } - switch (color) { case WHITE: if (original == BlockTypes.YELLOW_CONCRETE) { -- 2.39.5