| 475 | public void sortRecipes() { |
| 476 | if (arecipes.size() > 1000) return; |
| 477 | Collections.sort(arecipes, new Comparator<CachedRecipe>() {@Override public int compare(CachedRecipe aRecipe1, CachedRecipe aRecipe2) { |
| 478 | Recipe tRecipe1 = ((CachedDefaultRecipe)aRecipe1).mRecipe, tRecipe2 = ((CachedDefaultRecipe)aRecipe2).mRecipe; |
| 479 | int |
| 480 | tCompare = Long.compare(tRecipe1.mEUt, tRecipe2.mEUt); |
| 481 | if (tCompare != 0) return tCompare; |
| 482 | tCompare = Integer.compare(tRecipe1.mFluidInputs.length, tRecipe2.mFluidInputs.length); |
| 483 | if (tCompare != 0) return tCompare; |
| 484 | if (tRecipe1.mFluidInputs.length > 0) { |
| 485 | tCompare = FL.regName(tRecipe1.mFluidInputs[0]).compareTo(FL.regName(tRecipe2.mFluidInputs[0])); |
| 486 | if (tCompare != 0) return tCompare; |
| 487 | } |
| 488 | tCompare = Integer.compare(tRecipe1.mInputs.length, tRecipe2.mInputs.length); |
| 489 | if (tCompare != 0) return tCompare; |
| 490 | if (tRecipe1.mInputs.length > 0) { |
| 491 | ItemStack tInput1 = tRecipe1.mInputs[0], tInput2 = tRecipe2.mInputs[0]; |
| 492 | if (ST.valid(tInput1)) { |
| 493 | if (ST.invalid(tInput2)) return -1; |
| 494 | |
| 495 | OreDictItemData tData1 = OM.anydata_(tInput1), tData2 = OM.anydata_(tInput2); |
| 496 | if (tData1 != null && tData1.validMaterial()) { |
| 497 | if (tData2 == null || !tData2.validMaterial()) return -1; |
| 498 | tCompare = tData1.mMaterial.mMaterial.mNameInternal.compareTo(tData2.mMaterial.mMaterial.mNameInternal); |
| 499 | if (tCompare != 0) return tCompare; |
| 500 | tCompare = Long.compare(tData1.mMaterial.mAmount, tData2.mMaterial.mAmount); |
| 501 | if (tCompare != 0) return tCompare; |
| 502 | } else if (tData2 != null && tData2.validMaterial()) return 1; |
| 503 | |
| 504 | tCompare = Long.compare(tRecipe1.mDuration, tRecipe2.mDuration); |
| 505 | if (tCompare != 0) return tCompare; |
| 506 | tCompare = ST.regName(tInput1).compareTo(ST.regName(tInput2)); |
| 507 | if (tCompare != 0) return tCompare; |
| 508 | return Short.compare(ST.meta_(tInput1), ST.meta_(tInput2)); |
| 509 | } |
| 510 | if (ST.valid(tInput2)) return 1; |
| 511 | } |
| 512 | return 0; |
| 513 | }}); |
| 514 | } |
| 515 | |
| 516 | @Override |