Chests are now empty when removed (so they longer drop their items). Profile debugging mode added that prints how long an operation took.

This commit is contained in:
sk89q
2010-11-16 00:15:06 -08:00
parent 6b368a38a2
commit c6033a7e1c
3 changed files with 44 additions and 0 deletions

View File

@@ -184,6 +184,32 @@ public class ServerInterface {
return true;
}
/**
* Clear a chest's contents.
*
* @param pt
*/
public static boolean clearChest(Vector pt) {
ComplexBlock cblock = etc.getServer().getComplexBlock(
pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
if (!(cblock instanceof Chest)) {
return false;
}
Chest chest = (Chest)cblock;
hj[] itemArray = chest.getArray();
// Find an existing slot to put it into
for (int i = 0; itemArray.length > i; i++) {
itemArray[i] = null;
}
chest.update();
return true;
}
/**
* Generate a tree at a location.
*