Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void registerRecipes() {
- try {
- File Path = com.JV.MinestuckUtil.MinestuckRecipieUtil.Path;
- File F = new File(Path + "\\Recipies.txt");
- BufferedReader in = new BufferedReader(new FileReader(F));
- String line;
- while((line = in.readLine()) != null)
- {
- int groupNum = 0;
- String type = null;
- String modId = null;
- String item = null;
- Boolean Bool = null;
- GristType[] Gtype = new GristType[21];
- int[] intB = new int[21];
- int gristSubGroupNum = 0;
- int valueSubGroupNum = 0;
- GristType[] GtypeR = null;
- int[] intBR = null;
- Pattern p = Pattern.compile("\\(.*?\\)");
- Matcher m = p.matcher(line);
- while(m.find()){
- if(groupNum == 0){ type = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 1){ modId = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 2){ item = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 3){ String S = (String) (m.group().subSequence(1, m.group().length()-1));
- if(S.compareToIgnoreCase("true") == 0){Bool = true;}
- else{Bool = false;}}
- if(groupNum == 4){ String S = (String) (m.group().subSequence(1, m.group().length()-1));
- Pattern p2 = Pattern.compile("\\[.*?\\]");
- Matcher m2 = p2.matcher(S);
- while(m2.find()){String S2 = (String) (m2.group().subSequence(1, m2.group().length()-1));
- if(S2.compareToIgnoreCase("Amber") == 0){Gtype[gristSubGroupNum]= GristType.Amber;}
- if(S2.compareToIgnoreCase("Amethyst") == 0){Gtype[gristSubGroupNum]= GristType.Amethyst;}
- if(S2.compareToIgnoreCase("Artifact") == 0){Gtype[gristSubGroupNum]= GristType.Artifact;}
- if(S2.compareToIgnoreCase("Build") == 0){Gtype[gristSubGroupNum]= GristType.Build;}
- if(S2.compareToIgnoreCase("Caulk") == 0){Gtype[gristSubGroupNum]= GristType.Caulk;}
- if(S2.compareToIgnoreCase("Chalk") == 0){Gtype[gristSubGroupNum]= GristType.Chalk;}
- if(S2.compareToIgnoreCase("Cobalt") == 0){Gtype[gristSubGroupNum]= GristType.Cobalt;}
- if(S2.compareToIgnoreCase("Diamond") == 0){Gtype[gristSubGroupNum]= GristType.Diamond;}
- if(S2.compareToIgnoreCase("Garnet") == 0){Gtype[gristSubGroupNum]= GristType.Garnet;}
- if(S2.compareToIgnoreCase("Gold") == 0){Gtype[gristSubGroupNum]= GristType.Gold;}
- if(S2.compareToIgnoreCase("Iodine") == 0){Gtype[gristSubGroupNum]= GristType.Iodine;}
- if(S2.compareToIgnoreCase("Marble") == 0){Gtype[gristSubGroupNum]= GristType.Marble;}
- if(S2.compareToIgnoreCase("Mercury") == 0){Gtype[gristSubGroupNum]= GristType.Mercury;}
- if(S2.compareToIgnoreCase("Quartz") == 0){Gtype[gristSubGroupNum]= GristType.Quartz;}
- if(S2.compareToIgnoreCase("Ruby") == 0){Gtype[gristSubGroupNum]= GristType.Ruby;}
- if(S2.compareToIgnoreCase("Rust") == 0){Gtype[gristSubGroupNum]= GristType.Rust;}
- if(S2.compareToIgnoreCase("Shale") == 0){Gtype[gristSubGroupNum]= GristType.Shale;}
- if(S2.compareToIgnoreCase("Sulfur") == 0){Gtype[gristSubGroupNum]= GristType.Sulfur;}
- if(S2.compareToIgnoreCase("Tar") == 0){Gtype[gristSubGroupNum]= GristType.Tar;}
- if(S2.compareToIgnoreCase("Uranium") == 0){Gtype[gristSubGroupNum]= GristType.Uranium;}
- if(S2.compareToIgnoreCase("Zillium") == 0){Gtype[gristSubGroupNum]= GristType.Zillium;}
- gristSubGroupNum = gristSubGroupNum + 1;
- }
- }
- if(gristSubGroupNum > 0){
- GtypeR = new GristType[gristSubGroupNum];
- GtypeR[0] = Gtype[0];
- if(gristSubGroupNum == 2){GtypeR[1] = Gtype[1];}
- if(gristSubGroupNum == 3){GtypeR[2] = Gtype[2];}
- if(gristSubGroupNum == 4){GtypeR[3] = Gtype[3];}
- if(gristSubGroupNum == 5){GtypeR[4] = Gtype[4];}
- if(gristSubGroupNum == 6){GtypeR[5] = Gtype[5];}
- if(gristSubGroupNum == 7){GtypeR[6] = Gtype[6];}
- if(gristSubGroupNum == 8){GtypeR[7] = Gtype[7];}
- if(gristSubGroupNum == 9){GtypeR[8] = Gtype[8];}
- if(gristSubGroupNum == 10){GtypeR[9] = Gtype[9];}
- if(gristSubGroupNum == 11){GtypeR[10] = Gtype[10];}
- if(gristSubGroupNum == 12){GtypeR[11] = Gtype[11];}
- if(gristSubGroupNum == 13){GtypeR[12] = Gtype[12];}
- if(gristSubGroupNum == 14){GtypeR[13] = Gtype[13];}
- if(gristSubGroupNum == 15){GtypeR[14] = Gtype[14];}
- if(gristSubGroupNum == 16){GtypeR[15] = Gtype[15];}
- if(gristSubGroupNum == 17){GtypeR[16] = Gtype[16];}
- if(gristSubGroupNum == 18){GtypeR[17] = Gtype[17];}
- if(gristSubGroupNum == 19){GtypeR[18] = Gtype[18];}
- if(gristSubGroupNum == 20){GtypeR[19] = Gtype[19];}
- if(gristSubGroupNum == 21){GtypeR[20] = Gtype[20];}
- }
- if(groupNum == 5){ String S = (String) (m.group().subSequence(1, m.group().length()-1));
- Pattern p3 = Pattern.compile("\\[.*?\\]");
- Matcher m3 = p3.matcher(S);
- while(m3.find()){String S2 = (String) (m3.group().subSequence(1, m3.group().length()-1));
- int Num = Integer.parseInt(S2);
- intB[valueSubGroupNum] = Num;
- valueSubGroupNum = valueSubGroupNum + 1;
- }
- }
- if(valueSubGroupNum > 0){
- intBR = new int[valueSubGroupNum];
- intBR[0] = intB[0];
- if(valueSubGroupNum == 2){intBR[1] = intB[1];}
- if(valueSubGroupNum == 3){intBR[2] = intB[2];}
- if(valueSubGroupNum == 4){intBR[3] = intB[3];}
- if(valueSubGroupNum == 5){intBR[4] = intB[4];}
- if(valueSubGroupNum == 6){intBR[5] = intB[5];}
- if(valueSubGroupNum == 7){intBR[6] = intB[6];}
- if(valueSubGroupNum == 8){intBR[7] = intB[7];}
- if(valueSubGroupNum == 9){intBR[8] = intB[8];}
- if(valueSubGroupNum == 10){intBR[9] = intB[9];}
- if(valueSubGroupNum == 11){intBR[10] = intB[10];}
- if(valueSubGroupNum == 12){intBR[11] = intB[11];}
- if(valueSubGroupNum == 13){intBR[12] = intB[12];}
- if(valueSubGroupNum == 14){intBR[13] = intB[13];}
- if(valueSubGroupNum == 15){intBR[14] = intB[14];}
- if(valueSubGroupNum == 16){intBR[15] = intB[15];}
- if(valueSubGroupNum == 17){intBR[16] = intB[16];}
- if(valueSubGroupNum == 18){intBR[17] = intB[17];}
- if(valueSubGroupNum == 19){intBR[18] = intB[18];}
- if(valueSubGroupNum == 20){intBR[19] = intB[19];}
- if(valueSubGroupNum == 21){intBR[20] = intB[20];}
- }
- System.out.println(m.group().subSequence(1, m.group().length()-1));
- groupNum = groupNum + 1;
- if(type !=null && item != null && Bool != null && Gtype [1] != null && intBR != null){
- ResourceLocation R = new ResourceLocation(modId, item);
- if(type.compareToIgnoreCase("item")== 0){GristRegistry.addGristConversion(new ItemStack(ForgeRegistries.ITEMS.getValue(R)), Bool, new GristSet(GtypeR, intBR));}
- if(type.compareToIgnoreCase("block")== 0){GristRegistry.addGristConversion(new ItemStack(ForgeRegistries.BLOCKS.getValue(R)), Bool, new GristSet(GtypeR, intBR));}
- }
- }
- }
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- public static void registerCombos() {
- try {
- File Path = com.JV.MinestuckUtil.MinestuckRecipieUtil.Path;
- File F = new File(Path + "\\Combos.txt");
- BufferedReader in = new BufferedReader(new FileReader(F));
- String line;
- while((line = in.readLine()) != null)
- { int groupNum = 0;
- String Item1Type = null;
- String Item1ModId = null;
- String Item1Name = null;
- String Item2Type = null;
- String Item2ModId = null;
- String Item2Name = null;
- String AndOr = null;
- String Item3Type = null;
- String Item3ModId = null;
- String Item3Name = null;
- ItemStack item1 = null;
- ItemStack item2 = null;
- ItemStack item3 = null;
- Boolean OrAnd = null;
- Pattern p = Pattern.compile("\\(.*?\\)");
- Matcher m = p.matcher(line);
- while(m.find()){
- if(groupNum == 0){ Item1Type = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 1){ Item1ModId = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 2){ Item1Name = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 3){ Item2Type = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 4){ Item2ModId = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 5){ Item2Name = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 6){ AndOr = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 7){ Item3Type = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 8){ Item3ModId = (String) (m.group().subSequence(1, m.group().length()-1));}
- if(groupNum == 9){ Item3Name = (String) (m.group().subSequence(1, m.group().length()-1));}
- groupNum = groupNum + 1;
- if(Item3Name != null){
- ResourceLocation R1 = new ResourceLocation(Item1ModId, Item1Name);
- ResourceLocation R2 = new ResourceLocation(Item2ModId, Item2Name);
- ResourceLocation R3 = new ResourceLocation(Item3ModId, Item3Name);
- if(Item1Type.compareToIgnoreCase("item") == 0){item1 = new ItemStack(ForgeRegistries.ITEMS.getValue(R1));}
- if(Item1Type.compareToIgnoreCase("block") == 0){item1 = new ItemStack(ForgeRegistries.BLOCKS.getValue(R1));}
- if(Item2Type.compareToIgnoreCase("item") == 0){item2 = new ItemStack(ForgeRegistries.ITEMS.getValue(R2));}
- if(Item2Type.compareToIgnoreCase("block") == 0){item2 = new ItemStack(ForgeRegistries.BLOCKS.getValue(R2));}
- if(Item3Type.compareToIgnoreCase("item") == 0){item3 = new ItemStack(ForgeRegistries.ITEMS.getValue(R3));}
- if(Item3Type.compareToIgnoreCase("block") == 0){item3 = new ItemStack(ForgeRegistries.BLOCKS.getValue(R3));}
- if(AndOr.compareToIgnoreCase("and") == 0){OrAnd = CombinationRegistry.MODE_AND;}
- if(AndOr.compareToIgnoreCase("or") == 0){OrAnd = CombinationRegistry.MODE_OR;}
- if(item1 != null && item2 != null && item3 != null && OrAnd != null){CombinationRegistry.addCombination(item1, item2, OrAnd, item3);}
- }
- //CombinationRegistry.addCombination(new ItemStack(GameRegistry.findItem("minecraft", "carrot")),new ItemStack(GameRegistry.findItem("minecraft", "wheat_seeds")),false, new ItemStack(GameRegistry.findItem("minecraft", "slime_ball")));
- }
- }
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement