Improve handling of /reload, clean up dead code

This commit is contained in:
Mike Primm 2011-07-24 23:23:24 -05:00
parent 3ddce85f89
commit 737bcb98d9
23 changed files with 279 additions and 338 deletions

View file

@ -265,6 +265,11 @@ public class HDBlockModels {
* Load models
*/
public static void loadModels(File datadir) {
/* Reset models-by-ID-Data cache */
models_by_id_data.clear();
/* Reset scaled models by scale cache */
scaled_models_by_scale.clear();
/* Load block models */
InputStream in = TexturePack.class.getResourceAsStream("/models.txt");
if(in != null) {

View file

@ -26,8 +26,8 @@ import org.dynmap.debug.Debug;
import org.dynmap.utils.MapIterator.BlockStep;
import org.dynmap.hdmap.TexturePack.BlockTransparency;
import org.dynmap.hdmap.TexturePack.HDTextureMap;
import org.dynmap.kzedmap.KzedMap.KzedBufferedImage;
import org.dynmap.kzedmap.KzedMap;
import org.dynmap.utils.DynmapBufferedImage;
import org.dynmap.utils.FileLockManager;
import org.dynmap.utils.MapChunkCache;
import org.dynmap.utils.MapIterator;
@ -836,8 +836,8 @@ public class IsoHDPerspective implements HDPerspective {
/* Check if nether world */
boolean isnether = tile.getWorld().getEnvironment() == Environment.NETHER;
/* Create buffered image for each */
KzedBufferedImage im[] = new KzedBufferedImage[numshaders];
KzedBufferedImage dayim[] = new KzedBufferedImage[numshaders];
DynmapBufferedImage im[] = new DynmapBufferedImage[numshaders];
DynmapBufferedImage dayim[] = new DynmapBufferedImage[numshaders];
int[][] argb_buf = new int[numshaders][];
int[][] day_argb_buf = new int[numshaders][];
@ -848,10 +848,10 @@ public class IsoHDPerspective implements HDPerspective {
need_emittedlightlevel = true;
if(shader.isSkyLightLevelNeeded() || lighting.isSkyLightLevelNeeded())
need_skylightlevel = true;
im[i] = KzedMap.allocateBufferedImage(tileWidth, tileHeight);
im[i] = DynmapBufferedImage.allocateBufferedImage(tileWidth, tileHeight);
argb_buf[i] = im[i].argb_buf;
if(lighting.isNightAndDayEnabled()) {
dayim[i] = KzedMap.allocateBufferedImage(tileWidth, tileHeight);
dayim[i] = DynmapBufferedImage.allocateBufferedImage(tileWidth, tileHeight);
day_argb_buf[i] = dayim[i].argb_buf;
}
}
@ -931,7 +931,7 @@ public class IsoHDPerspective implements HDPerspective {
}
} finally {
FileLockManager.releaseWriteLock(f);
KzedMap.freeBufferedImage(im[i]);
DynmapBufferedImage.freeBufferedImage(im[i]);
}
MapManager.mapman.updateStatistics(tile, prefix, true, tile_update, !rendered[i]);
/* Handle day image, if needed */
@ -964,7 +964,7 @@ public class IsoHDPerspective implements HDPerspective {
}
} finally {
FileLockManager.releaseWriteLock(f);
KzedMap.freeBufferedImage(dayim[i]);
DynmapBufferedImage.freeBufferedImage(dayim[i]);
}
MapManager.mapman.updateStatistics(tile, prefix, true, tile_update, !rendered[i]);
}

View file

@ -22,6 +22,7 @@ import javax.imageio.ImageIO;
import org.dynmap.Color;
import org.dynmap.DynmapPlugin;
import org.dynmap.Log;
import org.dynmap.utils.DynmapBufferedImage;
import org.dynmap.utils.MapIterator.BlockStep;
import org.dynmap.kzedmap.KzedMap;
import org.dynmap.utils.MapIterator;
@ -553,7 +554,7 @@ public class TexturePack {
System.arraycopy(terrain_argb[i],native_scale*y,outbuf,((i>>4)*native_scale+y)*terrain_width + (i & 0xF)*native_scale, native_scale);
}
}
BufferedImage img = KzedMap.createBufferedImage(outbuf, terrain_width, terrain_height);
BufferedImage img = DynmapBufferedImage.createBufferedImage(outbuf, terrain_width, terrain_height);
ImageIO.write(img, "png", f);
}
@ -561,6 +562,8 @@ public class TexturePack {
* Load texture pack mappings
*/
public static void loadTextureMapping(File datadir) {
/* Start clean with texture packs - need to be loaded after mapping */
packs.clear();
/* Initialize map with blank map for all entries */
HDTextureMap.initializeTable();
/* Load block models */