fix a rare crash when the view is occluded by falling sand, fixes #443

This commit is contained in:
Leijurv 2019-06-05 14:26:26 -07:00
parent a6ea9ed3a6
commit aef84eceb8
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -169,6 +169,10 @@ public class MovementTraverse extends Movement {
if (dist < 0.83) { if (dist < 0.83) {
return state; return state;
} }
if (!state.getTarget().getRotation().isPresent()) {
// this can happen rarely when the server lags and doesn't send the falling sand entity until you've already walked through the block and are now mining the next one
return state;
}
// combine the yaw to the center of the destination, and the pitch to the specific block we're trying to break // combine the yaw to the center of the destination, and the pitch to the specific block we're trying to break
// it's safe to do this since the two blocks we break (in a traverse) are right on top of each other and so will have the same yaw // it's safe to do this since the two blocks we break (in a traverse) are right on top of each other and so will have the same yaw