Rename optimize isOutsideRange patch

This commit is contained in:
Nassim Jahnke
2021-11-25 18:18:57 +01:00
parent d1eb5f28fd
commit 65c02a066c
2 changed files with 4 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Tue, 5 May 2020 20:40:53 -0700
Subject: [PATCH] Optimize isOutsideRange to use distance maps
Subject: [PATCH] Optimize anyPlayerCloseEnoughForSpawning to use distance maps
Use a distance map to find the players in range quickly
@@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (event == null || event.isCancelled()) return false;
- blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
+ // don't check spectator and whatnot, already handled by mob spawn map update
+ if (this.playerIsCloseEnoughForSpawning(player, chunkcoordintpair, player.lastEntitySpawnRadiusSquared)) {
+ if (euclideanDistanceSquared(chunkcoordintpair, player) < player.lastEntitySpawnRadiusSquared) {
+ return true; // in range
}
- // Paper end
@@ -198,7 +198,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ continue;
+ }
+ // don't check spectator and whatnot, already handled by mob spawn map update
+ if (this.playerIsCloseEnoughForSpawning(player, chunkcoordintpair, range)) {
+ if (euclideanDistanceSquared(chunkcoordintpair, player) < range) {
+ return true; // in range
+ }
+ }