mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Add basic preloading (#1221)
This commit is contained in:
@ -1408,11 +1408,13 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
|
||||
// Pick how we're going to visit blocks
|
||||
RecursiveVisitor visitor;
|
||||
//FAWE start - provide extent for preloading
|
||||
if (recursive) {
|
||||
visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1));
|
||||
visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1), this);
|
||||
} else {
|
||||
visitor = new DownwardVisitor(mask, replace, origin.getBlockY(), (int) (radius * 2 + 1));
|
||||
visitor = new DownwardVisitor(mask, replace, origin.getBlockY(), (int) (radius * 2 + 1), this);
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
// Start at the origin
|
||||
visitor.visit(origin);
|
||||
@ -1667,7 +1669,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
int minY = region.getMinimumPoint().getBlockY();
|
||||
int maxY = Math.min(getMaximumPoint().getBlockY(), region.getMaximumPoint().getBlockY() + 1);
|
||||
SurfaceRegionFunction surface = new SurfaceRegionFunction(this, offset, minY, maxY);
|
||||
FlatRegionVisitor visitor = new FlatRegionVisitor(asFlatRegion(region), surface);
|
||||
FlatRegionVisitor visitor = new FlatRegionVisitor(asFlatRegion(region), surface, this);
|
||||
//FAWE end
|
||||
Operations.completeBlindly(visitor);
|
||||
return this.changes = visitor.getAffected();
|
||||
@ -1686,7 +1688,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
|
||||
Naturalizer naturalizer = new Naturalizer(this);
|
||||
FlatRegion flatRegion = Regions.asFlatRegion(region);
|
||||
LayerVisitor visitor = new LayerVisitor(flatRegion, minimumBlockY(region), maximumBlockY(region), naturalizer);
|
||||
//FAWE start - provide extent for preloading
|
||||
LayerVisitor visitor = new LayerVisitor(flatRegion, minimumBlockY(region), maximumBlockY(region), naturalizer, this);
|
||||
//FAWE end
|
||||
Operations.completeBlindly(visitor);
|
||||
return this.changes = naturalizer.getAffected();
|
||||
}
|
||||
@ -1937,7 +1941,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
} else {
|
||||
replace = new BlockReplace(this, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1));
|
||||
//FAWE start - provide extent for preloading
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1), this);
|
||||
//FAWE end
|
||||
|
||||
// Around the origin in a 3x3 block
|
||||
for (BlockVector3 position : CuboidRegion.fromCenter(origin, 1)) {
|
||||
@ -1980,7 +1986,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
);
|
||||
|
||||
BlockReplace replace = new BlockReplace(this, fluid.getDefaultState());
|
||||
NonRisingVisitor visitor = new NonRisingVisitor(mask, replace);
|
||||
//FAWE start - provide extent for preloading
|
||||
NonRisingVisitor visitor = new NonRisingVisitor(mask, replace, Integer.MAX_VALUE, this);
|
||||
//FAWE end
|
||||
|
||||
// Around the origin in a 3x3 block
|
||||
for (BlockVector3 position : CuboidRegion.fromCenter(origin, 1)) {
|
||||
@ -2586,7 +2594,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
checkNotNull(region);
|
||||
|
||||
SnowSimulator snowSimulator = new SnowSimulator(this, stack);
|
||||
LayerVisitor layerVisitor = new LayerVisitor(region, region.getMinimumY(), region.getMaximumY(), snowSimulator);
|
||||
//FAWE start - provide extent for preloading
|
||||
LayerVisitor layerVisitor = new LayerVisitor(region, region.getMinimumY(), region.getMaximumY(), snowSimulator, this);
|
||||
//FAWE end
|
||||
Operations.completeLegacy(layerVisitor);
|
||||
return snowSimulator.getAffected();
|
||||
}
|
||||
@ -2698,7 +2708,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
);
|
||||
|
||||
GroundFunction ground = new GroundFunction(new ExistingBlockMask(this), generator);
|
||||
LayerVisitor visitor = new LayerVisitor(region, minimumBlockY(region), maximumBlockY(region), ground);
|
||||
LayerVisitor visitor = new LayerVisitor(region, minimumBlockY(region), maximumBlockY(region), ground, this);
|
||||
visitor.setMask(new NoiseFilter2D(new RandomNoise(), density));
|
||||
Operations.completeLegacy(visitor);
|
||||
return this.changes = ground.getAffected();
|
||||
@ -2732,7 +2742,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
public int makeForest(Region region, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException {
|
||||
ForestGenerator generator = new ForestGenerator(this, treeType);
|
||||
GroundFunction ground = new GroundFunction(new ExistingBlockMask(this), generator);
|
||||
LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground);
|
||||
//FAWE start - provide extent for preloading
|
||||
LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground, this);
|
||||
//FAWE end
|
||||
visitor.setMask(new NoiseFilter2D(new RandomNoise(), density));
|
||||
Operations.completeLegacy(visitor);
|
||||
return ground.getAffected();
|
||||
|
Reference in New Issue
Block a user