Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.45 KB | None | 0 0
  1. public static void registerRecipes() {
  2. try {
  3. File Path = com.JV.MinestuckUtil.MinestuckRecipieUtil.Path;
  4. File F = new File(Path + "\\Recipies.txt");
  5. BufferedReader in = new BufferedReader(new FileReader(F));
  6. String line;
  7. while((line = in.readLine()) != null)
  8. {
  9. int groupNum = 0;
  10. String type = null;
  11. String modId = null;
  12. String item = null;
  13. Boolean Bool = null;
  14. GristType[] Gtype = new GristType[21];
  15. int[] intB = new int[21];
  16. int gristSubGroupNum = 0;
  17. int valueSubGroupNum = 0;
  18. GristType[] GtypeR = null;
  19. int[] intBR = null;
  20. Pattern p = Pattern.compile("\\(.*?\\)");
  21. Matcher m = p.matcher(line);
  22. while(m.find()){
  23. if(groupNum == 0){ type = (String) (m.group().subSequence(1, m.group().length()-1));}
  24. if(groupNum == 1){ modId = (String) (m.group().subSequence(1, m.group().length()-1));}
  25. if(groupNum == 2){ item = (String) (m.group().subSequence(1, m.group().length()-1));}
  26. if(groupNum == 3){ String S = (String) (m.group().subSequence(1, m.group().length()-1));
  27. if(S.compareToIgnoreCase("true") == 0){Bool = true;}
  28. else{Bool = false;}}
  29. if(groupNum == 4){ String S = (String) (m.group().subSequence(1, m.group().length()-1));
  30. Pattern p2 = Pattern.compile("\\[.*?\\]");
  31. Matcher m2 = p2.matcher(S);
  32. while(m2.find()){String S2 = (String) (m2.group().subSequence(1, m2.group().length()-1));
  33. if(S2.compareToIgnoreCase("Amber") == 0){Gtype[gristSubGroupNum]= GristType.Amber;}
  34. if(S2.compareToIgnoreCase("Amethyst") == 0){Gtype[gristSubGroupNum]= GristType.Amethyst;}
  35. if(S2.compareToIgnoreCase("Artifact") == 0){Gtype[gristSubGroupNum]= GristType.Artifact;}
  36. if(S2.compareToIgnoreCase("Build") == 0){Gtype[gristSubGroupNum]= GristType.Build;}
  37. if(S2.compareToIgnoreCase("Caulk") == 0){Gtype[gristSubGroupNum]= GristType.Caulk;}
  38. if(S2.compareToIgnoreCase("Chalk") == 0){Gtype[gristSubGroupNum]= GristType.Chalk;}
  39. if(S2.compareToIgnoreCase("Cobalt") == 0){Gtype[gristSubGroupNum]= GristType.Cobalt;}
  40. if(S2.compareToIgnoreCase("Diamond") == 0){Gtype[gristSubGroupNum]= GristType.Diamond;}
  41. if(S2.compareToIgnoreCase("Garnet") == 0){Gtype[gristSubGroupNum]= GristType.Garnet;}
  42. if(S2.compareToIgnoreCase("Gold") == 0){Gtype[gristSubGroupNum]= GristType.Gold;}
  43. if(S2.compareToIgnoreCase("Iodine") == 0){Gtype[gristSubGroupNum]= GristType.Iodine;}
  44. if(S2.compareToIgnoreCase("Marble") == 0){Gtype[gristSubGroupNum]= GristType.Marble;}
  45. if(S2.compareToIgnoreCase("Mercury") == 0){Gtype[gristSubGroupNum]= GristType.Mercury;}
  46. if(S2.compareToIgnoreCase("Quartz") == 0){Gtype[gristSubGroupNum]= GristType.Quartz;}
  47. if(S2.compareToIgnoreCase("Ruby") == 0){Gtype[gristSubGroupNum]= GristType.Ruby;}
  48. if(S2.compareToIgnoreCase("Rust") == 0){Gtype[gristSubGroupNum]= GristType.Rust;}
  49. if(S2.compareToIgnoreCase("Shale") == 0){Gtype[gristSubGroupNum]= GristType.Shale;}
  50. if(S2.compareToIgnoreCase("Sulfur") == 0){Gtype[gristSubGroupNum]= GristType.Sulfur;}
  51. if(S2.compareToIgnoreCase("Tar") == 0){Gtype[gristSubGroupNum]= GristType.Tar;}
  52. if(S2.compareToIgnoreCase("Uranium") == 0){Gtype[gristSubGroupNum]= GristType.Uranium;}
  53. if(S2.compareToIgnoreCase("Zillium") == 0){Gtype[gristSubGroupNum]= GristType.Zillium;}
  54. gristSubGroupNum = gristSubGroupNum + 1;
  55. }
  56. }
  57. if(gristSubGroupNum > 0){
  58. GtypeR = new GristType[gristSubGroupNum];
  59. GtypeR[0] = Gtype[0];
  60. if(gristSubGroupNum == 2){GtypeR[1] = Gtype[1];}
  61. if(gristSubGroupNum == 3){GtypeR[2] = Gtype[2];}
  62. if(gristSubGroupNum == 4){GtypeR[3] = Gtype[3];}
  63. if(gristSubGroupNum == 5){GtypeR[4] = Gtype[4];}
  64. if(gristSubGroupNum == 6){GtypeR[5] = Gtype[5];}
  65. if(gristSubGroupNum == 7){GtypeR[6] = Gtype[6];}
  66. if(gristSubGroupNum == 8){GtypeR[7] = Gtype[7];}
  67. if(gristSubGroupNum == 9){GtypeR[8] = Gtype[8];}
  68. if(gristSubGroupNum == 10){GtypeR[9] = Gtype[9];}
  69. if(gristSubGroupNum == 11){GtypeR[10] = Gtype[10];}
  70. if(gristSubGroupNum == 12){GtypeR[11] = Gtype[11];}
  71. if(gristSubGroupNum == 13){GtypeR[12] = Gtype[12];}
  72. if(gristSubGroupNum == 14){GtypeR[13] = Gtype[13];}
  73. if(gristSubGroupNum == 15){GtypeR[14] = Gtype[14];}
  74. if(gristSubGroupNum == 16){GtypeR[15] = Gtype[15];}
  75. if(gristSubGroupNum == 17){GtypeR[16] = Gtype[16];}
  76. if(gristSubGroupNum == 18){GtypeR[17] = Gtype[17];}
  77. if(gristSubGroupNum == 19){GtypeR[18] = Gtype[18];}
  78. if(gristSubGroupNum == 20){GtypeR[19] = Gtype[19];}
  79. if(gristSubGroupNum == 21){GtypeR[20] = Gtype[20];}
  80. }
  81. if(groupNum == 5){ String S = (String) (m.group().subSequence(1, m.group().length()-1));
  82. Pattern p3 = Pattern.compile("\\[.*?\\]");
  83. Matcher m3 = p3.matcher(S);
  84. while(m3.find()){String S2 = (String) (m3.group().subSequence(1, m3.group().length()-1));
  85. int Num = Integer.parseInt(S2);
  86. intB[valueSubGroupNum] = Num;
  87. valueSubGroupNum = valueSubGroupNum + 1;
  88. }
  89. }
  90. if(valueSubGroupNum > 0){
  91. intBR = new int[valueSubGroupNum];
  92. intBR[0] = intB[0];
  93. if(valueSubGroupNum == 2){intBR[1] = intB[1];}
  94. if(valueSubGroupNum == 3){intBR[2] = intB[2];}
  95. if(valueSubGroupNum == 4){intBR[3] = intB[3];}
  96. if(valueSubGroupNum == 5){intBR[4] = intB[4];}
  97. if(valueSubGroupNum == 6){intBR[5] = intB[5];}
  98. if(valueSubGroupNum == 7){intBR[6] = intB[6];}
  99. if(valueSubGroupNum == 8){intBR[7] = intB[7];}
  100. if(valueSubGroupNum == 9){intBR[8] = intB[8];}
  101. if(valueSubGroupNum == 10){intBR[9] = intB[9];}
  102. if(valueSubGroupNum == 11){intBR[10] = intB[10];}
  103. if(valueSubGroupNum == 12){intBR[11] = intB[11];}
  104. if(valueSubGroupNum == 13){intBR[12] = intB[12];}
  105. if(valueSubGroupNum == 14){intBR[13] = intB[13];}
  106. if(valueSubGroupNum == 15){intBR[14] = intB[14];}
  107. if(valueSubGroupNum == 16){intBR[15] = intB[15];}
  108. if(valueSubGroupNum == 17){intBR[16] = intB[16];}
  109. if(valueSubGroupNum == 18){intBR[17] = intB[17];}
  110. if(valueSubGroupNum == 19){intBR[18] = intB[18];}
  111. if(valueSubGroupNum == 20){intBR[19] = intB[19];}
  112. if(valueSubGroupNum == 21){intBR[20] = intB[20];}
  113. }
  114. System.out.println(m.group().subSequence(1, m.group().length()-1));
  115. groupNum = groupNum + 1;
  116. if(type !=null && item != null && Bool != null && Gtype [1] != null && intBR != null){
  117. ResourceLocation R = new ResourceLocation(modId, item);
  118. if(type.compareToIgnoreCase("item")== 0){GristRegistry.addGristConversion(new ItemStack(ForgeRegistries.ITEMS.getValue(R)), Bool, new GristSet(GtypeR, intBR));}
  119. if(type.compareToIgnoreCase("block")== 0){GristRegistry.addGristConversion(new ItemStack(ForgeRegistries.BLOCKS.getValue(R)), Bool, new GristSet(GtypeR, intBR));}
  120. }
  121. }
  122.  
  123.  
  124. }
  125. } catch (FileNotFoundException e) {
  126. // TODO Auto-generated catch block
  127. e.printStackTrace();
  128. } catch (IOException e) {
  129. // TODO Auto-generated catch block
  130. e.printStackTrace();
  131. }
  132. }
  133.  
  134.  
  135. public static void registerCombos() {
  136. try {
  137. File Path = com.JV.MinestuckUtil.MinestuckRecipieUtil.Path;
  138. File F = new File(Path + "\\Combos.txt");
  139. BufferedReader in = new BufferedReader(new FileReader(F));
  140. String line;
  141. while((line = in.readLine()) != null)
  142. { int groupNum = 0;
  143. String Item1Type = null;
  144. String Item1ModId = null;
  145. String Item1Name = null;
  146. String Item2Type = null;
  147. String Item2ModId = null;
  148. String Item2Name = null;
  149. String AndOr = null;
  150. String Item3Type = null;
  151. String Item3ModId = null;
  152. String Item3Name = null;
  153. ItemStack item1 = null;
  154. ItemStack item2 = null;
  155. ItemStack item3 = null;
  156. Boolean OrAnd = null;
  157. Pattern p = Pattern.compile("\\(.*?\\)");
  158. Matcher m = p.matcher(line);
  159. while(m.find()){
  160. if(groupNum == 0){ Item1Type = (String) (m.group().subSequence(1, m.group().length()-1));}
  161. if(groupNum == 1){ Item1ModId = (String) (m.group().subSequence(1, m.group().length()-1));}
  162. if(groupNum == 2){ Item1Name = (String) (m.group().subSequence(1, m.group().length()-1));}
  163. if(groupNum == 3){ Item2Type = (String) (m.group().subSequence(1, m.group().length()-1));}
  164. if(groupNum == 4){ Item2ModId = (String) (m.group().subSequence(1, m.group().length()-1));}
  165. if(groupNum == 5){ Item2Name = (String) (m.group().subSequence(1, m.group().length()-1));}
  166. if(groupNum == 6){ AndOr = (String) (m.group().subSequence(1, m.group().length()-1));}
  167. if(groupNum == 7){ Item3Type = (String) (m.group().subSequence(1, m.group().length()-1));}
  168. if(groupNum == 8){ Item3ModId = (String) (m.group().subSequence(1, m.group().length()-1));}
  169. if(groupNum == 9){ Item3Name = (String) (m.group().subSequence(1, m.group().length()-1));}
  170. groupNum = groupNum + 1;
  171. if(Item3Name != null){
  172. ResourceLocation R1 = new ResourceLocation(Item1ModId, Item1Name);
  173. ResourceLocation R2 = new ResourceLocation(Item2ModId, Item2Name);
  174. ResourceLocation R3 = new ResourceLocation(Item3ModId, Item3Name);
  175. if(Item1Type.compareToIgnoreCase("item") == 0){item1 = new ItemStack(ForgeRegistries.ITEMS.getValue(R1));}
  176. if(Item1Type.compareToIgnoreCase("block") == 0){item1 = new ItemStack(ForgeRegistries.BLOCKS.getValue(R1));}
  177. if(Item2Type.compareToIgnoreCase("item") == 0){item2 = new ItemStack(ForgeRegistries.ITEMS.getValue(R2));}
  178. if(Item2Type.compareToIgnoreCase("block") == 0){item2 = new ItemStack(ForgeRegistries.BLOCKS.getValue(R2));}
  179. if(Item3Type.compareToIgnoreCase("item") == 0){item3 = new ItemStack(ForgeRegistries.ITEMS.getValue(R3));}
  180. if(Item3Type.compareToIgnoreCase("block") == 0){item3 = new ItemStack(ForgeRegistries.BLOCKS.getValue(R3));}
  181. if(AndOr.compareToIgnoreCase("and") == 0){OrAnd = CombinationRegistry.MODE_AND;}
  182. if(AndOr.compareToIgnoreCase("or") == 0){OrAnd = CombinationRegistry.MODE_OR;}
  183. if(item1 != null && item2 != null && item3 != null && OrAnd != null){CombinationRegistry.addCombination(item1, item2, OrAnd, item3);}
  184. }
  185. //CombinationRegistry.addCombination(new ItemStack(GameRegistry.findItem("minecraft", "carrot")),new ItemStack(GameRegistry.findItem("minecraft", "wheat_seeds")),false, new ItemStack(GameRegistry.findItem("minecraft", "slime_ball")));
  186.  
  187.  
  188. }
  189. }
  190. } catch (FileNotFoundException e) {
  191. // TODO Auto-generated catch block
  192. e.printStackTrace();
  193. } catch (IOException e) {
  194. // TODO Auto-generated catch block
  195. e.printStackTrace();
  196. }
  197. }
  198. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement