mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-04 15:41:40 +00:00
fix reduce chunk source updates position check and mark experimental
Co-Authored-By: hayanesuru <68378576+hayanesuru@users.noreply.github.com>
This commit is contained in:
@@ -5,24 +5,15 @@ Subject: [PATCH] Reduce PlayerChunk Updates
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 1415043bee5fbbfcf9dab9184a9418d52f531f62..1a09ea1953169b72d67126283b5f581c2797506a 100644
|
||||
index 1415043bee5fbbfcf9dab9184a9418d52f531f62..516bc98d92ab4ac3b7c15091197b8107ab144a6b 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1368,6 +1368,8 @@ public class ServerGamePacketListenerImpl
|
||||
this.resetPosition();
|
||||
}
|
||||
|
||||
+ final net.minecraft.world.level.ChunkPos playerStartChunkPosition = this.player.chunkPosition(); // Leaf - Reduce PlayerChunk Updates
|
||||
+
|
||||
if (!this.updateAwaitingTeleport() && this.player.hasClientLoaded()) {
|
||||
double d = clampHorizontal(packet.getX(this.player.getX())); final double toX = d; // Paper - OBFHELPER
|
||||
double d1 = clampVertical(packet.getY(this.player.getY())); final double toY = d1; // Paper - OBFHELPER
|
||||
@@ -1639,7 +1641,7 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -1639,7 +1639,7 @@ public class ServerGamePacketListenerImpl
|
||||
&& !isFallFlying
|
||||
&& !isAutoSpinAttack
|
||||
&& this.noBlocksAround(this.player);
|
||||
- this.player.serverLevel().getChunkSource().move(this.player);
|
||||
+ if (!org.dreeam.leaf.config.modules.opt.ReduceChunkSourceUpdates.enabled || this.player.serverLevel() != serverLevel || this.player.chunkPosition() == playerStartChunkPosition) this.player.serverLevel().getChunkSource().move(this.player); // Leaf - Reduce PlayerChunk Updates
|
||||
+ if (!org.dreeam.leaf.config.modules.opt.ReduceChunkSourceUpdates.enabled || this.player.getLastSectionPos().asLong() != net.minecraft.core.SectionPos.asLong(this.player.blockPosition())) this.player.serverLevel().getChunkSource().move(this.player); // Leaf - Reduce PlayerChunk Updates
|
||||
Vec3 vec3 = new Vec3(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z);
|
||||
this.player.setOnGroundWithMovement(packet.isOnGround(), packet.horizontalCollision(), vec3);
|
||||
this.player.doCheckFallDamage(vec3.x, vec3.y, vec3.z, packet.isOnGround());
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.dreeam.leaf.config.modules.opt;
|
||||
|
||||
import org.dreeam.leaf.config.ConfigModules;
|
||||
import org.dreeam.leaf.config.EnumConfigCategory;
|
||||
import org.dreeam.leaf.config.annotations.Experimental;
|
||||
|
||||
public class ReduceChunkSourceUpdates extends ConfigModules {
|
||||
|
||||
@@ -9,15 +10,22 @@ public class ReduceChunkSourceUpdates extends ConfigModules {
|
||||
return EnumConfigCategory.PERF.getBaseKeyName() + ".reduce-chunk-source-updates";
|
||||
}
|
||||
|
||||
@Experimental
|
||||
public static boolean enabled = false;
|
||||
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath() + ".enabled", enabled,
|
||||
config.pickStringRegionBased(
|
||||
"Reduces chunk source updates on inter-chunk player moves.",
|
||||
"减少玩家跨区块移动时的区块源更新。"
|
||||
)
|
||||
config.addCommentRegionBased(getBasePath(), """
|
||||
*** Experimental Feature ***
|
||||
Reduces chunk source updates on inter-chunk player moves.""",
|
||||
"""
|
||||
*** 实验性功能 ***
|
||||
减少玩家跨区块移动时的区块源更新."""
|
||||
);
|
||||
enabled = config.getBoolean(getBasePath() + ".force-enabled", enabled);
|
||||
|
||||
if (config.getBoolean(getBasePath() + ".enabled", enabled)) {
|
||||
LOGGER.warn("Disabled reduce-chunk-source-updates due to its experimental");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user