mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-19 14:59:29 +00:00
38 lines
1.7 KiB
Diff
38 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Sun, 25 Dec 2022 10:47:29 +0100
|
|
Subject: [PATCH] Skip secondary POI sensor if absent
|
|
|
|
License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following mixin:
|
|
"net/caffeinemc/mods/lithium/mixin/ai/sensor/secondary_poi/SecondaryPoiSensorMixin.java"
|
|
By: 2No2Name <2No2Name@web.de>
|
|
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
|
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
|
|
|
* Lithium description *
|
|
|
|
villagers that have no secondary POI (farmland) do not search for it
|
|
|
|
diff --git a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
|
index 6b99afb4f237b5d6def98f3e03492975b795bc95..d9318a5a9eb3de89f48efa23b944c6d9e2ba37d1 100644
|
|
--- a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
|
+++ b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
|
@@ -22,6 +22,14 @@ public class SecondaryPoiSensor extends Sensor<Villager> {
|
|
|
|
@Override
|
|
protected void doTick(ServerLevel level, Villager entity) {
|
|
+ // Gale start - Lithium - skip secondary POI sensor if absent
|
|
+ var secondaryPoi = entity.getVillagerData().getProfession().secondaryPoi();
|
|
+
|
|
+ if (secondaryPoi.isEmpty()) {
|
|
+ entity.getBrain().eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE);
|
|
+ return;
|
|
+ }
|
|
+ // Gale end - Lithium - skip secondary POI sensor if absent
|
|
ResourceKey<Level> resourceKey = level.dimension();
|
|
BlockPos blockPos = entity.blockPosition();
|
|
List<GlobalPos> list = Lists.newArrayList();
|