remove Fast2DIterator

This commit is contained in:
MattBDev 2019-07-30 15:27:59 -04:00
parent 0d2b0025ce
commit cb03ed2fe8
3 changed files with 9 additions and 10 deletions

View File

@ -22,7 +22,6 @@ package com.sk89q.worldedit.command;
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION; import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.visitor.Fast2DIterator;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
@ -141,14 +140,14 @@ public class BiomeCommands {
Region region = session.getSelection(world); Region region = session.getSelection(world);
if (region instanceof FlatRegion) { if (region instanceof FlatRegion) {
for (BlockVector2 pt : new Fast2DIterator(((FlatRegion) region).asFlatRegion(), editSession)) { for (BlockVector2 pt : ((FlatRegion) region).asFlatRegion()) {
biomes.add(world.getBiome(pt)); biomes.add(world.getBiome(pt));
} }
} else { } else {
RegionVisitor visitor = new RegionVisitor(region, position -> { RegionVisitor visitor = new RegionVisitor(region, position -> {
biomes.add(world.getBiome(position.toBlockVector2())); biomes.add(world.getBiome(position.toBlockVector2()));
return true; return true;
}, editSession); });
Operations.completeBlindly(visitor); Operations.completeBlindly(visitor);
} }

View File

@ -20,6 +20,7 @@
package com.sk89q.worldedit.function.visitor; package com.sk89q.worldedit.function.visitor;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
@ -58,6 +59,9 @@ public class RegionVisitor implements Operation {
this.iterable = iterable; this.iterable = iterable;
} }
public RegionVisitor(Region region, RegionFunction regionFunction, EditSession editSession) {
}
/** /**
* Get the number of affected objects. * Get the number of affected objects.
* *

View File

@ -19,8 +19,6 @@
package com.sk89q.worldedit.math.convolution; package com.sk89q.worldedit.math.convolution;
import com.boydti.fawe.object.visitor.Fast2DIterator;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
@ -34,7 +32,6 @@ import com.sk89q.worldedit.registry.state.PropertyGroup;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.Iterator; import java.util.Iterator;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -93,11 +90,10 @@ public class HeightMap {
BlockVector3 min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
int bx = min.getBlockX(); int bx = min.getBlockX();
int bz = min.getBlockZ(); int bz = min.getBlockZ();
Iterable<BlockVector2> flat = Regions.asFlatRegion(region).asFlatRegion(); Iterator<BlockVector2> flat = Regions.asFlatRegion(region).asFlatRegion().iterator();
Iterator<BlockVector2> iter = new Fast2DIterator(flat, session).iterator();
int layer = 0; int layer = 0;
while (iter.hasNext()) { while (flat.hasNext()) {
BlockVector2 pos = iter.next(); BlockVector2 pos = flat.next();
int x = pos.getBlockX(); int x = pos.getBlockX();
int z = pos.getBlockZ(); int z = pos.getBlockZ();
layer = session.getNearestSurfaceLayer(x, z, (layer + 7) >> 3, 0, maxY); layer = session.getNearestSurfaceLayer(x, z, (layer + 7) >> 3, 0, maxY);