mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@5436d44 Deprecate several Keyed#getKey methods (#10357) PaperMC/Paper@a7f1dc6 Change online mode default for Velocity configuration (#10413) PaperMC/Paper@37db2d7 [ci skip] Update book page/char limit for book meta doc (#10415) PaperMC/Paper@526795b Update patches to handle vineflower decompiler (#10406) PaperMC/Paper@8fe90de [ci skip] Referenced InventoryDragEvent in documentation of InventoryClickEvent (#10395) PaperMC/Paper@46d462b Fix StackOverflowException thrown on shutdown (Fixes #10404) (#10408) PaperMC/Paper@f061e76 Fix hit criteria advancement triggered before changing state (#10409) PaperMC/Paper@3263470 Add color transition and clone functions to ParticleBuilder (#10342) PaperMC/Paper@4445d23 Deprecate ItemStack#setType & add ItemStack#withType (#10290)
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 984e3cc48f93f4f036689a269562f12ebd7bdef1..6e65bc6bd198abf8c60016696d7851a1e8e080ec 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); // Purpur
|
|
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 a2e02881f90a93f067301b63eb84dfad476bedbd..3c8b9ef3f55f4511f062b03822c8056c40dd7c92 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 002c9bba93dede25111c653ec1df38316f19421f..7dc82ffccc157a17335f1bc56ab81be3813294f6 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -2890,6 +2890,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);
|
|
@@ -2926,6 +2928,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;
|