mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-22 08:19:31 +00:00
62 lines
4.4 KiB
Diff
62 lines
4.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Sat, 24 Dec 2022 23:30:35 +0100
|
|
Subject: [PATCH] Make max interaction distance configurable
|
|
|
|
License: AGPL-3.0 (https://www.gnu.org/licenses/agpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
index 58b093bb1de78ee3b3b2ea364aa50474883f443a..9a511c8e86f7a8b96c450af811bf9d5bb3b28f18 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
@@ -173,7 +173,11 @@ public class ServerPlayerGameMode {
|
|
private void debugLogging(BlockPos pos, boolean success, int sequence, String reason) {}
|
|
|
|
public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, int sequence) {
|
|
- if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) > ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) {
|
|
+ // Gale start - make max interaction distance configurable
|
|
+ double configuredMaxInteractionDistance = this.player.level.galeConfig().gameplayMechanics.playerMaxInteractionDistance;
|
|
+ double maxInteractionDistanceSquared = configuredMaxInteractionDistance < 0 ? ServerGamePacketListenerImpl.DEFAULT_MAX_INTERACTION_DISTANCE : configuredMaxInteractionDistance * configuredMaxInteractionDistance;
|
|
+ if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) > maxInteractionDistanceSquared) {
|
|
+ // Gale end - make max interaction distance configurable
|
|
if (true) return; // Paper - Don't notify if unreasonably far away
|
|
this.debugLogging(pos, false, sequence, "too far");
|
|
} else if (pos.getY() >= worldHeight) {
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 315c7737f75c426a7e5c091fb340187df12235de..c7f996e8ef77671de4134db37e96022343f223a1 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -249,7 +249,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
static final Logger LOGGER = LogUtils.getLogger();
|
|
private static final int LATENCY_CHECK_INTERVAL = 15000;
|
|
- public static final double MAX_INTERACTION_DISTANCE = Mth.square(6.0D);
|
|
+ public static final double DEFAULT_MAX_INTERACTION_DISTANCE = Mth.square(6.0D); // Gale - make max interaction distance configurable
|
|
private static final int NO_BLOCK_UPDATES_TO_ACK = -1;
|
|
private static final int TRACKED_MESSAGE_DISCONNECT_THRESHOLD = 4096;
|
|
private static final Component CHAT_VALIDATION_FAILED = Component.translatable("multiplayer.disconnect.chat_validation_failed");
|
|
diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
|
|
index ffc39061f2363b979590888e736dd7a53a0d256a..c5598c0ba356dfc9e1ca66be8dbe7aaffaff316c 100644
|
|
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
|
|
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
|
|
@@ -267,6 +267,18 @@ public class GaleWorldConfiguration extends ConfigurationPart {
|
|
public boolean arrowMovementResetsDespawnCounter = true; // Gale - Purpur - make arrow movement resetting despawn counter configurable
|
|
public boolean hideFlamesOnEntitiesWithFireResistance = false; // Gale - Slice - hide flames on entities with fire resistance
|
|
|
|
+ // Gale start - make max interaction distance configurable
|
|
+ /**
|
|
+ * The maximum distance for blocks with which a player can interact with left- or right-clicking.
|
|
+ * Any value < 0 uses the default max distance, which is currently 6.0.
|
|
+ * <ul>
|
|
+ * <li><i>Default</i>: -1.0</li>
|
|
+ * <li><i>Vanilla</i>: -1.0</li>
|
|
+ * </ul>
|
|
+ */
|
|
+ public double playerMaxInteractionDistance = -1.0;
|
|
+ // Gale end - make max interaction distance configurable
|
|
+
|
|
public Fixes fixes;
|
|
public class Fixes extends ConfigurationPart {
|
|
|