Skip to content

Commit 9fa1b89

Browse files
authored
[1.20.4] FastVector Y level assertion causes soft-locks (#109)
Closes #108 This pull request removes the Y level assertion for the FastVector, allows undefined behavior to happen outside the range instead of crashing the client
1 parent d841059 commit 9fa1b89

File tree

1 file changed

+0
-3
lines changed
  • common/src/main/kotlin/com/lambda/util/world

1 file changed

+0
-3
lines changed

common/src/main/kotlin/com/lambda/util/world/Position.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,14 @@ internal const val Y_MASK = (1L shl Y_BITS) - 1L
4747

4848
internal const val MIN_X = -(1L shl X_BITS - 1)
4949
internal const val MIN_Z = -(1L shl Z_BITS - 1)
50-
internal const val MIN_Y = -(1L shl Y_BITS - 1)
5150
internal const val MAX_X = (1L shl X_BITS - 1) - 1L
5251
internal const val MAX_Z = (1L shl Z_BITS - 1) - 1L
53-
internal const val MAX_Y = (1L shl Y_BITS - 1) - 1L
5452

5553
/**
5654
* Creates a new position from the given coordinates.
5755
*/
5856
fun fastVectorOf(x: Long, y: Long, z: Long): FastVector {
5957
require(x in MIN_X..MAX_X) { "X coordinate out of bounds for $X_BITS bits: $x" }
60-
require(y in MIN_Y..MAX_Y) { "Y coordinate out of bounds for $Y_BITS bits: $y" }
6158
require(z in MIN_Z..MAX_Z) { "Z coordinate out of bounds for $Z_BITS bits: $z" }
6259

6360
return ((x and X_MASK) shl X_SHIFT) or ((z and Z_MASK) shl Z_SHIFT) or (y and Y_MASK)

0 commit comments

Comments
 (0)