From f58092167f4477802358b729e34c5a9f0a9d5caa Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Tue, 19 Jul 2011 01:47:46 -0500 Subject: [PATCH] Fix wool coloring in texture support --- src/main/java/org/dynmap/hdmap/HDBlockModels.java | 2 +- src/main/java/org/dynmap/hdmap/TexturePack.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/dynmap/hdmap/HDBlockModels.java b/src/main/java/org/dynmap/hdmap/HDBlockModels.java index 0f071461..3c468c3e 100644 --- a/src/main/java/org/dynmap/hdmap/HDBlockModels.java +++ b/src/main/java/org/dynmap/hdmap/HDBlockModels.java @@ -164,7 +164,7 @@ public class HDBlockModels { } } } - map[off] = (short)((255*raw_w) / (nativeres*nativeres*nativeres)); + map[off] = (short)((255*raw_w) / (res*res*res)); if(map[off] > 255) map[off] = 255; if(map[off] < 0) map[off] = 0; } diff --git a/src/main/java/org/dynmap/hdmap/TexturePack.java b/src/main/java/org/dynmap/hdmap/TexturePack.java index 1b82951c..5b1e51ee 100644 --- a/src/main/java/org/dynmap/hdmap/TexturePack.java +++ b/src/main/java/org/dynmap/hdmap/TexturePack.java @@ -463,8 +463,8 @@ public class TexturePack { } } /* Generate weighted compnents into color */ - c.setRGBA(accum_red / (nativeres*nativeres), accum_green / (nativeres*nativeres), - accum_blue / (nativeres*nativeres), accum_alpha / (nativeres*nativeres)); + c.setRGBA(accum_red / (res*res), accum_green / (res*res), + accum_blue / (res*res), accum_alpha / (res*res)); dest_argb[(y*res) + x] = c.getARGB(); } } @@ -581,6 +581,7 @@ public class TexturePack { blkids.add(Integer.parseInt(av[1])); } else if(av[0].equals("data")) { + if(databits < 0) databits = 0; if(av[1].equals("*")) databits = 0xFFFF; else