keaft

Untitled

Apr 18th, 2021
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.87 KB | None | 0 0
  1. import crafttweaker.item.IItemStack;
  2. import crafttweaker.oredict.IOreDict;
  3.  
  4. # Ore dictionary list to unify
  5. var oreDictToCompare = ["oreIron","nuggetGold","ore:dustWheat","ore:ingotCopper"] as string[];
  6.  
  7. # Mod priority list in order
  8. val priorityList = ["vanilla","mod1","mod2","mod3"] as string[];
  9.  
  10. # Variable setup
  11. val foundPriorityItem = 0;
  12. val PriorityItem = null;
  13.  
  14. # Iterate through oreDictToCompare
  15. for oreDictList in oreDictToCompare {
  16.    
  17.     # write all of current ore dictionary entries out of oreDictToCompare to it's own array
  18.     val oreDictEntries = oreDict.get(oreDictList);
  19.    
  20.     # Iterate through the current oreDictEntries items list
  21.     for item in oreDictEntries {
  22.        
  23.         # Write current oreDictEntry mod name to variable if the priority item hasn't been found yet.
  24.         if (foundPriorityItem == 0)
  25.             val oreDictEntryModName = baseMod.item;
  26.            
  27.         # If the priority item has been found, replace the rest of the item's recipes in the whole oreDictEntries to the priority item.
  28.         if (foundPriorityItem == 1)
  29.             recipes.replaceAllOccurences(item, PriorityItem);
  30.            
  31.         # Iterate through priorityList with the found mod name to determine if that item is the item to be used in all recipes.
  32.         else
  33.             for c in priorityList {
  34.                 if (oreDictEntryModName == c)
  35.                     recipes.replaceAllOccurences(oreDict, item);
  36.                     PriorityItem = item;
  37.                     foundPriorityItem = 1;
  38.                     break;
  39.             }
  40.             # If no priority item is found just skip and inform?
  41.             if (foundPriorityItem = 0)
  42.                 print("No additional items found for "&oreDictEntries);
  43.                 break;
  44.     }
  45.    
  46.     # Reset for next oreDictToCompare entry
  47.     foundPriorityItem = 0;
  48.     PriorityItem = null;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment