mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
46 lines
2.4 KiB
Diff
46 lines
2.4 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 f0583076ef62189508a392a76c3fb6b741bbdde9..a608092a6e72b9be92624e36dbf19539985cd9d5 100644
|
|
--- a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
|
+++ b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
|
@@ -22,6 +22,13 @@ 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().profession().value().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();
|
|
@@ -31,7 +38,7 @@ public class SecondaryPoiSensor extends Sensor<Villager> {
|
|
for (int i2 = -2; i2 <= 2; i2++) {
|
|
for (int i3 = -4; i3 <= 4; i3++) {
|
|
BlockPos blockPos1 = blockPos.offset(i1, i2, i3);
|
|
- if (entity.getVillagerData().profession().value().secondaryPoi().contains(level.getBlockState(blockPos1).getBlock())) {
|
|
+ if (secondaryPoi.contains(level.getBlockState(blockPos1).getBlock())) { // Gale - Lithium - skip secondary POI sensor if absent
|
|
list.add(GlobalPos.of(resourceKey, blockPos1));
|
|
}
|
|
}
|