Fix mob spawn limits

This commit is contained in:
Aikar 2018-08-26 21:21:28 -04:00
parent 835bc39b03
commit c677a1e520
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE

View file

@ -1,4 +1,4 @@
From 23a40a084921d02b074659229d6b03d7fd331700 Mon Sep 17 00:00:00 2001
From fa807b36de0c4f45acd8cc57912b446dc7b65860 Mon Sep 17 00:00:00 2001
From: Colin Godsey <crgodsey@gmail.com>
Date: Wed, 8 Aug 2018 10:10:06 -0600
Subject: [PATCH] Cache World Entity Type counts
@ -133,7 +133,7 @@ index 0000000000..35104542c5
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index de34a70e9b..5e87ee9726 100644
index 4252e8c02a..2b1affd03c 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -124,6 +124,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -170,7 +170,7 @@ index 79e52f7bac..42f6a6a93a 100644
return this.e;
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 32808558bb..0a57b26551 100644
index 32808558bb..62b4c64f68 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -114,7 +114,7 @@ public final class SpawnerCreature {
@ -178,7 +178,7 @@ index 32808558bb..0a57b26551 100644
if ((!enumcreaturetype.c() || flag1) && (enumcreaturetype.c() || flag) && (!enumcreaturetype.d() || flag2)) {
k = limit * i / SpawnerCreature.b; // CraftBukkit - use per-world limits
- int l1 = worldserver.a(enumcreaturetype.a(), k);
+ int l1 = k = worldserver.entityList.getCreatureCount(enumcreaturetype); // Paper - entity count cache
+ int l1 = worldserver.entityList.getCreatureCount(enumcreaturetype); // Paper - entity count cache
if (l1 <= k) {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();