mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 08:57:44 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@bcf52fe Delete some old patches PaperMC/Paper@348c855 Readd last API patch (with TODO) PaperMC/Paper@b630564 More patches PaperMC/Paper@3cb16c9 Add back per player mob spawning PaperMC/Paper@fe7b741 Another one PaperMC/Paper@12ed021 Update material tags and entity effect PaperMC/Paper@02bca1e Remove timings impl PaperMC/Paper@4d87302 Fix NPE and StackOverflowError for dispensers PaperMC/Paper@f8f230a Remove unnecessary AT PaperMC/Paper@29bf7be Fix unused parameter in PlayerList#remove PaperMC/Paper@9e35192 Execute spark tasks during tick sleep (#11525) PaperMC/Paper@e35f199 Use declaration order for state holder property iteration PaperMC/Paper@6288adb Remove leftover missed timings calls (#11527)
55 lines
4.6 KiB
Diff
55 lines
4.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Pantera <zeruskr@gmail.com>
|
|
Date: Fri, 26 Jan 2024 15:57:24 +0900
|
|
Subject: [PATCH] Configurable-villager-search-radius
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
|
index e1b6fe9ecda25f86431baf414f1bfd3a26a8b2bd..3d7578605812021bc84b99d4db1672a682d897ad 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
|
@@ -73,7 +73,7 @@ public class AcquirePoi {
|
|
};
|
|
// Paper start - optimise POI access
|
|
java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
|
|
- io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
|
|
+ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), world.purpurConfig.villagerAcquirePoiSearchRadius, world.purpurConfig.villagerAcquirePoiSearchRadius*world.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
|
|
Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes);
|
|
// Paper end - optimise POI access
|
|
Path path = findPathToPois(entity, set);
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
|
index 92731b6b593289e9f583c9b705b219e81fcd8e73..9104d7010bda6f9f73b478c11490ef9c53f76da2 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
|
@@ -56,7 +56,7 @@ public class NearestBedSensor extends Sensor<Mob> {
|
|
// Paper start - optimise POI access
|
|
java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
|
|
// don't ask me why it's unbounded. ask mojang.
|
|
- io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, type -> type.is(PoiTypes.HOME), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes);
|
|
+ io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, type -> type.is(PoiTypes.HOME), predicate, entity.blockPosition(), world.purpurConfig.villagerNearestBedSensorSearchRadius, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes); // Purpur
|
|
Path path = AcquirePoi.findPathToPois(entity, new java.util.HashSet<>(poiposes));
|
|
// Paper end - optimise POI access
|
|
if (path != null && path.canReach()) {
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index ac77bcccd70be1a83e4125ba848eb8e6d676406a..303feea75a2f4b2c11526cfa4013433be623f16f 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -2988,6 +2988,8 @@ public class PurpurWorldConfig {
|
|
public boolean villagerDisplayTradeItem = true;
|
|
public int villagerSpawnIronGolemRadius = 0;
|
|
public int villagerSpawnIronGolemLimit = 0;
|
|
+ public int villagerAcquirePoiSearchRadius = 48;
|
|
+ public int villagerNearestBedSensorSearchRadius = 48;
|
|
private void villagerSettings() {
|
|
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
|
|
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
|
|
@@ -3025,6 +3027,8 @@ public class PurpurWorldConfig {
|
|
villagerDisplayTradeItem = getBoolean("mobs.villager.display-trade-item", villagerDisplayTradeItem);
|
|
villagerSpawnIronGolemRadius = getInt("mobs.villager.spawn-iron-golem.radius", villagerSpawnIronGolemRadius);
|
|
villagerSpawnIronGolemLimit = getInt("mobs.villager.spawn-iron-golem.limit", villagerSpawnIronGolemLimit);
|
|
+ villagerAcquirePoiSearchRadius = getInt("mobs.villager.search-radius.acquire-poi", villagerAcquirePoiSearchRadius);
|
|
+ villagerNearestBedSensorSearchRadius = getInt("mobs.villager.search-radius.nearest-bed-sensor", villagerNearestBedSensorSearchRadius);
|
|
}
|
|
|
|
public boolean vindicatorRidable = false;
|