mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-03 22:26:19 +00:00
Originally vanilla logic is to use stream, and Mojang switched it to Guava's Collections2 since 1.21.4. It is much faster than using stream or manually adding to a new ArrayList. Manually adding to a new ArrayList requires allocating a new object array. However, the Collections2 lazy handles filter condition on iteration, so much better.
59 lines
3.5 KiB
Diff
59 lines
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
|
Date: Mon, 1 Nov 2077 00:00:00 +0800
|
|
Subject: [PATCH] TT20: Lag compensation
|
|
|
|
Original license: AGPL-3.0
|
|
Original project: https://github.com/snackbag/TT20
|
|
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
|
index 90409e9ef5cac2abe6748b723207c33224821194..a780cba7e2e95412226d9e80b892ab0126f50666 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -1541,6 +1541,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
|
|
this.server.spark.tickStart(); // Paper - spark
|
|
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
|
|
+ if (org.dreeam.leaf.config.modules.misc.LagCompensation.enabled) org.dreeam.leaf.misc.LagCompensation.TPSCalculator.onTick(); // Leaf - TT20 - Lag compensation - tick hook
|
|
this.tickCount++;
|
|
this.tickRateManager.tick();
|
|
this.tickChildren(hasTimeLeft);
|
|
diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java
|
|
index 43cdc2f8fdfdeb1426e386e0084087779ef62754..5984ea9f6236a80b666fe6c33a99245389b54e8f 100644
|
|
--- a/net/minecraft/world/level/material/LavaFluid.java
|
|
+++ b/net/minecraft/world/level/material/LavaFluid.java
|
|
@@ -189,7 +189,13 @@ public abstract class LavaFluid extends FlowingFluid {
|
|
|
|
@Override
|
|
public int getTickDelay(LevelReader level) {
|
|
- return level.dimensionType().ultraWarm() ? level.getWorldBorder().world.purpurConfig.lavaSpeedNether : level.getWorldBorder().world.purpurConfig.lavaSpeedNotNether; // Purpur - Make lava flow speed configurable
|
|
+ // Leaf start - TT20 - Lag compensation
|
|
+ if (org.dreeam.leaf.config.modules.misc.LagCompensation.enabled && org.dreeam.leaf.config.modules.misc.LagCompensation.enableForLava) {
|
|
+ return level.dimensionType().ultraWarm() ? org.dreeam.leaf.misc.LagCompensation.tt20(level.getWorldBorder().world.purpurConfig.lavaSpeedNether, true) : org.dreeam.leaf.misc.LagCompensation.tt20(level.getWorldBorder().world.purpurConfig.lavaSpeedNotNether, true); // Purpur - Make lava flow speed configurable // Leaf
|
|
+ } else {
|
|
+ return level.dimensionType().ultraWarm() ? level.getWorldBorder().world.purpurConfig.lavaSpeedNether : level.getWorldBorder().world.purpurConfig.lavaSpeedNotNether; // Purpur - Make lava flow speed configurable
|
|
+ }
|
|
+ // Leaf end - TT20 - Lag compensation
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/world/level/material/WaterFluid.java b/net/minecraft/world/level/material/WaterFluid.java
|
|
index b248fe1d66940c05d56fc322df61c52ece72e77f..361de86f003da8b9434c3cb5da5c8e79d6cd3e86 100644
|
|
--- a/net/minecraft/world/level/material/WaterFluid.java
|
|
+++ b/net/minecraft/world/level/material/WaterFluid.java
|
|
@@ -126,7 +126,13 @@ public abstract class WaterFluid extends FlowingFluid {
|
|
|
|
@Override
|
|
public int getTickDelay(LevelReader level) {
|
|
- return 5;
|
|
+ // Leaf start - TT20 - Lag compensation
|
|
+ if (org.dreeam.leaf.config.modules.misc.LagCompensation.enabled && org.dreeam.leaf.config.modules.misc.LagCompensation.enableForWater) {
|
|
+ return org.dreeam.leaf.misc.LagCompensation.tt20(5, true);
|
|
+ } else {
|
|
+ return 5;
|
|
+ }
|
|
+ // Leaf end - TT20 - Lag compensation
|
|
}
|
|
|
|
@Override
|