This commit is contained in:
cyberpwn
2021-08-26 06:35:12 -04:00
parent 44d75d9955
commit 2aa240337c
27 changed files with 146 additions and 232 deletions

View File

@@ -380,13 +380,12 @@ 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) {
Cuboid c = switch (dir) {
return 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 final void expand() {
private void expand() {
if (bpb < 8) {
changeBitsPerBlock(bpb + 1);
} else {
@@ -90,7 +90,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
changeBitsPerBlock(targetBits);
}
private final void changeBitsPerBlock(int bits) {
private 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 final int getPaletteId(T d) {
private 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 final int getCoordinateIndex(int x, int y, int z) {
private int getCoordinateIndex(int x, int y, int z) {
return y << 8 | z << 4 | x;
}
}