Merge pull request #3327 from scorbett123/fix-chunk-saving-crash

If context.player() returns none we don't want to use its position for pruning.
This commit is contained in:
Leijurv 2022-03-31 13:58:11 -07:00 committed by GitHub
commit 702d0790bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,7 +209,7 @@ public final class CachedWorld implements ICachedWorld, Helper {
private BlockPos guessPosition() { private BlockPos guessPosition() {
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) { for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
IWorldData data = ibaritone.getWorldProvider().getCurrentWorld(); IWorldData data = ibaritone.getWorldProvider().getCurrentWorld();
if (data != null && data.getCachedWorld() == this) { if (data != null && data.getCachedWorld() == this && ibaritone.getPlayerContext().player() != null) {
return ibaritone.getPlayerContext().playerFeet(); return ibaritone.getPlayerContext().playerFeet();
} }
} }