Added //fast mode, which allows the server to skip the dirtying of chunks. This means that you have to rejoin to see changes though, but most operations are doubled in speed.

This commit is contained in:
sk89q
2011-06-04 10:30:45 -07:00
parent d397460026
commit d881c14e2d
11 changed files with 514 additions and 23 deletions

View File

@ -87,15 +87,23 @@ public class EditSession {
* indicates no limit.
*/
private int maxBlocks = -1;
/**
* Indicates whether some types of blocks should be queued for best
* reproduction.
*/
private boolean queued = false;
/**
* Use the fast mode, which may leave chunks not flagged "dirty".
*/
private boolean fastMode = false;
/**
* Block bag to use for getting blocks.
*/
private BlockBag blockBag;
/**
* List of missing blocks;
*/
@ -185,11 +193,22 @@ public class EditSession {
}
}
}
boolean result;
boolean result = world.setBlockType(pt, id);
if (fastMode) {
result = world.setBlockTypeFast(pt, id);
} else {
result = world.setBlockType(pt, id);
}
if (id != 0) {
if (BlockType.usesData(id)) {
world.setBlockData(pt, block.getData());
if (existing != type && block.getData() > 0 && BlockType.usesData(id)) {
if (fastMode) {
world.setBlockDataFast(pt, block.getData());
} else {
world.setBlockData(pt, block.getData());
}
}
// Signs
@ -488,6 +507,24 @@ public class EditSession {
}
queued = false;
}
/**
* Set fast mode.
*
* @param fastMode
*/
public void setFastMode(boolean fastMode) {
this.fastMode = fastMode;
}
/**
* Return fast mode status.
*
* @return
*/
public boolean hasFastMode() {
return fastMode;
}
/**
* Finish off the queue.