Start isolating Bukkit dependencies, prep code for ports
This commit is contained in:
parent
6cfeee152c
commit
42418edf1f
42 changed files with 331 additions and 337 deletions
|
|
@ -1,9 +1,7 @@
|
|||
package org.dynmap.hdmap;
|
||||
|
||||
import static org.dynmap.JSONUtils.s;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ColorScheme;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
package org.dynmap.hdmap;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ColorScheme;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.hdmap.DefaultHDShader.BiomeColorOption;
|
||||
import org.json.simple.JSONObject;
|
||||
import static org.dynmap.JSONUtils.s;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@ package org.dynmap.hdmap;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package org.dynmap.hdmap;
|
||||
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public interface HDLighting {
|
||||
|
|
|
|||
|
|
@ -6,24 +6,19 @@ import static org.dynmap.JSONUtils.s;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
||||
import org.dynmap.Client;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapPlugin;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.MapType;
|
||||
import org.dynmap.debug.Debug;
|
||||
import org.dynmap.kzedmap.MapTileRenderer;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.TileFlags;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.avaje.ebean.text.StringParser;
|
||||
|
||||
public class HDMap extends MapType {
|
||||
|
||||
private String name;
|
||||
|
|
@ -133,13 +128,13 @@ public class HDMap extends MapType {
|
|||
public HDLighting getLighting() { return lighting; }
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location loc) {
|
||||
public MapTile[] getTiles(DynmapLocation loc) {
|
||||
return perspective.getTiles(loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location loc0, Location loc1) {
|
||||
return perspective.getTiles(loc0, loc1);
|
||||
public MapTile[] getTiles(DynmapLocation loc, int sx, int sy, int sz) {
|
||||
return perspective.getTiles(loc, sx, sy, sz);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -324,7 +319,7 @@ public class HDMap extends MapType {
|
|||
/* Otherwise, delete tile */
|
||||
f.delete();
|
||||
/* Push updates, clear hash code, and signal zoom tile update */
|
||||
MapManager.mapman.pushUpdate(world.world,
|
||||
MapManager.mapman.pushUpdate(world,
|
||||
new Client.Tile(day?tile.getDayFilename(prefix, getImageFormat()):tile.getFilename(prefix, getImageFormat())));
|
||||
MapManager.mapman.hashman.updateHashCode(tile.getKey(prefix), day?"day":null, tile.tx, tile.ty, -1);
|
||||
world.enqueueZoomOutUpdate(f);
|
||||
|
|
|
|||
|
|
@ -1,23 +1,15 @@
|
|||
package org.dynmap.hdmap;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapPlugin;
|
||||
import org.dynmap.DynmapWorld;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.MapType;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
|
|
@ -122,7 +114,7 @@ public class HDMapManager {
|
|||
* Initialize shader states for all shaders for given tile
|
||||
*/
|
||||
public HDShaderState[] getShaderStateForTile(HDMapTile tile, MapChunkCache cache, MapIterator mapiter, String mapname) {
|
||||
DynmapWorld w = MapManager.mapman.worldsLookup.get(tile.getWorld().getName());
|
||||
DynmapWorld w = MapManager.mapman.worldsLookup.get(tile.getDynmapWorld().getName());
|
||||
if(w == null) return new HDShaderState[0];
|
||||
ArrayList<HDShaderState> shaders = new ArrayList<HDShaderState>();
|
||||
for(MapType map : w.maps) {
|
||||
|
|
@ -163,7 +155,7 @@ public class HDMapManager {
|
|||
private HashMap<String, boolean[]> cached_data_flags_by_world_perspective = new HashMap<String, boolean[]>();
|
||||
|
||||
private boolean[] getCachedFlags(HDMapTile t) {
|
||||
String w = t.getWorld().getName();
|
||||
String w = t.getDynmapWorld().getName();
|
||||
String k = w + "/" + t.perspective.getName();
|
||||
boolean[] flags = cached_data_flags_by_world_perspective.get(k);
|
||||
if(flags != null)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import org.dynmap.MapType;
|
|||
|
||||
import java.util.List;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.kzedmap.KzedMap;
|
||||
import org.dynmap.kzedmap.MapTileRenderer;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
|
||||
public class HDMapTile extends MapTile {
|
||||
|
|
@ -58,7 +56,7 @@ public class HDMapTile extends MapTile {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return tx ^ ty ^ perspective.getName().hashCode() ^ getWorld().getName().hashCode();
|
||||
return tx ^ ty ^ perspective.getName().hashCode() ^ world.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -70,16 +68,16 @@ public class HDMapTile extends MapTile {
|
|||
}
|
||||
|
||||
public boolean equals(HDMapTile o) {
|
||||
return o.tx == tx && o.ty == ty && (perspective == o.perspective) && (o.getWorld() == getWorld());
|
||||
return o.tx == tx && o.ty == ty && (perspective == o.perspective) && (o.world == world);
|
||||
}
|
||||
|
||||
public String getKey(String prefix) {
|
||||
return getWorld().getName() + "." + prefix;
|
||||
return world.getName() + "." + prefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getWorld().getName() + ":" + getFilename();
|
||||
return world.getName() + ":" + getFilename();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ package org.dynmap.hdmap;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.json.simple.JSONObject;
|
||||
|
|
@ -12,9 +12,9 @@ public interface HDPerspective {
|
|||
/* Get name of perspective */
|
||||
String getName();
|
||||
/* Get tiles invalidated by change at given location */
|
||||
MapTile[] getTiles(Location loc);
|
||||
MapTile[] getTiles(DynmapLocation loc);
|
||||
/* Get tiles invalidated by change at given volume, defined by 2 opposite corner locations */
|
||||
MapTile[] getTiles(Location loc0, Location loc1);
|
||||
MapTile[] getTiles(DynmapLocation loc0, int sx, int sy, int sz);
|
||||
/* Get tiles adjacent to given tile */
|
||||
MapTile[] getAdjecentTiles(MapTile tile);
|
||||
/* Get chunks needed for given tile */
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package org.dynmap.hdmap;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package org.dynmap.hdmap;
|
||||
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.utils.Vector3D;
|
||||
|
||||
/**
|
||||
* This interface is used to define the operational state of a renderer during raytracing
|
||||
|
|
|
|||
|
|
@ -10,14 +10,11 @@ import java.util.Collections;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.dynmap.Client;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapLocation;
|
||||
import org.dynmap.DynmapPlugin.CompassMode;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
|
|
@ -29,7 +26,6 @@ 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;
|
||||
import org.dynmap.utils.DynmapBufferedImage;
|
||||
import org.dynmap.utils.FileLockManager;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
|
|
@ -74,18 +70,12 @@ public class IsoHDPerspective implements HDPerspective {
|
|||
public static final double MAX_SCALE = 64;
|
||||
public static final double MIN_SCALE = 1;
|
||||
|
||||
private boolean need_skylightlevel = false;
|
||||
private boolean need_emittedlightlevel = false;
|
||||
private boolean need_biomedata = false;
|
||||
private boolean need_rawbiomedata = false;
|
||||
|
||||
private static final int CHEST_BLKTYPEID = 54;
|
||||
private static final int FENCE_BLKTYPEID = 85;
|
||||
private static final int REDSTONE_BLKTYPEID = 55;
|
||||
private static final int IRONFENCE_BLKTYPEID = 101;
|
||||
private static final int GLASSPANE_BLKTYPEID = 102;
|
||||
private static final int FENCEGATE_BLKTYPEID = 107;
|
||||
private static final int NETHERFENCE_BLKTYPEID = 113;
|
||||
|
||||
private enum ChestData {
|
||||
SINGLE_WEST, SINGLE_SOUTH, SINGLE_EAST, SINGLE_NORTH, LEFT_WEST, LEFT_SOUTH, LEFT_EAST, LEFT_NORTH, RIGHT_WEST, RIGHT_SOUTH, RIGHT_EAST, RIGHT_NORTH
|
||||
|
|
@ -826,8 +816,8 @@ public class IsoHDPerspective implements HDPerspective {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MapTile[] getTiles(Location loc) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(loc.getWorld().getName());
|
||||
public MapTile[] getTiles(DynmapLocation loc) {
|
||||
DynmapWorld world = MapManager.mapman.getWorld(loc.world);
|
||||
HashSet<MapTile> tiles = new HashSet<MapTile>();
|
||||
Vector3D block = new Vector3D();
|
||||
block.setFromLocation(loc); /* Get coordinate for block */
|
||||
|
|
@ -853,35 +843,17 @@ public class IsoHDPerspective implements HDPerspective {
|
|||
}
|
||||
|
||||
@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);
|
||||
HashSet<MapTile> tiles = new HashSet<MapTile>();
|
||||
Vector3D blocks[] = new Vector3D[] { new Vector3D(), new Vector3D() };
|
||||
/* Get ordered point - 0=minX,Y,Z, 1=maxX,Y,Z */
|
||||
if(loc0.getBlockX() < loc1.getBlockX()) {
|
||||
blocks[0].x = loc0.getBlockX() - 1;
|
||||
blocks[1].x = loc1.getBlockX() + 1;
|
||||
}
|
||||
else {
|
||||
blocks[0].x = loc1.getBlockX() - 1;
|
||||
blocks[1].x = loc0.getBlockX() + 1;
|
||||
}
|
||||
if(loc0.getBlockY() < loc1.getBlockY()) {
|
||||
blocks[0].y = loc0.getBlockY() - 1;
|
||||
blocks[1].y = loc1.getBlockY() + 1;
|
||||
}
|
||||
else {
|
||||
blocks[0].y = loc1.getBlockY() - 1;
|
||||
blocks[1].y = loc0.getBlockY() + 1;
|
||||
}
|
||||
if(loc0.getBlockZ() < loc1.getBlockZ()) {
|
||||
blocks[0].z = loc0.getBlockZ() - 1;
|
||||
blocks[1].z = loc1.getBlockZ() + 1;
|
||||
}
|
||||
else {
|
||||
blocks[0].z = loc1.getBlockZ() - 1;
|
||||
blocks[1].z = loc0.getBlockZ() + 1;
|
||||
}
|
||||
blocks[0].x = loc.x - 1;
|
||||
blocks[0].y = loc.y - 1;
|
||||
blocks[0].z = loc.z - 1;
|
||||
blocks[1].x = loc.x + sx;
|
||||
blocks[1].y = loc.y + sy;
|
||||
blocks[1].z = loc.z + sz;
|
||||
|
||||
Vector3D corner = new Vector3D();
|
||||
Vector3D tcorner = new Vector3D();
|
||||
int mintilex = Integer.MAX_VALUE;
|
||||
|
|
@ -1089,7 +1061,7 @@ public class IsoHDPerspective implements HDPerspective {
|
|||
if(numshaders == 0)
|
||||
return false;
|
||||
/* Check if nether world */
|
||||
boolean isnether = tile.getWorld().getEnvironment() == Environment.NETHER;
|
||||
boolean isnether = tile.getDynmapWorld().isNether();
|
||||
/* Create buffered image for each */
|
||||
DynmapBufferedImage im[] = new DynmapBufferedImage[numshaders];
|
||||
DynmapBufferedImage dayim[] = new DynmapBufferedImage[numshaders];
|
||||
|
|
@ -1100,12 +1072,7 @@ public class IsoHDPerspective implements HDPerspective {
|
|||
int bgnight[] = new int[numshaders];
|
||||
|
||||
for(int i = 0; i < numshaders; i++) {
|
||||
HDShader shader = shaderstate[i].getShader();
|
||||
HDLighting lighting = shaderstate[i].getLighting();
|
||||
if(shader.isEmittedLightLevelNeeded() || lighting.isEmittedLightLevelNeeded())
|
||||
need_emittedlightlevel = true;
|
||||
if(shader.isSkyLightLevelNeeded() || lighting.isSkyLightLevelNeeded())
|
||||
need_skylightlevel = true;
|
||||
im[i] = DynmapBufferedImage.allocateBufferedImage(tileWidth, tileHeight);
|
||||
argb_buf[i] = im[i].argb_buf;
|
||||
if(lighting.isNightAndDayEnabled()) {
|
||||
|
|
@ -1196,7 +1163,7 @@ public class IsoHDPerspective implements HDPerspective {
|
|||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + f.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(tile.getWorld(), new Client.Tile(fname));
|
||||
MapManager.mapman.pushUpdate(tile.getDynmapWorld(), new Client.Tile(fname));
|
||||
hashman.updateHashCode(tile.getKey(prefix), null, tile.tx, tile.ty, crc);
|
||||
tile.getDynmapWorld().enqueueZoomOutUpdate(f);
|
||||
tile_update = true;
|
||||
|
|
@ -1229,7 +1196,7 @@ public class IsoHDPerspective implements HDPerspective {
|
|||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + f.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(tile.getWorld(), new Client.Tile(fname));
|
||||
MapManager.mapman.pushUpdate(tile.getDynmapWorld(), new Client.Tile(fname));
|
||||
hashman.updateHashCode(tile.getKey(prefix), "day", tile.tx, tile.ty, crc);
|
||||
tile.getDynmapWorld().enqueueZoomOutUpdate(f);
|
||||
tile_update = true;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
package org.dynmap.hdmap;
|
||||
|
||||
import static org.dynmap.JSONUtils.s;
|
||||
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.Log;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class ShadowHDLighting extends DefaultHDLighting {
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import java.awt.image.BufferedImage;
|
|||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
@ -21,7 +19,6 @@ import java.util.zip.ZipFile;
|
|||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
|
|
@ -30,7 +27,6 @@ import org.dynmap.Log;
|
|||
import org.dynmap.MapManager;
|
||||
import org.dynmap.utils.DynmapBufferedImage;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
import org.dynmap.kzedmap.KzedMap;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package org.dynmap.hdmap;
|
|||
|
||||
import static org.dynmap.JSONUtils.s;
|
||||
|
||||
import org.bukkit.World.Environment;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.Log;
|
||||
|
|
|
|||
|
|
@ -2,11 +2,9 @@ package org.dynmap.hdmap;
|
|||
|
||||
import static org.dynmap.JSONUtils.s;
|
||||
|
||||
import org.bukkit.World.Environment;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue