Switch MCPC+ to using unloadChunkRequest - unloadChunk() seems to not clean up properly

This commit is contained in:
Mike Primm 2013-03-17 23:43:11 -05:00
parent bf16d18371
commit bee16ef331
5 changed files with 18 additions and 2 deletions

View File

@ -106,4 +106,8 @@ public abstract class BukkitVersionHelper {
* Get field value from NBT compound * Get field value from NBT compound
*/ */
public abstract Object getFieldValue(Object nbt, String field); public abstract Object getFieldValue(Object nbt, String field);
/**
* Unload chunk no save needed
*/
public abstract void unloadChunkNoSave(World w, int cx, int cz);
} }

View File

@ -95,5 +95,8 @@ public class BukkitVersionHelperBukkitForge extends BukkitVersionHelperGeneric {
} }
return true; return true;
} }
@Override
public void unloadChunkNoSave(World w, int cx, int cz) {
w.unloadChunkRequest(cx, cz);
}
} }

View File

@ -93,4 +93,9 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
nmst_y = getField(nms_tileentity, new String[] { "y" }, int.class); nmst_y = getField(nms_tileentity, new String[] { "y" }, int.class);
nmst_z = getField(nms_tileentity, new String[] { "z" }, int.class); nmst_z = getField(nms_tileentity, new String[] { "z" }, int.class);
} }
@Override
public void unloadChunkNoSave(World w, int cx, int cz) {
w.unloadChunk(cx, cz, false, false);
}
} }

View File

@ -88,4 +88,8 @@ public class BukkitVersionHelperMCPC extends BukkitVersionHelperGeneric {
nmst_y = getField(nms_tileentity, new String[] { "m" }, int.class); nmst_y = getField(nms_tileentity, new String[] { "m" }, int.class);
nmst_z = getField(nms_tileentity, new String[] { "n" }, int.class); nmst_z = getField(nms_tileentity, new String[] { "n" }, int.class);
} }
@Override
public void unloadChunkNoSave(World w, int cx, int cz) {
w.unloadChunkRequest(cx, cz);
}
} }

View File

@ -944,7 +944,7 @@ public class NewMapChunkCache implements MapChunkCache {
* while the actual in-use chunk area for a player where the chunks are managed * while the actual in-use chunk area for a player where the chunks are managed
* by the MC base server is 21x21 (or about a 160 block radius). * by the MC base server is 21x21 (or about a 160 block radius).
* Also, if we did generate it, need to save it */ * Also, if we did generate it, need to save it */
w.unloadChunk(chunk.x, chunk.z, false, false); helper.unloadChunkNoSave(w, chunk.x, chunk.z);
} }
else if (isunloadpending) { /* Else, if loaded and unload is pending */ else if (isunloadpending) { /* Else, if loaded and unload is pending */
w.unloadChunkRequest(chunk.x, chunk.z); /* Request new unload */ w.unloadChunkRequest(chunk.x, chunk.z); /* Request new unload */