add a world check

This commit is contained in:
zimzaza4
2024-11-14 08:01:14 +08:00
parent 7d745aa3cd
commit 24415dabce
2 changed files with 5 additions and 1 deletions

View File

@@ -125,7 +125,7 @@
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>5.3.0-SNAPSHOT</version>
<version>5.3.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@@ -329,10 +329,14 @@ public class EntityTask {
if (GeyserModelEngine.getInstance().getJoinedPlayer() != null && GeyserModelEngine.getInstance().getJoinedPlayer().getIfPresent(player) != null) {
return false;
}
Location playerLocation = player.getLocation().clone();
Location entityLocation = entity.getLocation().clone();
playerLocation.setY(0);
entityLocation.setY(0);
if (playerLocation.getWorld() != entityLocation.getWorld()) {
return false;
}
if (playerLocation.distanceSquared(entityLocation) > player.getSendViewDistance() * player.getSendViewDistance() * 16) {
return false;
}