Skip to content

Commit

Permalink
Fix scaling false with BadPacketsT
Browse files Browse the repository at this point in the history
  • Loading branch information
SamB440 committed Jun 12, 2024

Verified

This commit was signed with the committer’s verified signature.
SamB440 SamB440
1 parent 11efc2e commit f43dbd9
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -36,21 +36,25 @@ public void onPacketReceive(final PacketReceiveEvent event) {
if (packetEntity == null) {
return;
}

// Make sure our target entity is actually a player (Player NPCs work too)
if (!EntityTypes.PLAYER.equals(packetEntity.getType())) {
// We can't check for any entity that is not a player
return;
}

// Perform the interaction vector check
// TODO:
// 27/12/2023 - Dynamic values for more than just one entity type?
// 28/12/2023 - Player-only is fine
// 30/12/2023 - Expansions differ in 1.9+
if (targetVector.y > minY && targetVector.y < maxY
&& Math.abs(targetVector.x) < maxXZ
&& Math.abs(targetVector.z) < maxXZ) {
final float scale = packetEntity.scale;
if (targetVector.y > (minY * scale) && targetVector.y < (maxY * scale)
&& Math.abs(targetVector.x) < (maxXZ * scale)
&& Math.abs(targetVector.z) < (maxXZ * scale)) {
return;
}

// Log the vector
final String verbose = String.format("%.5f/%.5f/%.5f",
targetVector.x, targetVector.y, targetVector.z);

0 comments on commit f43dbd9

Please sign in to comment.