mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
Airplane: Remove streams in PoiCompetitorScan
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
||||
Date: Mon, 22 Jul 2024 10:56:59 +0800
|
||||
Subject: [PATCH] Airplane: Remove streams in PoiCompetitorScan
|
||||
|
||||
Original license: GPLv3
|
||||
Original project: https://github.com/TECHNOVE/Airplane-Experimental
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Remove streams"
|
||||
By: Paul Sauve <paul@technove.co>
|
||||
As part of: Airplane (https://github.com/TECHNOVE/Airplane-Experimental)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
Airplane
|
||||
Copyright (C) 2020 Technove LLC
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java b/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java
|
||||
index 7302d397d39d8400527ab2da4adaf8d792256749..faeb1d42d8361c02b63e33059edaeff78e719c71 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java
|
||||
@@ -22,13 +22,7 @@ public class PoiCompetitorScan {
|
||||
world.getPoiManager()
|
||||
.getType(globalPos.pos())
|
||||
.ifPresent(
|
||||
- poiType -> context.<List<LivingEntity>>get(mobs)
|
||||
- .stream()
|
||||
- .filter(mob -> mob instanceof Villager && mob != entity)
|
||||
- .map(villagerx -> (Villager)villagerx)
|
||||
- .filter(LivingEntity::isAlive)
|
||||
- .filter(villagerx -> competesForSameJobsite(globalPos, poiType, villagerx))
|
||||
- .reduce(entity, PoiCompetitorScan::selectWinner)
|
||||
+ poiType -> poiCompete(context.get(mobs), entity, globalPos, poiType) // Leaf - Airplane - Remove streams in PoiCompetitorScan
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@@ -36,6 +30,21 @@ public class PoiCompetitorScan {
|
||||
);
|
||||
}
|
||||
|
||||
+ // Leaf start - Airplane - Remove streams in PoiCompetitorScan
|
||||
+ private static void poiCompete(
|
||||
+ List<LivingEntity> mobs, Villager entity, GlobalPos globalPos,
|
||||
+ Holder<net.minecraft.world.entity.ai.village.poi.PoiType> poiType
|
||||
+ ) {
|
||||
+ for (LivingEntity mob : mobs) {
|
||||
+ if (mob instanceof Villager villagerx && mob != entity) {
|
||||
+ if (villagerx.isAlive() && competesForSameJobsite(globalPos, poiType, villagerx)) {
|
||||
+ entity = selectWinner(entity, villagerx);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Leaf end - Airplane - Remove streams in PoiCompetitorScan
|
||||
+
|
||||
private static Villager selectWinner(Villager first, Villager second) {
|
||||
Villager villager;
|
||||
Villager villager2;
|
||||
Reference in New Issue
Block a user