Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ See the patches list below.
[WindSpigot-0017] Configurable fishing rod speed multiplier

[PandaSpigot-0115] Break up and make tab spam limits configurable
[PandaSpigot-0072] Fix Bugs with Spigot Mob Spawn Logic
[PandaSpigot-0105] Fix SPIGOT-2622: Only one player receiving the server shutdown message
[PandaSpigot-0060] Backport SPIGOT-5428: Better handling of some ItemMeta
[PandaSpigot-0130] Backport Fix SPIGOT-3348: Skin Cache Bug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,23 @@ public SpawnerCreature() {
}

// Spigot start - get entity count only from chunks being processed in b
private int getEntityCount(WorldServer server, Class oClass) {
// PandaSpigot start - use entire world, not just active chunks. Spigot broke vanilla expectations.
int sum = 0;
for (Chunk c : server.chunkProviderServer.chunks.values()) {
sum += c.entityCount.getInt(oClass); // SportPaper: trove -> fastutil
}
return sum;
// PandaSpigot end
// int i = 0;
// Iterator<Long> it = this.b.iterator();
// while ( it.hasNext() )
// {
// Long coord = it.next();
// int x = LongHash.msw( coord );
// int z = LongHash.lsw( coord );
// if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) )
// {
// i += server.getChunkAt( x, z ).entityCount.get( oClass );
// }
// }
// return i;
private int getEntityCount(WorldServer server, Class<? extends IAnimal> oClass) {
int i = 0;
Iterator<Long> it = this.b.iterator();
while (it.hasNext()) {
Long coord = it.next();
int x = LongHash.msw(coord);
int z = LongHash.lsw(coord);
if (!server.chunkProviderServer.unloadQueue.contains(coord) && server.isChunkLoaded(x, z, true)) {
// FalchusSpigot start
Chunk chunk = server.getChunkAt(x, z);
if (chunk != null) {
// FalchusSpigot end
i += chunk.entityCount.getInt(oClass);
}
}
}
return i;
}
// Spigot end

Expand All @@ -58,7 +54,7 @@ public int a(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2
while (iterator.hasNext()) {
EntityHuman entityhuman = iterator.next();

if (!entityhuman.isSpectator() || !entityhuman.affectsSpawning) { // PaperSpigot
if (!entityhuman.isSpectator() && entityhuman.affectsSpawning) { // PaperSpigot
int l = MathHelper.floor(entityhuman.locX / 16.0D);

j = MathHelper.floor(entityhuman.locZ / 16.0D);
Expand Down Expand Up @@ -129,10 +125,10 @@ public int a(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2
* CraftBukkit - use per-world limits
*/

if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 289) { // PandaSpigot - use 17x17 like vanilla (a at top of file)
if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / a) {
Iterator iterator1 = this.b.iterator();

int moblimit = (limit * i / 289) - mobcnt + 1; // Spigot - up to 1 more than limit // PandaSpigot - use 17x17 like vanilla (a at top of file)
int moblimit = (limit * i / a) - mobcnt + 1; // Spigot - up to 1 more than limit
label115: while (iterator1.hasNext() && (moblimit > 0)) { // Spigot - while more allowed
// CraftBukkit start = use LongHash
// and LongObjectHashMap
Expand Down
Loading