Do not add passengers of entities that were above save limit (#5073)

Co-authored-by: Spottedleaf <spottedleaf@spottedleaf.dev>
This commit is contained in:
Jason 2021-01-16 16:05:33 -08:00 committed by GitHub
parent cb99288a5b
commit d6f730655a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ index c5495e02c3fe271b26f62ea2ec64e07957edf37e..234d2daecc5d0bf6a99c0a5f4a87f947
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 8e7da2c5f3852920ec5fbcdd2bff4d299e6aa499..060ef42bc8f22688071fa375bd4dbab8dd2c1e9e 100644 index 8e7da2c5f3852920ec5fbcdd2bff4d299e6aa499..f51bf71c8d6eef3c054ac64765709794fcfad5ee 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -495,11 +495,22 @@ public class ChunkRegionLoader { @@ -495,11 +495,22 @@ public class ChunkRegionLoader {
@ -80,7 +80,7 @@ index 8e7da2c5f3852920ec5fbcdd2bff4d299e6aa499..060ef42bc8f22688071fa375bd4dbab8
+ final int saveLimit = world.paperConfig.entityPerChunkSaveLimits.getOrDefault(entityType, -1); + final int saveLimit = world.paperConfig.entityPerChunkSaveLimits.getOrDefault(entityType, -1);
+ if (saveLimit > -1) { + if (saveLimit > -1) {
+ if (loadedEntityCounts.getOrDefault(entityType, 0) >= saveLimit) { + if (loadedEntityCounts.getOrDefault(entityType, 0) >= saveLimit) {
+ return entity; + return null;
+ } + }
+ loadedEntityCounts.merge(entityType, 1, Integer::sum); + loadedEntityCounts.merge(entityType, 1, Integer::sum);
+ } + }