Remove unneeded mob spawn cap patch - Fixes #235

I misread the code and thought the code kept looping until the mob spawn cap was hit.

Upon furthur review, this is not true, so this patch doesn't do anything sane.
This commit is contained in:
Aikar 2016-05-27 21:35:28 -04:00
parent 13492455a1
commit fe18b38aea
27 changed files with 63 additions and 115 deletions

View File

@ -1,52 +0,0 @@
From 665309dc76ad50bb5c79f50fcbf48cdcf5bc92f4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 15 Apr 2016 21:27:14 -0400
Subject: [PATCH] Allow capping number of attempts at spawning mobs
By default, this logic would loop endlessly trying to fill the world
with entities until it hits the worlds spawn.
This patch will cap the # of attempts to so that the tick does not spend
extra long time on mob spawning
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6a235d1..d470e75 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -320,4 +320,18 @@ public class PaperWorldConfig {
private void useVanillaScoreboardColoring() {
useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false);
}
+
+ public int maxMobSpawnAttempts;
+ private void maxMobSpawnAttempts() {
+ maxMobSpawnAttempts = getInt("max-mob-spawn-attempts", 250);
+ log( "Max Mob Spawn Attempts: " + maxMobSpawnAttempts);
+ if (maxMobSpawnAttempts < 0) {
+ maxMobSpawnAttempts = Integer.MAX_VALUE;
+ } else {
+ if (maxMobSpawnAttempts < 250 && PaperConfig.version < 10) {
+ set("max-mob-spawn-attempts", 250);
+ maxMobSpawnAttempts = 250;
+ }
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index a034db2..113a372 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -140,8 +140,9 @@ public final class SpawnerCreature {
Iterator iterator1 = this.b.iterator();
int moblimit = (limit * i / 256) - mobcnt + 1; // Spigot - up to 1 more than limit
+ int maxMobSpawnAttempts = worldserver.paperConfig.maxMobSpawnAttempts; // Paper - max attempts
label120:
- while (iterator1.hasNext() && (moblimit > 0)) { // Spigot - while more allowed
+ while (iterator1.hasNext() && (moblimit > 0) && maxMobSpawnAttempts-- > 0) { // Spigot - while more allowed // Paper - max attempts
// CraftBukkit start = use LongHash and LongObjectHashMap
long key = ((Long) iterator1.next()).longValue();
BlockPosition blockposition1 = getRandomPosition(worldserver, LongHash.msw(key), LongHash.lsw(key));
--
2.8.2

View File

@ -1,4 +1,4 @@
From 6af571f68b3d32ada3218e9406e09087329afe9c Mon Sep 17 00:00:00 2001
From b068d063f98eb23fa58eda1e26f9874ba159a304 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 16 Apr 2016 00:39:33 -0400
Subject: [PATCH] Configurable RCON IP address
@ -19,5 +19,5 @@ index 8309a99..3a6561a 100644
if (0 == this.h) {
this.h = this.i + 10;
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 24a5d2b07f91ca93ea021402ebbd2c51bc2010b1 Mon Sep 17 00:00:00 2001
From 6869070acce7a2ed7a821bb157c34db70de22c6c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 17 Apr 2016 17:27:09 -0400
Subject: [PATCH] Prevent Fire from loading chunks
@ -45,5 +45,5 @@ index cb11099..951f0cf 100644
return i;
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 36de0ebaee44a6c862e91ce02328130379638d41 Mon Sep 17 00:00:00 2001
From 94406909cbd42e589bd2380c3de9d308fa53c9df Mon Sep 17 00:00:00 2001
From: Isaac Moore <rmsy@me.com>
Date: Tue, 19 Apr 2016 14:09:31 -0500
Subject: [PATCH] Implement PlayerLocaleChangeEvent
@ -49,5 +49,5 @@ index 7568fc8..d23cade 100644
@Override
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 2ecdfc5475eb3774493dbfc05aee7822b79b2333 Mon Sep 17 00:00:00 2001
From 34d571332952449b1187a9afe61f565ac0575944 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 01:43:11 -0500
Subject: [PATCH] EntityRegainHealthEvent isFastRegen API
@ -41,5 +41,5 @@ index df5fbeb..ebadb37 100644
this.foodTickTimer = 0;
}
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,16 +1,16 @@
From 40dda2d897571e1d1bbc27d767096ba0ac6c0ffd Mon Sep 17 00:00:00 2001
From 928b12e8cc7000f5cd8cb3cb4a2ef5efce65798e Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Thu, 21 Apr 2016 23:51:55 -0700
Subject: [PATCH] Add ability to configure frosted_ice properties
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d470e75..ccc11a8 100644
index 6a235d1..cc307c4 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -334,4 +334,14 @@ public class PaperWorldConfig {
}
}
@@ -320,4 +320,14 @@ public class PaperWorldConfig {
private void useVanillaScoreboardColoring() {
useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false);
}
+
+ public boolean frostedIceEnabled = true;
@ -44,5 +44,5 @@ index 8f502b9..bddfea0 100644
}
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 76ee96877676bceaed80df78b73f2a327b8573c6 Mon Sep 17 00:00:00 2001
From 7c0576f1a381b34355c782f0cb34303143d7ca98 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 18:20:05 -0500
Subject: [PATCH] Vehicle Event Cancellation Changes
@ -90,5 +90,5 @@ index b2dc764..2374a35 100644
return this.bv().size() < 1;
}
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From bb373b3b0dad597e4f58085441298a085988ec94 Mon Sep 17 00:00:00 2001
From 7fa53b55160cf63907e2ff84cf3ed9e1783882af Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Fri, 4 Mar 2016 03:16:11 -0500
Subject: [PATCH] Arrow pickup rule API
@ -54,5 +54,5 @@ index 2a3482c..fbf289f 100644
private final Arrow.Spigot spigot = new Arrow.Spigot()
{
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 96f6ebe5e1b8a63789ffffb307ef1cf856c434de Mon Sep 17 00:00:00 2001
From a02b0089dead6bcbc2103c847cc067855b6aef72 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 20:34:21 -0500
Subject: [PATCH] Check entity count additions and mark entities removed
@ -54,7 +54,7 @@ index b94cdad..904141a 100644
// Spigot start - decrement creature type count
// Keep this synced up with World.a(Class)
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index b3dd456..5c3e075 100644
index 6e7e9af..23b342b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1739,7 +1739,7 @@ public abstract class World implements IBlockAccess {
@ -67,5 +67,5 @@ index b3dd456..5c3e075 100644
if (!entity.aa || entity.ab != k || entity.ac != l || entity.ad != i1) {
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 33bc5ffd91ccca0e30489cba02ec2963f670e086 Mon Sep 17 00:00:00 2001
From 7c4048c52e4c36d4646335713eb75e1f2ca4effc Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 24 Apr 2016 19:49:33 -0500
Subject: [PATCH] SPIGOT-1401: Fix dispenser, dropper, furnace placement
@ -51,5 +51,5 @@ index 61a6b8a..25f7b4b 100644
public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, @Nullable ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
if (world.isClientSide) {
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From daafbd9ad18ff3fab1e810dbf51ea59ccb3af390 Mon Sep 17 00:00:00 2001
From df91c49a8a8472b88e89ad0634954ee2b495b793 Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Sat, 23 Apr 2016 19:51:19 -0400
Subject: [PATCH] Reimplement PlayerEditBookEvent
@ -85,5 +85,5 @@ index 4d471ec..cf27086 100644
}
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From ff070ed082dcd1c44676ba68b3d39daed7b88b90 Mon Sep 17 00:00:00 2001
From 6a110c2813f8b97f35921b67d31e6e2f3f21df4a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 27 Apr 2016 22:09:52 -0400
Subject: [PATCH] Improve Minecraft Hopper Performance
@ -74,5 +74,5 @@ index de458c8..ec0b1ca 100644
return this.g > 0;
}
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 3b596ccedcfa761caa54a479c5aa43c6a3b5053c Mon Sep 17 00:00:00 2001
From 059294d9f3416fec8a01bd061149ba6409d3bb66 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 28 Apr 2016 00:57:27 -0400
Subject: [PATCH] remove null possibility for getServer singleton
@ -35,5 +35,5 @@ index e1c0c0b..ec9f037 100644
// CraftBukkit end
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From d0e77b7d023cdba51d177126f4592d26da939ee1 Mon Sep 17 00:00:00 2001
From 6c301c0cf944d0d47e82f3b9a8b8eaf78e62dcd4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 29 Apr 2016 20:02:00 -0400
Subject: [PATCH] Improve Maps (in item frames) performance and bug fixes
@ -48,7 +48,7 @@ index 6c8da79..38e88d8 100644
Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 5c3e075..0f1ee49 100644
index 23b342b..6c67062 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1144,6 +1144,7 @@ public abstract class World implements IBlockAccess {
@ -145,5 +145,5 @@ index 256a131..5768cd5 100644
public RenderData() {
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From ba491f530be8703553a9b5f2f5b24a330519ba4c Mon Sep 17 00:00:00 2001
From 97bbe372fc937d26e9ff4e96ff362a2e4f417586 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 1 May 2016 21:19:14 -0400
Subject: [PATCH] LootTable API & Replenishable Lootables Feature
@ -11,10 +11,10 @@ This feature is good for long term worlds so that newer players
do not suffer with "Every chest has been looted"
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index ccc11a8..9c79f2e 100644
index cc307c4..efed4c6 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -344,4 +344,26 @@ public class PaperWorldConfig {
@@ -330,4 +330,26 @@ public class PaperWorldConfig {
this.frostedIceDelayMax = this.getInt("frosted-ice.delay.max", this.frostedIceDelayMax);
this.log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax);
}
@ -729,5 +729,5 @@ index e9963e2..acb4dee 100644
CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) {
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 66f472758c6daa56f3b4a702d0a381fc4a8c5e8c Mon Sep 17 00:00:00 2001
From c410b547a8bf8a5fcb80ce9e2717d8219d1edc3d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Jan 2016 00:13:19 -0500
Subject: [PATCH] Do not load chunks for pathfinding
@ -18,5 +18,5 @@ index a8fd64c..11c11cf 100644
}
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 62e510d99d8349b4b4b97604ba2a554a83fcf8f0 Mon Sep 17 00:00:00 2001
From 918008d4358443f08f3da80724ad524c25c1f4eb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 17 Jun 2013 01:24:00 -0400
Subject: [PATCH] Entity Tracking Improvements
@ -99,5 +99,5 @@ index 38e88d8..a783ecb 100644
}
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,11 +1,11 @@
From be3ff0c83d60893778ddfbe1ccf0ab5f8dabeede Mon Sep 17 00:00:00 2001
From 96b982b083de4b5304dcc0defbce9d2d5a32d69e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 7 May 2016 23:33:08 -0400
Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 1199fa2..f5f1e2a 100644
index e234c41..c0b6bf1 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -223,4 +223,9 @@ public class PaperConfig {
@ -31,5 +31,5 @@ index 230004b..62752f8 100644
nbttagcompound.setString("Name", scoreboardteam.getName());
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From a7b3f62597464c1911ef9e2a8ad16d50dcce9e55 Mon Sep 17 00:00:00 2001
From a7138126f853f5b09a48a0e348dbaf7dd93c39a8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 12 May 2016 01:55:17 -0400
Subject: [PATCH] Do not mark chunks as active for neighbor updates
@ -109,5 +109,5 @@ index 7b61b14..7752b50 100644
neighbor.setNeighborLoaded(-x, -z);
chunk.setNeighborLoaded(x, z);
--
2.8.3
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 4cbcf0a94fdb7939154591d342fe7b69fe933176 Mon Sep 17 00:00:00 2001
From 315afb375674d27304fae4183a583984e739055f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 12 May 2016 02:03:56 -0400
Subject: [PATCH] Unmark chunk as unloading when unload is cancelled
@ -30,5 +30,5 @@ index 6d1b98b..4a2cad6 100644
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
this.world.getServer().getPluginManager().callEvent(event);
--
2.8.2.windows.1
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 00816855c6c0d23f13289a10f4e8329ea47ec3f0 Mon Sep 17 00:00:00 2001
From 6d579c739f7aa7810454f8abf134194f1cc30baf Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 12 May 2016 23:02:58 -0500
Subject: [PATCH] System property for disabling watchdoge
@ -18,5 +18,5 @@ index 3ed983c..fb57e0d 100644
Logger log = Bukkit.getServer().getLogger();
log.log( Level.SEVERE, "The server has stopped responding!" );
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 07e28d1f91da91eb58b0cc4afa22b92ed477f447 Mon Sep 17 00:00:00 2001
From bd4875040e0063bc788a902ae367ab7bfaed9aec Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 13 May 2016 01:38:06 -0400
Subject: [PATCH] Optimize EAR
@ -65,5 +65,5 @@ index ce421eb..a7c4437 100644
}
}
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From a1cf500c7a15721dfa81f4607e6f67f4cc7246a7 Mon Sep 17 00:00:00 2001
From 09a58e2b714a1361da3ed4ac26506e12abc56af9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 16 May 2016 20:47:41 -0400
Subject: [PATCH] Optimize UserCache / Thread Safe
@ -96,5 +96,5 @@ index 5cc2731..2420112 100644
}
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From e7916ce21713f358b99e80754dac20434ec5120d Mon Sep 17 00:00:00 2001
From 6b7b2b272be834ecd1ddb2fd5ae25331c995a240 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 16 May 2016 22:54:36 -0400
Subject: [PATCH] MC-99914 - ensure EntityItem loads before EntityPotion
@ -29,5 +29,5 @@ index 7e7ec23..8df9f38 100644
if (System.console() == null && System.getProperty("jline.terminal") == null) {
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 35daee4c95827a178f1f80c336d4e100f64fa91f Mon Sep 17 00:00:00 2001
From 3e7863928d22425c7f33221ee729bebf39f50731 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 16 May 2016 23:19:16 -0400
Subject: [PATCH] Avoid blocking on Network Manager creation
@ -45,5 +45,5 @@ index 4ab28e6..08634c3 100644
if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 )
{
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,14 +1,14 @@
From 9b002ecab7ef680b6a1fb31a26978850620bd457 Mon Sep 17 00:00:00 2001
From 201d211ea97e013c64cf7f186a294b5465043bf3 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 22 May 2016 20:20:55 -0500
Subject: [PATCH] Optional old TNT cannon behaviors
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 9c79f2e..3b0542a 100644
index efed4c6..1e60a3b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -366,4 +366,12 @@ public class PaperWorldConfig {
@@ -352,4 +352,12 @@ public class PaperWorldConfig {
);
}
}
@ -391,5 +391,5 @@ index 28261c5..275e044 100644
EntityHuman entityhuman = (EntityHuman) entity;
--
2.8.2
2.7.4 (Apple Git-66)

View File

@ -1,4 +1,4 @@
From 10a2bb42c44b07bf3854f948f887a3e9ee795720 Mon Sep 17 00:00:00 2001
From 335b62827ed9942cf0a7482071634360bb5c4fa1 Mon Sep 17 00:00:00 2001
From: Martin Panzer <postremus1996@googlemail.com>
Date: Mon, 23 May 2016 12:12:37 +0200
Subject: [PATCH] Faster redstone torch rapid clock removal
@ -39,5 +39,5 @@ index e2f4f44..cf24c45 100644
public RedstoneUpdateInfo(BlockPosition blockposition, long i) {
this.a = blockposition;
--
2.8.2
2.7.4 (Apple Git-66)