From 057d25bd151008c4997b5c11cd2344e13a94bdb4 Mon Sep 17 00:00:00 2001 From: "Lukas Rieger (Blue)" Date: Mon, 8 Aug 2022 21:29:16 +0200 Subject: [PATCH] Fix color issue and fix cli-webserver not working --- .../bluemap/core/map/hires/HiresModelRenderer.java | 2 +- .../core/map/hires/blockmodel/ResourceModelBuilder.java | 2 +- .../java/de/bluecolored/bluemap/core/util/math/Color.java | 8 ++++---- .../main/java/de/bluecolored/bluemap/cli/BlueMapCLI.java | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/HiresModelRenderer.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/HiresModelRenderer.java index e16307a7..449f54f9 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/HiresModelRenderer.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/HiresModelRenderer.java @@ -88,7 +88,7 @@ public HiresTileMeta render(World world, Vector3i modelMin, Vector3i modelMax, H //update color and height (only if not 100% translucent) if (blockColor.a > 0) { maxHeight = y; - columnColor.overlay(blockColor); + columnColor.overlay(blockColor.premultiplied()); } } } diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/blockmodel/ResourceModelBuilder.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/blockmodel/ResourceModelBuilder.java index a60671d1..f15d4c60 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/blockmodel/ResourceModelBuilder.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/blockmodel/ResourceModelBuilder.java @@ -108,7 +108,7 @@ public void build(BlockNeighborhood block, Variant variant, BlockModelView bl } if (color.a > 0) { - color.flatten(); + color.flatten().straight(); color.a = blockColorOpacity; } diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/util/math/Color.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/util/math/Color.java index 5b69b0b0..c4ef8318 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/util/math/Color.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/util/math/Color.java @@ -142,10 +142,10 @@ public Color straight() { @Override public String toString() { return "Color{" + - "r=" + r + - ", g=" + g + - ", b=" + b + - ", a=" + a + + "r=" + r + " (" + (int) (r * 255) + ")" + + ", g=" + g + " (" + (int) (g * 255) + ")" + + ", b=" + b + " (" + (int) (b * 255) + ")" + + ", a=" + a + " (" + (int) (a * 255) + ")" + ", premultiplied=" + premultiplied + '}'; } diff --git a/implementations/cli/src/main/java/de/bluecolored/bluemap/cli/BlueMapCLI.java b/implementations/cli/src/main/java/de/bluecolored/bluemap/cli/BlueMapCLI.java index 9fa0f38a..05f9fdc5 100644 --- a/implementations/cli/src/main/java/de/bluecolored/bluemap/cli/BlueMapCLI.java +++ b/implementations/cli/src/main/java/de/bluecolored/bluemap/cli/BlueMapCLI.java @@ -189,13 +189,13 @@ public void startWebserver(BlueMapService blueMap, boolean verbose) throws IOExc routingRequestHandler.register(".*", new FileRequestHandler(config.getWebroot())); // map route - for (var mapId : blueMap.getConfigs().getMapConfigs().keySet()) { - Storage storage = blueMap.getStorage(mapId); + for (var mapConfigEntry : blueMap.getConfigs().getMapConfigs().entrySet()) { + Storage storage = blueMap.getStorage(mapConfigEntry.getValue().getStorage()); routingRequestHandler.register( - "maps/" + Pattern.quote(mapId) + "/(.*)", + "maps/" + Pattern.quote(mapConfigEntry.getKey()) + "/(.*)", "$1", - new MapRequestHandler(mapId, storage) + new MapRequestHandler(mapConfigEntry.getKey(), storage) ); }