73983e4c16
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 3dc4cdcd Update to Minecraft 1.14.3-pre4 88b25a8c SPIGOT-5098: Add a method to allow colored sign changes 6d913552 Update to Minecraft 1.14.3-pre4 CraftBukkit Changes:f1f33559
Update to Minecraft 1.14.38a3d3f49
SPIGOT-5098: Add a method to allow colored sign changes533290e2
SPIGOT-5100: Console warning from pig zombie targeting6dde4b9f
SPIGOT-5094: Allow opening merchant for wandering traders and hide the xp bar for custom merchants9af90077
SPIGOT-5097: Bukkit.clearRecipes() no longer working38fa220f
Fix setting game rules via the APIfe3930ce
Update to Minecraft 1.14.3-pre4da071ec5
Remove outdated build delay. Spigot Changes: 4d2f30f1 Update to Minecraft 1.14.3 f16400e3 Update to Minecraft 1.14.3-pre4
99 Zeilen
6.0 KiB
Diff
99 Zeilen
6.0 KiB
Diff
From e62f02e098120bd54c0eeeefb9e153e70b428ef3 Mon Sep 17 00:00:00 2001
|
|
From: kickash32 <kickash32@gmail.com>
|
|
Date: Sun, 2 Jun 2019 01:22:02 -0400
|
|
Subject: [PATCH] Actually-Limit-Natural-Spawns-To-Limit
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
index 3da7e10a92..4c3bcb63d9 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
@@ -412,8 +412,12 @@ public class ChunkProviderServer extends IChunkProvider {
|
|
if (enumcreaturetype != EnumCreatureType.MISC && (!enumcreaturetype.c() || this.allowAnimals) && (enumcreaturetype.c() || this.allowMonsters) && (!enumcreaturetype.d() || flag2)) {
|
|
int k1 = limit * l / ChunkProviderServer.b; // CraftBukkit - use per-world limits
|
|
|
|
- if (object2intmap.getInt(enumcreaturetype) <= k1) {
|
|
- SpawnerCreature.a(enumcreaturetype, (World) this.world, chunk, blockposition);
|
|
+ // Paper start - only allow spawns upto the limit per chunk and update count afterwards
|
|
+ int currEntityCount = object2intmap.getInt(enumcreaturetype);
|
|
+ int difference = k1 - currEntityCount;
|
|
+ if (difference > 0) {
|
|
+ object2intmap.put(enumcreaturetype, currEntityCount + SpawnerCreature.spawnMobs(enumcreaturetype, world, chunk, blockposition, difference));
|
|
+ // Paper end
|
|
}
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
index 09f1b9d762..b442e09eb4 100644
|
|
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
@@ -16,13 +16,20 @@ public final class SpawnerCreature {
|
|
|
|
private static final Logger LOGGER = LogManager.getLogger();
|
|
|
|
+ // Paper start - add maxSpawns parameter and update counts
|
|
public static void a(EnumCreatureType enumcreaturetype, World world, Chunk chunk, BlockPosition blockposition) {
|
|
+ spawnMobs(enumcreaturetype, world, chunk, blockposition, Integer.MAX_VALUE);
|
|
+ }
|
|
+
|
|
+ public static int spawnMobs(EnumCreatureType enumcreaturetype, World world, Chunk chunk, BlockPosition blockposition, int maxSpawns) {
|
|
+ // Paper end
|
|
ChunkGenerator<?> chunkgenerator = world.getChunkProvider().getChunkGenerator();
|
|
int i = 0;
|
|
BlockPosition blockposition1 = getRandomPosition(world, chunk);
|
|
int j = blockposition1.getX();
|
|
int k = blockposition1.getY();
|
|
int l = blockposition1.getZ();
|
|
+ int amountSpawned = 0; // Paper - keep track of mobs spawned
|
|
|
|
if (k >= 1) {
|
|
IBlockData iblockdata = world.getTypeIfLoadedAndInBounds(blockposition1); // Paper - don't load chunks for mob spawn
|
|
@@ -85,7 +92,7 @@ public final class SpawnerCreature {
|
|
);
|
|
if (!event.callEvent()) {
|
|
if (event.shouldAbortSpawn()) {
|
|
- return;
|
|
+ return amountSpawned; // Paper
|
|
}
|
|
++i2;
|
|
continue;
|
|
@@ -104,7 +111,7 @@ public final class SpawnerCreature {
|
|
} catch (Exception exception) {
|
|
SpawnerCreature.LOGGER.warn("Failed to create mob", exception);
|
|
ServerInternalException.reportInternalException(exception); // Paper
|
|
- return;
|
|
+ return amountSpawned; // Paper
|
|
}
|
|
|
|
entityinsentient.setPositionRotation((double) f, (double) k, (double) f1, world.random.nextFloat() * 360.0F, 0.0F);
|
|
@@ -114,10 +121,17 @@ public final class SpawnerCreature {
|
|
if (world.addEntity(entityinsentient, SpawnReason.NATURAL)) {
|
|
++i;
|
|
++i2;
|
|
+ // Paper start - stop when limit is reached
|
|
+ amountSpawned++;
|
|
+ }
|
|
+
|
|
+ if (amountSpawned >= maxSpawns){
|
|
+ return amountSpawned; // Paper
|
|
}
|
|
+ // Paper end
|
|
// CraftBukkit end
|
|
if (i >= entityinsentient.dD()) {
|
|
- return;
|
|
+ return amountSpawned; // Paper
|
|
}
|
|
|
|
if (entityinsentient.c(i2)) {
|
|
@@ -142,6 +156,7 @@ public final class SpawnerCreature {
|
|
|
|
}
|
|
}
|
|
+ return amountSpawned; // Paper
|
|
}
|
|
|
|
@Nullable
|
|
--
|
|
2.22.0
|
|
|