Start isolating Bukkit dependencies, prep code for ports
This commit is contained in:
parent
4a25fcf706
commit
d149a8e048
42 changed files with 331 additions and 337 deletions
|
|
@ -1,8 +1,8 @@
|
|||
package org.dynmap.kzedmap;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ public class CaveTileRenderer extends DefaultTileRenderer {
|
|||
public boolean isNightAndDayEnabled() { return false; }
|
||||
|
||||
@Override
|
||||
protected void scan(World world, int seq, boolean isnether, final Color result, final Color result_day,
|
||||
protected void scan(DynmapWorld world, int seq, boolean isnether, final Color result, final Color result_day,
|
||||
MapIterator mapiter) {
|
||||
boolean air = true;
|
||||
int emitted = 0;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import java.util.HashSet;
|
|||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.dynmap.Client;
|
||||
import org.dynmap.Color;
|
||||
|
|
@ -119,8 +117,8 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||
}
|
||||
|
||||
public boolean render(MapChunkCache cache, KzedMapTile tile, File outputFile) {
|
||||
World world = tile.getWorld();
|
||||
boolean isnether = (world.getEnvironment() == Environment.NETHER);
|
||||
DynmapWorld world = tile.getDynmapWorld();
|
||||
boolean isnether = world.isNether();
|
||||
DynmapBufferedImage im = DynmapBufferedImage.allocateBufferedImage(KzedMap.tileWidth, KzedMap.tileHeight);
|
||||
DynmapBufferedImage zim = DynmapBufferedImage.allocateBufferedImage(KzedMap.tileWidth/2, KzedMap.tileHeight/2);
|
||||
|
||||
|
|
@ -278,7 +276,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + fname.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(mtile.getWorld(), new Client.Tile(mtile.getFilename()));
|
||||
MapManager.mapman.pushUpdate(mtile.getDynmapWorld(), new Client.Tile(mtile.getFilename()));
|
||||
hashman.updateHashCode(mtile.getKey(prefix), null, tx, ty, crc);
|
||||
updated_fname = true;
|
||||
didwrite = true;
|
||||
|
|
@ -309,7 +307,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + dfname.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(mtile.getWorld(), new Client.Tile(mtile.getDayFilename()));
|
||||
MapManager.mapman.pushUpdate(mtile.getDynmapWorld(), new Client.Tile(mtile.getDayFilename()));
|
||||
hashman.updateHashCode(mtile.getKey(prefix), "day", tx, ty, crc);
|
||||
updated_dfname = true;
|
||||
didwrite = true;
|
||||
|
|
@ -328,7 +326,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||
try {
|
||||
if(updated_fname || (!zoomFile.exists())) {
|
||||
saveZoomedTile(zmtile, zoomFile, zimg, ox, oy, null);
|
||||
MapManager.mapman.pushUpdate(zmtile.getWorld(),
|
||||
MapManager.mapman.pushUpdate(zmtile.getDynmapWorld(),
|
||||
new Client.Tile(zmtile.getFilename()));
|
||||
zmtile.getDynmapWorld().enqueueZoomOutUpdate(zoomFile);
|
||||
ztile_updated = true;
|
||||
|
|
@ -346,7 +344,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||
try {
|
||||
if(updated_dfname || (!zoomFile_day.exists())) {
|
||||
saveZoomedTile(zmtile, zoomFile_day, zimg_day, ox, oy, "day");
|
||||
MapManager.mapman.pushUpdate(zmtile.getWorld(),
|
||||
MapManager.mapman.pushUpdate(zmtile.getDynmapWorld(),
|
||||
new Client.Tile(zmtile.getDayFilename()));
|
||||
zmtile.getDynmapWorld().enqueueZoomOutUpdate(zoomFile_day);
|
||||
ztile_updated = true;
|
||||
|
|
@ -403,7 +401,7 @@ public class DefaultTileRenderer implements MapTileRenderer {
|
|||
zIm.flush();
|
||||
|
||||
}
|
||||
protected void scan(World world, int seq, boolean isnether, final Color result, final Color result_day,
|
||||
protected void scan(DynmapWorld world, int seq, boolean isnether, final Color result, final Color result_day,
|
||||
MapIterator mapiter) {
|
||||
int lightlevel = 15;
|
||||
int lightlevel_day = 15;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ package org.dynmap.kzedmap;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ public class HighlightTileRenderer extends DefaultTileRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void scan(World world,int seq, boolean isnether, final Color result, final Color result_day,
|
||||
protected void scan(DynmapWorld world,int seq, boolean isnether, final Color result, final Color result_day,
|
||||
MapIterator mapiter) {
|
||||
result.setTransparent();
|
||||
for (;;) {
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.MapTile;
|
||||
|
|
@ -50,12 +50,12 @@ public class KzedMap extends MapType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location l) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(l.getWorld().getName());
|
||||
public MapTile[] getTiles(DynmapLocation l) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(l.world);
|
||||
|
||||
int x = l.getBlockX();
|
||||
int y = l.getBlockY();
|
||||
int z = l.getBlockZ();
|
||||
int x = l.x;
|
||||
int y = l.y;
|
||||
int z = l.z;
|
||||
|
||||
int dx = x - anchorx;
|
||||
int dy = y - anchory;
|
||||
|
|
@ -99,18 +99,18 @@ public class KzedMap extends MapType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location loc0, Location loc1) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(loc0.getWorld().getName());
|
||||
public MapTile[] getTiles(DynmapLocation loc, int sx, int sy, int sz) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(loc.world);
|
||||
ArrayList<MapTile> tiles = new ArrayList<MapTile>();
|
||||
/* Transform both to tile coordinates */
|
||||
int dx = loc0.getBlockX() - anchorx;
|
||||
int dy = loc0.getBlockY() - anchory;
|
||||
int dz = loc0.getBlockZ() - anchorz;
|
||||
int dx = loc.x - anchorx;
|
||||
int dy = loc.y - anchory;
|
||||
int dz = loc.z - anchorz;
|
||||
int px0 = dx + dz;
|
||||
int py0 = dx - dz - dy;
|
||||
dx = loc0.getBlockX() - anchorx;
|
||||
dy = loc0.getBlockY() - anchory;
|
||||
dz = loc0.getBlockZ() - anchorz;
|
||||
dx = loc.x + sx - anchorx;
|
||||
dy = loc.y + sy - anchory;
|
||||
dz = loc.z + sz - anchorz;
|
||||
int px1 = dx + dz;
|
||||
int py1 = dx - dz - dy;
|
||||
/* Compute ranges */
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import java.io.File;
|
|||
import java.util.List;
|
||||
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.flat.FlatMap;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
|
||||
public class KzedMapTile extends MapTile {
|
||||
|
|
@ -83,7 +82,7 @@ public class KzedMapTile extends MapTile {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return px ^ py ^ map.getName().hashCode() ^ getWorld().getName().hashCode();
|
||||
return px ^ py ^ map.getName().hashCode() ^ world.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -95,15 +94,15 @@ public class KzedMapTile extends MapTile {
|
|||
}
|
||||
|
||||
public boolean equals(KzedMapTile o) {
|
||||
return o.px == px && o.py == py && (o.map == map) && (o.getWorld() == getWorld());
|
||||
return o.px == px && o.py == py && (o.map == map) && (o.world == world);
|
||||
}
|
||||
|
||||
public String getKey(String prefix) {
|
||||
return getWorld().getName() + "." + prefix;
|
||||
return world.getName() + "." + prefix;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getWorld().getName() + ":" + getFilename();
|
||||
return world.getName() + ":" + getFilename();
|
||||
}
|
||||
|
||||
public boolean render(MapChunkCache cache, String mapname) {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class KzedZoomedMapTile extends MapTile {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getFilename().hashCode() ^ getWorld().hashCode();
|
||||
return getFilename().hashCode() ^ world.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -86,7 +86,7 @@ public class KzedZoomedMapTile extends MapTile {
|
|||
|
||||
|
||||
public String getKey(String prefix) {
|
||||
return getWorld().getName() + ".z" + prefix;
|
||||
return world.getName() + ".z" + prefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue