Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
f37381ea8a
Removes synchronization from sending packets Makes normal packet sends no longer need to be wrapped and queued like it use to work. Adds more packet queue immunities on top of keep alive to let the following scenarios go out without delay: - Keep Alive - Chat - Kick - All of the packets during the Player Joined World event Hoping that latter one helps join timeout issues more too for slow connections. Removes processing packet queue off of main thread - for the few cases where it is allowed, order is not necessary nor should it even be happening concurrently in first place (handshaking/login/status) Ensures packets sent asynchronously are dispatched on main thread This helps ensure safety for ProtocolLib as packet listeners are commonly accessing world state. This will allow you to schedule a packet to be sent async, but itll be dispatched sync for packet listeners to process. This should solve some deadlock risks This may provide a decent performance improvement because thread synchronization incurs a cache reset so by avoiding ever entering a synchronized block, we get to avoid that, and packet sending is a really hot activity.
61 Zeilen
2.7 KiB
Diff
61 Zeilen
2.7 KiB
Diff
From 59d1d306e9914f440eb7f2b3c41b8bf530da8229 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sun, 24 Mar 2019 01:01:32 -0400
|
|
Subject: [PATCH] Only count Natural Spawned mobs towards natural spawn mob
|
|
limit
|
|
|
|
This resolves the super common complaint about mobs not spawning.
|
|
|
|
This was ultimately a flaw in the vanilla count algorithim that allows
|
|
spawners and other misc mobs to count against the mob limit, which are
|
|
not bounded, and can prevent the entire world from spawning new.
|
|
|
|
I believe Bukkits changes around persistence may of actually made it
|
|
worse than vanilla.
|
|
|
|
This should fully solve all of the issues around it so that only natural
|
|
influences natural spawns.
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index ca2ac17747d..a3fc76b5122 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -505,6 +505,16 @@ public class PaperWorldConfig {
|
|
maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24);
|
|
}
|
|
|
|
+ public boolean countAllMobsForSpawning = false;
|
|
+ private void countAllMobsForSpawning() {
|
|
+ countAllMobsForSpawning = getBoolean("count-all-mobs-for-spawning", false);
|
|
+ if (countAllMobsForSpawning) {
|
|
+ log("Counting all mobs for spawning. Mob farms may reduce natural spawns elsewhere in world.");
|
|
+ } else {
|
|
+ log("Using improved mob spawn limits (Only Natural Spawns impact spawn limits for more natural spawns)");
|
|
+ }
|
|
+ }
|
|
+
|
|
public boolean antiXray;
|
|
public boolean asynchronous;
|
|
public EngineMode engineMode;
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index ad5e538b249..5d1fa08f697 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -957,6 +957,13 @@ public class WorldServer extends World {
|
|
EnumCreatureType enumcreaturetype = entity.getEntityType().e();
|
|
|
|
if (enumcreaturetype != EnumCreatureType.MISC && this.getChunkProvider().b(entity)) {
|
|
+ // Paper start - Only count natural spawns
|
|
+ if (!this.paperConfig.countAllMobsForSpawning &&
|
|
+ !(entity.spawnReason == CreatureSpawnEvent.SpawnReason.NATURAL ||
|
|
+ entity.spawnReason == CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
|
|
+ continue;
|
|
+ }
|
|
+ // Paper end
|
|
object2intmap.mergeInt(enumcreaturetype, 1, Integer::sum);
|
|
}
|
|
}
|
|
--
|
|
2.26.2
|
|
|