Skip to content

Commit

Permalink
change: unexposed enum values and added getById methods
Browse files Browse the repository at this point in the history
  • Loading branch information
NoJokeFNA committed Jun 19, 2022
1 parent 0750983 commit 282a3e0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ public enum Mirror {
LEFT_RIGHT,
FRONT_BACK;

public static final Mirror[] VALUES = values();
private static final Mirror[] VALUES = values();

public static Mirror getById(int index) {
return VALUES[index];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ public enum Mode {
COMPARE,
SUBTRACT;

public static final Mode[] VALUES = values();
private static final Mode[] VALUES = values();

public static Mode getById(int index) {
return VALUES[index];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@ public enum Rotation {
CLOCKWISE_180,
COUNTERCLOCKWISE_90;

public static final Rotation[] VALUES = values();
private static final Rotation[] VALUES = values();

public static Rotation getById(int index) {
return VALUES[index];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,17 @@ public void read() {
int z = readInt();
this.position = new Vector3i(x, y, z);
}
this.action = Action.VALUES[readVarInt()];
this.mode = Mode.VALUES[readVarInt()];
this.action = Action.getById(readVarInt());
this.mode = Mode.getById(readVarInt());
this.name = readString();
this.offsetX = readByte();
this.offsetY = readByte();
this.offsetZ = readByte();
this.sizeX = readByte();
this.sizeY = readByte();
this.sizeZ = readByte();
this.mirror = Mirror.VALUES[readVarInt()];
this.rotation = Rotation.VALUES[readVarInt()];
this.mirror = Mirror.getById(readVarInt());
this.rotation = Rotation.getById(readVarInt());
this.metadata = readString();
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_10)) {
this.integrity = readFloat();
Expand Down Expand Up @@ -368,6 +368,10 @@ public enum Action {
LOAD_THE_STRUCTURE,
DETECT_SIZE;

public static final Action[] VALUES = values();
private static final Action[] VALUES = values();

public static Action getById(int index) {
return VALUES[index];
}
}
}

0 comments on commit 282a3e0

Please sign in to comment.