From 86b87e78e3cfea49ffb40b2a3f560e25bd9ef863 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Sat, 17 Mar 2012 00:34:33 -0500 Subject: [PATCH] Add misc/swampgrasscolor.png and misc/swampfoliagecolor.png support --- .../org/dynmap/bukkit/NewMapChunkCache.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java b/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java index b4d58142..86104b9e 100644 --- a/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java +++ b/src/main/java/org/dynmap/bukkit/NewMapChunkCache.java @@ -243,6 +243,47 @@ public class NewMapChunkCache implements MapChunkCache { } return mult; } + public final int getSmoothColorMultiplier(int[] colormap, int width, int[] swampmap, int swampwidth) { + int mult = 0xFFFFFF; + try { + int rx = x - x_base; + int rz = z - z_base; + BiomeMap bm = biomemap[rx][rz]; + if(sameneighborbiomecnt[rx][rz] >= (byte)8) { /* All neighbors same? */ + if(bm == BiomeMap.SWAMPLAND) { + mult = swampmap[bm.biomeLookup(swampwidth)]; + } + else { + mult = colormap[bm.biomeLookup(width)]; + } + } + else { + int raccum = 0; + int gaccum = 0; + int baccum = 0; + for(int xoff = -1; xoff < 2; xoff++) { + for(int zoff = -1; zoff < 2; zoff++) { + bm = biomemap[rx+xoff][rz+zoff]; + int rmult; + if(bm == BiomeMap.SWAMPLAND) { + rmult = swampmap[bm.biomeLookup(swampwidth)]; + } + else { + rmult = colormap[bm.biomeLookup(width)]; + } + raccum += (rmult >> 16) & 0xFF; + gaccum += (rmult >> 8) & 0xFF; + baccum += rmult & 0xFF; + } + } + mult = ((raccum / 9) << 16) | ((gaccum / 9) << 8) | (baccum / 9); + } + } catch (Exception x) { + exceptions++; + mult = 0xFFFFFF; + } + return mult; + } public final int getSmoothWaterColorMultiplier() { try {