3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-10-03 08:41:05 +02:00

Improve block break/place detection in 1.8->1.9 (#3886)

Servers can send sound packets where the positions have a slight offset. This PR aims to improve the detection to account for that.

Closes https://github.com/ViaVersion/ViaFabricPlus/issues/333
Dieser Commit ist enthalten in:
EnZaXD 2024-05-28 08:43:21 +02:00 committet von GitHub
Ursprung 3f7d286606
Commit d9446eed07
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -143,8 +143,13 @@ public class EntityTracker1_9 extends EntityTrackerBase {
}
}
public boolean interactedBlockRecently(int x, int y, int z) {
return blockInteractions.contains(new BlockPosition(x, y, z));
public boolean interactedBlockRecently(final int x, final int y, final int z) {
for (final BlockPosition position : blockInteractions) {
if (Math.abs(position.x() - x) <= 1 && Math.abs(position.y() - y) <= 1 && Math.abs(position.z() - z) <= 1) {
return true;
}
}
return false;
}
public void addBlockInteraction(BlockPosition p) {