PaperMC/patches/server-remapped/0388-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch
Mariell Hoversholm a207d14a0e
Rename all patches to correct numbering scheme
Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-06-11 15:46:44 +02:00

20 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Callahan <mr.callahhh@gmail.com>
Date: Mon, 13 Jan 2020 23:47:28 -0600
Subject: [PATCH] Prevent sync chunk loads when villagers try to find beds
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java
index 5151c794985a135d3bd794bbafdf524ab9f670de..9a582fb4b96b2d0406cc86e473e8bf8c4e488e37 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java
@@ -46,7 +46,8 @@ public class SleepInBed extends Behavior<LivingEntity> {
}
}
- BlockState iblockdata = world.getBlockState(globalpos.getBlockPosition());
+ BlockState iblockdata = world.getTypeIfLoaded(globalpos.getBlockPosition()); // Paper
+ if (iblockdata == null) { return false; } // Paper
return globalpos.getBlockPosition().a((Position) entity.position(), 2.0D) && iblockdata.getBlock().is((Tag) BlockTags.BEDS) && !(Boolean) iblockdata.getValue(BedBlock.OCCUPIED);
}