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 45aa7db5c4
commit cac7bbc139
27 changed files with 80 additions and 78 deletions

View File

@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
}
}
private void useVanillaScoreboardColoring() {
useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false);
}
+
+ public boolean frostedIceEnabled = true;
@ -43,4 +43,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
--
--
2.7.4 (Apple Git-66)

View File

@ -1,50 +0,0 @@
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -0,0 +0,0 @@ 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));
--

View File

@ -53,4 +53,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Spigot start
private final Arrow.Spigot spigot = new Arrow.Spigot()
{
--
--
2.7.4 (Apple Git-66)

View File

@ -44,4 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order
if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 )
{
--
--
2.7.4 (Apple Git-66)

View File

@ -66,4 +66,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int i1 = MathHelper.floor(entity.locZ / 16.0D);
if (!entity.aa || entity.ab != k || entity.ac != l || entity.ad != i1) {
--
--
2.7.4 (Apple Git-66)

View File

@ -18,4 +18,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.i = iminecraftserver.e_();
if (0 == this.h) {
this.h = this.i + 10;
--
--
2.7.4 (Apple Git-66)

View File

@ -17,4 +17,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
--
--
2.7.4 (Apple Git-66)

View File

@ -108,4 +108,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (neighbor != null) {
neighbor.setNeighborLoaded(-x, -z);
chunk.setNeighborLoaded(x, z);
--
--
2.7.4 (Apple Git-66)

View File

@ -30,4 +30,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setString("Name", scoreboardteam.getName());
--
--
2.7.4 (Apple Git-66)

View File

@ -98,4 +98,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
--
--
2.7.4 (Apple Git-66)

View File

@ -40,4 +40,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.a(f);
this.foodTickTimer = 0;
}
--
--
2.7.4 (Apple Git-66)

View File

@ -38,4 +38,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public RedstoneUpdateInfo(BlockPosition blockposition, long i) {
this.a = blockposition;
--
--
2.7.4 (Apple Git-66)

View File

@ -48,4 +48,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
@Override
--
--
2.7.4 (Apple Git-66)

View File

@ -144,4 +144,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public final ArrayList<MapCursor> cursors;
public RenderData() {
--
--
2.7.4 (Apple Git-66)

View File

@ -73,4 +73,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public boolean o() {
return this.g > 0;
}
--
--
2.7.4 (Apple Git-66)

View File

@ -728,4 +728,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final CraftInventory inventory;
CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) {
--
--
2.7.4 (Apple Git-66)

View File

@ -28,4 +28,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Try to see if we're actually running in a terminal, disable jline if not
if (System.console() == null && System.getProperty("jline.terminal") == null) {
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
--
--
2.7.4 (Apple Git-66)

View File

@ -64,4 +64,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
}
--
--
2.7.4 (Apple Git-66)

View File

@ -95,4 +95,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
--
--
2.7.4 (Apple Git-66)

View File

@ -390,4 +390,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entity;
--
--
2.7.4 (Apple Git-66)

View File

@ -44,4 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
return i;
--
--
2.7.4 (Apple Git-66)

View File

@ -84,4 +84,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
--
--
2.7.4 (Apple Git-66)

View File

@ -50,4 +50,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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.7.4 (Apple Git-66)

View File

@ -17,4 +17,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
{
Logger log = Bukkit.getServer().getLogger();
log.log( Level.SEVERE, "The server has stopped responding!" );
--
--
2.7.4 (Apple Git-66)

View File

@ -29,4 +29,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
this.world.getServer().getPluginManager().callEvent(event);
--
--
2.7.4 (Apple Git-66)

View File

@ -89,4 +89,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected boolean q(Entity entity) {
return this.bv().size() < 1;
}
--
--
2.7.4 (Apple Git-66)

View File

@ -34,4 +34,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// CraftBukkit end
--
--
2.7.4 (Apple Git-66)