mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 04:28:35 +00:00
remove mutability in clipboards (particularly clipboard pattern)
fixes #776
This commit is contained in:
@ -116,14 +116,8 @@ public class CPUOptimizedClipboard extends LinearClipboard {
|
||||
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) {
|
||||
return x + ((yLast == y) ? yLastI : (yLastI = (yLast = y) * getArea())) + ((zLast == z) ? zLastI
|
||||
: (zLastI = (zLast = z) * getWidth()));
|
||||
return x + y * getArea() + z * getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -324,8 +324,7 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -193,13 +193,8 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
||||
return nbtMap.values();
|
||||
}
|
||||
|
||||
private int ylast;
|
||||
private int ylasti;
|
||||
private int zlast;
|
||||
private int zlasti;
|
||||
|
||||
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
|
||||
|
Reference in New Issue
Block a user