Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 18:10:08 +01:00
Don't do the unbelievable bad use of a MutableBlockVector2 in the creation of a set (#1825)
* Don't do the unbelievable bad use of a MutableBlockVector2 in the creation of a set - Fixes IntellectualSites/PlotSquared#3683 * Clean up remnants of the use of MutableBlockVector2
Dieser Commit ist enthalten in:
Ursprung
d2b4154cc0
Commit
907ad8528e
@ -440,7 +440,6 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
||||
);
|
||||
Region adjustedRegion = new CuboidRegion(newMin, newMax);
|
||||
return adjustedRegion.getChunks().stream()
|
||||
.map(c -> BlockVector2.at(c.getX(), c.getZ()))
|
||||
.sorted(Comparator
|
||||
.comparingInt(BlockVector2::getZ)
|
||||
.thenComparingInt(BlockVector2::getX)) //needed for RegionLimitedWorldAccess
|
||||
|
@ -93,7 +93,6 @@ public final class MemBlockSet extends BlockSet {
|
||||
@Override
|
||||
public Iterator<BlockVector2> iterator() {
|
||||
return new Iterator<>() {
|
||||
private final MutableBlockVector2 mutable = new MutableBlockVector2();
|
||||
private boolean hasNext;
|
||||
private int X;
|
||||
private int Z;
|
||||
@ -131,9 +130,10 @@ public final class MemBlockSet extends BlockSet {
|
||||
|
||||
@Override
|
||||
public BlockVector2 next() {
|
||||
mutable.setComponents(setX + getBlockOffsetX(), setZ + getBlockOffsetZ());
|
||||
// Maintain correct order of method call/variable use
|
||||
BlockVector2 result = BlockVector2.at(setX + getBlockOffsetX(), setZ + getBlockOffsetZ());
|
||||
init();
|
||||
return mutable;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -377,12 +377,11 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
final int size = (maxX - minX + 1) * (maxZ - minZ + 1);
|
||||
|
||||
//FAWE start
|
||||
return new AbstractSet<BlockVector2>() {
|
||||
return new AbstractSet<>() {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Iterator<BlockVector2> iterator() {
|
||||
return new Iterator<BlockVector2>() {
|
||||
final MutableBlockVector2 mutable = new MutableBlockVector2(0, 0);
|
||||
return new Iterator<>() {
|
||||
|
||||
final int bx = minX;
|
||||
final int bz = minZ;
|
||||
@ -410,8 +409,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
|
||||
@Override
|
||||
public BlockVector2 next() {
|
||||
mutable.mutX(x);
|
||||
mutable.mutZ(z);
|
||||
int curX = x;
|
||||
int curZ = z;
|
||||
if (++x > rtx) {
|
||||
if (++z > rtz) {
|
||||
if (x > tx) {
|
||||
@ -427,7 +426,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
}
|
||||
x = tx;
|
||||
hasNext = false;
|
||||
return mutable;
|
||||
return BlockVector2.at(curX, curZ);
|
||||
}
|
||||
} else {
|
||||
z = rbz;
|
||||
@ -442,7 +441,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
x = rbx;
|
||||
}
|
||||
}
|
||||
return mutable;
|
||||
return BlockVector2.at(curX, curZ);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren