-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Airplane: Remove streams in PoiCompetitorScan
- Loading branch information
1 parent
0c0c456
commit 0eb6a72
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
patches/server/0089-Airplane-Remove-streams-in-PoiCompetitorScan.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |