mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-02 07:33:39 +01:00
15bf6a2103
* Updated Upstream and Sidestream(s) (Paper) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 808bd9198 Add fast alternative constructor for Vector3f (#5339) e849c51da fix #5336 0b25bacfc fix patch 'Remove streams from SensorNearest' (fixes #5330) 4d287e31c Use Adventure for `/version` command feedback, add copy to clipboard click event (#5333) * Updated Upstream and Sidestream(s) (Tuinity) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Tuinity Changes: 19ac660 Move region chunk unload & poi unload hook up 38ad5a1 Do not run close logic for inventories on chunk unload fb75a6f Do not allow the server to unload chunks at request of plugins
56 lines
2.8 KiB
Diff
56 lines
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Mykyta Komarnytskyy <nkomarn@hotmail.com>
|
|
Date: Sat, 24 Oct 2020 21:03:53 -0500
|
|
Subject: [PATCH] Smarter statistics ticking
|
|
|
|
In vanilla, statistics that count time spent for an action (i.e. time played or sneak time) are incremented every tick. This is retarded. With this patch and a configured interval of 20, the statistics are only ticked every 20th tick and are incremented by 20 ticks at a time. This means a lot less ticking with the same accurate counting.
|
|
|
|
With an interval of 20, this patch saves roughly 3ms per tick on a server w/ 80 players online.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
index 15a2065abf7c187a9b92bd743240085e2a61a906..1730108aa67802ed15407c45542b6223ca86634f 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -175,18 +175,23 @@ public abstract class EntityHuman extends EntityLiving {
|
|
this.p();
|
|
if (!this.world.isClientSide) {
|
|
this.foodData.a(this);
|
|
- this.a(StatisticList.PLAY_ONE_MINUTE);
|
|
+ // Yatopia start
|
|
+ int interval = org.yatopiamc.yatopia.server.YatopiaConfig.playerTimeStatisticsInterval;
|
|
+ if (ticksLived % interval == 0) {
|
|
+ this.a(StatisticList.PLAY_ONE_MINUTE, interval);
|
|
+ // Yatopia end
|
|
if (this.isAlive()) {
|
|
- this.a(StatisticList.TIME_SINCE_DEATH);
|
|
+ this.a(StatisticList.TIME_SINCE_DEATH, interval); // Yatopia
|
|
}
|
|
|
|
if (this.bx()) {
|
|
- this.a(StatisticList.SNEAK_TIME);
|
|
+ this.a(StatisticList.SNEAK_TIME, interval); // Yatopia
|
|
}
|
|
|
|
if (!this.isSleeping()) {
|
|
- this.a(StatisticList.TIME_SINCE_REST);
|
|
+ this.a(StatisticList.TIME_SINCE_REST, interval); // Yatopia
|
|
}
|
|
+ } // Yatopia
|
|
}
|
|
|
|
int i = 29999999;
|
|
diff --git a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
|
index 81ab5afa7bd397266d2afe77426d2e629529aa1a..045ace1444b4db8fa5fab09f970de7a696c56ab8 100644
|
|
--- a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
|
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
|
@@ -230,4 +230,9 @@ public class YatopiaConfig {
|
|
checkFlying = getBoolean("settings.checks.flight", checkFlying);
|
|
checkVehicleFlying = getBoolean("settings.checks.vehicle-flight", checkVehicleFlying);
|
|
}
|
|
+
|
|
+ public static int playerTimeStatisticsInterval = 1;
|
|
+ private static void intervals() {
|
|
+ playerTimeStatisticsInterval = Math.max(1, getInt("settings.intervals.player-time-statistics", 1));
|
|
+ }
|
|
}
|