mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-13 00:47:35 +00:00
Bookmarks Chains: Use active Item as preferred if exists (#664)
Co-authored-by: Caedis <Caedis@users.noreply.github.com>
This commit is contained in:
1 parent
0634466851
commit
cd7d014704
1 file changed
+14
-3
@@ -137,15 +137,26 @@ public class RecipeChainMath {
|
||||
|
||||
for (BookmarkItem ingrItem : this.recipeIngredients) {
|
||||
if (ingrItem.factor > 0 && recipeId.equals(ingrItem.recipeId) && !preferredItems.containsKey(ingrItem)) {
|
||||
BookmarkItem activeItem = null;
|
||||
BookmarkItem prefItem = null;
|
||||
|
||||
for (BookmarkItem item : this.recipeResults) {
|
||||
if (item.factor > (prefItem == null ? 0 : prefItem.factor) && item.containsItems(ingrItem)
|
||||
&& !visited.contains(item.recipeId)) {
|
||||
prefItem = item;
|
||||
if (item.factor > 0 && !visited.contains(item.recipeId) && item.containsItems(ingrItem)) {
|
||||
|
||||
if ((activeItem == null || item.factor > activeItem.factor) && NEIClientUtils
|
||||
.areStacksSameTypeCraftingWithNBT(ingrItem.itemStack, item.itemStack)) {
|
||||
activeItem = item;
|
||||
} else if (prefItem == null || item.factor > prefItem.factor) {
|
||||
prefItem = item;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (activeItem != null) {
|
||||
prefItem = activeItem;
|
||||
}
|
||||
|
||||
if (prefItem != null) {
|
||||
preferredItems.put(ingrItem, prefItem);
|
||||
collectPreferredItems(prefItem.recipeId, preferredItems, visited);
|
||||
|
||||
Reference in new issue
Block a user