diff --git a/patches/server/0093-Increase-time-statistics-in-intervals.patch b/patches/server/0093-Increase-time-statistics-in-intervals.patch new file mode 100644 index 0000000..def8748 --- /dev/null +++ b/patches/server/0093-Increase-time-statistics-in-intervals.patch @@ -0,0 +1,95 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MartijnMuijsers +Date: Wed, 30 Nov 2022 22:50:57 +0100 +Subject: [PATCH] Increase time statistics in intervals + +License: MIT (https://opensource.org/licenses/MIT) + +This patch is based on the following patch: +"Smarter statistics ticking" +By: Mykyta Komarnytskyy +As part of: Hydrinity (https://github.com/duplexsystem/Hydrinity) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Hydrinity description * + +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. + +* Hydrinity copyright * + +This patch was created for the Hydrinity project by Mykyta Komarnytskyy under the MIT license. + +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 8818ca46af000926ed9eacb47953f440bdac1342..2bf1663dc1e969ea9e192c9941155eb99efff715 100644 +--- a/src/main/java/net/minecraft/world/entity/player/Player.java ++++ b/src/main/java/net/minecraft/world/entity/player/Player.java +@@ -116,6 +116,7 @@ import net.minecraft.world.phys.AABB; + import net.minecraft.world.phys.Vec3; + import net.minecraft.world.scores.PlayerTeam; + import net.minecraft.world.scores.Scoreboard; ++import org.galemc.gale.configuration.GaleGlobalConfiguration; + import org.slf4j.Logger; + import org.bukkit.craftbukkit.entity.CraftHumanEntity; + import org.bukkit.craftbukkit.event.CraftEventFactory; +@@ -288,19 +289,24 @@ public abstract class Player extends LivingEntity { + if (!this.level.isClientSide) { + this.foodData.tick(this); + this.wardenSpawnTracker.tick(); +- this.awardStat(Stats.PLAY_TIME); +- this.awardStat(Stats.TOTAL_WORLD_TIME); ++ // Gale start - Hydrinity - increase time statistics in intervals ++ int interval = Math.max(1, GaleGlobalConfiguration.get().smallOptimizations.reducedIntervals.increaseTimeStatistics); ++ if (interval == 1 || this.tickCount % interval == 0) { ++ this.awardStat(Stats.PLAY_TIME, interval); ++ this.awardStat(Stats.TOTAL_WORLD_TIME, interval); ++ // Gale end - Hydrinity - increase time statistics in intervals + if (this.isAlive()) { +- this.awardStat(Stats.TIME_SINCE_DEATH); ++ this.awardStat(Stats.TIME_SINCE_DEATH, interval); // Gale - Hydrinity - increase time statistics in intervals + } + + if (this.isDiscrete()) { +- this.awardStat(Stats.CROUCH_TIME); ++ this.awardStat(Stats.CROUCH_TIME, interval); // Gale - Hydrinity - increase time statistics in intervals + } + + if (!this.isSleeping()) { +- this.awardStat(Stats.TIME_SINCE_REST); ++ this.awardStat(Stats.TIME_SINCE_REST, interval); // Gale - Hydrinity - increase time statistics in intervals + } ++ } // Gale - Hydrinity - increase time statistics in intervals + } + + int i = 29999999; +diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java +index eb1a5b20810cbad9f47505a8534a42b20b8653d5..44c69a6104f19d799510e349448b8a15805c38c0 100644 +--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java ++++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java +@@ -43,6 +43,25 @@ public class GaleGlobalConfiguration extends ConfigurationPart { + public int checkSpookySeason = 20 * 60 * 60; + // Gale end - Airplane - reduced spooky season checks + ++ // Gale start - Hydrinity - increase time statistics in intervals ++ /** ++ * The interval at which to increase the time-related statistics such as total playtime, time since ++ * the last death, etc. ++ * For example: ++ *
    ++ *
  • If this value is set to 20, the total playtime in ticks will be increased by 20 every second.
  • ++ *
  • If this value is set to 100, the total playtime in ticks will be increased by 100 every 5 seconds.
  • ++ *
++ * Given in ticks. ++ * Any value <= 0 behaves like 1. ++ *
    ++ *
  • Default: 20 (1 second)
  • ++ *
  • Vanilla: 1
  • ++ *
++ */ ++ public int increaseTimeStatistics = 20; ++ // Gale end - Hydrinity - increase time statistics in intervals ++ + } + + public boolean disableVanillaProfiler = true; // Gale - Airplane - config to disable vanilla profiler diff --git a/patches/server/0093-For-collision-check-has-physics-before-same-vehicle.patch b/patches/server/0094-For-collision-check-has-physics-before-same-vehicle.patch similarity index 100% rename from patches/server/0093-For-collision-check-has-physics-before-same-vehicle.patch rename to patches/server/0094-For-collision-check-has-physics-before-same-vehicle.patch diff --git a/patches/server/0094-Variable-main-thread-task-delay.patch b/patches/server/0095-Variable-main-thread-task-delay.patch similarity index 99% rename from patches/server/0094-Variable-main-thread-task-delay.patch rename to patches/server/0095-Variable-main-thread-task-delay.patch index d423b3d..26ddfec 100644 --- a/patches/server/0094-Variable-main-thread-task-delay.patch +++ b/patches/server/0095-Variable-main-thread-task-delay.patch @@ -864,7 +864,7 @@ index 0000000000000000000000000000000000000000..4b82aea23b99180f13c71a1797c4d829 + +} diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java -index eb1a5b20810cbad9f47505a8534a42b20b8653d5..a3280d7e485289785ac0dec42561a2d357860264 100644 +index 44c69a6104f19d799510e349448b8a15805c38c0..02e9a61635078af3d31a112984f4c20dddc8ac7b 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java @@ -2,11 +2,14 @@ @@ -882,7 +882,7 @@ index eb1a5b20810cbad9f47505a8534a42b20b8653d5..a3280d7e485289785ac0dec42561a2d3 import java.util.Locale; import java.util.function.Consumer; -@@ -55,6 +58,223 @@ public class GaleGlobalConfiguration extends ConfigurationPart { +@@ -74,6 +77,223 @@ public class GaleGlobalConfiguration extends ConfigurationPart { } // Gale end - Pufferfish - SIMD support diff --git a/patches/server/0095-Reduce-RandomSource-instances.patch b/patches/server/0096-Reduce-RandomSource-instances.patch similarity index 100% rename from patches/server/0095-Reduce-RandomSource-instances.patch rename to patches/server/0096-Reduce-RandomSource-instances.patch diff --git a/patches/server/0096-CPU-cores-estimation.patch b/patches/server/0097-CPU-cores-estimation.patch similarity index 97% rename from patches/server/0096-CPU-cores-estimation.patch rename to patches/server/0097-CPU-cores-estimation.patch index 8ab536a..dbbb186 100644 --- a/patches/server/0096-CPU-cores-estimation.patch +++ b/patches/server/0097-CPU-cores-estimation.patch @@ -44,10 +44,10 @@ index 947ad1463a973546bdaf68654086291a3414aa9b..69bde99acff7bdae9af7cfe60e222167 import org.yaml.snakeyaml.constructor.SafeConstructor; import org.yaml.snakeyaml.error.MarkedYAMLException; diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java -index a3280d7e485289785ac0dec42561a2d357860264..7cc0beb603776238fd58257384365791a002d7c1 100644 +index 02e9a61635078af3d31a112984f4c20dddc8ac7b..ea85ba6b26a71479571f994b09808b210275fc02 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java -@@ -286,6 +286,7 @@ public class GaleGlobalConfiguration extends ConfigurationPart { +@@ -305,6 +305,7 @@ public class GaleGlobalConfiguration extends ConfigurationPart { public boolean setBlockInFarChunk = true; // Gale - Purpur - do not log setBlock in far chunks public boolean unrecognizedRecipes = false; // Gale - Purpur - do not log unrecognized recipes public boolean legacyMaterialInitialization = false; // Gale - Purpur - do not log legacy Material initialization diff --git a/patches/server/0097-Add-centralized-AsyncExecutor.patch b/patches/server/0098-Add-centralized-AsyncExecutor.patch similarity index 100% rename from patches/server/0097-Add-centralized-AsyncExecutor.patch rename to patches/server/0098-Add-centralized-AsyncExecutor.patch diff --git a/patches/server/0098-Remove-Paper-async-executor.patch b/patches/server/0099-Remove-Paper-async-executor.patch similarity index 100% rename from patches/server/0098-Remove-Paper-async-executor.patch rename to patches/server/0099-Remove-Paper-async-executor.patch diff --git a/patches/server/0099-Remove-Paper-cleaner-executor.patch b/patches/server/0100-Remove-Paper-cleaner-executor.patch similarity index 100% rename from patches/server/0099-Remove-Paper-cleaner-executor.patch rename to patches/server/0100-Remove-Paper-cleaner-executor.patch diff --git a/patches/server/0100-Remove-background-executor.patch b/patches/server/0101-Remove-background-executor.patch similarity index 100% rename from patches/server/0100-Remove-background-executor.patch rename to patches/server/0101-Remove-background-executor.patch diff --git a/patches/server/0101-Remove-bootstrap-executor.patch b/patches/server/0102-Remove-bootstrap-executor.patch similarity index 100% rename from patches/server/0101-Remove-bootstrap-executor.patch rename to patches/server/0102-Remove-bootstrap-executor.patch diff --git a/patches/server/0102-Remove-world-upgrade-executors.patch b/patches/server/0103-Remove-world-upgrade-executors.patch similarity index 100% rename from patches/server/0102-Remove-world-upgrade-executors.patch rename to patches/server/0103-Remove-world-upgrade-executors.patch diff --git a/patches/server/0103-Remove-tab-complete-executor.patch b/patches/server/0104-Remove-tab-complete-executor.patch similarity index 100% rename from patches/server/0103-Remove-tab-complete-executor.patch rename to patches/server/0104-Remove-tab-complete-executor.patch diff --git a/patches/server/0104-Remove-text-filter-executor.patch b/patches/server/0105-Remove-text-filter-executor.patch similarity index 100% rename from patches/server/0104-Remove-text-filter-executor.patch rename to patches/server/0105-Remove-text-filter-executor.patch