first 100!

This commit is contained in:
Noah van der Aa 2024-10-22 20:04:31 +02:00
parent d280061a1a
commit 3585434382
No known key found for this signature in database
GPG key ID: 547D90BC6FF753CF
77 changed files with 510 additions and 470 deletions

View file

@ -714,7 +714,7 @@ index f7197f1347251a37dd0f6d9ffa2f09bc3a4e1233..d0d36a57ec4896bcb74970f8fb24d8f3
} catch (Exception exception) {
if (exception instanceof ReportedException) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d7810b7a0bcb 100644
index 3322865949fe5ddaab2dffc39260b75093f0f204..638d648be24c9907bab6dcb671f42c4cf569e2d7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -203,7 +203,7 @@ import org.bukkit.craftbukkit.Main;
@ -726,7 +726,7 @@ index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d781
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, ChunkIOErrorReporter, CommandSource {
@@ -925,6 +925,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -926,6 +926,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
MinecraftServer.LOGGER.info("Stopping server");
@ -734,7 +734,7 @@ index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d781
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@@ -1227,9 +1228,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1228,9 +1229,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private boolean haveTime() {
// CraftBukkit start
@ -756,7 +756,7 @@ index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d781
private void executeModerately() {
this.runAllTasks();
java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
@@ -1258,12 +1271,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1259,12 +1272,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
protected void waitUntilNextTick() {
@ -771,7 +771,7 @@ index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d781
});
} finally {
this.waitingForNextTick = false;
@@ -1369,7 +1382,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1370,7 +1383,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void tickServer(BooleanSupplier shouldKeepTicking) {
@ -780,7 +780,7 @@ index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d781
long i = Util.getNanos();
int j = this.pauseWhileEmptySeconds() * 20;
@@ -1392,7 +1405,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1393,7 +1406,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
@ -796,7 +796,7 @@ index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d781
++this.tickCount;
this.tickRateManager.tick();
this.tickChildren(shouldKeepTicking);
@@ -1408,6 +1428,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1409,6 +1429,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ProfilerFiller gameprofilerfiller = Profiler.get();
@ -808,7 +808,7 @@ index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d781
gameprofilerfiller.push("tallying");
long k = Util.getNanos() - i;
int l = this.tickCount % 100;
@@ -1418,13 +1443,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1419,13 +1444,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float) k / (float) TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;
this.logTickMethodTime(i);
gameprofilerfiller.pop();
@ -823,7 +823,7 @@ index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d781
MinecraftServer.LOGGER.debug("Autosave started");
ProfilerFiller gameprofilerfiller = Profiler.get();
@@ -1432,7 +1455,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1433,7 +1456,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.saveEverything(true, false, false);
gameprofilerfiller.pop();
MinecraftServer.LOGGER.debug("Autosave finished");
@ -831,7 +831,7 @@ index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d781
}
private void logTickMethodTime(long tickStartTime) {
@@ -1505,26 +1527,26 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1506,26 +1528,26 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
entityplayer.connection.suspendFlushing();
});
@ -865,7 +865,7 @@ index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d781
// Send time updates to everyone, it will get the right time from the world the player is in.
if (this.tickCount % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
@@ -1532,7 +1554,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1533,7 +1555,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.serverLevel().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
}
}
@ -874,7 +874,7 @@ index 3d1e9f24b83513c9f499471e7eefaf639f9097ec..4502e2cf565b7b0547a1963b1119d781
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
@@ -1568,24 +1590,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1569,24 +1591,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
gameprofilerfiller.popPush("connection");
@ -991,7 +991,7 @@ index 9d6be455c3bbcdbcb9d3d24b0bad79f46ba6a8cb..de6cceeec4fc4a64d325b506ae9d9b0e
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index b6fb3921b7df9748e38df494fd0012f45d97ac4b..5c9ed5091d61418d99582cb5a7242b5e10126dc5 100644
index 88e98f49565a098debcea8d58368e53d7623f6b5..84ea1974445fc7be80ed474d8a2133b58ee4c8fe 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,8 +1,10 @@
@ -1581,6 +1581,34 @@ index d76591694c3b167b8b8f17b61a373a43140a8b68..717e4bf9f5ee0ec2c3a0b5cc65a50b0f
}
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
index d1b82dec25069a7027aaf53086b1829e511fc301..4367ccc628bb4f404d6a081083002518442f462b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
@@ -576,15 +576,12 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun
@Nullable
private static LevelChunk.PostLoadProcessor postLoadChunk(ServerLevel world, List<CompoundTag> entities, List<CompoundTag> blockEntities) {
return entities.isEmpty() && blockEntities.isEmpty() ? null : (chunk) -> {
- world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot
if (!entities.isEmpty()) {
world.addLegacyChunkEntities(EntityType.loadEntitiesRecursive(entities, world, EntitySpawnReason.LOAD));
}
- world.timings.syncChunkLoadEntitiesTimer.stopTiming(); // Spigot
Iterator iterator = blockEntities.iterator();
- world.timings.syncChunkLoadTileEntitiesTimer.startTiming(); // Spigot
while (iterator.hasNext()) {
CompoundTag nbttagcompound = (CompoundTag) iterator.next();
boolean flag = nbttagcompound.getBoolean("keepPacked");
@@ -600,7 +597,6 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun
}
}
}
- world.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot
};
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9bf8c4d9154c433e586f59587e8d7db7c310bb9c..232a21080ff416ac5b9fdf913f6784eb3bcdacfa 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java