added changeColor
Dieser Commit ist enthalten in:
Ursprung
e5c2fe20b0
Commit
3e9a103018
@ -21,6 +21,7 @@ package de.steamwar.bausystem.world;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
@ -29,12 +30,13 @@ 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 org.bukkit.Bukkit;
|
||||
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
||||
class Region_15 {
|
||||
@ -70,4 +72,117 @@ class Region_15 {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
static void changeColor(Clipboard clipboard, Color color) throws WorldEditException {
|
||||
for (int x = 0; x < clipboard.getDimensions().getX(); x++) {
|
||||
for (int y = 0; y < clipboard.getDimensions().getX(); y++) {
|
||||
for (int z = 0; z < clipboard.getDimensions().getX(); z++) {
|
||||
BlockVector3 blockPointer = clipboard.getMinimumPoint().add(x, y, z);
|
||||
clipboard.setBlock(blockPointer, mapColor(clipboard.getFullBlock(blockPointer).getBlockType(), 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) {
|
||||
return BlockTypes.WHITE_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.WHITE_STAINED_GLASS;
|
||||
}
|
||||
case ORANGE:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.ORANGE_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.ORANGE_STAINED_GLASS;
|
||||
}
|
||||
case MAGENTA:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.MAGENTA_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.MAGENTA_STAINED_GLASS;
|
||||
}
|
||||
case LIGHT_BLUE:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.LIGHT_BLUE_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.LIGHT_BLUE_STAINED_GLASS;
|
||||
}
|
||||
case LIME:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.LIME_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.LIME_STAINED_GLASS;
|
||||
}
|
||||
case PINK:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.PINK_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.PINK_STAINED_GLASS;
|
||||
}
|
||||
case GRAY:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.GRAY_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.GRAY_STAINED_GLASS;
|
||||
}
|
||||
case LIGHT_GRAY:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.LIGHT_GRAY_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.LIGHT_GRAY_STAINED_GLASS;
|
||||
}
|
||||
case CYAN:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.CYAN_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.CYAN_STAINED_GLASS;
|
||||
}
|
||||
case PURPLE:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.PURPLE_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.PURPLE_STAINED_GLASS;
|
||||
}
|
||||
case BLUE:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.BLUE_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.BLUE_STAINED_GLASS;
|
||||
}
|
||||
case BROWN:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.BROWN_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.BROWN_STAINED_GLASS;
|
||||
}
|
||||
case GREEN:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.GREEN_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.GREEN_STAINED_GLASS;
|
||||
}
|
||||
case RED:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.RED_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.RED_STAINED_GLASS;
|
||||
}
|
||||
case BLACK:
|
||||
if (original == BlockTypes.YELLOW_CONCRETE) {
|
||||
return BlockTypes.BLACK_CONCRETE;
|
||||
} else {
|
||||
return BlockTypes.BLACK_STAINED_GLASS;
|
||||
}
|
||||
case YELLOW:
|
||||
default:
|
||||
return original;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren