Paper/Spigot-Server-Patches/0414-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch
2020-02-10 22:35:46 -06:00

24 lines
1.3 KiB
Diff

From 480b09577ea0a64c67a7b18d6e2477db7c837ec2 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/server/BehaviorSleep.java b/src/main/java/net/minecraft/server/BehaviorSleep.java
index fa575dde1..dfe0f6650 100644
--- a/src/main/java/net/minecraft/server/BehaviorSleep.java
+++ b/src/main/java/net/minecraft/server/BehaviorSleep.java
@@ -31,7 +31,8 @@ public class BehaviorSleep extends Behavior<EntityLiving> {
if (optional.isPresent() && worldserver.getTime() - ((MinecraftSerializableLong) optional.get()).a() < 100L) {
return false;
} else {
- IBlockData iblockdata = worldserver.getType(globalpos.getBlockPosition());
+ IBlockData iblockdata = worldserver.getTypeIfLoaded(globalpos.getBlockPosition()); // Paper
+ if(iblockdata == null) return false; // Paper
return globalpos.getBlockPosition().a((IPosition) entityliving.getPositionVector(), 2.0D) && iblockdata.getBlock().a(TagsBlock.BEDS) && !(Boolean) iblockdata.get(BlockBed.OCCUPIED);
}
--
2.25.0