geforkt von Mirrors/FastAsyncWorldEdit
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);
|
Region adjustedRegion = new CuboidRegion(newMin, newMax);
|
||||||
return adjustedRegion.getChunks().stream()
|
return adjustedRegion.getChunks().stream()
|
||||||
.map(c -> BlockVector2.at(c.getX(), c.getZ()))
|
|
||||||
.sorted(Comparator
|
.sorted(Comparator
|
||||||
.comparingInt(BlockVector2::getZ)
|
.comparingInt(BlockVector2::getZ)
|
||||||
.thenComparingInt(BlockVector2::getX)) //needed for RegionLimitedWorldAccess
|
.thenComparingInt(BlockVector2::getX)) //needed for RegionLimitedWorldAccess
|
||||||
|
@ -93,7 +93,6 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
@Override
|
@Override
|
||||||
public Iterator<BlockVector2> iterator() {
|
public Iterator<BlockVector2> iterator() {
|
||||||
return new Iterator<>() {
|
return new Iterator<>() {
|
||||||
private final MutableBlockVector2 mutable = new MutableBlockVector2();
|
|
||||||
private boolean hasNext;
|
private boolean hasNext;
|
||||||
private int X;
|
private int X;
|
||||||
private int Z;
|
private int Z;
|
||||||
@ -131,9 +130,10 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockVector2 next() {
|
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();
|
init();
|
||||||
return mutable;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -377,12 +377,11 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
final int size = (maxX - minX + 1) * (maxZ - minZ + 1);
|
final int size = (maxX - minX + 1) * (maxZ - minZ + 1);
|
||||||
|
|
||||||
//FAWE start
|
//FAWE start
|
||||||
return new AbstractSet<BlockVector2>() {
|
return new AbstractSet<>() {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Iterator<BlockVector2> iterator() {
|
public Iterator<BlockVector2> iterator() {
|
||||||
return new Iterator<BlockVector2>() {
|
return new Iterator<>() {
|
||||||
final MutableBlockVector2 mutable = new MutableBlockVector2(0, 0);
|
|
||||||
|
|
||||||
final int bx = minX;
|
final int bx = minX;
|
||||||
final int bz = minZ;
|
final int bz = minZ;
|
||||||
@ -410,8 +409,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockVector2 next() {
|
public BlockVector2 next() {
|
||||||
mutable.mutX(x);
|
int curX = x;
|
||||||
mutable.mutZ(z);
|
int curZ = z;
|
||||||
if (++x > rtx) {
|
if (++x > rtx) {
|
||||||
if (++z > rtz) {
|
if (++z > rtz) {
|
||||||
if (x > tx) {
|
if (x > tx) {
|
||||||
@ -427,7 +426,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
}
|
}
|
||||||
x = tx;
|
x = tx;
|
||||||
hasNext = false;
|
hasNext = false;
|
||||||
return mutable;
|
return BlockVector2.at(curX, curZ);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
z = rbz;
|
z = rbz;
|
||||||
@ -442,7 +441,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
x = rbx;
|
x = rbx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mutable;
|
return BlockVector2.at(curX, curZ);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren