mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-21 07:09:21 +08:00
64840b3018
Fix NPE when setting a player's spectator target
36 lines
2.4 KiB
Diff
36 lines
2.4 KiB
Diff
From f5d5bd26cd99def1285340bd7914b8b93449fa72 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Wed, 12 Sep 2018 21:12:57 -0400
|
|
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/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
index 387570ed..fb57cb83 100644
|
|
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
@@ -129,9 +129,9 @@ public final class SpawnerCreature {
|
|
int i2 = blockposition1.getX();
|
|
int j2 = blockposition1.getY();
|
|
int k2 = blockposition1.getZ();
|
|
- IBlockData iblockdata = worldserver.getType(blockposition1);
|
|
+ IBlockData iblockdata = worldserver.getTypeIfLoadedAndInBounds(blockposition1); // Paper - don't load chunks for mob spawn
|
|
|
|
- if (!iblockdata.isOccluding()) {
|
|
+ if (iblockdata != null && !iblockdata.isOccluding()) { // Paper - don't load chunks for mob spawn
|
|
int l2 = 0;
|
|
int i3 = 0;
|
|
|
|
@@ -167,7 +167,7 @@ public final class SpawnerCreature {
|
|
i4 = biomebase_biomemeta.c + worldserver.random.nextInt(1 + biomebase_biomemeta.d - biomebase_biomemeta.c);
|
|
}
|
|
|
|
- if (worldserver.a(enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition)) {
|
|
+ if (worldserver.isLoadedAndInBounds(blockposition_mutableblockposition) && worldserver.a(enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn
|
|
EntityPositionTypes.Surface entitypositiontypes_surface = EntityPositionTypes.a(biomebase_biomemeta.b);
|
|
if (entitypositiontypes_surface != null && a(entitypositiontypes_surface, worldserver, blockposition_mutableblockposition, biomebase_biomemeta.b)) {
|
|
EntityInsentient entityinsentient;
|
|
--
|
|
2.19.1
|
|
|