mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-02-13 02:11:56 +01:00
Replaced tabs with spaces to conform the Bukkit standards.
This commit is contained in:
parent
daa2d0f186
commit
84d01c530a
@ -18,7 +18,7 @@ public class ColorScheme {
|
||||
|
||||
public String name;
|
||||
/* Switch to arrays - faster than map */
|
||||
public Color[][] colors; /* [blk-type][step] */
|
||||
public Color[][] colors; /* [blk-type][step] */
|
||||
public Color[][][] datacolors; /* [bkt-type][blk-dat][step] */
|
||||
|
||||
public ColorScheme(String name, Color[][] colors, Color[][][] datacolors) {
|
||||
@ -67,12 +67,12 @@ public class ColorScheme {
|
||||
Integer id;
|
||||
Integer dat = null;
|
||||
int idx = split[0].indexOf(':');
|
||||
if(idx > 0) { /* ID:data - data color */
|
||||
id = new Integer(split[0].substring(0, idx));
|
||||
dat = new Integer(split[0].substring(idx+1));
|
||||
if(idx > 0) { /* ID:data - data color */
|
||||
id = new Integer(split[0].substring(0, idx));
|
||||
dat = new Integer(split[0].substring(idx+1));
|
||||
}
|
||||
else {
|
||||
id = new Integer(split[0]);
|
||||
id = new Integer(split[0]);
|
||||
}
|
||||
Color[] c = new Color[4];
|
||||
|
||||
@ -83,36 +83,36 @@ public class ColorScheme {
|
||||
c[2] = new Color(Integer.parseInt(split[13]), Integer.parseInt(split[14]), Integer.parseInt(split[15]), Integer.parseInt(split[16]));
|
||||
|
||||
if(dat != null) {
|
||||
if(enab_datacolor) {
|
||||
Color[][] dcolor = datacolors[id]; /* Existing list? */
|
||||
if(dcolor == null) {
|
||||
dcolor = new Color[16][]; /* Make 16 index long list */
|
||||
datacolors[id] = dcolor;
|
||||
}
|
||||
if((dat >= 0) && (dat < 16)) { /* Add color to list */
|
||||
dcolor[dat] = c;
|
||||
}
|
||||
}
|
||||
if(dat == 0) { /* Index zero is base color too */
|
||||
colors[id] = c;
|
||||
}
|
||||
if(enab_datacolor) {
|
||||
Color[][] dcolor = datacolors[id]; /* Existing list? */
|
||||
if(dcolor == null) {
|
||||
dcolor = new Color[16][]; /* Make 16 index long list */
|
||||
datacolors[id] = dcolor;
|
||||
}
|
||||
if((dat >= 0) && (dat < 16)) { /* Add color to list */
|
||||
dcolor[dat] = c;
|
||||
}
|
||||
}
|
||||
if(dat == 0) { /* Index zero is base color too */
|
||||
colors[id] = c;
|
||||
}
|
||||
}
|
||||
else {
|
||||
colors[id] = c;
|
||||
colors[id] = c;
|
||||
}
|
||||
nc += 1;
|
||||
}
|
||||
scanner.close();
|
||||
/* Last, push base color into any open slots in data colors list */
|
||||
for(int k = 0; k < 256; k++) {
|
||||
Color[][] dc = datacolors[k]; /* see if data colors too */
|
||||
if(dc != null) {
|
||||
Color[] c = colors[k];
|
||||
for(int i = 0; i < 16; i++) {
|
||||
if(dc[i] == null)
|
||||
dc[i] = c;
|
||||
}
|
||||
}
|
||||
Color[][] dc = datacolors[k]; /* see if data colors too */
|
||||
if(dc != null) {
|
||||
Color[] c = colors[k];
|
||||
for(int i = 0; i < 16; i++) {
|
||||
if(dc[i] == null)
|
||||
dc[i] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.log(Level.SEVERE, "Could not load colors '" + name + "' ('" + colorSchemeFile + "').", e);
|
||||
|
@ -354,13 +354,13 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
World w = getServer().getWorld(args[i]);
|
||||
if(w != null)
|
||||
mapManager.renderFullWorld(new Location(w, 0, 0, 0));
|
||||
mapManager.renderFullWorld(new Location(w, 0, 0, 0));
|
||||
}
|
||||
return true;
|
||||
} else if (player != null) {
|
||||
Location loc = player.getLocation();
|
||||
if(loc != null)
|
||||
mapManager.renderFullWorld(loc);
|
||||
Location loc = player.getLocation();
|
||||
if(loc != null)
|
||||
mapManager.renderFullWorld(loc);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -40,24 +40,24 @@ public class MapManager {
|
||||
private DynmapPlugin plug_in;
|
||||
private boolean do_timesliced_render = false;
|
||||
private double timeslice_interval = 0.0;
|
||||
private boolean do_sync_render = false; /* Do incremental renders on sync thread too */
|
||||
private boolean do_sync_render = false; /* Do incremental renders on sync thread too */
|
||||
/* Which timesliced renders are active */
|
||||
private HashMap<String, FullWorldRenderState> active_renders = new HashMap<String, FullWorldRenderState>();
|
||||
|
||||
/* lock for our data structures */
|
||||
public static final Object lock = new Object();
|
||||
|
||||
public static MapManager mapman; /* Our singleton */
|
||||
|
||||
public static MapManager mapman; /* Our singleton */
|
||||
|
||||
private static class ImageWriter {
|
||||
Runnable run;
|
||||
Runnable run;
|
||||
}
|
||||
|
||||
private class FullWorldRenderState implements Runnable {
|
||||
DynmapWorld world; /* Which world are we rendering */
|
||||
Location loc; /* Start location */
|
||||
int map_index = -1; /* Which map are we on */
|
||||
MapType map;
|
||||
DynmapWorld world; /* Which world are we rendering */
|
||||
Location loc; /* Start location */
|
||||
int map_index = -1; /* Which map are we on */
|
||||
MapType map;
|
||||
HashSet<MapTile> found = null;
|
||||
HashSet<MapTile> rendered = null;
|
||||
LinkedList<MapTile> renderQueue = null;
|
||||
@ -65,8 +65,8 @@ public class MapManager {
|
||||
|
||||
/* Full world, all maps render */
|
||||
FullWorldRenderState(DynmapWorld dworld, Location l) {
|
||||
world = dworld;
|
||||
loc = l;
|
||||
world = dworld;
|
||||
loc = l;
|
||||
found = new HashSet<MapTile>();
|
||||
rendered = new HashSet<MapTile>();
|
||||
renderQueue = new LinkedList<MapTile>();
|
||||
@ -74,39 +74,39 @@ public class MapManager {
|
||||
|
||||
/* Single tile render - used for incremental renders */
|
||||
FullWorldRenderState(MapTile t) {
|
||||
world = worlds.get(t.getWorld().getName());
|
||||
tile0 = t;
|
||||
world = worlds.get(t.getWorld().getName());
|
||||
tile0 = t;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
MapTile tile;
|
||||
|
||||
if(tile0 == null) { /* Not single tile render */
|
||||
/* If render queue is empty, start next map */
|
||||
if(renderQueue.isEmpty()) {
|
||||
found.clear();
|
||||
rendered.clear();
|
||||
map_index++; /* Next map */
|
||||
if(map_index >= world.maps.size()) { /* Last one done? */
|
||||
log.info("Full render finished.");
|
||||
active_renders.remove(world.world.getName());
|
||||
return;
|
||||
}
|
||||
map = world.maps.get(map_index);
|
||||
MapTile tile;
|
||||
|
||||
if(tile0 == null) { /* Not single tile render */
|
||||
/* If render queue is empty, start next map */
|
||||
if(renderQueue.isEmpty()) {
|
||||
found.clear();
|
||||
rendered.clear();
|
||||
map_index++; /* Next map */
|
||||
if(map_index >= world.maps.size()) { /* Last one done? */
|
||||
log.info("Full render finished.");
|
||||
active_renders.remove(world.world.getName());
|
||||
return;
|
||||
}
|
||||
map = world.maps.get(map_index);
|
||||
|
||||
/* Now, prime the render queue */
|
||||
for (MapTile mt : map.getTiles(loc)) {
|
||||
if (!found.contains(mt)) {
|
||||
found.add(mt);
|
||||
renderQueue.add(mt);
|
||||
}
|
||||
}
|
||||
}
|
||||
tile = renderQueue.pollFirst();
|
||||
}
|
||||
else { /* Else, single tile render */
|
||||
tile = tile0;
|
||||
}
|
||||
/* Now, prime the render queue */
|
||||
for (MapTile mt : map.getTiles(loc)) {
|
||||
if (!found.contains(mt)) {
|
||||
found.add(mt);
|
||||
renderQueue.add(mt);
|
||||
}
|
||||
}
|
||||
}
|
||||
tile = renderQueue.pollFirst();
|
||||
}
|
||||
else { /* Else, single tile render */
|
||||
tile = tile0;
|
||||
}
|
||||
|
||||
DynmapChunk[] requiredChunks = tile.getMap().getRequiredChunks(tile);
|
||||
LinkedList<DynmapChunk> loadedChunks = new LinkedList<DynmapChunk>();
|
||||
@ -118,21 +118,21 @@ public class MapManager {
|
||||
if ((!wasLoaded) && didload)
|
||||
loadedChunks.add(chunk);
|
||||
}
|
||||
if(tile0 != null) { /* Single tile? */
|
||||
render(tile); /* Just render */
|
||||
if(tile0 != null) { /* Single tile? */
|
||||
render(tile); /* Just render */
|
||||
}
|
||||
else {
|
||||
if (render(tile)) {
|
||||
found.remove(tile);
|
||||
rendered.add(tile);
|
||||
for (MapTile adjTile : map.getAdjecentTiles(tile)) {
|
||||
if (!found.contains(adjTile) && !rendered.contains(adjTile)) {
|
||||
found.add(adjTile);
|
||||
renderQueue.add(adjTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
found.remove(tile);
|
||||
if (render(tile)) {
|
||||
found.remove(tile);
|
||||
rendered.add(tile);
|
||||
for (MapTile adjTile : map.getAdjecentTiles(tile)) {
|
||||
if (!found.contains(adjTile) && !rendered.contains(adjTile)) {
|
||||
found.add(adjTile);
|
||||
renderQueue.add(adjTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
found.remove(tile);
|
||||
}
|
||||
/* And unload what we loaded */
|
||||
while (!loadedChunks.isEmpty()) {
|
||||
@ -141,45 +141,45 @@ public class MapManager {
|
||||
* when chunks are unloaded but not saved - removing them seems to do the trick */
|
||||
Chunk cc = w.getChunkAt(c.x, c.z);
|
||||
if(cc != null) {
|
||||
for(Entity e: cc.getEntities())
|
||||
e.remove();
|
||||
for(Entity e: cc.getEntities())
|
||||
e.remove();
|
||||
}
|
||||
/* Since we only remember ones we loaded, and we're synchronous, no player has
|
||||
* moved, so it must be safe (also prevent chunk leak, which appears to happen
|
||||
* because isChunkInUse defined "in use" as being within 256 blocks of a player,
|
||||
* while the actual in-use chunk area for a player where the chunks are managed
|
||||
* by the MC base server is 21x21 (or about a 160 block radius) */
|
||||
w.unloadChunk(c.x, c.z, false, false);
|
||||
w.unloadChunk(c.x, c.z, false, false);
|
||||
}
|
||||
if(tile0 == null) { /* fullrender */
|
||||
/* Schedule the next tile to be worked */
|
||||
scheduler.scheduleSyncDelayedTask(plug_in, this, (int)(timeslice_interval*20));
|
||||
if(tile0 == null) { /* fullrender */
|
||||
/* Schedule the next tile to be worked */
|
||||
scheduler.scheduleSyncDelayedTask(plug_in, this, (int)(timeslice_interval*20));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MapManager(DynmapPlugin plugin, ConfigurationNode configuration) {
|
||||
|
||||
mapman = this;
|
||||
|
||||
|
||||
mapman = this;
|
||||
|
||||
this.tileQueue = new AsynchronousQueue<MapTile>(new Handler<MapTile>() {
|
||||
@Override
|
||||
public void handle(MapTile t) {
|
||||
if(do_sync_render)
|
||||
scheduler.scheduleSyncDelayedTask(plug_in,
|
||||
new FullWorldRenderState(t), 1);
|
||||
else
|
||||
render(t);
|
||||
if(do_sync_render)
|
||||
scheduler.scheduleSyncDelayedTask(plug_in,
|
||||
new FullWorldRenderState(t), 1);
|
||||
else
|
||||
render(t);
|
||||
}
|
||||
}, (int) (configuration.getDouble("renderinterval", 0.5) * 1000));
|
||||
|
||||
this.writeQueue = new AsynchronousQueue<ImageWriter>(
|
||||
new Handler<ImageWriter>() {
|
||||
@Override
|
||||
public void handle(ImageWriter w) {
|
||||
w.run.run();
|
||||
}
|
||||
}, 10);
|
||||
new Handler<ImageWriter>() {
|
||||
@Override
|
||||
public void handle(ImageWriter w) {
|
||||
w.run.run();
|
||||
}
|
||||
}, 10);
|
||||
|
||||
do_timesliced_render = configuration.getBoolean("timeslicerender", true);
|
||||
timeslice_interval = configuration.getDouble("timesliceinterval", 0.5);
|
||||
@ -217,16 +217,16 @@ public class MapManager {
|
||||
return;
|
||||
}
|
||||
if(do_timesliced_render) {
|
||||
String wname = l.getWorld().getName();
|
||||
FullWorldRenderState rndr = active_renders.get(wname);
|
||||
if(rndr != null) {
|
||||
log.info("Full world render of world '" + wname + "' already active.");
|
||||
return;
|
||||
}
|
||||
rndr = new FullWorldRenderState(world,l); /* Make new activation record */
|
||||
active_renders.put(wname, rndr); /* Add to active table */
|
||||
/* Schedule first tile to be worked */
|
||||
scheduler.scheduleSyncDelayedTask(plug_in, rndr, (int)(timeslice_interval*20));
|
||||
String wname = l.getWorld().getName();
|
||||
FullWorldRenderState rndr = active_renders.get(wname);
|
||||
if(rndr != null) {
|
||||
log.info("Full world render of world '" + wname + "' already active.");
|
||||
return;
|
||||
}
|
||||
rndr = new FullWorldRenderState(world,l); /* Make new activation record */
|
||||
active_renders.put(wname, rndr); /* Add to active table */
|
||||
/* Schedule first tile to be worked */
|
||||
scheduler.scheduleSyncDelayedTask(plug_in, rndr, (int)(timeslice_interval*20));
|
||||
log.info("Full render starting on world '" + wname + "' (timesliced)...");
|
||||
|
||||
return;
|
||||
@ -355,7 +355,7 @@ public class MapManager {
|
||||
|
||||
public void startRendering() {
|
||||
tileQueue.start();
|
||||
writeQueue.start();
|
||||
writeQueue.start();
|
||||
}
|
||||
|
||||
public void stopRendering() {
|
||||
@ -407,12 +407,12 @@ public class MapManager {
|
||||
}
|
||||
|
||||
public void enqueueImageWrite(Runnable run) {
|
||||
ImageWriter handler = new ImageWriter();
|
||||
handler.run = run;
|
||||
writeQueue.push(handler);
|
||||
ImageWriter handler = new ImageWriter();
|
||||
handler.run = run;
|
||||
writeQueue.push(handler);
|
||||
}
|
||||
|
||||
public boolean doSyncRender() {
|
||||
return do_sync_render;
|
||||
return do_sync_render;
|
||||
}
|
||||
}
|
||||
|
@ -127,19 +127,19 @@ public class FlatMap extends MapType {
|
||||
final MapTile mtile = tile;
|
||||
final BufferedImage img = im;
|
||||
MapManager.mapman.enqueueImageWrite(new Runnable() {
|
||||
public void run() {
|
||||
Debug.debug("saving image " + fname.getPath());
|
||||
try {
|
||||
ImageIO.write(img, "png", fname);
|
||||
} catch (IOException e) {
|
||||
Debug.error("Failed to save image: " + fname.getPath(), e);
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + fname.getPath(), e);
|
||||
}
|
||||
img.flush();
|
||||
MapManager.mapman.pushUpdate(mtile.getWorld(),
|
||||
new Client.Tile(mtile.getFilename()));
|
||||
}
|
||||
public void run() {
|
||||
Debug.debug("saving image " + fname.getPath());
|
||||
try {
|
||||
ImageIO.write(img, "png", fname);
|
||||
} catch (IOException e) {
|
||||
Debug.error("Failed to save image: " + fname.getPath(), e);
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + fname.getPath(), e);
|
||||
}
|
||||
img.flush();
|
||||
MapManager.mapman.pushUpdate(mtile.getWorld(),
|
||||
new Client.Tile(mtile.getFilename()));
|
||||
}
|
||||
});
|
||||
|
||||
return rendered;
|
||||
|
@ -29,22 +29,22 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
protected Color highlightColor = new Color(255, 0, 0);
|
||||
|
||||
private static final Color[] woolshades = {
|
||||
Color.WHITE,
|
||||
Color.ORANGE,
|
||||
Color.MAGENTA,
|
||||
new Color(51,204,255),
|
||||
Color.YELLOW,
|
||||
new Color(102,255,102),
|
||||
Color.PINK,
|
||||
Color.GRAY,
|
||||
Color.LIGHT_GRAY,
|
||||
Color.CYAN,
|
||||
new Color(255,0,255),
|
||||
Color.BLUE,
|
||||
new Color(102,51,51),
|
||||
Color.GREEN,
|
||||
Color.RED,
|
||||
Color.BLACK
|
||||
Color.WHITE,
|
||||
Color.ORANGE,
|
||||
Color.MAGENTA,
|
||||
new Color(51,204,255),
|
||||
Color.YELLOW,
|
||||
new Color(102,255,102),
|
||||
Color.PINK,
|
||||
Color.GRAY,
|
||||
Color.LIGHT_GRAY,
|
||||
Color.CYAN,
|
||||
new Color(255,0,255),
|
||||
Color.BLUE,
|
||||
new Color(102,51,51),
|
||||
Color.GREEN,
|
||||
Color.RED,
|
||||
Color.BLACK
|
||||
};
|
||||
|
||||
@Override
|
||||
@ -132,88 +132,88 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
final File fname = outputFile;
|
||||
final KzedMapTile mtile = tile;
|
||||
final BufferedImage img = im;
|
||||
final KzedZoomedMapTile zmtile = new KzedZoomedMapTile(mtile.getWorld(),
|
||||
(KzedMap) mtile.getMap(), mtile);
|
||||
final File zoomFile = MapManager.mapman.getTileFile(zmtile);
|
||||
|
||||
MapManager.mapman.enqueueImageWrite(new Runnable() {
|
||||
public void run() {
|
||||
doFileWrites(fname, mtile, img, zmtile, zoomFile);
|
||||
}
|
||||
final KzedZoomedMapTile zmtile = new KzedZoomedMapTile(mtile.getWorld(),
|
||||
(KzedMap) mtile.getMap(), mtile);
|
||||
final File zoomFile = MapManager.mapman.getTileFile(zmtile);
|
||||
|
||||
MapManager.mapman.enqueueImageWrite(new Runnable() {
|
||||
public void run() {
|
||||
doFileWrites(fname, mtile, img, zmtile, zoomFile);
|
||||
}
|
||||
});
|
||||
|
||||
return !isempty;
|
||||
}
|
||||
|
||||
private void doFileWrites(final File fname, final KzedMapTile mtile,
|
||||
final BufferedImage img, final KzedZoomedMapTile zmtile, final File zoomFile) {
|
||||
Debug.debug("saving image " + fname.getPath());
|
||||
try {
|
||||
ImageIO.write(img, "png", fname);
|
||||
} catch (IOException e) {
|
||||
Debug.error("Failed to save image: " + fname.getPath(), e);
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + fname.getPath(), e);
|
||||
}
|
||||
mtile.file = fname;
|
||||
// Since we've already got the new tile, and we're on an async thread, just
|
||||
// make the zoomed tile here
|
||||
int px = mtile.px;
|
||||
int py = mtile.py;
|
||||
int zpx = zmtile.getTileX();
|
||||
int zpy = zmtile.getTileY();
|
||||
final BufferedImage img, final KzedZoomedMapTile zmtile, final File zoomFile) {
|
||||
Debug.debug("saving image " + fname.getPath());
|
||||
try {
|
||||
ImageIO.write(img, "png", fname);
|
||||
} catch (IOException e) {
|
||||
Debug.error("Failed to save image: " + fname.getPath(), e);
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + fname.getPath(), e);
|
||||
}
|
||||
mtile.file = fname;
|
||||
// Since we've already got the new tile, and we're on an async thread, just
|
||||
// make the zoomed tile here
|
||||
int px = mtile.px;
|
||||
int py = mtile.py;
|
||||
int zpx = zmtile.getTileX();
|
||||
int zpy = zmtile.getTileY();
|
||||
|
||||
/* scaled size */
|
||||
int scw = KzedMap.tileWidth / 2;
|
||||
int sch = KzedMap.tileHeight / 2;
|
||||
/* scaled size */
|
||||
int scw = KzedMap.tileWidth / 2;
|
||||
int sch = KzedMap.tileHeight / 2;
|
||||
|
||||
/* origin in zoomed-out tile */
|
||||
int ox = 0;
|
||||
int oy = 0;
|
||||
/* origin in zoomed-out tile */
|
||||
int ox = 0;
|
||||
int oy = 0;
|
||||
|
||||
if (zpx != px)
|
||||
ox = scw;
|
||||
if (zpy != py)
|
||||
oy = sch;
|
||||
if (zpx != px)
|
||||
ox = scw;
|
||||
if (zpy != py)
|
||||
oy = sch;
|
||||
|
||||
BufferedImage zIm = null;
|
||||
try {
|
||||
zIm = ImageIO.read(zoomFile);
|
||||
} catch (IOException e) {
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
}
|
||||
BufferedImage zIm = null;
|
||||
try {
|
||||
zIm = ImageIO.read(zoomFile);
|
||||
} catch (IOException e) {
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
}
|
||||
|
||||
if (zIm == null) {
|
||||
/* create new one */
|
||||
zIm = new BufferedImage(KzedMap.tileWidth, KzedMap.tileHeight, BufferedImage.TYPE_INT_RGB);
|
||||
Debug.debug("New zoom-out tile created " + zmtile.getFilename());
|
||||
} else {
|
||||
Debug.debug("Loaded zoom-out tile from " + zmtile.getFilename());
|
||||
}
|
||||
|
||||
/* blit scaled rendered tile onto zoom-out tile */
|
||||
Graphics2D g2 = zIm.createGraphics();
|
||||
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||
g2.drawImage(img, ox, oy, scw, sch, null);
|
||||
if (zIm == null) {
|
||||
/* create new one */
|
||||
zIm = new BufferedImage(KzedMap.tileWidth, KzedMap.tileHeight, BufferedImage.TYPE_INT_RGB);
|
||||
Debug.debug("New zoom-out tile created " + zmtile.getFilename());
|
||||
} else {
|
||||
Debug.debug("Loaded zoom-out tile from " + zmtile.getFilename());
|
||||
}
|
||||
|
||||
/* blit scaled rendered tile onto zoom-out tile */
|
||||
Graphics2D g2 = zIm.createGraphics();
|
||||
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||
g2.drawImage(img, ox, oy, scw, sch, null);
|
||||
|
||||
img.flush();
|
||||
img.flush();
|
||||
|
||||
/* save zoom-out tile */
|
||||
|
||||
try {
|
||||
ImageIO.write(zIm, "png", zoomFile);
|
||||
Debug.debug("Saved zoom-out tile at " + zoomFile.getName());
|
||||
} catch (IOException e) {
|
||||
Debug.error("Failed to save zoom-out tile: " + zoomFile.getName(), e);
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save zoom-out tile (NullPointerException): " + zoomFile.getName(), e);
|
||||
}
|
||||
zIm.flush();
|
||||
/* Push updates for both files.*/
|
||||
MapManager.mapman.pushUpdate(mtile.getWorld(),
|
||||
new Client.Tile(mtile.getFilename()));
|
||||
MapManager.mapman.pushUpdate(zmtile.getWorld(),
|
||||
new Client.Tile(zmtile.getFilename()));
|
||||
/* save zoom-out tile */
|
||||
|
||||
try {
|
||||
ImageIO.write(zIm, "png", zoomFile);
|
||||
Debug.debug("Saved zoom-out tile at " + zoomFile.getName());
|
||||
} catch (IOException e) {
|
||||
Debug.error("Failed to save zoom-out tile: " + zoomFile.getName(), e);
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save zoom-out tile (NullPointerException): " + zoomFile.getName(), e);
|
||||
}
|
||||
zIm.flush();
|
||||
/* Push updates for both files.*/
|
||||
MapManager.mapman.pushUpdate(mtile.getWorld(),
|
||||
new Client.Tile(mtile.getFilename()));
|
||||
MapManager.mapman.pushUpdate(zmtile.getWorld(),
|
||||
new Client.Tile(zmtile.getFilename()));
|
||||
}
|
||||
|
||||
|
||||
@ -224,8 +224,8 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
|
||||
int id = world.getBlockTypeIdAt(x, y, z);
|
||||
byte data = 0;
|
||||
if(colorScheme.datacolors[id] != null) { /* If data colored */
|
||||
data = world.getBlockAt(x, y, z).getData();
|
||||
if(colorScheme.datacolors[id] != null) { /* If data colored */
|
||||
data = world.getBlockAt(x, y, z).getData();
|
||||
}
|
||||
switch (seq) {
|
||||
case 0:
|
||||
@ -250,9 +250,9 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
||||
}
|
||||
Color[] colors;
|
||||
if(data != 0)
|
||||
colors = colorScheme.datacolors[id][data];
|
||||
colors = colorScheme.datacolors[id][data];
|
||||
else
|
||||
colors = colorScheme.colors[id];
|
||||
colors = colorScheme.colors[id];
|
||||
if (colors != null) {
|
||||
Color c = colors[seq];
|
||||
if (c.getAlpha() > 0) {
|
||||
|
@ -32,8 +32,8 @@ public class HighlightTileRenderer extends DefaultTileRenderer {
|
||||
|
||||
int id = world.getBlockTypeIdAt(x, y, z);
|
||||
byte data = 0;
|
||||
if(colorScheme.datacolors[id] != null) { /* If data colored */
|
||||
data = world.getBlockAt(x, y, z).getData();
|
||||
if(colorScheme.datacolors[id] != null) { /* If data colored */
|
||||
data = world.getBlockAt(x, y, z).getData();
|
||||
}
|
||||
|
||||
switch (seq) {
|
||||
@ -56,9 +56,9 @@ public class HighlightTileRenderer extends DefaultTileRenderer {
|
||||
if (id != 0) {
|
||||
Color[] colors;
|
||||
if(data != 0)
|
||||
colors = colorScheme.datacolors[id][data];
|
||||
colors = colorScheme.datacolors[id][data];
|
||||
else
|
||||
colors = colorScheme.colors[id];
|
||||
colors = colorScheme.colors[id];
|
||||
if (colors != null) {
|
||||
Color c = colors[seq];
|
||||
|
||||
|
@ -18,6 +18,6 @@ public class ZoomedTileRenderer {
|
||||
}
|
||||
|
||||
public void render(final KzedZoomedMapTile zt, final File outputPath) {
|
||||
return; /* Doing this in Default render, since image already loaded */
|
||||
return; /* Doing this in Default render, since image already loaded */
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user