Skip to content

Commit b8e2c88

Browse files
authored
Cleanup Smart sort (#207)
1 parent daa477c commit b8e2c88

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

leaf-server/minecraft-patches/features/0089-Smart-sort-entities-in-NearestLivingEntitySensor.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ This offers a 10~15% performance improvement in average.
1313
In best situation, this can give an up to 50% improvement.
1414

1515
diff --git a/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
16-
index b0c5e41fefc7c9adf1a61bd5b52861736657d37e..9b34ea111f43e2e103f2be6ecb186175aed7e175 100644
16+
index b0c5e41fefc7c9adf1a61bd5b52861736657d37e..bcfbb03a75c4e5c80517f9acd24588f1ac703e67 100644
1717
--- a/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
1818
+++ b/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
1919
@@ -13,6 +13,10 @@ import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities;
2020
import net.minecraft.world.phys.AABB;
2121

2222
public class NearestLivingEntitySensor<T extends LivingEntity> extends Sensor<T> {
2323
+ // Leaf start - Smart sort entities in NearestLivingEntitySensor
24-
+ private static final int NUM_BUCKETS = org.apache.commons.lang3.math.NumberUtils.toInt((System.getProperty("Leaf.nearestEntitySensorBucketCount", "10")), 10);
24+
+ private static final int NUM_BUCKETS = Integer.getInteger("Leaf.nearestEntitySensorBucketCount", 10);
2525
+ private static final int BUCKET_SORT_THRESHOLD = (int) Math.floor(NUM_BUCKETS * org.apache.commons.lang3.math.NumberUtils.toDouble(System.getProperty("Leaf.nearestEntitySensorBucketSortThresholdRatio", "2.0"), 2.0D));
2626
+ // Leaf end - Smart sort entities in NearestLivingEntitySensor
2727
@Override

0 commit comments

Comments
 (0)