From cd553cfaa15b7d2096f71b8249e66f37d26d24c2 Mon Sep 17 00:00:00 2001 From: Jurgen Date: Sun, 7 Apr 2024 16:31:00 +0200 Subject: [PATCH] implemented mc version dependent switch so old maps shouldn't break --- .../java/org/dynmap/hdmap/TopoHDShader.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/TopoHDShader.java b/DynmapCore/src/main/java/org/dynmap/hdmap/TopoHDShader.java index 62ccf074..13a21bda 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/TopoHDShader.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/TopoHDShader.java @@ -26,11 +26,23 @@ public class TopoHDShader implements HDShader { private int worldheight = 384; public TopoHDShader(DynmapCore core, ConfigurationNode configuration) { name = (String) configuration.get("name"); - fillcolor = new Color[worldheight]; /* Color by Y, must be range of total world height, offset by +64*/ - /* Load defined colors from parameters */ - for(int i = 0; i < worldheight; i++) { - fillcolor[i] = configuration.getColor("color" + (i - 64), null); /* need to substract by 64 because Color does not accept <0 indexes*/ + + if (HDBlockModels.checkVersionRange(core.getDynmapPluginPlatformVersion(), "-1.17.0")){ + worldheight = 256; + fillcolor = new Color[worldheight]; /* Color by Y, must be range of total world height, offset by +64*/ + /* Load defined colors from parameters */ + for(int i = 0; i < worldheight; i++) { + fillcolor[i] = configuration.getColor("color" + (i - 64), null); /* need to substract by 64 because Color does not accept <0 indexes*/ + } } + else{ + fillcolor = new Color[worldheight]; /* Color by Y, must be range of total world height, offset by +64*/ + /* Load defined colors from parameters */ + for(int i = 0; i < worldheight; i++) { + fillcolor[i] = configuration.getColor("color" + (i - 64), null); /* need to substract by 64 because Color does not accept <0 indexes*/ + } + } + linecolor = configuration.getColor("linecolor", null); watercolor = configuration.getColor("watercolor", null); float wateralpha = configuration.getFloat("wateralpha", 1.0F);