3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Dieser Commit ist enthalten in:
Jake Potrebic 2022-06-07 21:22:42 -07:00
Ursprung f371b4e374
Commit f04e64dfc6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5
14 geänderte Dateien mit 116 neuen und 116 gelöschten Zeilen

Datei anzeigen

@ -12,7 +12,7 @@ Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bd549661ccfb29b9a4f9d69956c549ba3e888e31..032e6819da27c8616b9b3b6c09bd559e69c35100 100644
index bd549661ccfb29b9a4f9d69956c549ba3e888e31..39a079ce407081ba1ff13c23cfbeeab9c5a78e07 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -267,7 +267,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -96,11 +96,11 @@ index bd549661ccfb29b9a4f9d69956c549ba3e888e31..032e6819da27c8616b9b3b6c09bd559e
// Spigot start
Arrays.fill( recentTps, 20 );
- long curTime, tickSection = Util.getMillis(), tickCount = 1;
+ long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
+ lastTick = start - TICK_TIME; // Paper
+ long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
+ lastTick = start - TICK_TIME; // Paper
while (this.running) {
- long i = (curTime = Util.getMillis()) - this.nextTickTime;
+ long i = ((curTime = System.nanoTime()) / (1000L * 1000L)) - this.nextTickTime; // Paper
+ long i = ((curTime = System.nanoTime()) / (1000L * 1000L)) - this.nextTickTime; // Paper
if (i > 5000L && this.nextTickTime - this.lastOverloadWarning >= 30000L) { // CraftBukkit
long j = i / 50L;
@ -114,22 +114,22 @@ index bd549661ccfb29b9a4f9d69956c549ba3e888e31..032e6819da27c8616b9b3b6c09bd559e
++MinecraftServer.currentTickLong; // Paper
- if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 )
+ if ( ++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0 )
+ if ( ++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0 )
{
- double currentTps = 1E3 / ( curTime - tickSection ) * MinecraftServer.SAMPLE_INTERVAL;
- this.recentTps[0] = MinecraftServer.calcTps( this.recentTps[0], 0.92, currentTps ); // 1/exp(5sec/1min)
- this.recentTps[1] = MinecraftServer.calcTps( this.recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min)
- this.recentTps[2] = MinecraftServer.calcTps( this.recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min)
+ final long diff = curTime - tickSection;
+ java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
+ tps1.add(currentTps, diff);
+ tps5.add(currentTps, diff);
+ tps15.add(currentTps, diff);
+ // Backwards compat with bad plugins
+ this.recentTps[0] = tps1.getAverage();
+ this.recentTps[1] = tps5.getAverage();
+ this.recentTps[2] = tps15.getAverage();
+ // Paper end
+ final long diff = curTime - tickSection;
+ java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
+ tps1.add(currentTps, diff);
+ tps5.add(currentTps, diff);
+ tps15.add(currentTps, diff);
+ // Backwards compat with bad plugins
+ this.recentTps[0] = tps1.getAverage();
+ this.recentTps[1] = tps5.getAverage();
+ this.recentTps[2] = tps15.getAverage();
+ // Paper end
tickSection = curTime;
}
// Spigot end
@ -138,13 +138,13 @@ index bd549661ccfb29b9a4f9d69956c549ba3e888e31..032e6819da27c8616b9b3b6c09bd559e
}
- MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
+ //MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
+ lastTick = curTime;
+ //MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
+ lastTick = curTime;
this.nextTickTime += 50L;
this.startMetricsRecordingTick();
this.profiler.push("tick");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 93947c982c40be873bd1f3273ca69dbdf6820aeb..a7dcdb5cce888f8580b54f7de263110e69285311 100644
index 6a35ff1c7d7b59b8dae8bbae2f2133f74d00e35b..24ede23d6cb432c0f842ce076ce592ef8c089a85 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2374,6 +2374,17 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -36,17 +36,17 @@ index c3539fabda1887cca6e82abce26dff088cdc4251..924b890d34c113ce804244dbb6635ff7
public static int tabSpamLimit = 500;
private static void tabSpamLimiters() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b031d4340dbee22108f8cbc15729337c50160a29..87970a1291b6c01bcb94a87fbbb0877a9d6b350f 100644
index 6d92ab505613fc0ba0c0436c6a6336eb6349a461..40d086016536dd3efa5c861a770853c166974c7c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1057,6 +1057,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.updateStatusIcon(this.status);
// Spigot start
+ org.spigotmc.WatchdogThread.hasStarted = true; // Paper
+ org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
lastTick = start - TICK_TIME; // Paper
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
lastTick = start - TICK_TIME; // Paper
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6681c07f5f59124299263d990cfe7bdf202aef87..907de15edda4f9b1165d985ff6b2c2a8317f06b5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

Datei anzeigen

@ -33,10 +33,10 @@ index 6e7699e5a725eac05de3e809ae9a45a45891892b..07a912cd9f7af3464ecd0de1d789fdcd
public boolean generateFlatBedrock = false;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ba8f8b222e8951e0eea8642ecbb843fbf5146f5d..600a774a0cdad4b2582afb3c603734209dac24f7 100644
index 5c5a42f59908b1f7a737d97c2470037a3d4361a8..4c0ab7705824a02bb7e9906fbd3a5c4792bc7dd7 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -222,6 +222,7 @@ public class ServerPlayer extends Player {
@@ -229,6 +229,7 @@ public class ServerPlayer extends Player {
public boolean wonGame;
private int containerUpdateDelay; // Paper
public long loginTime; // Paper
@ -45,10 +45,10 @@ index ba8f8b222e8951e0eea8642ecbb843fbf5146f5d..600a774a0cdad4b2582afb3c60373420
public boolean queueHealthUpdatePacket = false;
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
index d5a701b2d684bbe18f985adb6bd62e9218d3a0a6..babdbd9c78ff71a12d7bb369603f139cec1602ff 100644
index 96765f740eb5704c977be7c037ecf81fbc1c7a92..acaac635ad09eab3cfdac27137dc75da9da1edac 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java
@@ -24,7 +24,7 @@ public class PatrolSpawner implements CustomSpawner {
@@ -25,7 +25,7 @@ public class PatrolSpawner implements CustomSpawner {
@Override
public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) {
@ -57,9 +57,9 @@ index d5a701b2d684bbe18f985adb6bd62e9218d3a0a6..babdbd9c78ff71a12d7bb369603f139c
if (!spawnMonsters) {
return 0;
} else if (!world.getGameRules().getBoolean(GameRules.RULE_DO_PATROL_SPAWNING)) {
@@ -32,23 +32,51 @@ public class PatrolSpawner implements CustomSpawner {
@@ -33,23 +33,51 @@ public class PatrolSpawner implements CustomSpawner {
} else {
Random random = world.random;
RandomSource randomsource = world.random;
- --this.nextTick;
- if (this.nextTick > 0) {
@ -70,7 +70,7 @@ index d5a701b2d684bbe18f985adb6bd62e9218d3a0a6..babdbd9c78ff71a12d7bb369603f139c
return 0;
+ }
+
+ net.minecraft.server.level.ServerPlayer entityhuman = world.players().get(random.nextInt(j));
+ net.minecraft.server.level.ServerPlayer entityhuman = world.players().get(randomsource.nextInt(j));
+ if (entityhuman.isSpectator()) {
+ return 0;
+ }
@ -80,7 +80,7 @@ index d5a701b2d684bbe18f985adb6bd62e9218d3a0a6..babdbd9c78ff71a12d7bb369603f139c
+ --entityhuman.patrolSpawnDelay;
+ patrolSpawnDelay = entityhuman.patrolSpawnDelay;
} else {
- this.nextTick += 12000 + random.nextInt(1200);
- this.nextTick += 12000 + randomsource.nextInt(1200);
- long i = world.getDayTime() / 24000L;
+ this.nextTick--;
+ patrolSpawnDelay = this.nextTick;
@ -96,15 +96,15 @@ index d5a701b2d684bbe18f985adb6bd62e9218d3a0a6..babdbd9c78ff71a12d7bb369603f139c
+ days = world.getDayTime() / 24000L;
+ }
+ if (world.paperConfig.patrolPerPlayerDelay) {
+ entityhuman.patrolSpawnDelay += world.paperConfig.patrolDelay + random.nextInt(1200);
+ entityhuman.patrolSpawnDelay += world.paperConfig.patrolDelay + randomsource.nextInt(1200);
+ } else {
+ this.nextTick += world.paperConfig.patrolDelay + random.nextInt(1200);
+ this.nextTick += world.paperConfig.patrolDelay + randomsource.nextInt(1200);
+ }
- if (i >= 5L && world.isDay()) {
- if (random.nextInt(5) != 0) {
- if (randomsource.nextInt(5) != 0) {
+ if (days >= world.paperConfig.patrolStartDay && world.isDay()) {
+ if (random.nextDouble() >= world.paperConfig.patrolSpawnChance) {
+ if (randomsource.nextDouble() >= world.paperConfig.patrolSpawnChance) {
+ // Paper end
return 0;
} else {
@ -113,7 +113,7 @@ index d5a701b2d684bbe18f985adb6bd62e9218d3a0a6..babdbd9c78ff71a12d7bb369603f139c
if (j < 1) {
return 0;
} else {
- Player entityhuman = (Player) world.players().get(random.nextInt(j));
- Player entityhuman = (Player) world.players().get(randomsource.nextInt(j));
if (entityhuman.isSpectator()) {
return 0;

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Remote Connections shouldn't hold up shutdown
Bugs in the connection logic appears to leave stale connections even, preventing shutdown
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 4357d5c7c66d9490a34f2d591ddc3d58d36cadd1..ab26a26ac553071ecd943dc8a3b41debf8b797ef 100644
index 0cd6e4fbcc97ab6b64333860d56946268c1f5064..8f5910ee6469af62bab9c26c2e1985784ae73900 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -434,11 +434,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -399,11 +399,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
if (this.rconThread != null) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Do not allow bees to load chunks for beehives
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 8e857d4ff6497d68e462418d75b8378ff7adbc97..c49e7ea3e2efc4459f5ed1d4ebd83c9d23420611 100644
index d94f045d7fe928c256c5d3e1af02ac73d7897f5a..d13f3460644f635ded96bf92ddf9ecf8984c8e47 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -408,6 +408,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -409,6 +409,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
if (this.hivePos == null) {
return false;
} else {
@ -16,7 +16,7 @@ index 8e857d4ff6497d68e462418d75b8378ff7adbc97..c49e7ea3e2efc4459f5ed1d4ebd83c9d
BlockEntity tileentity = this.level.getBlockEntity(this.hivePos);
return tileentity instanceof BeehiveBlockEntity && ((BeehiveBlockEntity) tileentity).isFireNearby();
@@ -441,6 +442,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -442,6 +443,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
}
private boolean doesHiveHaveSpace(BlockPos pos) {
@ -24,7 +24,7 @@ index 8e857d4ff6497d68e462418d75b8378ff7adbc97..c49e7ea3e2efc4459f5ed1d4ebd83c9d
BlockEntity tileentity = this.level.getBlockEntity(pos);
return tileentity instanceof BeehiveBlockEntity ? !((BeehiveBlockEntity) tileentity).isFull() : false;
@@ -920,6 +922,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -921,6 +923,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public boolean canBeeUse() {
if (Bee.this.hasHive() && Bee.this.wantsToEnterHive() && Bee.this.hivePos.closerToCenterThan(Bee.this.position(), 2.0D)) {
@ -32,7 +32,7 @@ index 8e857d4ff6497d68e462418d75b8378ff7adbc97..c49e7ea3e2efc4459f5ed1d4ebd83c9d
BlockEntity tileentity = Bee.this.level.getBlockEntity(Bee.this.hivePos);
if (tileentity instanceof BeehiveBlockEntity) {
@@ -943,6 +946,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -944,6 +947,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public void start() {

Datei anzeigen

@ -7,10 +7,10 @@ Suspected case would be around the technique used in .stopRiding
Stack will identify any causer of this and warn instead of crashing.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index a0ffdeaad5c375539857d6a5a94832216d09f024..5346109670bedf88f13b4eff47c5292170fb47cc 100644
index 5cf6f6f67520af8d94456a028828e49446e82be9..496f9580fe0f28381f863cd505779e6b9c103bc9 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1600,6 +1600,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1643,6 +1643,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void addEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot
@ -26,10 +26,10 @@ index a0ffdeaad5c375539857d6a5a94832216d09f024..5346109670bedf88f13b4eff47c52921
EntityType<?> entitytypes = entity.getType();
int i = entitytypes.clientTrackingRange() * 16;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0a7dbafd938141b34dc66d0b4af26dba92a21c06..5009ad1a758e192eaf6ca59baab26d2ba58a6c66 100644
index 6bded610f82189a5549e656881dbce0d34f285b2..8808b8b5b3fa03a1a0c4d843867f1e26d966ab85 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2210,7 +2210,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2288,7 +2288,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTrackingStart(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot
@ -38,9 +38,9 @@ index 0a7dbafd938141b34dc66d0b4af26dba92a21c06..5009ad1a758e192eaf6ca59baab26d2b
if (entity instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entity;
@@ -2243,6 +2243,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
@@ -2322,6 +2322,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
entity.valid = true; // CraftBukkit
+ ServerLevel.this.getChunkSource().addEntity(entity);
// Paper start - Set origin location when the entity is being added to the world

Datei anzeigen

@ -7,10 +7,10 @@ Causes sync chunk loads and who knows what all else.
This is safe because Spectators are skipped in unloaded chunks too in vanilla.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 600a774a0cdad4b2582afb3c603734209dac24f7..ef222e90d1dd125c909f00bab98eeb501f547a50 100644
index 4c0ab7705824a02bb7e9906fbd3a5c4792bc7dd7..25cbb75767331682276f3c1abd6a08bbc81b4e13 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -643,7 +643,7 @@ public class ServerPlayer extends Player {
@@ -650,7 +650,7 @@ public class ServerPlayer extends Player {
public void doTick() {
try {

Datei anzeigen

@ -7,10 +7,10 @@ This fixes a lot of game state issues where packets were delayed for processing
due to 1.15's new queue but processed while dead.
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 8a05690556f8f979d268cd7c6b5c14343ad33579..49648e258c6e72ac921f69114e1e36a926749d46 100644
index 6eb7240850d50528d8fad8dff79ee578e3f9b588..fba9636e670300e31b5348de9cf3bc23e0eb6e6a 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1128,7 +1128,7 @@ public abstract class Player extends LivingEntity {
@@ -1174,7 +1174,7 @@ public abstract class Player extends LivingEntity {
@Override
protected boolean isImmobile() {

Datei anzeigen

@ -14,10 +14,10 @@ movement will load only the chunk the player enters anyways and avoids loading
massive amounts of surrounding chunks due to large AABB lookups.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 7b000de3fa232a75cc3737783e4a38025d0d8bde..52ce9718321b96ffb00b3a1b1b2b0071a91217b6 100644
index a2071ea91515c5ddd2318cc4918328d20dec224e..dcdf25a8111410d54adc2e758775efcce0165b73 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -791,6 +791,7 @@ public abstract class PlayerList {
@@ -795,6 +795,7 @@ public abstract class PlayerList {
entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// CraftBukkit end
@ -26,11 +26,11 @@ index 7b000de3fa232a75cc3737783e4a38025d0d8bde..52ce9718321b96ffb00b3a1b1b2b0071
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 32e93c0c9c56a00585ede420f488cfe4a1b37ffa..384f4eabb2ebacd459e0f21e268e3dd0cd4b4d20 100644
index ea522476dff5408e1b7e488c4460406409d140ca..0e36422d3bf2261ee792774b17cfbeadd05f2b1d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -174,6 +174,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// Paper end
@@ -195,6 +195,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
+ public boolean collisionLoadChunks = false; // Paper

Datei anzeigen

@ -10,10 +10,10 @@ larger than the keep loaded range.
By skipping this, we avoid potential for a large spike on server start.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ef222e90d1dd125c909f00bab98eeb501f547a50..888e127e7e59a7ceb63f12ec69046916a0e29fc9 100644
index 25cbb75767331682276f3c1abd6a08bbc81b4e13..3603e169f9195b86553867ddabca2e3ad90a494f 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -313,7 +313,7 @@ public class ServerPlayer extends Player {
@@ -320,7 +320,7 @@ public class ServerPlayer extends Player {
this.stats = server.getPlayerList().getPlayerStats(this);
this.advancements = server.getPlayerList().getPlayerAdvancements(this);
this.maxUpStep = 1.0F;
@ -22,7 +22,7 @@ index ef222e90d1dd125c909f00bab98eeb501f547a50..888e127e7e59a7ceb63f12ec69046916
this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
@@ -531,7 +531,7 @@ public class ServerPlayer extends Player {
@@ -538,7 +538,7 @@ public class ServerPlayer extends Player {
position = Vec3.atCenterOf(((ServerLevel) world).getSharedSpawnPos());
}
this.level = world;
@ -32,10 +32,10 @@ index ef222e90d1dd125c909f00bab98eeb501f547a50..888e127e7e59a7ceb63f12ec69046916
this.gameMode.setLevel((ServerLevel) world);
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 52ce9718321b96ffb00b3a1b1b2b0071a91217b6..332bc127230fcefcdab0087922536af8b6ff1e8c 100644
index dcdf25a8111410d54adc2e758775efcce0165b73..3290a2e4689c9e34c3260db4de8ac7f6dc74f8ea 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -210,6 +210,8 @@ public abstract class PlayerList {
@@ -214,6 +214,8 @@ public abstract class PlayerList {
worldserver1 = worldserver;
}

Datei anzeigen

@ -71,10 +71,10 @@ index 8cc4cb2163a93b9491550fe6d0f5d980fb216920..4dd14d73a37b32288a64fbd67ee22c43
cause = cause.getCause();
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 03ebc2a0476aef9297cbbc7f358915703a469b02..4ed65f1371013fb91fe60a0e1501e222a6e9c508 100644
index 6d71dd7021afa2cb3c1200c64de08e3658e0a998..08ada4f1818f3dc8aeee417df11948a48b66bcfd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -297,7 +297,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -282,7 +282,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod;
public Commands vanillaCommandDispatcher;
@ -83,7 +83,7 @@ index 03ebc2a0476aef9297cbbc7f358915703a469b02..4ed65f1371013fb91fe60a0e1501e222
// CraftBukkit end
// Spigot start
public static final int TPS = 20;
@@ -307,6 +307,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -292,6 +292,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Spigot end
public static long currentTickLong = 0L; // Paper
@ -93,7 +93,7 @@ index 03ebc2a0476aef9297cbbc7f358915703a469b02..4ed65f1371013fb91fe60a0e1501e222
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new Thread(() -> {
@@ -911,6 +914,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -864,6 +867,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
private boolean hasStopped = false;
@ -101,7 +101,7 @@ index 03ebc2a0476aef9297cbbc7f358915703a469b02..4ed65f1371013fb91fe60a0e1501e222
private final Object stopLock = new Object();
public final boolean hasStopped() {
synchronized (this.stopLock) {
@@ -925,6 +929,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -878,6 +882,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hasStopped) return;
this.hasStopped = true;
}
@ -119,9 +119,9 @@ index 03ebc2a0476aef9297cbbc7f358915703a469b02..4ed65f1371013fb91fe60a0e1501e222
+ }
+ // Paper end
// CraftBukkit end
MinecraftServer.LOGGER.info("Stopping server");
MinecraftTimings.stopServer(); // Paper
@@ -1005,7 +1022,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics();
@@ -962,7 +979,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getProfileCache().save(false); // Paper
}
// Spigot end
@ -140,35 +140,35 @@ index 03ebc2a0476aef9297cbbc7f358915703a469b02..4ed65f1371013fb91fe60a0e1501e222
}
public String getLocalIp() {
@@ -1098,6 +1126,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1055,6 +1083,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected void runServer() {
try {
+ long serverStartTime = Util.getNanos(); // Paper
if (this.initServer()) {
this.nextTickTime = Util.getMillis();
this.status.setDescription(new TextComponent(this.motd));
@@ -1105,6 +1134,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.updateStatusIcon(this.status);
if (!this.initServer()) {
throw new IllegalStateException("Failed to initialize server");
}
@@ -1066,6 +1095,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.updateStatusIcon(this.status);
// Spigot start
+ // Paper start - move done tracking
+ LOGGER.info("Running delayed init tasks");
+ this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // run all 1 tick delay tasks during init,
+ // this is going to be the first thing the tick process does anyways, so move done and run it after
+ // everything is init before watchdog tick.
+ // anything at 3+ won't be caught here but also will trip watchdog....
+ // tasks are default scheduled at -1 + delay, and first tick will tick at 1
+ String doneTime = String.format(java.util.Locale.ROOT, "%.3fs", (double) (Util.getNanos() - serverStartTime) / 1.0E9D);
+ LOGGER.info("Done ({})! For help, type \"help\"", doneTime);
+ // Paper end
// Spigot start
+ // Paper start - move done tracking
+ LOGGER.info("Running delayed init tasks");
+ this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // run all 1 tick delay tasks during init,
+ // this is going to be the first thing the tick process does anyways, so move done and run it after
+ // everything is init before watchdog tick.
+ // anything at 3+ won't be caught here but also will trip watchdog....
+ // tasks are default scheduled at -1 + delay, and first tick will tick at 1
+ String doneTime = String.format(java.util.Locale.ROOT, "%.3fs", (double) (Util.getNanos() - serverStartTime) / 1.0E9D);
+ LOGGER.info("Done ({})! For help, type \"help\"", doneTime);
+ // Paper end
+
+ org.spigotmc.WatchdogThread.tick(); // Paper
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
@@ -1162,6 +1203,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.onServerCrash((CrashReport) null);
+ org.spigotmc.WatchdogThread.tick(); // Paper
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
@@ -1120,6 +1161,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
}
} catch (Throwable throwable) {
+ // Paper start
@ -180,8 +180,8 @@ index 03ebc2a0476aef9297cbbc7f358915703a469b02..4ed65f1371013fb91fe60a0e1501e222
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);
// Spigot Start
if ( throwable.getCause() != null )
@@ -1195,14 +1242,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profileCache.clearExecutor();
@@ -1153,14 +1200,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.services.profileCache().clearExecutor();
}
- org.spigotmc.WatchdogThread.doStop(); // Spigot
@ -198,7 +198,7 @@ index 03ebc2a0476aef9297cbbc7f358915703a469b02..4ed65f1371013fb91fe60a0e1501e222
}
}
@@ -1266,6 +1313,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1224,6 +1271,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public TickTask wrapRunnable(Runnable runnable) {
@ -211,7 +211,7 @@ index 03ebc2a0476aef9297cbbc7f358915703a469b02..4ed65f1371013fb91fe60a0e1501e222
return new TickTask(this.tickCount, runnable);
}
@@ -1492,6 +1545,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1450,6 +1503,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
} catch (Throwable t) {
@ -219,7 +219,7 @@ index 03ebc2a0476aef9297cbbc7f358915703a469b02..4ed65f1371013fb91fe60a0e1501e222
throw new RuntimeException("Error generating crash report", t);
}
// Spigot End
@@ -1949,7 +2003,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1915,7 +1969,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.packRepository.setSelected(dataPacks);
this.worldData.setDataPackConfig(MinecraftServer.getSelectedPacks(this.packRepository));
this.resources.managers.updateRegistryTags(this.registryAccess());
@ -228,12 +228,12 @@ index 03ebc2a0476aef9297cbbc7f358915703a469b02..4ed65f1371013fb91fe60a0e1501e222
+ //this.getPlayerList().saveAll(); // Paper - we don't need to do this
this.getPlayerList().reloadResources();
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureManager.onResourceManagerReload(this.resources.resourceManager);
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index ab26a26ac553071ecd943dc8a3b41debf8b797ef..d0d058287fc1e87e944e99d4fc2cbd38eafb82b3 100644
index 8f5910ee6469af62bab9c26c2e1985784ae73900..7d381cc2c514045aad2bf65fd166b8ad1c8a9c97 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -284,7 +284,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -276,7 +276,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
long j = Util.getNanos() - i;
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
@ -242,7 +242,7 @@ index ab26a26ac553071ecd943dc8a3b41debf8b797ef..d0d058287fc1e87e944e99d4fc2cbd38
if (dedicatedserverproperties.announcePlayerAchievements != null) {
((GameRules.BooleanValue) this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)).set(dedicatedserverproperties.announcePlayerAchievements, this);
}
@@ -441,7 +441,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -406,7 +406,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
//this.remoteStatusListener.b(); // Paper - don't wait for remote connections
}
@ -252,7 +252,7 @@ index ab26a26ac553071ecd943dc8a3b41debf8b797ef..d0d058287fc1e87e944e99d4fc2cbd38
}
@Override
@@ -767,7 +768,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -747,7 +748,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override
public void stopServer() {
super.stopServer();
@ -262,10 +262,10 @@ index ab26a26ac553071ecd943dc8a3b41debf8b797ef..d0d058287fc1e87e944e99d4fc2cbd38
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 5346109670bedf88f13b4eff47c5292170fb47cc..7776c22744cdd31459e9634d1d549bdf2876e04f 100644
index 496f9580fe0f28381f863cd505779e6b9c103bc9..eb0fbf2126e7c9978f46c92b6999f00c5aea9a58 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -571,6 +571,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -587,6 +587,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
MutableBoolean mutableboolean = new MutableBoolean();
do {
@ -274,10 +274,10 @@ index 5346109670bedf88f13b4eff47c5292170fb47cc..7776c22744cdd31459e9634d1d549bdf
list.stream().map((playerchunk) -> {
CompletableFuture completablefuture;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 332bc127230fcefcdab0087922536af8b6ff1e8c..936742383a6834bfd687ec48db308475f598d216 100644
index 3290a2e4689c9e34c3260db4de8ac7f6dc74f8ea..8fa76c3184d7e25339c2de27332ff4d523a4b85e 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -512,7 +512,7 @@ public abstract class PlayerList {
@@ -516,7 +516,7 @@ public abstract class PlayerList {
this.cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
@ -299,10 +299,10 @@ index 6fefa619299d3202158490630d62c16aef71e831..7a4ade1a4190bf4fbb048919ae2be230
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 334fd625829c8e5e9c434b184f6d0084b2d6ccc8..e4c2bd0131a54495fbd1930ad046225118e33186 100644
index c4e679eca56ca756d2d7a9d2ffa2a56e5ab3f721..6f04f79832b52fc898ec2b13af03bc28d4e0bbc1 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -832,6 +832,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -789,6 +789,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
try {
tickConsumer.accept(entity);
} catch (Throwable throwable) {
@ -311,10 +311,10 @@ index 334fd625829c8e5e9c434b184f6d0084b2d6ccc8..e4c2bd0131a54495fbd1930ad0462251
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
MinecraftServer.LOGGER.error(msg, throwable);
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index f994d393929ca6813d4209fb9c93550e4f692228..0b049b267a1e1d6b48c035ed54ff24337863fb9e 100644
index 930fa1703727249585b4ac045db15d55736c58fd..f362f0edf7ee81d2e21d86d57b86420f9619f32e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1058,6 +1058,7 @@ public class LevelChunk extends ChunkAccess {
@@ -1083,6 +1083,7 @@ public class LevelChunk extends ChunkAccess {
gameprofilerfiller.pop();
} catch (Throwable throwable) {
@ -323,10 +323,10 @@ index f994d393929ca6813d4209fb9c93550e4f692228..0b049b267a1e1d6b48c035ed54ff2433
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 21a10a0dc98cb2c669a505d6185c2093855afae6..9e2adc414d43f0c91f222be5f082e74d9db173aa 100644
index 8a36ed778814dfd74ab190fa25cc6dbb54275ac0..14baaf2d679ccceeecb32958cd2ad0ef54beaf4b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2067,7 +2067,7 @@ public final class CraftServer implements Server {
@@ -2050,7 +2050,7 @@ public final class CraftServer implements Server {
@Override
public boolean isPrimaryThread() {
@ -336,7 +336,7 @@ index 21a10a0dc98cb2c669a505d6185c2093855afae6..9e2adc414d43f0c91f222be5f082e74d
// Paper start
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 69b7a11d423b1cd8560cd726dd2b9a2b203e7dfd..7a5e7e8a680ead5128fbf5829bc47704715b94bd 100644
index fea479165e4cf1e4fc6e462d63123bf31bb4e3c3..5e79ad04aed13462d1d187a71801aeb2628495e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -12,6 +12,8 @@ import java.util.logging.Level;

Datei anzeigen

@ -7,10 +7,10 @@ Prevents pathfinding from spamming failures for things such as
arrow attacks.
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 7991baa181d60ac037fd859278d00274ddb42be8..b47cd6d8ed02875bd9af54d27b7c1cda340e7f9f 100644
index 649c2fdba307d986d13916bf90e311c862ccefc1..af53372391d05dd6aa3757556418e8723b8b6d80 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -189,9 +189,29 @@ public abstract class PathNavigation {
@@ -191,9 +191,29 @@ public abstract class PathNavigation {
return this.moveTo(this.createPath(x, y, z, 1), speed);
}