mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 08:28:35 +00:00
Improve performance of various commands/actions
- Add chunk preloading to RegionVisitor if supplied with a suitable Extent - Where extents are used in masks, set EditSession as the extent as they are otherwise initialised with WorldWrapper that is very slow - Fixes #1073
This commit is contained in:
@ -549,7 +549,9 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
* @return the number of blocks that matched the mask
|
||||
*/
|
||||
default int countBlocks(Region region, Mask searchMask) {
|
||||
RegionVisitor visitor = new RegionVisitor(region, searchMask::test);
|
||||
//FAWE start > use slightly more performant RegionVisitor
|
||||
RegionVisitor visitor = new RegionVisitor(region, searchMask::test, this);
|
||||
//FAWE end
|
||||
Operations.completeBlindly(visitor);
|
||||
return visitor.getAffected();
|
||||
}
|
||||
@ -648,7 +650,9 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
|
||||
BlockReplace replace = new BlockReplace(this, pattern);
|
||||
RegionMaskingFilter filter = new RegionMaskingFilter(this, mask, replace);
|
||||
RegionVisitor visitor = new RegionVisitor(region, filter);
|
||||
//FAWE start > add extent to RegionVisitor to allow chunk preloading
|
||||
RegionVisitor visitor = new RegionVisitor(region, filter, this);
|
||||
//FAWE end
|
||||
Operations.completeLegacy(visitor);
|
||||
return visitor.getAffected();
|
||||
}
|
||||
|
Reference in New Issue
Block a user