mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
remove mutability in clipboards (particularly clipboard pattern)
fixes #776
This commit is contained in:
parent
d4c0ab3790
commit
be44e1449c
@ -116,14 +116,8 @@ public class CPUOptimizedClipboard extends LinearClipboard {
|
|||||||
return nbtMapIndex.get(index);
|
return nbtMapIndex.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int yLast;
|
|
||||||
private int yLastI;
|
|
||||||
private int zLast;
|
|
||||||
private int zLastI;
|
|
||||||
|
|
||||||
public int getIndex(int x, int y, int z) {
|
public int getIndex(int x, int y, int z) {
|
||||||
return x + ((yLast == y) ? yLastI : (yLastI = (yLast = y) * getArea())) + ((zLast == z) ? zLastI
|
return x + y * getArea() + z * getWidth();
|
||||||
: (zLastI = (zLast = z) * getWidth()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -324,8 +324,7 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getIndex(int x, int y, int z) {
|
public int getIndex(int x, int y, int z) {
|
||||||
return x + (ylast == y ? ylasti : (ylasti = (ylast = y) * getArea())) + (zlast == z
|
return x + y * getArea() + z * getWidth();
|
||||||
? zlasti : (zlasti = (zlast = z) * getWidth()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -193,13 +193,8 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
|||||||
return nbtMap.values();
|
return nbtMap.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int ylast;
|
|
||||||
private int ylasti;
|
|
||||||
private int zlast;
|
|
||||||
private int zlasti;
|
|
||||||
|
|
||||||
public int getIndex(int x, int y, int z) {
|
public int getIndex(int x, int y, int z) {
|
||||||
return x + ((ylast == y) ? ylasti : (ylasti = (ylast = y) * getArea())) + ((zlast == z) ? zlasti : (zlasti = (zlast = z) * getWidth()));
|
return x + y * getArea() + z * getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,7 +32,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
public class RepeatingExtentPattern extends AbstractExtentPattern {
|
public class RepeatingExtentPattern extends AbstractExtentPattern {
|
||||||
|
|
||||||
private final BlockVector3 size;
|
private final BlockVector3 size;
|
||||||
private final MutableBlockVector3 mutable;
|
|
||||||
private BlockVector3 origin;
|
private BlockVector3 origin;
|
||||||
private BlockVector3 offset;
|
private BlockVector3 offset;
|
||||||
|
|
||||||
@ -47,7 +46,6 @@ public class RepeatingExtentPattern extends AbstractExtentPattern {
|
|||||||
setOrigin(origin);
|
setOrigin(origin);
|
||||||
setOffset(offset);
|
setOffset(offset);
|
||||||
size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1);
|
size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1);
|
||||||
this.mutable = new MutableBlockVector3();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,7 +91,7 @@ public class RepeatingExtentPattern extends AbstractExtentPattern {
|
|||||||
int x = Math.abs(position.getX() + offset.getX()) % size.getBlockX() + origin.getX();
|
int x = Math.abs(position.getX() + offset.getX()) % size.getBlockX() + origin.getX();
|
||||||
int y = Math.abs(position.getY() + offset.getY()) % size.getBlockY() + origin.getY();
|
int y = Math.abs(position.getY() + offset.getY()) % size.getBlockY() + origin.getY();
|
||||||
int z = Math.abs(position.getZ() + offset.getZ()) % size.getBlockZ() + origin.getZ();
|
int z = Math.abs(position.getZ() + offset.getZ()) % size.getBlockZ() + origin.getZ();
|
||||||
return getExtent().getFullBlock(mutable.setComponents(x, y, z));
|
return getExtent().getFullBlock(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user