9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-21 16:09:19 +00:00
Files
Leaf/patches/server/0019-Remove-UseItemOnPacket-Too-Far-Check.patch
Dreeam 424c438a9f Updated Upstream (Paper/Gale/Purpur)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@8fd3a67 [ci skip] Clean up book limits patch (#11297)
PaperMC/Paper@dae906b Add getWorld method that uses adventure Key (#11199)
PaperMC/Paper@ba1b016 Allow server administrators to disable book size checks (#10457)
PaperMC/Paper@a8cb8e6 [ci skip] Fix JavaDocs for HeightMap#MOTION_BLOCKING_NO_LEAVES (#11291)
PaperMC/Paper@e4b38b4 Fixup config parsing
PaperMC/Paper@3271119 Fix SculkBloomEvent firing for block entity loading (#11306)

Gale Changes:
Dreeam-qwq/Gale@38ba923 Updated Upstream (Paper)
Dreeam-qwq/Gale@7ebf026 Fix code style & Adjust sequence of `organizationDisplayName` and `projectDisplayName` in version fetcher

Purpur Changes:
PurpurMC/Purpur@3510a9e Updated Upstream (Paper)
PurpurMC/Purpur@1d3cef7 Updated Upstream (Paper)
PurpurMC/Purpur@c4a6f63 Updated Upstream (Paper)
PurpurMC/Purpur@568a028 Updated Upstream (Paper)
2024-08-20 13:07:55 -04:00

55 lines
3.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Fri, 18 Nov 2022 23:26:16 -0500
Subject: [PATCH] Remove UseItemOnPacket Too Far Check
This Check is added in 1.17.x -> 1.18.x that updated by Mojang.
By removing this check, it gives ability for hackers to use some modules of hack clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7e719807c031ab5bf128e3f5523285c1ca5dfe11..32ab1aaa2a22b4d354e01439b3adebec01cb47d6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2018,7 +2018,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
Vec3 vec3d1 = vec3d.subtract(Vec3.atCenterOf(blockposition));
double d0 = 1.0000001D;
- if (Math.abs(vec3d1.x()) < 1.0000001D && Math.abs(vec3d1.y()) < 1.0000001D && Math.abs(vec3d1.z()) < 1.0000001D) {
+ if (org.dreeam.leaf.config.modules.gameplay.ConfigurableMaxUseItemDistance.maxUseItemDistance <= 0
+ || (Math.abs(vec3d1.x()) < org.dreeam.leaf.config.modules.gameplay.ConfigurableMaxUseItemDistance.maxUseItemDistance
+ && Math.abs(vec3d1.y()) < org.dreeam.leaf.config.modules.gameplay.ConfigurableMaxUseItemDistance.maxUseItemDistance
+ && Math.abs(vec3d1.z()) < org.dreeam.leaf.config.modules.gameplay.ConfigurableMaxUseItemDistance.maxUseItemDistance)
+ ) { // Leaf - Remove UseItemOnPacket Too Far Check and make it configurable
Direction enumdirection = movingobjectpositionblock.getDirection();
this.player.resetLastActionTime();
diff --git a/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableMaxUseItemDistance.java b/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableMaxUseItemDistance.java
new file mode 100644
index 0000000000000000000000000000000000000000..aef8135fe44330a2459f06ebc10816f1ed83ac7e
--- /dev/null
+++ b/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableMaxUseItemDistance.java
@@ -0,0 +1,23 @@
+package org.dreeam.leaf.config.modules.gameplay;
+
+import org.dreeam.leaf.config.ConfigModules;
+import org.dreeam.leaf.config.EnumConfigCategory;
+
+public class ConfigurableMaxUseItemDistance extends ConfigModules {
+
+ public String getBasePath() {
+ return EnumConfigCategory.GAMEPLAY.getBaseKeyName() + ".player";
+ }
+
+ public static double maxUseItemDistance = 1.0000001D;
+
+ @Override
+ public void onLoaded() {
+ maxUseItemDistance = config.getDouble(getBasePath() + ".max-use-item-distance", maxUseItemDistance, """
+ The max distance of UseItem for players.
+ Set to -1 to disable max-distance-check.
+ NOTE: if set to -1 to disable the check,
+ players are able to use some packet modules of hack clients,
+ and NoCom Exploit!!""");
+ }
+}