9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/Leaf-Server/minecraft-patches/features/0012-Remove-UseItemOnPacket-Too-Far-Check.patch
Dreeam ed1cdcd19d Leaf 1.21.4
WIP
2025-01-17 19:54:25 -05:00

30 lines
2.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/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ec6276f3335fd963c8554dbc43adf5bdfe3d2412..162617ea984e54898f19c16ff8e7d759bddcc190 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1998,8 +1998,14 @@ public class ServerGamePacketListenerImpl
BlockPos blockPos = hitResult.getBlockPos();
if (this.player.canInteractWithBlock(blockPos, 1.0)) {
Vec3 vec3 = location.subtract(Vec3.atCenterOf(blockPos));
- double d = 1.0000001;
- if (Math.abs(vec3.x()) < 1.0000001 && Math.abs(vec3.y()) < 1.0000001 && Math.abs(vec3.z()) < 1.0000001) {
+ // Leaf start - Remove UseItemOnPacket Too Far Check and make it configurable
+ //double d = 1.0000001;
+ if (org.dreeam.leaf.config.modules.gameplay.ConfigurableMaxUseItemDistance.maxUseItemDistance <= 0
+ || (Math.abs(vec3.x()) < org.dreeam.leaf.config.modules.gameplay.ConfigurableMaxUseItemDistance.maxUseItemDistance
+ && Math.abs(vec3.y()) < org.dreeam.leaf.config.modules.gameplay.ConfigurableMaxUseItemDistance.maxUseItemDistance
+ && Math.abs(vec3.z()) < org.dreeam.leaf.config.modules.gameplay.ConfigurableMaxUseItemDistance.maxUseItemDistance)
+ ) {
+ // Leaf end - Remove UseItemOnPacket Too Far Check and make it configurable
Direction direction = hitResult.getDirection();
this.player.resetLastActionTime();
int maxY = this.player.level().getMaxY();