mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-30 20:21:41 +01:00
[1.16] Improve performance of matching ingredients for shapeless recipes (#4694)
This commit is contained in:
parent
7811aecad6
commit
51ed2d9d21
@ -43,6 +43,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
- return i == this.ingredients.size() && autorecipestackmanager.a(this, (IntList) null);
|
- return i == this.ingredients.size() && autorecipestackmanager.a(this, (IntList) null);
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
|
+ if (matchedProvided.isEmpty() || matchedIngredients.isEmpty()) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
+ java.util.List<RecipeItemStack> ingredients = new java.util.ArrayList<>(this.ingredients);
|
+ java.util.List<RecipeItemStack> ingredients = new java.util.ArrayList<>(this.ingredients);
|
||||||
+ providedItems.sort(java.util.Comparator.comparingInt((ItemStack c) -> (int) matchedProvided.getCount(c)).reversed());
|
+ providedItems.sort(java.util.Comparator.comparingInt((ItemStack c) -> (int) matchedProvided.getCount(c)).reversed());
|
||||||
+ ingredients.sort(java.util.Comparator.comparingInt((RecipeItemStack c) -> (int) matchedIngredients.getCount(c)));
|
+ ingredients.sort(java.util.Comparator.comparingInt((RecipeItemStack c) -> (int) matchedIngredients.getCount(c)));
|
||||||
|
Loading…
Reference in New Issue
Block a user