Add support for greater-than-128 high worlds

This commit is contained in:
Mike Primm 2012-02-01 00:40:38 -06:00
parent 9d529de700
commit 417b8d6e31
2 changed files with 9 additions and 13 deletions

View File

@ -16,7 +16,7 @@ public class BukkitWorld extends DynmapWorld {
private static BlockLightLevel bll = new BlockLightLevel(); private static BlockLightLevel bll = new BlockLightLevel();
public BukkitWorld(World w) { public BukkitWorld(World w) {
super(w.getName()); super(w.getName(), w.getMaxHeight());
world = w; world = w;
} }

View File

@ -82,9 +82,11 @@ public class NewMapChunkCache implements MapChunkCache {
private int lastbiome_x = Integer.MIN_VALUE, lastbiome_z = Integer.MIN_VALUE; private int lastbiome_x = Integer.MIN_VALUE, lastbiome_z = Integer.MIN_VALUE;
private BiomeMap lastbiome; private BiomeMap lastbiome;
private int lastcountswamp_x = Integer.MIN_VALUE, lastcountswamp_z = Integer.MIN_VALUE, lastcountswamp; private int lastcountswamp_x = Integer.MIN_VALUE, lastcountswamp_z = Integer.MIN_VALUE, lastcountswamp;
private final int worldheight;
OurMapIterator(int x0, int y0, int z0) { OurMapIterator(int x0, int y0, int z0) {
initialize(x0, y0, z0); initialize(x0, y0, z0);
worldheight = w.getMaxHeight();
} }
public final void initialize(int x0, int y0, int z0) { public final void initialize(int x0, int y0, int z0) {
this.x = x0; this.x = x0;
@ -113,9 +115,6 @@ public class NewMapChunkCache implements MapChunkCache {
blkdata = snap.getBlockData(bx, y, bz); blkdata = snap.getBlockData(bx, y, bz);
return blkdata; return blkdata;
} }
public final int getHighestBlockYAt() {
return snap.getHighestBlockYAt(bx, bz);
}
public int getBlockSkyLight() { public int getBlockSkyLight() {
return snap.getBlockSkyLight(bx, y, bz); return snap.getBlockSkyLight(bx, y, bz);
} }
@ -293,7 +292,7 @@ public class NewMapChunkCache implements MapChunkCache {
return snap.getBlockTypeId(bx, y-1, bz); return snap.getBlockTypeId(bx, y-1, bz);
} }
else if(s == BlockStep.Y_PLUS) { else if(s == BlockStep.Y_PLUS) {
if(y < 127) if(y < (worldheight-1))
return snap.getBlockTypeId(bx, y+1, bz); return snap.getBlockTypeId(bx, y+1, bz);
} }
else { else {
@ -309,6 +308,10 @@ public class NewMapChunkCache implements MapChunkCache {
public BlockStep getLastStep() { public BlockStep getLastStep() {
return laststep; return laststep;
} }
@Override
public int getWorldHeight() {
return worldheight;
}
} }
private class OurEndMapIterator extends OurMapIterator { private class OurEndMapIterator extends OurMapIterator {
@ -716,13 +719,6 @@ public class NewMapChunkCache implements MapChunkCache {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim]; ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
return (byte)ss.getBlockData(x & 0xF, y, z & 0xF); return (byte)ss.getBlockData(x & 0xF, y, z & 0xF);
} }
/* Get highest block Y
*
*/
public int getHighestBlockYAt(int x, int z) {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
return ss.getHighestBlockYAt(x & 0xF, z & 0xF);
}
/* Get sky light level /* Get sky light level
*/ */
public int getBlockSkyLight(int x, int y, int z) { public int getBlockSkyLight(int x, int y, int z) {