mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@893ea746 Make stage 2 chunk unload utilise I/O future write PaperMC/Paper@a41043f2 Add back command source for command blocks with output disabled and fix bukkit->minecraft not respecting output disabled for minecart command blocks (#13271) PaperMC/Paper@1f31ee5e Do not record task execution time as TickTime individually
This commit is contained in:
@@ -2,7 +2,7 @@ group = org.purpurmc.purpur
|
|||||||
version = 1.21.10-R0.1-SNAPSHOT
|
version = 1.21.10-R0.1-SNAPSHOT
|
||||||
|
|
||||||
mcVersion = 1.21.10
|
mcVersion = 1.21.10
|
||||||
paperCommit = e8c6ba5068287049c890688534963041208c4213
|
paperCommit = 1f31ee5ebe45d97a596a4429d9871e3f8910cd28
|
||||||
|
|
||||||
org.gradle.configuration-cache = true
|
org.gradle.configuration-cache = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ index 6c452f195055afb489f828bfac9f23217ba7653d..7261bb8b2728b6e4ff519874375ef42f
|
|||||||
public boolean isClientAuthoritative() {
|
public boolean isClientAuthoritative() {
|
||||||
return false;
|
return false;
|
||||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||||
index e35fb4f48a16780d8728ac1c7bb0fc64e2ded4e7..2c7039281854cc9b21e2badb62389522a5c1728e 100644
|
index 9337f3fa2daa224d04499fd2bb0fef9c1283ba27..614f725bee3b3047402543a12896935faeea877d 100644
|
||||||
--- a/net/minecraft/server/MinecraftServer.java
|
--- a/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/net/minecraft/server/MinecraftServer.java
|
+++ b/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -1824,6 +1824,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1819,6 +1819,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
|
serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
|
||||||
serverLevel.updateLagCompensationTick(); // Paper - lag compensation
|
serverLevel.updateLagCompensationTick(); // Paper - lag compensation
|
||||||
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = serverLevel.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
|
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = serverLevel.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
// Paper start - improve tick loop
|
// Paper start - improve tick loop
|
||||||
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes1s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(1L));
|
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes1s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(1L));
|
||||||
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes5s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(5L));
|
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes5s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(5L));
|
||||||
@@ -370,6 +_,7 @@
|
@@ -371,6 +_,7 @@
|
||||||
public double[] computeTPS() {
|
public double[] computeTPS() {
|
||||||
final long interval = this.tickRateManager().nanosecondsPerTick();
|
final long interval = this.tickRateManager().nanosecondsPerTick();
|
||||||
return new double[] {
|
return new double[] {
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
getTPS(this.tickTimes1m, interval),
|
getTPS(this.tickTimes1m, interval),
|
||||||
getTPS(this.tickTimes5m, interval),
|
getTPS(this.tickTimes5m, interval),
|
||||||
getTPS(this.tickTimes15m, interval)
|
getTPS(this.tickTimes15m, interval)
|
||||||
@@ -1012,6 +_,15 @@
|
@@ -1013,6 +_,15 @@
|
||||||
|
|
||||||
LOGGER.info("Stopping server");
|
LOGGER.info("Stopping server");
|
||||||
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.server != null) {
|
if (this.server != null) {
|
||||||
this.server.spark.disable(); // Paper - spark
|
this.server.spark.disable(); // Paper - spark
|
||||||
@@ -1110,6 +_,8 @@
|
@@ -1111,6 +_,8 @@
|
||||||
this.safeShutdown(waitForShutdown, false);
|
this.safeShutdown(waitForShutdown, false);
|
||||||
}
|
}
|
||||||
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
|
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
this.isRestarting = isRestarting;
|
this.isRestarting = isRestarting;
|
||||||
this.hasLoggedStop = true; // Paper - Debugging
|
this.hasLoggedStop = true; // Paper - Debugging
|
||||||
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
|
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
|
||||||
@@ -1293,6 +_,16 @@
|
@@ -1288,6 +_,16 @@
|
||||||
}
|
}
|
||||||
// Paper end - Add onboarding message for initial server start
|
// Paper end - Add onboarding message for initial server start
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
while (this.running) {
|
while (this.running) {
|
||||||
final long tickStart = System.nanoTime(); // Paper - improve tick loop
|
final long tickStart = System.nanoTime(); // Paper - improve tick loop
|
||||||
long l; // Paper - improve tick loop - diff on change, expect this to be tick interval
|
long l; // Paper - improve tick loop - diff on change, expect this to be tick interval
|
||||||
@@ -1306,8 +_,10 @@
|
@@ -1301,8 +_,10 @@
|
||||||
final long ticksBehind = Math.max(1L, this.tickSchedule.getPeriodsAhead(l, tickStart));
|
final long ticksBehind = Math.max(1L, this.tickSchedule.getPeriodsAhead(l, tickStart));
|
||||||
final long catchup = (long)Math.max(
|
final long catchup = (long)Math.max(
|
||||||
1,
|
1,
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
|
|
||||||
// adjust ticksBehind so that it is not greater-than catchup
|
// adjust ticksBehind so that it is not greater-than catchup
|
||||||
if (ticksBehind > catchup) {
|
if (ticksBehind > catchup) {
|
||||||
@@ -1778,7 +_,7 @@
|
@@ -1773,7 +_,7 @@
|
||||||
long worldTime = level.getGameTime();
|
long worldTime = level.getGameTime();
|
||||||
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
|
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
|
||||||
for (Player entityhuman : level.players()) {
|
for (Player entityhuman : level.players()) {
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
|
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
|
||||||
@@ -1950,7 +_,7 @@
|
@@ -1945,7 +_,7 @@
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
public String getServerModName() {
|
public String getServerModName() {
|
||||||
|
|||||||
@@ -1,127 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Preva1l <prod.preva1l@gmail.com>
|
|
||||||
Date: Thu, 30 Oct 2025 21:52:52 -0700
|
|
||||||
Subject: [PATCH] Further reduce impact of tick time calculations,
|
|
||||||
PaperPR#13256
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/time/TickData.java b/src/main/java/ca/spottedleaf/moonrise/common/time/TickData.java
|
|
||||||
index 7e4fec66f1f7e9daabd015cde689e67736d6a54a..b562acd4d87a75e66f5256dd85faf48eff26f552 100644
|
|
||||||
--- a/src/main/java/ca/spottedleaf/moonrise/common/time/TickData.java
|
|
||||||
+++ b/src/main/java/ca/spottedleaf/moonrise/common/time/TickData.java
|
|
||||||
@@ -292,78 +292,51 @@ public final class TickData {
|
|
||||||
// So, we will "compact" the data by merging any inbetween tick times
|
|
||||||
// the next tick.
|
|
||||||
// If there is no "next tick", then we will create one.
|
|
||||||
- final List<TickInformation> collapsedData = new ArrayList<>();
|
|
||||||
- for (int i = 0, len = allData.size(); i < len; ++i) {
|
|
||||||
- final List<TickTime> toCollapse = new ArrayList<>();
|
|
||||||
- TickTime lastTick = null;
|
|
||||||
- for (;i < len; ++i) {
|
|
||||||
- final TickTime time = allData.get(i);
|
|
||||||
- if (!time.isTickExecution()) {
|
|
||||||
- toCollapse.add(time);
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
- lastTick = time;
|
|
||||||
- break;
|
|
||||||
- }
|
|
||||||
+ final int len = allData.size();
|
|
||||||
+ final List<TickInformation> collapsedData = new ArrayList<>(len);
|
|
||||||
+
|
|
||||||
+ long totalTickTime = 0L;
|
|
||||||
+ long totalCpuTime = 0L;
|
|
||||||
+ TickTime lastActualTick = null;
|
|
||||||
+
|
|
||||||
+ for (final TickTime time : allData) {
|
|
||||||
+ if (!time.isTickExecution()) {
|
|
||||||
+ totalTickTime += time.tickLength();
|
|
||||||
+ totalCpuTime += time.supportCPUTime() ? time.tickCpuTime() : 0L;
|
|
||||||
+ } else {
|
|
||||||
+ final long tickCpu = time.supportCPUTime() ? time.tickCpuTime() : 0L;
|
|
||||||
|
|
||||||
- if (toCollapse.isEmpty()) {
|
|
||||||
- // nothing to collapse
|
|
||||||
- final TickTime last = allData.get(i);
|
|
||||||
collapsedData.add(
|
|
||||||
new TickInformation(
|
|
||||||
- last.differenceFromLastTick(tickInterval),
|
|
||||||
- last.tickLength(),
|
|
||||||
- last.supportCPUTime() ? last.tickCpuTime() : 0L
|
|
||||||
+ time.differenceFromLastTick(tickInterval),
|
|
||||||
+ time.tickLength() + totalTickTime,
|
|
||||||
+ tickCpu + totalCpuTime
|
|
||||||
)
|
|
||||||
);
|
|
||||||
+
|
|
||||||
+ totalTickTime = 0L;
|
|
||||||
+ totalCpuTime = 0L;
|
|
||||||
+ lastActualTick = time;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (totalTickTime > 0 && createFakeTick) {
|
|
||||||
+ final long differenceBetweenTicks;
|
|
||||||
+ if (lastActualTick != null) {
|
|
||||||
+ differenceBetweenTicks = lastActualTick.tickStart();
|
|
||||||
} else {
|
|
||||||
- long totalTickTime = 0L;
|
|
||||||
- long totalCpuTime = 0L;
|
|
||||||
- for (int k = 0, len2 = toCollapse.size(); k < len2; ++k) {
|
|
||||||
- final TickTime time = toCollapse.get(k);
|
|
||||||
- totalTickTime += time.tickLength();
|
|
||||||
- totalCpuTime += time.supportCPUTime() ? time.tickCpuTime() : 0L;
|
|
||||||
- }
|
|
||||||
- if (i < len) {
|
|
||||||
- // we know there is a tick to collapse into
|
|
||||||
- final TickTime last = allData.get(i);
|
|
||||||
- collapsedData.add(
|
|
||||||
- new TickInformation(
|
|
||||||
- last.differenceFromLastTick(tickInterval),
|
|
||||||
- last.tickLength() + totalTickTime,
|
|
||||||
- (last.supportCPUTime() ? last.tickCpuTime() : 0L) + totalCpuTime
|
|
||||||
- )
|
|
||||||
- );
|
|
||||||
- } else if (createFakeTick) {
|
|
||||||
- // we do not have a tick to collapse into, so we must make one up
|
|
||||||
- // we will assume that the tick is "starting now" and ongoing
|
|
||||||
-
|
|
||||||
- // compute difference between imaginary tick and last tick
|
|
||||||
- final long differenceBetweenTicks;
|
|
||||||
- if (lastTick != null) {
|
|
||||||
- // we have a last tick, use it
|
|
||||||
- differenceBetweenTicks = lastTick.tickStart();
|
|
||||||
- } else {
|
|
||||||
- // we don't have a last tick, so we must make one up that makes sense
|
|
||||||
- // if the current interval exceeds the max tick time, then use it
|
|
||||||
-
|
|
||||||
- // Otherwise use the interval length.
|
|
||||||
- // This is how differenceFromLastTick() works on TickTime when there is no previous interval.
|
|
||||||
- differenceBetweenTicks = Math.max(
|
|
||||||
- tickInterval, totalTickTime
|
|
||||||
- );
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- collapsedData.add(
|
|
||||||
- new TickInformation(
|
|
||||||
- differenceBetweenTicks,
|
|
||||||
- totalTickTime,
|
|
||||||
- totalCpuTime
|
|
||||||
- )
|
|
||||||
- );
|
|
||||||
- }
|
|
||||||
+ differenceBetweenTicks = Math.max(tickInterval, totalTickTime);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ collapsedData.add(
|
|
||||||
+ new TickInformation(
|
|
||||||
+ differenceBetweenTicks,
|
|
||||||
+ totalTickTime,
|
|
||||||
+ totalCpuTime
|
|
||||||
+ )
|
|
||||||
+ );
|
|
||||||
}
|
|
||||||
+
|
|
||||||
return collapsedData;
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user