Raismin97

Mcreator Config file creator

Sep 26th, 2020 (edited)
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.94 KB | None | 0 0
  1. package net.mcreator.vanillaaddons.procedures;
  2.  
  3. import net.minecraft.world.IWorld;
  4.  
  5. import net.mcreator.vanillaaddons.VanillaaddonsModVariables;
  6. import net.mcreator.vanillaaddons.VanillaaddonsModElements;
  7.  
  8. import java.util.Map;
  9.  
  10. import java.io.IOException;
  11. import java.io.FileWriter;
  12. import java.io.FileReader;
  13. import java.io.FileNotFoundException;
  14. import java.io.File;
  15. import java.io.BufferedWriter;
  16. import java.io.BufferedReader;
  17.  
  18. @VanillaaddonsModElements.ModElement.Tag
  19. public class ConfigFileReaderProcedure extends VanillaaddonsModElements.ModElement {
  20.     public ConfigFileReaderProcedure(VanillaaddonsModElements instance) {
  21.         super(instance, 79);
  22.     }
  23.  
  24.     public static void executeProcedure(Map<String, Object> dependencies){
  25.         if(dependencies.get("world") == null){
  26.             System.err.println("Failed to load dependency world for procedure ConfigFileReader!");
  27.             return;
  28.         }
  29.                 IWorld world = (IWorld) dependencies.get("world");
  30.         if ((        (VanillaaddonsModVariables.WorldVariables.get(world).FirtsLoad)
  31. ==(true))) {if ((true)) {File ConfigFile = new File("//config/RaisminMod/" + "/" + "VanillaAddons.cfg");
  32. try {
  33.   FileWriter ConfigFilewriter = new FileWriter(ConfigFile);
  34.   BufferedWriter ConfigFilebw = new BufferedWriter(ConfigFilewriter);
  35. ConfigFilebw.write("# Configuration file");
  36. ConfigFilebw.newLine();
  37. ConfigFilebw.write("");
  38. ConfigFilebw.newLine();
  39. ConfigFilebw.write();
  40. ConfigFilebw.newLine();
  41. ConfigFilebw.write("#Version mod:0.0.0001");
  42. ConfigFilebw.newLine();
  43. ConfigFilebw.write("");
  44. ConfigFilebw.newLine();
  45. ConfigFilebw.write("Modules {");
  46. ConfigFilebw.newLine();
  47. ConfigFilebw.write("");
  48. ConfigFilebw.close();
  49. ConfigFilewriter.close();
  50. } catch (FileNotFoundException fileNotFoundException) {
  51.   fileNotFoundException.printStackTrace();
  52. } catch (IOException exception) {
  53.   exception.printStackTrace();
  54. }
  55. ConfigFilebw.write((("#If the magma block should become lava")+""+("[Default = true]")));
  56. ConfigFilebw.close();
  57. ConfigFilewriter.close();
  58. } catch (FileNotFoundException fileNotFoundException) {
  59.   fileNotFoundException.printStackTrace();
  60. } catch (IOException exception) {
  61.   exception.printStackTrace();
  62. }
  63. ConfigFilebw.write((("B:")+""+("ShouldMagmaHeat=")+""+("true")));
  64. ConfigFilebw.close();
  65. ConfigFilewriter.close();
  66. } catch (FileNotFoundException fileNotFoundException) {
  67.   fileNotFoundException.printStackTrace();
  68. } catch (IOException exception) {
  69.   exception.printStackTrace();
  70. }
  71. ConfigFilebw.write("");
  72. ConfigFilebw.close();
  73. ConfigFilewriter.close();
  74. }catch(
  75.     FileNotFoundException fileNotFoundException)
  76.     {
  77.         fileNotFoundException.printStackTrace();
  78.     }catch(
  79.     IOException exception)
  80.     {
  81.         exception.printStackTrace();
  82.     }ConfigFilebw.write((("#how many adjacent lava are needed to heat up")+""+("[Default = 2]")));ConfigFilebw.close();ConfigFilewriter.close();}catch(FileNotFoundException fileNotFoundException)
  83.     {
  84.         fileNotFoundException.printStackTrace();
  85.     }catch(IOException exception)
  86.     {
  87.   exception.printStackTrace();
  88. }ConfigFilebw.write((("I:")+""+("LavaNeedHeatUp")+""+("2")));ConfigFilebw.close();ConfigFilewriter.close();}catch(
  89.     FileNotFoundException fileNotFoundException)
  90.     {
  91.         fileNotFoundException.printStackTrace();
  92.     }catch(
  93.     IOException exception)
  94.     {
  95.         exception.printStackTrace();
  96.     }ConfigFilebw.write("");ConfigFilebw.close();ConfigFilewriter.close();}catch(
  97.     FileNotFoundException fileNotFoundException)
  98.     {
  99.         fileNotFoundException.printStackTrace();
  100.     }catch(
  101.     IOException exception)
  102.     {
  103.         exception.printStackTrace();
  104.     }ConfigFilebw.write((("#if the gravel and pile should exist")+""+("[Default = true]")));ConfigFilebw.close();ConfigFilewriter.close();}catch(
  105.     FileNotFoundException fileNotFoundException)
  106.     {
  107.         fileNotFoundException.printStackTrace();
  108.     }catch(
  109.     IOException exception)
  110.     {
  111.         exception.printStackTrace();
  112.     }ConfigFilebw.write((("B:")+""+("GravelSandPile = ")+""+("true")));ConfigFilebw.close();ConfigFilewriter.close();}catch(
  113.     FileNotFoundException fileNotFoundException)
  114.     {
  115.         fileNotFoundException.printStackTrace();
  116.     }catch(
  117.     IOException exception)
  118.     {
  119.         exception.printStackTrace();
  120.     }ConfigFilebw.write("}");ConfigFilebw.newLine();ConfigFilebw.write("");ConfigFilebw.close();ConfigFilewriter.close();}catch(
  121.     FileNotFoundException fileNotFoundException)
  122.     {
  123.         fileNotFoundException.printStackTrace();
  124.     }catch(
  125.     IOException exception)
  126.     {
  127.         exception.printStackTrace();
  128.     }VanillaaddonsModVariables.WorldVariables.get(world).FirtsLoad=(boolean)(false);VanillaaddonsModVariables.WorldVariables.get(world).syncData(world);}}else{File ConfigFile = new File("//config/RaisminMod/" + "/" + "VanillaAddons.cfg");try
  129.     {
  130.   final BufferedReader ConfigFileReader = new BufferedReader(new FileReader(ConfigFile));
  131.   String ConfigFileReadLine = null;
  132. ConfigFileReadLine = ConfigFileReader.readLine();
  133. if ((!(((ConfigFileReadLine)
  134. ).equals("# Configuration file")))) {ConfigFilebw.write("# Configuration file");
  135. ConfigFilebw.newLine();
  136. }ConfigFileReadLine = ConfigFileReader.readLine();
  137. if ((!(((ConfigFileReadLine)
  138. ).equals("")))) {ConfigFilebw.write("");
  139. ConfigFilebw.newLine();
  140. }ConfigFileReadLine = ConfigFileReader.readLine();
  141. if ((!(((ConfigFileReadLine)
  142. ).equals()))) {ConfigFilebw.write();
  143. ConfigFilebw.newLine();
  144. }ConfigFileReadLine = ConfigFileReader.readLine();
  145. if ((!(((ConfigFileReadLine)
  146. ).equals()))) {ConfigFilebw.write();
  147. ConfigFilebw.newLine();
  148. }ConfigFileReadLine = ConfigFileReader.readLine();
  149. ConfigFileReadLine = ConfigFileReader.readLine();
  150. ConfigFileReadLine = ConfigFileReader.readLine();
  151. ConfigFileReadLine = ConfigFileReader.readLine();
  152. ConfigFileReadLine = ConfigFileReader.readLine();
  153. if ((!(((((ConfigFileReadLine)
  154. ).equals((("B:")+""+("ShouldMagmaHeat=")+""+("true"))))||(((ConfigFileReadLine)
  155. ).equals((("B:")+""+("ShouldMagmaHeat=")+""+("false")))))||((((ConfigFileReadLine)
  156. ).equals((("B:")+""+("ShouldMagmaHeat=")+""+("1"))))||(((ConfigFileReadLine)
  157. ).equals((("B:")+""+("ShouldMagmaHeat=")+""+("0")))))))) {ConfigFilebw.write((("B:")+""+("ShouldMagmaHeat=")+""+("true")));
  158. ConfigFilebw.newLine();
  159.         VanillaaddonsModVariables.WorldVariables.get(world).ShoulMagmaHeat =(boolean)(true);
  160.         VanillaaddonsModVariables.WorldVariables.get(world).syncData(world);
  161. }else{if (((((ConfigFileReadLine)
  162. ).equals((("B:")+""+("ShouldMagmaHeat=")+""+("true"))))||(((ConfigFileReadLine)
  163. ).equals((("B:")+""+("ShouldMagmaHeat=")+""+("1")))))) {        VanillaaddonsModVariables.WorldVariables.get(world).ShoulMagmaHeat =(boolean)(true);
  164.         VanillaaddonsModVariables.WorldVariables.get(world).syncData(world);
  165. }else{        VanillaaddonsModVariables.WorldVariables.get(world).ShoulMagmaHeat =(boolean)(false);
  166.         VanillaaddonsModVariables.WorldVariables.get(world).syncData(world);
  167. }}ConfigFileReadLine = ConfigFileReader.readLine();
  168. ConfigFileReadLine = ConfigFileReader.readLine();
  169. if (((ConfigFileReadLine)
  170. .contains("LavaNeedHeatUp"))) {        VanillaaddonsModVariables.WorldVariables.get(world).LavaNeedHeatup =(double)new Object() {int convert(String s) { try { return Integer.parseInt(s.trim()); } catch (Exception e) { }return 0; }}.convert();
  171.         VanillaaddonsModVariables.WorldVariables.get(world).syncData(world);
  172. }else{ConfigFilebw.write((("I:")+""+("LavaNeedHeatUp")+""+("2")));
  173. ConfigFilebw.close();
  174. ConfigFilewriter.close();
  175. } catch (FileNotFoundException fileNotFoundException) {
  176.   fileNotFoundException.printStackTrace();
  177. } catch (IOException exception) {
  178.   exception.printStackTrace();
  179. }
  180.         VanillaaddonsModVariables.WorldVariables.get(world).LavaNeedHeatup =(double)2;
  181.         VanillaaddonsModVariables.WorldVariables.get(world).syncData(world);
  182. }ConfigFileReadLine=ConfigFileReader.readLine();ConfigFileReadLine=ConfigFileReader.readLine();if((!(((((ConfigFileReadLine)).equals((("B:")+""+("GravelSandPile=")+""+("true"))))||(((ConfigFileReadLine)).equals((("B:")+""+("GravelSandPile=")+""+("false")))))||((((ConfigFileReadLine)).equals((("B:")+""+("GravelSandPile=")+""+("1"))))||(((ConfigFileReadLine)).equals((("B:")+""+("GravelSandPile=")+""+("0"))))))))
  183.     {ConfigFilebw.write((("B:")+""+("GravelSandPile")+""+("true")));
  184. ConfigFilebw.newLine();
  185.         VanillaaddonsModVariables.WorldVariables.get(world).GravelSandPile =(boolean)(true);
  186.         VanillaaddonsModVariables.WorldVariables.get(world).syncData(world);
  187. }else{if (((((ConfigFileReadLine)
  188. ).equals((("B:")+""+("GravelSandPile")+""+("true"))))||(((ConfigFileReadLine)
  189. ).equals((("B:")+""+("GravelSandPile")+""+("1")))))) {        VanillaaddonsModVariables.WorldVariables.get(world).GravelSandPile =(boolean)(true);
  190.         VanillaaddonsModVariables.WorldVariables.get(world).syncData(world);
  191. }else{        VanillaaddonsModVariables.WorldVariables.get(world).GravelSandPile =(boolean)(false);
  192.         VanillaaddonsModVariables.WorldVariables.get(world).syncData(world);
  193. }}ConfigFileReader.close();}catch(
  194.     FileNotFoundException fileNotFoundException)
  195.     {
  196.         fileNotFoundException.printStackTrace();
  197.     }catch(
  198.     IOException exception)
  199.     {
  200.         exception.printStackTrace();
  201.     }
  202. }}}
  203.  
Add Comment
Please, Sign In to add comment