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 { @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 resourceKey = world.dimension(); BlockPos blockPos = entity.blockPosition(); List list = Lists.newArrayList();