mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 19:25:15 +01:00
Try fix for getHighestBlockY() not working as advertised
This commit is contained in:
parent
50f7382b7a
commit
ecdb50920e
@ -4,6 +4,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
@ -31,8 +32,8 @@ public class NewMapChunkCache implements MapChunkCache {
|
|||||||
private static Method gethandle = null;
|
private static Method gethandle = null;
|
||||||
private static Method removeentities = null;
|
private static Method removeentities = null;
|
||||||
private static Method getworldhandle = null;
|
private static Method getworldhandle = null;
|
||||||
private static Field chunkbiome = null;
|
|
||||||
private static boolean use_spout = false;
|
private static boolean use_spout = false;
|
||||||
|
private static boolean use_sections = false;
|
||||||
|
|
||||||
private World w;
|
private World w;
|
||||||
private DynmapWorld dw;
|
private DynmapWorld dw;
|
||||||
@ -532,15 +533,13 @@ public class NewMapChunkCache implements MapChunkCache {
|
|||||||
} catch (ClassNotFoundException cnfx) {
|
} catch (ClassNotFoundException cnfx) {
|
||||||
} catch (NoSuchMethodException nsmx) {
|
} catch (NoSuchMethodException nsmx) {
|
||||||
}
|
}
|
||||||
|
/* Check for ChunkSnapshot.isSectionEmpty(int) method */
|
||||||
/* Get CraftChunkSnapshot.biome field */
|
|
||||||
try {
|
try {
|
||||||
Class c = Class.forName("org.bukkit.craftbukkit.CraftChunkSnapshot");
|
ChunkSnapshot.class.getDeclaredMethod("isSectionEmpty", new Class[] { int.class });
|
||||||
chunkbiome = c.getDeclaredField("biome");
|
use_sections = true;
|
||||||
chunkbiome.setAccessible(true);
|
} catch (NoSuchMethodException nsmx) {
|
||||||
} catch (ClassNotFoundException cnfx) {
|
|
||||||
} catch (NoSuchFieldException nsmx) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
use_spout = DynmapPlugin.plugin.hasSpout();
|
use_spout = DynmapPlugin.plugin.hasSpout();
|
||||||
|
|
||||||
init = true;
|
init = true;
|
||||||
@ -799,25 +798,18 @@ public class NewMapChunkCache implements MapChunkCache {
|
|||||||
isSectionNotEmpty[idx] = new boolean[nsect + 1];
|
isSectionNotEmpty[idx] = new boolean[nsect + 1];
|
||||||
int maxy = 0;
|
int maxy = 0;
|
||||||
if(snaparray[idx] != EMPTY) {
|
if(snaparray[idx] != EMPTY) {
|
||||||
/* Get max height */
|
if(!use_sections) {
|
||||||
if(dw.isNether()) {
|
Arrays.fill(isSectionNotEmpty[idx], true);
|
||||||
maxy = 128;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(int i = 0; i < 16; i++) {
|
for(int i = 0; i < nsect; i++) {
|
||||||
for(int j = 0; j < 16; j++) {
|
if(snaparray[idx].isSectionEmpty(i) == false) {
|
||||||
maxy = Math.max(maxy, snaparray[idx].getHighestBlockYAt(i, j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
maxy = (maxy-1) >> 4;
|
|
||||||
for(int i = 0; i <= nsect; i++) {
|
|
||||||
if(i <= maxy) { /* Below top? */
|
|
||||||
isSectionNotEmpty[idx][i] = true;
|
isSectionNotEmpty[idx][i] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public boolean isEmptySection(int sx, int sy, int sz) {
|
public boolean isEmptySection(int sx, int sy, int sz) {
|
||||||
int idx = (sx - x_min) + (sz - z_min) * x_dim;
|
int idx = (sx - x_min) + (sz - z_min) * x_dim;
|
||||||
if(isSectionNotEmpty[idx] == null) {
|
if(isSectionNotEmpty[idx] == null) {
|
||||||
@ -901,8 +893,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
|||||||
public boolean setChunkDataTypes(boolean blockdata, boolean biome, boolean highestblocky, boolean rawbiome) {
|
public boolean setChunkDataTypes(boolean blockdata, boolean biome, boolean highestblocky, boolean rawbiome) {
|
||||||
this.biome = biome;
|
this.biome = biome;
|
||||||
this.biomeraw = rawbiome;
|
this.biomeraw = rawbiome;
|
||||||
//this.highesty = highestblocky;
|
this.highesty = highestblocky;
|
||||||
this.highesty = true;
|
|
||||||
this.blockdata = blockdata;
|
this.blockdata = blockdata;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user