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

@ -6,7 +6,7 @@ Subject: [PATCH] Prevent mob spawning from loading/generating chunks
also prevents if out of world border bounds
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 831799937d4e1f31dbf7caaf0c6b38762ccec127..86cdb9ea888b85424285fc26534dc7a7ad3610ac 100644
index 831799937d4e1f31dbf7caaf0c6b38762ccec127..94d2d83da52ce20f12a4e3f235f75d5c537ae9d1 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -196,9 +196,9 @@ public final class NaturalSpawner {
@ -14,7 +14,7 @@ index 831799937d4e1f31dbf7caaf0c6b38762ccec127..86cdb9ea888b85424285fc26534dc7a7
ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator();
int i = pos.getY();
- BlockState iblockdata = chunk.getBlockState(pos);
+ BlockState iblockdata = world.getTypeIfLoadedAndInBounds(pos); // Paper - don't load chunks for mob spawn
+ BlockState iblockdata = world.getBlockStateIfLoadedAndInBounds(pos); // Paper - don't load chunks for mob spawn
- if (!iblockdata.isRedstoneConductor(chunk, pos)) {
+ if (iblockdata != null && !iblockdata.isRedstoneConductor(chunk, pos)) { // Paper - don't load chunks for mob spawn