Описание
# ProxLib


[](https://modrinth.com/mod/proxlib)
[](https://fabricmc.net/)
[](https://minecraft.net/)
ProxLib is a library that enables proximity-based communication between players in Minecraft. It allows nearby players to directly exchange data with each other through the server without the server needing to have andy mods or plugins installed to relay this data.
## Overview
ProxLib powers [ProxChat] and can be used by other mods to implement proximity-based communication features. It provides a simple API for sending and receiving data packets between players who are within approximately 26 blocks of each other.
The library works by cleverly encoding data into Minecraft's existing packet system through block breaking action packets (only aborts), which are relayed to all nearby players without server validation (yes, also works on air!).
## How It Works
- **Communication Method**: Uses `PlayerActionC2SPacket` with the `ABORT_DESTROY_BLOCK` action
- **Data Encoding**: Data is encoded into the relative block positions around the player
- **Range**: Approximately 26 blocks (technically limited by Minecraft's 32-block action packet relay)
- **Data Capacity**: 9 bits per Minecraft packet
- Data sent is prepended by 2 minecraft packets as a magic (to recognize it as a Prox Packet), 2 bytes for Vendor and Packet Id as well a 3 bytes for the packet length.
- So if you send a packet that has 4 bytes of data, this would become `2 + (2 + 2 + 3 + 4) * (8 / 9) » 11.77 » 12` minecraft packets
- **Reliability**: Works on virtually all servers, including those with anti-cheat systems
- Be aware that Anti Cheats might treat this as packet spam or some weird attempt at nuker. **This could cause the player to get flagged for cheating**.
- My testing here was mainly on 2b2t. The Anti Cheat did not block any of the packets, did not kick me, but a recent update causes a lagback when sending data and moving (data is still sent fine).
- Stops working when you're less than ~6 blocks away from the lower and upper vertical build limits (and possibly when next to world border)
- Works even when the sending player is in creative mode!
**Disclaimer:** Because this mod sends out a lot of the aforementioned `ABORT_DESTROY_BLOCK` packets, an anticheat might flag the player for packet spamming or even nuking (even though no nuker would ever send aborts).
So make sure that the player is aware that this might happen before they enable the corresponding sending functionality.
## Installation
### For Mod Users
ProxLib is a library mod and should be installed alongside mods that depend on it.
Mods may bundle this library, so you might never be aware of this being included unless you scout the Libraries in your ingame mod menu.
### For Mod Developers
Add ProxLib as a dependency in your `build.gradle`:
```groovy
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
dependencies {
// E.g. for MC Version 1.21.4 (make sure to check which is the most recent version).
// Remove the "include" if you don't wish bundling this mod directly into yours (currently