Fix cursor getting stuck on edge of world bounds when looking inward from outside the bounds.

This commit is contained in:
David Vierra 2015-03-14 17:37:22 -10:00
parent 9478bdaf99
commit 01882cbae4

View File

@ -127,14 +127,18 @@ def _cast(origin, vector, maxDistance, stepSize):
def advanceToChunk(ray, dimension, maxDistance):
point, vector = ray
inBounds = point in dimension.bounds
for pos, face in _cast(point, vector, maxDistance, 16):
x, y, z = pos
x >>= 4
y >>= 4
z >>= 4
if pos not in dimension.bounds:
if inBounds and pos not in dimension.bounds:
raise RayBoundsError("Ray exited dimension bounds.")
inBounds = pos in dimension.bounds
if dimension.containsChunk(x, z):
chunk = dimension.getChunk(x, z)
section = chunk.getSection(y)