mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
28 lines
1.5 KiB
Diff
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..c6f5f7f7c0821b707d9cfe239ccab748e6b8b9cb 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.performance.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();
|