From 94e5a931ecb48bf193adc35ecea1677665799942 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 1 May 2017 02:32:34 +1000 Subject: [PATCH] finish biome priority --- .../fawe/jnbt/anvil/HeightMapMCAGenerator.java | 7 ++++++- .../regions/general/plot/CreateFromImage.java | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/jnbt/anvil/HeightMapMCAGenerator.java b/core/src/main/java/com/boydti/fawe/jnbt/anvil/HeightMapMCAGenerator.java index d94f21dd..5dafeea6 100644 --- a/core/src/main/java/com/boydti/fawe/jnbt/anvil/HeightMapMCAGenerator.java +++ b/core/src/main/java/com/boydti/fawe/jnbt/anvil/HeightMapMCAGenerator.java @@ -45,6 +45,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent { private char[] overlay; private TextureUtil textureUtil; private boolean randomVariation = true; + private int biomePriority = 0; private boolean modifiedMain = false; @@ -260,6 +261,10 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent { } } + public void setBiomePriority(int value) { + this.biomePriority = ((value * 65536) / 100) - 32768; + } + public void setBlockAndBiomeColor(BufferedImage img) { if (img.getWidth() != getWidth() || img.getHeight() != getLength()) throw new IllegalArgumentException("Input image dimensions do not match the current height map!"); @@ -275,7 +280,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent { BaseBlock block = textureUtil.getNearestBlock(color); TextureUtil.BiomeColor biome = textureUtil.getNearestBiome(color); int blockColor = textureUtil.getColor(block); - if (textureUtil.colorDistance(biome.grass, color) <= textureUtil.colorDistance(blockColor, color)) { + if (textureUtil.colorDistance(biome.grass, color) - biomePriority <= textureUtil.colorDistance(blockColor, color)) { byte biomeByte = (byte) biome.id; biomes[index] = biomeByte; if (yBiome && x > 0 && x < widthIndex) { diff --git a/core/src/main/java/com/boydti/fawe/regions/general/plot/CreateFromImage.java b/core/src/main/java/com/boydti/fawe/regions/general/plot/CreateFromImage.java index f4af24d2..f249056f 100644 --- a/core/src/main/java/com/boydti/fawe/regions/general/plot/CreateFromImage.java +++ b/core/src/main/java/com/boydti/fawe/regions/general/plot/CreateFromImage.java @@ -152,6 +152,7 @@ public class CreateFromImage extends Command { fp.sendMessage(BBC.getPrefix() + "/2 cfi paletteComplexity "); fp.sendMessage(BBC.getPrefix() + "/2 cfi paletteRandomization "); fp.sendMessage(BBC.getPrefix() + "/2 cfi paletteBlocks "); + fp.sendMessage(BBC.getPrefix() + "/2 cfi paletteBiomePriority "); fp.sendMessage(BBC.getPrefix() + "/2 cfi done"); fp.sendMessage(BBC.getPrefix() + "/2 cfi cancel"); File folder = new File(PS.imp().getWorldContainer(), plot.getWorldName() + File.separator + "region"); @@ -245,6 +246,19 @@ public class CreateFromImage extends Command { player.sendMessage("Set color palette blocks, what's next?"); return; } + case "biomepriority": + case "palettebiomepriority": + case "setpalettebiomepriority": { + // roughness + // blocks + if (argList.size() != 2) { + C.COMMAND_SYNTAX.send(player, "/2 cfi " + argList.get(0) + " "); + return; + } + generator.setBiomePriority(Integer.parseInt(argList.get(1))); + player.sendMessage("Set color palette biome priority, what's next?"); + return; + } case "color": case "setcolor": { if (argList.size() != 2) { @@ -482,7 +496,7 @@ public class CreateFromImage extends Command { player.sendMessage(BBC.getPrefix() + "Cancelled!"); return; default: - C.COMMAND_SYNTAX.send(player, "/2 cfi "); + C.COMMAND_SYNTAX.send(player, "/2 cfi "); return; } } catch (IOException e) {