mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-27 02:49:19 +00:00
Originally vanilla logic is to use stream, and Mojang switched it to Guava's Collections2 since 1.21.4. It is much faster than using stream or manually adding to a new ArrayList. Manually adding to a new ArrayList requires allocating a new object array. However, the Collections2 lazy handles filter condition on iteration, so much better.
29 lines
1.9 KiB
Diff
29 lines
1.9 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 a0941c15a9391f85af9fcb3784c66514b314f4dc..f20cb459f83f870e1c04ed1d83eee885619dfe57 100644
|
|
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -2122,8 +2122,13 @@ 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
|
|
+ //double d = 1.0000001;
|
|
+ final double maxDistance = org.dreeam.leaf.config.modules.gameplay.ConfigurableMaxUseItemDistance.maxUseItemDistance;
|
|
+ if (maxDistance <= 0
|
|
+ || (Math.abs(vec3.x()) < maxDistance && Math.abs(vec3.y()) < maxDistance && Math.abs(vec3.z()) < maxDistance)
|
|
+ ) {
|
|
+ // Leaf end - Remove UseItemOnPacket Too Far check
|
|
Direction direction = hitResult.getDirection();
|
|
this.player.resetLastActionTime();
|
|
int maxY = this.player.level().getMaxY();
|