Clarify exception messages for invalid view distances (#7510)

This commit is contained in:
Noah van der Aa 2022-03-04 11:23:28 +01:00
parent a9bcb9deed
commit 0e75816bcf

View file

@ -326,7 +326,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ public void setSendDistance(final int distance) {
+ if (distance != -1 && (distance < MIN_VIEW_DISTANCE || distance > MAX_VIEW_DISTANCE + 1)) {
+ throw new IllegalArgumentException(Integer.toString(distance));
+ throw new IllegalArgumentException("Send distance must be a number between " + MIN_VIEW_DISTANCE + " and " + (MAX_VIEW_DISTANCE + 1) + ", or -1, got: " + distance);
+ }
+ this.rawSendDistance = distance;
+ }
@ -338,7 +338,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ public void setLoadDistance(final int distance) {
+ if (distance != -1 && (distance < MIN_VIEW_DISTANCE || distance > MAX_VIEW_DISTANCE + 1)) {
+ throw new IllegalArgumentException(Integer.toString(distance));
+ throw new IllegalArgumentException("Load distance must be a number between " + MIN_VIEW_DISTANCE + " and " + (MAX_VIEW_DISTANCE + 1) + ", or -1, got: " + distance);
+ }
+ this.rawLoadDistance = distance;
+ }
@ -349,7 +349,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ public void setTickDistance(final int distance) {
+ if (distance < MIN_VIEW_DISTANCE || distance > MAX_VIEW_DISTANCE) {
+ throw new IllegalArgumentException(Integer.toString(distance));
+ throw new IllegalArgumentException("View distance must be a number between " + MIN_VIEW_DISTANCE + " and " + MAX_VIEW_DISTANCE + ", got: " + distance);
+ }
+ this.rawTickDistance = distance;
+ }
@ -942,7 +942,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ public void setTargetSendViewDistance(final int distance) {
+ if (distance != -1 && (distance < MIN_VIEW_DISTANCE || distance > MAX_VIEW_DISTANCE + 1)) {
+ throw new IllegalArgumentException(Integer.toString(distance));
+ throw new IllegalArgumentException("Send view distance must be a number between " + MIN_VIEW_DISTANCE + " and " + (MAX_VIEW_DISTANCE + 1) + " or -1, got: " + distance);
+ }
+ this.sendViewDistance = distance;
+ }
@ -953,7 +953,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ public void setTargetNoTickViewDistance(final int distance) {
+ if (distance != -1 && (distance < MIN_VIEW_DISTANCE || distance > MAX_VIEW_DISTANCE)) {
+ throw new IllegalArgumentException(Integer.toString(distance));
+ throw new IllegalArgumentException("Simulation distance must be a number between " + MIN_VIEW_DISTANCE + " and " + MAX_VIEW_DISTANCE + " or -1, got: " + distance);
+ }
+ this.loadViewDistance = distance == -1 ? -1 : distance + 1;
+ }
@ -964,7 +964,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ public void setTargetTickViewDistance(final int distance) {
+ if (distance != -1 && (distance < MIN_VIEW_DISTANCE || distance > MAX_VIEW_DISTANCE)) {
+ throw new IllegalArgumentException(Integer.toString(distance));
+ throw new IllegalArgumentException("View distance must be a number between " + MIN_VIEW_DISTANCE + " and " + MAX_VIEW_DISTANCE + " or -1, got: " + distance);
+ }
+ this.tickViewDistance = distance;
+ }