Upstream has released updates that appear to apply and compile correctly. [Purpur Changes] PurpurMC/Purpur@e86a1b6: Updated Upstream (Paper) PurpurMC/Purpur@962ee30: Updated Upstream (Paper) PurpurMC/Purpur@74d1b4c: Updated Upstream (Paper) PurpurMC/Purpur@e2e8c61: Updated Upstream (Paper) PurpurMC/Purpur@7a01fd8: Updated Upstream (Paper) PurpurMC/Purpur@34c18f0: Updated Upstream (Paper) PurpurMC/Purpur@ca668ab: Updated Upstream (Paper) PurpurMC/Purpur@200178d: Updated Upstream (Paper) PurpurMC/Purpur@9968cbb: Updated Upstream (Paper) PurpurMC/Purpur@db09358: Fix clamp-levels option not being true by default (#1609) PurpurMC/Purpur@f289b6a: Updated Upstream (Paper) PurpurMC/Purpur@959c29d: Fix Tridents giving errors without having an Elytra equipped (#1612) PurpurMC/Purpur@68c1612: Fix villagers not spawning when the `follow-emerald-blocks` option is enabled (#1611) PurpurMC/Purpur@5b75c68: fix `bypass-mob-griefing` not being the inverse of mobgriefing gamerule, closes #1603 PurpurMC/Purpur@55d4309: Updated Upstream (Paper) PurpurMC/Purpur@0601f87: Updated Upstream (Paper) PurpurMC/Purpur@06dde9d: Add Ridable and Attribute options for Creaking mob (#1613) PurpurMC/Purpur@420a1ce: Set the bee's `takes-damage-from-water` option to true by default (#1614) PurpurMC/Purpur@2b6f273: Updated Upstream (Paper) PurpurMC/Purpur@504f311: Updated Upstream (Paper) PurpurMC/Purpur@2b694c9: Updated Upstream (Paper) PurpurMC/Purpur@96d7ef7: Updated Upstream (Paper) PurpurMC/Purpur@e141f68: Updated Upstream (Paper) PurpurMC/Purpur@7f6f667: Updated Upstream (Pufferfish) PurpurMC/Purpur@de20ba9: ignore `minecart.max-speed` config value if using minecart experiment, closes #1618 PurpurMC/Purpur@03062a8: fix ridable mobs not being controllable, closes #1620 PurpurMC/Purpur@0493ac3: Updated Upstream (Paper) PurpurMC/Purpur@16ce24a: fix(ridables/creaking): override tick method in look/move control
178 lines
9.4 KiB
Diff
178 lines
9.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: AlphaKR93 <dev@alpha93.kr>
|
|
Date: Fri, 13 Dec 2024 23:36:03 +0900
|
|
Subject: [PATCH] SparklyPaper - MSPT by World
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/command/MSPTCommand.java b/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
|
index 8b5293b0c696ef21d0101493ffa41b60bf0bc86b..bf3a6e8e35fe9869dfa56a97dd5d820296de9721 100644
|
|
--- a/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
|
+++ b/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
|
@@ -25,6 +25,29 @@ import static net.kyori.adventure.text.format.NamedTextColor.YELLOW;
|
|
public final class MSPTCommand extends Command {
|
|
private static final DecimalFormat DF = new DecimalFormat("########0.0");
|
|
private static final Component SLASH = text("/");
|
|
+ // Plazma start - MSPT by world
|
|
+ private static final Component COMMA = text(", ", YELLOW);
|
|
+ private static final Component HEADER = text().color(YELLOW).append(
|
|
+ text("("),
|
|
+ text("avg", GRAY),
|
|
+ text("/"),
|
|
+ text("min", GRAY),
|
|
+ text("/"),
|
|
+ text("max", GRAY),
|
|
+ text(")")
|
|
+ ).append(
|
|
+ text(" from last 1s"),
|
|
+ text(",", GRAY),
|
|
+ text(" 5s"),
|
|
+ text(",", GRAY),
|
|
+ text(" 10s"),
|
|
+ text(",", GRAY),
|
|
+ text(" 30s"),
|
|
+ text(",", GRAY),
|
|
+ text(" 1m"),
|
|
+ text(":", YELLOW)
|
|
+ ).build();
|
|
+ // Plazma end - MSPT by world
|
|
|
|
public MSPTCommand(final String name) {
|
|
super(name);
|
|
@@ -45,39 +68,44 @@ public final class MSPTCommand extends Command {
|
|
MinecraftServer server = MinecraftServer.getServer();
|
|
|
|
List<Component> times = new ArrayList<>();
|
|
+ // Plazma start - MSPT by world
|
|
+ times.addAll(eval(server.tickTimes1s.getTimes()));
|
|
times.addAll(eval(server.tickTimes5s.getTimes()));
|
|
times.addAll(eval(server.tickTimes10s.getTimes()));
|
|
+ times.addAll(eval(server.tickTimes30s.getTimes()));
|
|
times.addAll(eval(server.tickTimes60s.getTimes()));
|
|
|
|
- sender.sendMessage(text().content("Server tick times ").color(GOLD)
|
|
- .append(text().color(YELLOW)
|
|
- .append(
|
|
- text("("),
|
|
- text("avg", GRAY),
|
|
- text("/"),
|
|
- text("min", GRAY),
|
|
- text("/"),
|
|
- text("max", GRAY),
|
|
- text(")")
|
|
- )
|
|
- ).append(
|
|
- text(" from last 5s"),
|
|
- text(",", GRAY),
|
|
- text(" 10s"),
|
|
- text(",", GRAY),
|
|
- text(" 1m"),
|
|
- text(":", YELLOW)
|
|
- )
|
|
- );
|
|
- sender.sendMessage(text().content("◴ ").color(GOLD)
|
|
- .append(text().color(GRAY)
|
|
- .append(
|
|
- times.get(0), SLASH, times.get(1), SLASH, times.get(2), text(", ", YELLOW),
|
|
- times.get(3), SLASH, times.get(4), SLASH, times.get(5), text(", ", YELLOW),
|
|
- times.get(6), SLASH, times.get(7), SLASH, times.get(8)
|
|
- )
|
|
- )
|
|
- );
|
|
+ sender.sendMessage(text().content("Server tick times ").color(GOLD).append(HEADER));
|
|
+ sender.sendMessage(text().content("◴ ").color(GOLD).append(text().color(GRAY).append(
|
|
+ times.get(0), SLASH, times.get(1), SLASH, times.get(2), COMMA,
|
|
+ times.get(3), SLASH, times.get(4), SLASH, times.get(5), COMMA,
|
|
+ times.get(6), SLASH, times.get(7), SLASH, times.get(8), COMMA,
|
|
+ times.get(9), SLASH, times.get(10), SLASH, times.get(11), COMMA,
|
|
+ times.get(12), SLASH, times.get(13), SLASH, times.get(14)
|
|
+ )));
|
|
+
|
|
+ sender.sendMessage(text());
|
|
+ sender.sendMessage(text().content("World tick times ").color(GOLD).append(HEADER));
|
|
+ for (net.minecraft.server.level.ServerLevel serverLevel : server.getAllLevels()) {
|
|
+ List<Component> worldTimes = new ArrayList<>();
|
|
+ worldTimes.addAll(eval(serverLevel.tickTimes1s.getTimes()));
|
|
+ worldTimes.addAll(eval(serverLevel.tickTimes5s.getTimes()));
|
|
+ worldTimes.addAll(eval(serverLevel.tickTimes10s.getTimes()));
|
|
+ worldTimes.addAll(eval(serverLevel.tickTimes30s.getTimes()));
|
|
+ worldTimes.addAll(eval(serverLevel.tickTimes60s.getTimes()));
|
|
+
|
|
+ sender.sendMessage(text().content("◴ " + serverLevel.getWorld().getName() + ": ").color(GOLD).append(
|
|
+ text().color(GRAY).append(
|
|
+ worldTimes.get(0), SLASH, worldTimes.get(1), SLASH, worldTimes.get(2), COMMA,
|
|
+ worldTimes.get(3), SLASH, worldTimes.get(4), SLASH, worldTimes.get(5), COMMA,
|
|
+ worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8), COMMA,
|
|
+ worldTimes.get(9), SLASH, worldTimes.get(10), SLASH, worldTimes.get(11), COMMA,
|
|
+ worldTimes.get(12), SLASH, worldTimes.get(13), SLASH, worldTimes.get(14)
|
|
+ ))
|
|
+ );
|
|
+ }
|
|
+ // Plazma end - MSPT by world
|
|
+
|
|
return true;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 022c4c01ab015a2a6135baa5dbe442fa7a1b4615..26c5cb68b464305fde43e2e0e1a415a2425483ea 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -264,8 +264,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
private final long[] tickTimesNanos;
|
|
private long aggregatedTickTimesNanos;
|
|
// Paper start - Add tick times API and /mspt command
|
|
+ public final TickTimes tickTimes1s = new TickTimes(20); // Plazma - Add more MSPT
|
|
public final TickTimes tickTimes5s = new TickTimes(100);
|
|
public final TickTimes tickTimes10s = new TickTimes(200);
|
|
+ public final TickTimes tickTimes30s = new TickTimes(600); // Plazma - Add more MSPT
|
|
public final TickTimes tickTimes60s = new TickTimes(1200);
|
|
// Paper end - Add tick times API and /mspt command
|
|
@Nullable
|
|
@@ -1778,8 +1780,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
this.tickTimesNanos[l] = k;
|
|
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float) k / (float) TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;
|
|
// Paper start - Add tick times API and /mspt command
|
|
+ this.tickTimes1s.add(this.tickCount, k); // Plazma - Add more MSPT
|
|
this.tickTimes5s.add(this.tickCount, k);
|
|
this.tickTimes10s.add(this.tickCount, k);
|
|
+ this.tickTimes30s.add(this.tickCount, k); // Plazma - Add more MSPT
|
|
this.tickTimes60s.add(this.tickCount, k);
|
|
// Paper end - Add tick times API and /mspt command
|
|
this.logTickMethodTime(i);
|
|
@@ -1941,7 +1945,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
//gameprofilerfiller.push("tick"); // Plazma - Completely remove Mojang profilers
|
|
|
|
try {
|
|
+ // Plazma start - MSPT by world
|
|
+ long i = Util.getNanos();
|
|
worldserver.tick(shouldKeepTicking);
|
|
+ long d = Util.getNanos() - i;
|
|
+
|
|
+ worldserver.tickTimes1s.add(this.tickCount, d);
|
|
+ worldserver.tickTimes5s.add(this.tickCount, d);
|
|
+ worldserver.tickTimes10s.add(this.tickCount, d);
|
|
+ worldserver.tickTimes30s.add(this.tickCount, d);
|
|
+ worldserver.tickTimes60s.add(this.tickCount, d);
|
|
+ // Plazma end - MSPT by world
|
|
} catch (Throwable throwable) {
|
|
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index 14188b6e317dca2bbf98896951605f2e3742506f..137138aa1e42d4f12ed0bc54bc25918d29120333 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -598,6 +598,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
}
|
|
// Paper end - lag compensation
|
|
|
|
+ // Plazma start - MSPT by world
|
|
+ public final MinecraftServer.TickTimes tickTimes1s = new MinecraftServer.TickTimes(20);
|
|
+ public final MinecraftServer.TickTimes tickTimes5s = new MinecraftServer.TickTimes(100);
|
|
+ public final MinecraftServer.TickTimes tickTimes10s = new MinecraftServer.TickTimes(200);
|
|
+ public final MinecraftServer.TickTimes tickTimes30s = new MinecraftServer.TickTimes(600);
|
|
+ public final MinecraftServer.TickTimes tickTimes60s = new MinecraftServer.TickTimes(1200);
|
|
+ // Plazma end - MSPT by world
|
|
+
|
|
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
|
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
|
// Plazma start - Configurable Plazma
|