9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/leaves-server/minecraft-patches/features/0060-Skip-secondary-POI-sensor-if-absent.patch
Lumine1909 f09fbb247d 1.21.5 (#470)
---------

Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com>
Co-authored-by: Fortern <blueten.ki@gmail.com>
Co-authored-by: MC_XiaoHei <xor7xiaohei@gmail.com>
Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com>
Co-authored-by: MC_XiaoHei <xiaohei.xor7@outlook.com>
2025-06-05 18:41:51 +08:00

28 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Tue, 18 Jul 2023 14:29:47 +0800
Subject: [PATCH] Skip secondary POI sensor if absent
This patch is Powered by Gale(https://github.com/GaleMC/Gale)
diff --git a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
index f0583076ef62189508a392a76c3fb6b741bbdde9..a11c2ef54b6b8193362c2a2d42cef49765adb5c5 100644
--- a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
+++ b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
@@ -22,6 +22,15 @@ public class SecondaryPoiSensor extends Sensor<Villager> {
@Override
protected void doTick(ServerLevel level, Villager entity) {
+ // Leaves start - skip secondary POI sensor if absent
+ if (org.leavesmc.leaves.LeavesConfig.performance.skipSecondaryPOISensorIfAbsent) {
+ var secondaryPoi = entity.getVillagerData().profession().value().secondaryPoi();
+ if (secondaryPoi.isEmpty()) {
+ entity.getBrain().eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE);
+ return;
+ }
+ }
+ // Leaves end - skip secondary POI sensor if absent
ResourceKey<Level> resourceKey = level.dimension();
BlockPos blockPos = entity.blockPosition();
List<GlobalPos> list = Lists.newArrayList();