Auto stash before revert of "Cleanup"

This commit is contained in:
cyberpwn
2021-08-27 00:16:30 -04:00
parent 2aa240337c
commit 8ff5887955
28 changed files with 238 additions and 156 deletions

View File

@@ -380,12 +380,13 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* @return a new Cuboid outset by the given direction and amount
*/
public Cuboid outset(CuboidDirection dir, int amount) {
return switch (dir) {
Cuboid c = switch (dir) {
case Horizontal -> expand(CuboidDirection.North, amount).expand(CuboidDirection.South, amount).expand(CuboidDirection.East, amount).expand(CuboidDirection.West, amount);
case Vertical -> expand(CuboidDirection.Down, amount).expand(CuboidDirection.Up, amount);
case Both -> outset(CuboidDirection.Horizontal, amount).outset(CuboidDirection.Vertical, amount);
default -> throw new IllegalArgumentException("invalid direction " + dir);
};
return c;
}
/**

View File

@@ -68,7 +68,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
data = new NibbleArray(CAPACITY, i);
}
private void expand() {
private final void expand() {
if (bpb < 8) {
changeBitsPerBlock(bpb + 1);
} else {
@@ -90,7 +90,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
changeBitsPerBlock(targetBits);
}
private void changeBitsPerBlock(int bits) {
private final void changeBitsPerBlock(int bits) {
bpb = bits;
data = new NibbleArray(bpb, CAPACITY, data);
}
@@ -103,7 +103,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
return palette.get(data.get(getCoordinateIndex(x, y, z)));
}
private int getPaletteId(T d) {
private final int getPaletteId(T d) {
int index = palette.indexOf(d);
if (index == -1) {
@@ -118,7 +118,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
return index + Byte.MIN_VALUE;
}
private int getCoordinateIndex(int x, int y, int z) {
private final int getCoordinateIndex(int x, int y, int z) {
return y << 8 | z << 4 | x;
}
}