9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/patches/server/0074-Skip-secondary-POI-sensor-if-absent.patch
2024-08-14 17:07:19 +08:00

28 lines
1.5 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/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
index a0e0692d17760f440fe81d52887284c787e562db..4b9470eb94ca1d90161cfbd3de06ec5f56adbb7b 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
@@ -22,6 +22,15 @@ public class SecondaryPoiSensor extends Sensor<Villager> {
@Override
protected void doTick(ServerLevel world, Villager entity) {
+ // Leaves start - skip secondary POI sensor if absent
+ if (org.leavesmc.leaves.LeavesConfig.skipSecondaryPOISensorIfAbsent) {
+ var secondaryPoi = entity.getVillagerData().getProfession().secondaryPoi();
+ if (secondaryPoi.isEmpty()) {
+ entity.getBrain().eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE);
+ return;
+ }
+ }
+ // Leaves end - skip secondary POI sensor if absent
ResourceKey<Level> resourceKey = world.dimension();
BlockPos blockPos = entity.blockPosition();
List<GlobalPos> list = Lists.newArrayList();