mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-07 19:31:37 +01:00
Simplify
This commit is contained in:
parent
69ab2c0045
commit
fa5fe8f208
@ -112,12 +112,9 @@ final class EntityTrackerImpl implements EntityTracker {
|
||||
@Override
|
||||
public <T extends Entity> void nearbyEntities(@NotNull Point point, double range, @NotNull Target<T> target, @NotNull Consumer<T> query) {
|
||||
final TargetEntry<Entity> entry = entries[target.ordinal()];
|
||||
final int chunkRange;
|
||||
// No need to loop through neighbor chunk if the point is a chunk coordinate
|
||||
if (point.x() % 16 == 0 && point.z() % 16 == 0) {
|
||||
chunkRange = (int) (range / Chunk.CHUNK_SECTION_SIZE);
|
||||
} else {
|
||||
chunkRange = (int) (range / Chunk.CHUNK_SECTION_SIZE) + 1;
|
||||
int chunkRange = (int) (range / Chunk.CHUNK_SECTION_SIZE);
|
||||
if (point.x() % 16 != 0 || point.z() % 16 != 0) {
|
||||
chunkRange++; // Need to loop through surrounding chunks to properly support borders
|
||||
}
|
||||
// Loop through range
|
||||
if (range % 16 == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user