mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-25 03:35:18 +01:00
Merge pull request #212 from mikeprimm/master
Add support for alternate tile directory structure, to better support huge worlds
This commit is contained in:
commit
1eb9789780
@ -121,6 +121,8 @@ templates:
|
|||||||
# Template for normal world
|
# Template for normal world
|
||||||
normal:
|
normal:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
# If bigworld set to true, use alternate directory layout better suited to large worlds
|
||||||
|
# bigworld: true
|
||||||
center:
|
center:
|
||||||
x: 0
|
x: 0
|
||||||
y: 64
|
y: 64
|
||||||
@ -184,6 +186,8 @@ templates:
|
|||||||
# Nether world template
|
# Nether world template
|
||||||
nether:
|
nether:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
# If bigworld set to true, use alternate directory layout better suited to large worlds
|
||||||
|
# bigworld: true
|
||||||
center:
|
center:
|
||||||
x: 0
|
x: 0
|
||||||
y: 64
|
y: 64
|
||||||
@ -209,6 +213,8 @@ templates:
|
|||||||
# Skylands world template
|
# Skylands world template
|
||||||
skylands:
|
skylands:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
# If bigworld set to true, use alternate directory layout better suited to large worlds
|
||||||
|
# bigworld: true
|
||||||
center:
|
center:
|
||||||
x: 0
|
x: 0
|
||||||
y: 64
|
y: 64
|
||||||
@ -267,6 +273,8 @@ worlds:
|
|||||||
# x: 0
|
# x: 0
|
||||||
# y: 64
|
# y: 64
|
||||||
# z: 0
|
# z: 0
|
||||||
|
# # If bigworld set to true, use alternate directory layout better suited to large worlds
|
||||||
|
# # bigworld: true
|
||||||
# maps:
|
# maps:
|
||||||
# - class: org.dynmap.flat.FlatMap
|
# - class: org.dynmap.flat.FlatMap
|
||||||
# name: flat
|
# name: flat
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.dynmap;
|
package org.dynmap;
|
||||||
|
|
||||||
import static org.dynmap.JSONUtils.a;
|
import static org.dynmap.JSONUtils.a;
|
||||||
import static org.dynmap.JSONUtils.l;
|
|
||||||
import static org.dynmap.JSONUtils.s;
|
import static org.dynmap.JSONUtils.s;
|
||||||
|
|
||||||
import org.dynmap.Event.Listener;
|
import org.dynmap.Event.Listener;
|
||||||
@ -33,6 +32,7 @@ public class ClientConfigurationComponent extends Component {
|
|||||||
s(wo, "center/x", wn.getFloat("center/x", 0.0f));
|
s(wo, "center/x", wn.getFloat("center/x", 0.0f));
|
||||||
s(wo, "center/y", wn.getFloat("center/y", 64.0f));
|
s(wo, "center/y", wn.getFloat("center/y", 64.0f));
|
||||||
s(wo, "center/z", wn.getFloat("center/z", 0.0f));
|
s(wo, "center/z", wn.getFloat("center/z", 0.0f));
|
||||||
|
s(wo, "bigworld", world.bigworld);
|
||||||
a(t, "worlds", wo);
|
a(t, "worlds", wo);
|
||||||
|
|
||||||
for(MapType mt : world.maps) {
|
for(MapType mt : world.maps) {
|
||||||
|
@ -15,4 +15,5 @@ public class DynmapWorld {
|
|||||||
public int servertime;
|
public int servertime;
|
||||||
public boolean sendposition;
|
public boolean sendposition;
|
||||||
public boolean sendhealth;
|
public boolean sendhealth;
|
||||||
|
public boolean bigworld; /* If true, deeper directory hierarchy */
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package org.dynmap;
|
|||||||
import org.dynmap.Event.Listener;
|
import org.dynmap.Event.Listener;
|
||||||
import org.dynmap.web.handlers.ClientUpdateHandler;
|
import org.dynmap.web.handlers.ClientUpdateHandler;
|
||||||
import org.dynmap.web.handlers.SendMessageHandler;
|
import org.dynmap.web.handlers.SendMessageHandler;
|
||||||
import org.dynmap.web.handlers.SendMessageHandler.Message;
|
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import static org.dynmap.JSONUtils.*;
|
import static org.dynmap.JSONUtils.*;
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package org.dynmap;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
@ -13,9 +12,7 @@ import java.util.Iterator;
|
|||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.dynmap.web.Json;
|
import org.dynmap.web.Json;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
@ -2,7 +2,6 @@ package org.dynmap;
|
|||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.LinkedList;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -11,7 +10,6 @@ import org.bukkit.entity.Entity;
|
|||||||
* Container for managing chunks - dependent upon using chunk snapshots, since rendering is off server thread
|
* Container for managing chunks - dependent upon using chunk snapshots, since rendering is off server thread
|
||||||
*/
|
*/
|
||||||
public class MapChunkCache {
|
public class MapChunkCache {
|
||||||
private World w;
|
|
||||||
private static Method getchunkdata = null;
|
private static Method getchunkdata = null;
|
||||||
private static Method gethandle = null;
|
private static Method gethandle = null;
|
||||||
private static Method poppreservedchunk = null;
|
private static Method poppreservedchunk = null;
|
||||||
@ -164,7 +162,6 @@ public class MapChunkCache {
|
|||||||
}
|
}
|
||||||
x_dim = x_max - x_min + 1;
|
x_dim = x_max - x_min + 1;
|
||||||
}
|
}
|
||||||
this.w = w;
|
|
||||||
|
|
||||||
if(!initialized) {
|
if(!initialized) {
|
||||||
try {
|
try {
|
||||||
|
@ -297,6 +297,7 @@ public class MapManager {
|
|||||||
dynmapWorld.servertime = (int)(w.getTime() % 24000);
|
dynmapWorld.servertime = (int)(w.getTime() % 24000);
|
||||||
dynmapWorld.sendposition = worldConfiguration.getBoolean("sendposition", true);
|
dynmapWorld.sendposition = worldConfiguration.getBoolean("sendposition", true);
|
||||||
dynmapWorld.sendhealth = worldConfiguration.getBoolean("sendhealth", true);
|
dynmapWorld.sendhealth = worldConfiguration.getBoolean("sendhealth", true);
|
||||||
|
dynmapWorld.bigworld = worldConfiguration.getBoolean("bigworld", false);
|
||||||
if(loclist != null) {
|
if(loclist != null) {
|
||||||
for(ConfigurationNode loc : loclist) {
|
for(ConfigurationNode loc : loclist) {
|
||||||
Location lx = new Location(w, loc.getDouble("x", 0), loc.getDouble("y", 64), loc.getDouble("z", 0));
|
Location lx = new Location(w, loc.getDouble("x", 0), loc.getDouble("y", 64), loc.getDouble("z", 0));
|
||||||
|
@ -3,10 +3,14 @@ package org.dynmap;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
public abstract class MapTile {
|
public abstract class MapTile {
|
||||||
private World world;
|
protected DynmapWorld world;
|
||||||
private MapType map;
|
private MapType map;
|
||||||
|
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
|
return world.world;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DynmapWorld getDynmapWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,7 +22,7 @@ public abstract class MapTile {
|
|||||||
|
|
||||||
public abstract String getDayFilename();
|
public abstract String getDayFilename();
|
||||||
|
|
||||||
public MapTile(World world, MapType map) {
|
public MapTile(DynmapWorld world, MapType map) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.map = map;
|
this.map = map;
|
||||||
}
|
}
|
||||||
@ -38,6 +42,6 @@ public abstract class MapTile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return world.getName() + "." + map.getName();
|
return world.world.getName() + "." + map.getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.dynmap.flat;
|
package org.dynmap.flat;
|
||||||
|
|
||||||
|
import org.dynmap.DynmapWorld;
|
||||||
import static org.dynmap.JSONUtils.a;
|
import static org.dynmap.JSONUtils.a;
|
||||||
import static org.dynmap.JSONUtils.s;
|
import static org.dynmap.JSONUtils.s;
|
||||||
import java.awt.image.DataBufferInt;
|
import java.awt.image.DataBufferInt;
|
||||||
@ -75,13 +76,14 @@ public class FlatMap extends MapType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MapTile[] getTiles(Location l) {
|
public MapTile[] getTiles(Location l) {
|
||||||
return new MapTile[] { new FlatMapTile(l.getWorld(), this, (int) Math.floor(l.getBlockX() / 128.0), (int) Math.floor(l.getBlockZ() / 128.0), 128) };
|
DynmapWorld w = MapManager.mapman.getWorld(l.getWorld().getName());
|
||||||
|
return new MapTile[] { new FlatMapTile(w, this, (int) Math.floor(l.getBlockX() / 128.0), (int) Math.floor(l.getBlockZ() / 128.0), 128) };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MapTile[] getAdjecentTiles(MapTile tile) {
|
public MapTile[] getAdjecentTiles(MapTile tile) {
|
||||||
FlatMapTile t = (FlatMapTile) tile;
|
FlatMapTile t = (FlatMapTile) tile;
|
||||||
World w = t.getWorld();
|
DynmapWorld w = t.getDynmapWorld();
|
||||||
int x = t.x;
|
int x = t.x;
|
||||||
int y = t.y;
|
int y = t.y;
|
||||||
int s = t.size;
|
int s = t.size;
|
||||||
@ -257,6 +259,8 @@ public class FlatMap extends MapType {
|
|||||||
if((!outputFile.exists()) || (crc != hashman.getImageHashCode(tile.getKey(), null, t.x, t.y))) {
|
if((!outputFile.exists()) || (crc != hashman.getImageHashCode(tile.getKey(), null, t.x, t.y))) {
|
||||||
/* Wrap buffer as buffered image */
|
/* Wrap buffer as buffered image */
|
||||||
Debug.debug("saving image " + outputFile.getPath());
|
Debug.debug("saving image " + outputFile.getPath());
|
||||||
|
if(!outputFile.getParentFile().exists())
|
||||||
|
outputFile.getParentFile().mkdirs();
|
||||||
try {
|
try {
|
||||||
ImageIO.write(im.buf_img, "png", outputFile);
|
ImageIO.write(im.buf_img, "png", outputFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -282,6 +286,8 @@ public class FlatMap extends MapType {
|
|||||||
crc = hashman.calculateTileHash(argb_buf_day);
|
crc = hashman.calculateTileHash(argb_buf_day);
|
||||||
if((!dayfile.exists()) || (crc != hashman.getImageHashCode(tile.getKey(), "day", t.x, t.y))) {
|
if((!dayfile.exists()) || (crc != hashman.getImageHashCode(tile.getKey(), "day", t.x, t.y))) {
|
||||||
Debug.debug("saving image " + dayfile.getPath());
|
Debug.debug("saving image " + dayfile.getPath());
|
||||||
|
if(!dayfile.getParentFile().exists())
|
||||||
|
dayfile.getParentFile().mkdirs();
|
||||||
try {
|
try {
|
||||||
ImageIO.write(im_day.buf_img, "png", dayfile);
|
ImageIO.write(im_day.buf_img, "png", dayfile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -387,8 +393,10 @@ public class FlatMap extends MapType {
|
|||||||
public int x;
|
public int x;
|
||||||
public int y;
|
public int y;
|
||||||
public int size;
|
public int size;
|
||||||
|
private String fname;
|
||||||
|
private String fname_day;
|
||||||
|
|
||||||
public FlatMapTile(World world, FlatMap map, int x, int y, int size) {
|
public FlatMapTile(DynmapWorld world, FlatMap map, int x, int y, int size) {
|
||||||
super(world, map);
|
super(world, map);
|
||||||
this.map = map;
|
this.map = map;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
@ -398,11 +406,23 @@ public class FlatMap extends MapType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFilename() {
|
public String getFilename() {
|
||||||
return map.prefix + "_" + size + "_" + -(y+1) + "_" + x + ".png";
|
if(fname == null) {
|
||||||
|
if(world.bigworld)
|
||||||
|
fname = map.prefix + "/" + ((-(y+1))>>5) + "_" + (x>>5) + "/" + size + "_" + -(y+1) + "_" + x + ".png";
|
||||||
|
else
|
||||||
|
fname = map.prefix + "_" + size + "_" + -(y+1) + "_" + x + ".png";
|
||||||
|
}
|
||||||
|
return fname;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String getDayFilename() {
|
public String getDayFilename() {
|
||||||
return map.prefix + "_day_" + size + "_" + -(y+1) + "_" + x + ".png";
|
if(fname_day == null) {
|
||||||
|
if(world.bigworld)
|
||||||
|
fname_day = map.prefix + "_day/" + ((-(y+1))>>5) + "_" + (x>>5) + "/" + size + "_" + -(y+1) + "_" + x + ".png";
|
||||||
|
else
|
||||||
|
fname_day = map.prefix + "_day_" + size + "_" + -(y+1) + "_" + x + ".png";
|
||||||
|
}
|
||||||
|
return fname_day;
|
||||||
}
|
}
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getWorld().getName() + ":" + getFilename();
|
return getWorld().getName() + ":" + getFilename();
|
||||||
|
@ -188,7 +188,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Hand encoding and writing file off to MapManager */
|
/* Hand encoding and writing file off to MapManager */
|
||||||
KzedZoomedMapTile zmtile = new KzedZoomedMapTile(tile.getWorld(),
|
KzedZoomedMapTile zmtile = new KzedZoomedMapTile(tile.getDynmapWorld(),
|
||||||
(KzedMap) tile.getMap(), tile);
|
(KzedMap) tile.getMap(), tile);
|
||||||
File zoomFile = MapManager.mapman.getTileFile(zmtile);
|
File zoomFile = MapManager.mapman.getTileFile(zmtile);
|
||||||
|
|
||||||
@ -239,6 +239,8 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
int ty = mtile.py/KzedMap.tileHeight;
|
int ty = mtile.py/KzedMap.tileHeight;
|
||||||
if((!fname.exists()) || (crc != hashman.getImageHashCode(mtile.getKey(), null, tx, ty))) {
|
if((!fname.exists()) || (crc != hashman.getImageHashCode(mtile.getKey(), null, tx, ty))) {
|
||||||
Debug.debug("saving image " + fname.getPath());
|
Debug.debug("saving image " + fname.getPath());
|
||||||
|
if(!fname.getParentFile().exists())
|
||||||
|
fname.getParentFile().mkdirs();
|
||||||
try {
|
try {
|
||||||
ImageIO.write(img.buf_img, "png", fname);
|
ImageIO.write(img.buf_img, "png", fname);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -263,6 +265,8 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
crc = hashman.calculateTileHash(img.argb_buf);
|
crc = hashman.calculateTileHash(img.argb_buf);
|
||||||
if((!dfname.exists()) || (crc != hashman.getImageHashCode(mtile.getKey(), "day", tx, ty))) {
|
if((!dfname.exists()) || (crc != hashman.getImageHashCode(mtile.getKey(), "day", tx, ty))) {
|
||||||
Debug.debug("saving image " + dfname.getPath());
|
Debug.debug("saving image " + dfname.getPath());
|
||||||
|
if(!dfname.getParentFile().exists())
|
||||||
|
dfname.getParentFile().mkdirs();
|
||||||
try {
|
try {
|
||||||
ImageIO.write(img_day.buf_img, "png", dfname);
|
ImageIO.write(img_day.buf_img, "png", dfname);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -334,6 +338,8 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||||||
zIm.setRGB(ox, oy, KzedMap.tileWidth/2, KzedMap.tileHeight/2, zimg.argb_buf, 0, KzedMap.tileWidth/2);
|
zIm.setRGB(ox, oy, KzedMap.tileWidth/2, KzedMap.tileHeight/2, zimg.argb_buf, 0, KzedMap.tileWidth/2);
|
||||||
|
|
||||||
/* save zoom-out tile */
|
/* save zoom-out tile */
|
||||||
|
if(!zoomFile.getParentFile().exists())
|
||||||
|
zoomFile.getParentFile().mkdirs();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ImageIO.write(zIm, "png", zoomFile);
|
ImageIO.write(zIm, "png", zoomFile);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.dynmap.kzedmap;
|
package org.dynmap.kzedmap;
|
||||||
|
|
||||||
|
import org.dynmap.DynmapWorld;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -14,6 +15,7 @@ import org.bukkit.World;
|
|||||||
import org.dynmap.ConfigurationNode;
|
import org.dynmap.ConfigurationNode;
|
||||||
import org.dynmap.DynmapChunk;
|
import org.dynmap.DynmapChunk;
|
||||||
import org.dynmap.Log;
|
import org.dynmap.Log;
|
||||||
|
import org.dynmap.MapManager;
|
||||||
import org.dynmap.MapTile;
|
import org.dynmap.MapTile;
|
||||||
import org.dynmap.MapType;
|
import org.dynmap.MapType;
|
||||||
import org.dynmap.MapChunkCache;
|
import org.dynmap.MapChunkCache;
|
||||||
@ -45,7 +47,6 @@ public class KzedMap extends MapType {
|
|||||||
public static final int anchorz = 0;
|
public static final int anchorz = 0;
|
||||||
|
|
||||||
MapTileRenderer[] renderers;
|
MapTileRenderer[] renderers;
|
||||||
ZoomedTileRenderer zoomrenderer;
|
|
||||||
|
|
||||||
/* BufferedImage with direct access to its ARGB-formatted data buffer */
|
/* BufferedImage with direct access to its ARGB-formatted data buffer */
|
||||||
public static class KzedBufferedImage {
|
public static class KzedBufferedImage {
|
||||||
@ -67,13 +68,11 @@ public class KzedMap extends MapType {
|
|||||||
this.renderers = new MapTileRenderer[renderers.size()];
|
this.renderers = new MapTileRenderer[renderers.size()];
|
||||||
renderers.toArray(this.renderers);
|
renderers.toArray(this.renderers);
|
||||||
Log.info("Loaded " + renderers.size() + " renderers for map '" + getClass().toString() + "'.");
|
Log.info("Loaded " + renderers.size() + " renderers for map '" + getClass().toString() + "'.");
|
||||||
|
|
||||||
zoomrenderer = new ZoomedTileRenderer(configuration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MapTile[] getTiles(Location l) {
|
public MapTile[] getTiles(Location l) {
|
||||||
World world = l.getWorld();
|
DynmapWorld world = MapManager.mapman.getWorld(l.getWorld().getName());
|
||||||
|
|
||||||
int x = l.getBlockX();
|
int x = l.getBlockX();
|
||||||
int y = l.getBlockY();
|
int y = l.getBlockY();
|
||||||
@ -124,7 +123,7 @@ public class KzedMap extends MapType {
|
|||||||
public MapTile[] getAdjecentTiles(MapTile tile) {
|
public MapTile[] getAdjecentTiles(MapTile tile) {
|
||||||
if (tile instanceof KzedMapTile) {
|
if (tile instanceof KzedMapTile) {
|
||||||
KzedMapTile t = (KzedMapTile) tile;
|
KzedMapTile t = (KzedMapTile) tile;
|
||||||
World world = tile.getWorld();
|
DynmapWorld world = tile.getDynmapWorld();
|
||||||
MapTileRenderer renderer = t.renderer;
|
MapTileRenderer renderer = t.renderer;
|
||||||
return new MapTile[] {
|
return new MapTile[] {
|
||||||
new KzedMapTile(world, this, renderer, t.px - tileWidth, t.py),
|
new KzedMapTile(world, this, renderer, t.px - tileWidth, t.py),
|
||||||
@ -135,7 +134,7 @@ public class KzedMap extends MapType {
|
|||||||
return new MapTile[0];
|
return new MapTile[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTile(ArrayList<MapTile> tiles, World world, int px, int py) {
|
public void addTile(ArrayList<MapTile> tiles, DynmapWorld world, int px, int py) {
|
||||||
for (int i = 0; i < renderers.length; i++) {
|
for (int i = 0; i < renderers.length; i++) {
|
||||||
tiles.add(new KzedMapTile(world, this, renderers[i], px, py));
|
tiles.add(new KzedMapTile(world, this, renderers[i], px, py));
|
||||||
}
|
}
|
||||||
@ -229,10 +228,7 @@ public class KzedMap extends MapType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean render(MapChunkCache cache, MapTile tile, File outputFile) {
|
public boolean render(MapChunkCache cache, MapTile tile, File outputFile) {
|
||||||
if (tile instanceof KzedZoomedMapTile) {
|
if (tile instanceof KzedMapTile) {
|
||||||
zoomrenderer.render(cache, (KzedZoomedMapTile) tile, outputFile);
|
|
||||||
return true;
|
|
||||||
} else if (tile instanceof KzedMapTile) {
|
|
||||||
return ((KzedMapTile) tile).renderer.render(cache, (KzedMapTile) tile, outputFile);
|
return ((KzedMapTile) tile).renderer.render(cache, (KzedMapTile) tile, outputFile);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.dynmap.kzedmap;
|
package org.dynmap.kzedmap;
|
||||||
|
|
||||||
|
import org.dynmap.DynmapWorld;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -9,11 +10,13 @@ public class KzedMapTile extends MapTile {
|
|||||||
public KzedMap map;
|
public KzedMap map;
|
||||||
public MapTileRenderer renderer;
|
public MapTileRenderer renderer;
|
||||||
public int px, py;
|
public int px, py;
|
||||||
|
private String fname;
|
||||||
|
private String fname_day;
|
||||||
|
|
||||||
// Hack.
|
// Hack.
|
||||||
public File file = null;
|
public File file = null;
|
||||||
|
|
||||||
public KzedMapTile(World world, KzedMap map, MapTileRenderer renderer, int px, int py) {
|
public KzedMapTile(DynmapWorld world, KzedMap map, MapTileRenderer renderer, int px, int py) {
|
||||||
super(world, map);
|
super(world, map);
|
||||||
this.map = map;
|
this.map = map;
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
@ -23,12 +26,24 @@ public class KzedMapTile extends MapTile {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFilename() {
|
public String getFilename() {
|
||||||
return renderer.getName() + "_" + px + "_" + py + ".png";
|
if(fname == null) {
|
||||||
|
if(world.bigworld)
|
||||||
|
fname = renderer.getName() + "/" + (px >> 12) + '_' + (py >> 12) + '/' + px + "_" + py + ".png";
|
||||||
|
else
|
||||||
|
fname = renderer.getName() + "_" + px + "_" + py + ".png";
|
||||||
|
}
|
||||||
|
return fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDayFilename() {
|
public String getDayFilename() {
|
||||||
return renderer.getName() + "_day_" + px + "_" + py + ".png";
|
if(fname_day == null) {
|
||||||
|
if(world.bigworld)
|
||||||
|
fname_day = renderer.getName() + "_day/" + (px >> 12) + '_' + (py >> 12) + '/' + px + "_" + py + ".png";
|
||||||
|
else
|
||||||
|
fname_day = renderer.getName() + "_day_" + px + "_" + py + ".png";
|
||||||
|
}
|
||||||
|
return fname_day;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,22 +1,40 @@
|
|||||||
package org.dynmap.kzedmap;
|
package org.dynmap.kzedmap;
|
||||||
|
|
||||||
|
import org.dynmap.DynmapWorld;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.dynmap.MapTile;
|
import org.dynmap.MapTile;
|
||||||
|
|
||||||
public class KzedZoomedMapTile extends MapTile {
|
public class KzedZoomedMapTile extends MapTile {
|
||||||
|
private String fname;
|
||||||
|
private String fname_day;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFilename() {
|
public String getFilename() {
|
||||||
return "z" + originalTile.renderer.getName() + "_" + getTileX() + "_" + getTileY() + ".png";
|
if(fname == null) {
|
||||||
|
if(world.bigworld)
|
||||||
|
fname = "z" + originalTile.renderer.getName() + "/" + (getTileX()>>12) + '_' +
|
||||||
|
(getTileY() >> 12) + '/' + getTileX() + "_" + getTileY() + ".png";
|
||||||
|
else
|
||||||
|
fname = "z" + originalTile.renderer.getName() + "_" + getTileX() + "_" + getTileY() + ".png";
|
||||||
|
}
|
||||||
|
return fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDayFilename() {
|
public String getDayFilename() {
|
||||||
return "z" + originalTile.renderer.getName() + "_day_" + getTileX() + "_" + getTileY() + ".png";
|
if(fname_day == null) {
|
||||||
|
if(world.bigworld)
|
||||||
|
fname_day = "z" + originalTile.renderer.getName() + "_day/" + (getTileX()>>12) + '_' +
|
||||||
|
(getTileY() >> 12) + '/' + getTileX() + "_" + getTileY() + ".png";
|
||||||
|
else
|
||||||
|
fname_day = "z" + originalTile.renderer.getName() + "_day_" + getTileX() + "_" + getTileY() + ".png";
|
||||||
|
}
|
||||||
|
return fname_day;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KzedMapTile originalTile;
|
public KzedMapTile originalTile;
|
||||||
|
|
||||||
public KzedZoomedMapTile(World world, KzedMap map, KzedMapTile original) {
|
public KzedZoomedMapTile(DynmapWorld world, KzedMap map, KzedMapTile original) {
|
||||||
super(world, map);
|
super(world, map);
|
||||||
this.originalTile = original;
|
this.originalTile = original;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
package org.dynmap.kzedmap;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.dynmap.MapChunkCache;
|
|
||||||
public class ZoomedTileRenderer {
|
|
||||||
public ZoomedTileRenderer(Map<String, Object> configuration) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void render(MapChunkCache cache, final KzedZoomedMapTile zt, final File outputPath) {
|
|
||||||
return; /* Doing this in Default render, since image already loaded */
|
|
||||||
}
|
|
||||||
}
|
|
@ -29,6 +29,10 @@ FlatMapType.prototype = $.extend(new DynMapType(), {
|
|||||||
if(this.dynmap.map.mapTypes[this.dynmap.map.mapTypeId].nightandday && this.dynmap.serverday)
|
if(this.dynmap.map.mapTypes[this.dynmap.map.mapTypeId].nightandday && this.dynmap.serverday)
|
||||||
dnprefix = '_day';
|
dnprefix = '_day';
|
||||||
|
|
||||||
|
if(this.dynmap.world.bigworld)
|
||||||
|
tileName = this.prefix + dnprefix + '/' + (coord.x >> 5) + '_' + (coord.y >> 5) +
|
||||||
|
'/128_' + coord.x + '_' + coord.y + '.png';
|
||||||
|
else
|
||||||
tileName = this.prefix + dnprefix + '_128_' + coord.x + '_' + coord.y + '.png';
|
tileName = this.prefix + dnprefix + '_128_' + coord.x + '_' + coord.y + '.png';
|
||||||
imgSize = Math.pow(2, 7+zoom);
|
imgSize = Math.pow(2, 7+zoom);
|
||||||
var tile = $('<div/>')
|
var tile = $('<div/>')
|
||||||
|
@ -51,13 +51,27 @@ KzedMapType.prototype = $.extend(new DynMapType(), {
|
|||||||
// Most zoomed out tiles.
|
// Most zoomed out tiles.
|
||||||
tileSize = 128;
|
tileSize = 128;
|
||||||
imgSize = tileSize;
|
imgSize = tileSize;
|
||||||
|
if (this.dynmap.world.bigworld) {
|
||||||
|
tileName = 'z' + this.prefix + dnprefix + '/' + ((-coord.x * tileSize*2)>>12) +
|
||||||
|
'_' + ((coord.y * tileSize*2) >> 12) + '/' +
|
||||||
|
(-coord.x * tileSize*2) + '_' + (coord.y * tileSize*2) + '.png';
|
||||||
|
}
|
||||||
|
else {
|
||||||
tileName = 'z' + this.prefix + dnprefix + '_' + (-coord.x * tileSize*2) + '_' + (coord.y * tileSize*2) + '.png';
|
tileName = 'z' + this.prefix + dnprefix + '_' + (-coord.x * tileSize*2) + '_' + (coord.y * tileSize*2) + '.png';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Other zoom levels.
|
// Other zoom levels.
|
||||||
tileSize = 128;
|
tileSize = 128;
|
||||||
|
|
||||||
imgSize = Math.pow(2, 6+zoom);
|
imgSize = Math.pow(2, 6+zoom);
|
||||||
|
if(this.dynmap.world.bigworld) {
|
||||||
|
tileName = this.prefix + dnprefix + '/' + ((-coord.x*tileSize) >> 12) + '_' +
|
||||||
|
((coord.y*tileSize)>>12) + '/' +
|
||||||
|
(-coord.x*tileSize) + '_' + (coord.y*tileSize) + '.png';
|
||||||
|
}
|
||||||
|
else {
|
||||||
tileName = this.prefix + dnprefix + '_' + (-coord.x*tileSize) + '_' + (coord.y*tileSize) + '.png';
|
tileName = this.prefix + dnprefix + '_' + (-coord.x*tileSize) + '_' + (coord.y*tileSize) + '.png';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var img;
|
var img;
|
||||||
var tile = $('<div/>')
|
var tile = $('<div/>')
|
||||||
|
Loading…
Reference in New Issue
Block a user