Skip to content

Commit

Permalink
Redirect some vanilla methods to fix plugin compatibility
Browse files Browse the repository at this point in the history
Citizens and ModelEngine and potentially more
  • Loading branch information
Dreeam-qwq committed Feb 19, 2024
1 parent 6fc1127 commit b2439a9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ Subject: [PATCH] Redirect to Gale's method to fix plugin incompatibility


diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index bdf9ee08a9661f43b7a568b2aa7e4fc7e44a48c1..8e8a8441ff850eccbe0ffeb56b0c26746566d1b6 100644
index bdf9ee08a9661f43b7a568b2aa7e4fc7e44a48c1..f7681b61abcaddc057f4ea481176cf18ec982da7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -335,6 +335,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -250,6 +250,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl

static final Logger LOGGER = LogUtils.getLogger();
public static final double DEFAULT_MAX_INTERACTION_DISTANCE_SQUARED = Mth.square(6.0D); // Gale - make max interaction distance configurable
+ public static double MAX_INTERACTION_DISTANCE = DEFAULT_MAX_INTERACTION_DISTANCE_SQUARED; // Leaf - Redirect to Gale's `getMaxInteractionDistanceSquared` method to fix plugin incompatibility
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");
@@ -331,7 +332,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Gale start - make max interaction distance configurable
public static double getMaxInteractionDistanceSquared(Level level) {
var config = level.galeConfig().gameplayMechanics;
- return config.playerMaxInteractionDistance < 0 ? ServerGamePacketListenerImpl.DEFAULT_MAX_INTERACTION_DISTANCE_SQUARED : config.playerMaxInteractionDistanceSquared;
+ MAX_INTERACTION_DISTANCE = config.playerMaxInteractionDistance < 0 ? ServerGamePacketListenerImpl.DEFAULT_MAX_INTERACTION_DISTANCE_SQUARED : config.playerMaxInteractionDistanceSquared;
+ return MAX_INTERACTION_DISTANCE;
}
// Gale end - make max interaction distance configurable

+ public double MAX_INTERACTION_DISTANCE = ServerGamePacketListenerImpl.getMaxInteractionDistanceSquared(this.connection.getPlayer().level()); // Leaf - Redirect to Gale's `getMaxInteractionDistanceSquared` method to fix plugin incompatibility
+
// Purpur start
private final com.google.common.cache.LoadingCache<CraftPlayer, Boolean> kickPermissionCache = com.google.common.cache.CacheBuilder.newBuilder()
.maximumSize(1000)
19 changes: 19 additions & 0 deletions patches/server/0064-Redirect-vanilla-profiler.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <[email protected]>
Date: Mon, 19 Feb 2024 13:10:16 -0500
Subject: [PATCH] Redirect vanilla profiler


diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
index 9c2321ebb1237b4ecd3e7f7053e5039b800d89ff..009716c07f5c6b5571792fe87b0a07a4e65fc43d 100644
--- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
+++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
@@ -153,4 +153,8 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter {
public int getHeight() {
return this.level.getHeight();
}
+
+ public net.minecraft.util.profiling.ProfilerFiller getProfiler() {
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Gale - Purpur - remove vanilla profiler // Leaf - Redirect to fix plugin incompatibility
+ }
}

0 comments on commit b2439a9

Please sign in to comment.