Revert chunk load change - but still make sure they don't unload under us

This commit is contained in:
Mike Primm 2013-05-10 17:36:27 -05:00
parent fe83a7d1cc
commit d4aaa1d1fd

View file

@ -858,34 +858,18 @@ public class NewMapChunkCache implements MapChunkCache {
wasLoaded = true; wasLoaded = true;
} }
try { try {
if (!wasLoaded) { didload = w.loadChunk(chunk.x, chunk.z, false);
didload = w.loadChunk(chunk.x, chunk.z, false);
}
else { /* If already was loaded, no need to load */
didload = true;
}
} catch (Throwable t) { /* Catch chunk error from Bukkit */ } catch (Throwable t) { /* Catch chunk error from Bukkit */
Log.warning("Bukkit error loading chunk " + chunk.x + "," + chunk.z + " on " + w.getName()); Log.warning("Bukkit error loading chunk " + chunk.x + "," + chunk.z + " on " + w.getName());
if(!wasLoaded) { /* If wasn't loaded, we loaded it if it now is */ if(!wasLoaded) { /* If wasn't loaded, we loaded it if it now is */
didload = w.isChunkLoaded(chunk.x, chunk.z); didload = w.isChunkLoaded(chunk.x, chunk.z);
} }
} }
boolean didgenerate = false;
/* If it did load, make cache of it */ /* If it did load, make cache of it */
if(didload) { if(didload) {
tileData = new DynIntHashMap(); tileData = new DynIntHashMap();
Chunk c = w.getChunkAt(chunk.x, chunk.z); /* Get the chunk */ Chunk c = w.getChunkAt(chunk.x, chunk.z); /* Get the chunk */
/* Test if chunk isn't populated */
boolean populated = true;
//TODO: figure out why this doesn't appear to be reliable in Bukkit
//if((nmschunk != null) && (doneflag != null)) {
// try {
// populated = doneflag.getBoolean(nmschunk);
// } catch (IllegalArgumentException e) {
// } catch (IllegalAccessException e) {
// }
//}
if(!vis) { if(!vis) {
if(hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN) if(hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN)
ss = STONE; ss = STONE;
@ -894,9 +878,6 @@ public class NewMapChunkCache implements MapChunkCache {
else else
ss = EMPTY; ss = EMPTY;
} }
else if(!populated) { /* If not populated, treat as empty */
ss = EMPTY;
}
else { else {
if(blockdata || highesty) { if(blockdata || highesty) {
ss = c.getChunkSnapshot(highesty, biome, biomeraw); ss = c.getChunkSnapshot(highesty, biome, biomeraw);
@ -905,7 +886,7 @@ public class NewMapChunkCache implements MapChunkCache {
} }
/* Get tile entity data */ /* Get tile entity data */
List<Object> vals = new ArrayList<Object>(); List<Object> vals = new ArrayList<Object>();
Map tileents = helper.getTileEntitiesForChunk(c); Map<?,?> tileents = helper.getTileEntitiesForChunk(c);
for(Object t : tileents.values()) { for(Object t : tileents.values()) {
int te_x = helper.getTileEntityX(t); int te_x = helper.getTileEntityX(t);
int te_y = helper.getTileEntityY(t); int te_y = helper.getTileEntityY(t);