summaryrefslogtreecommitdiffhomepage
path: root/patches/server/0289-Prevent-Enderman-from-loading-chunks.patch
blob: b467426b0bedbebf15eb80e7d05e394aa49b1190 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 18 Dec 2018 02:15:08 +0000
Subject: [PATCH] Prevent Enderman from loading chunks


diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index a8b3ae30d48173a699cd0e612df3d4de8a5d53e4..58c52872d07130825922bcde32011647d46e171f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -506,7 +506,8 @@ public class EnderMan extends Monster implements NeutralMob {
             int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 2.0D);
             int k = Mth.floor(this.enderman.getZ() - 1.0D + randomsource.nextDouble() * 2.0D);
             BlockPos blockposition = new BlockPos(i, j, k);
-            BlockState iblockdata = world.getBlockState(blockposition);
+            BlockState iblockdata = world.getBlockStateIfLoaded(blockposition); // Paper
+            if (iblockdata == null) return; // Paper
             BlockPos blockposition1 = blockposition.below();
             BlockState iblockdata1 = world.getBlockState(blockposition1);
             BlockState iblockdata2 = this.enderman.getCarriedBlock();
@@ -552,7 +553,8 @@ public class EnderMan extends Monster implements NeutralMob {
             int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 3.0D);
             int k = Mth.floor(this.enderman.getZ() - 2.0D + randomsource.nextDouble() * 4.0D);
             BlockPos blockposition = new BlockPos(i, j, k);
-            BlockState iblockdata = world.getBlockState(blockposition);
+            BlockState iblockdata = world.getBlockStateIfLoaded(blockposition); // Paper
+            if (iblockdata == null) return; // Paper
             Vec3 vec3d = new Vec3((double) this.enderman.getBlockX() + 0.5D, (double) j + 0.5D, (double) this.enderman.getBlockZ() + 0.5D);
             Vec3 vec3d1 = new Vec3((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D);
             BlockHitResult movingobjectpositionblock = world.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.enderman));