Fix empty/null chunk section check in LevelChunk#getBlockData, rename… (#7039)

… patch and methods to make more sense with Mojang mappings
This commit is contained in:
Jason 2021-12-05 15:32:02 -08:00 committed by GitHub
parent 7c8fdc1fb6
commit fd263ef962
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 166 additions and 163 deletions

View file

@ -5,7 +5,7 @@ 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 c7714824d8e85087397047cf9bcb0528968b1f93..cfdb631500962ec19007db55bd4453687b91c2f8 100644
index c7714824d8e85087397047cf9bcb0528968b1f93..d47002d45dabd66f38d25d398d8943f4b911cdc5 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -490,7 +490,8 @@ public class EnderMan extends Monster implements NeutralMob {
@ -13,7 +13,7 @@ index c7714824d8e85087397047cf9bcb0528968b1f93..cfdb631500962ec19007db55bd445368
int k = Mth.floor(this.enderman.getZ() - 1.0D + random.nextDouble() * 2.0D);
BlockPos blockposition = new BlockPos(i, j, k);
- BlockState iblockdata = world.getBlockState(blockposition);
+ BlockState iblockdata = world.getTypeIfLoaded(blockposition); // Paper
+ BlockState iblockdata = world.getBlockStateIfLoaded(blockposition); // Paper
+ if (iblockdata == null) return; // Paper
BlockPos blockposition1 = blockposition.below();
BlockState iblockdata1 = world.getBlockState(blockposition1);
@ -23,7 +23,7 @@ index c7714824d8e85087397047cf9bcb0528968b1f93..cfdb631500962ec19007db55bd445368
int k = Mth.floor(this.enderman.getZ() - 2.0D + random.nextDouble() * 4.0D);
BlockPos blockposition = new BlockPos(i, j, k);
- BlockState iblockdata = world.getBlockState(blockposition);
+ BlockState iblockdata = world.getTypeIfLoaded(blockposition); // Paper
+ 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);