Skip to content

Commit 6b21b39

Browse files
committed
限制广播包检查移动范围
1 parent aa4a553 commit 6b21b39

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/org/itxtech/synapseapi/SynapseEntry.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,18 +742,18 @@ public void handleDataPacket(SynapseDataPacket pk) {
742742
* @param packetY 数据包中的Y坐标
743743
* @param packetZ 数据包中的Z坐标
744744
* @param player 玩家实例
745-
* @return 坐标是否在合理范围内(XZ偏差不超过2个区块,Y偏差不超过16格
745+
* @return 坐标是否在合理范围内(XZ偏差不超过1个区块,Y偏差不超过6格
746746
*/
747747
private static boolean isPositionNearPlayer(float packetX, float packetY, float packetZ, SynapsePlayer player) {
748748
int packetChunkX = ((int) packetX) >> 4;
749749
int packetChunkZ = ((int) packetZ) >> 4;
750750
int playerChunkX = ((int) player.x) >> 4;
751751
int playerChunkZ = ((int) player.z) >> 4;
752752

753-
int yThreshold = player.isGliding() ? 80 : 16;
753+
int yThreshold = player.isGliding() ? 20 : 6;
754754

755-
return Math.abs(packetChunkX - playerChunkX) <= 2
756-
&& Math.abs(packetChunkZ - playerChunkZ) <= 2
755+
return Math.abs(packetChunkX - playerChunkX) <= 1
756+
&& Math.abs(packetChunkZ - playerChunkZ) <= 1
757757
&& Math.abs((int) packetY - (int) player.y) <= yThreshold;
758758
}
759759

0 commit comments

Comments
 (0)