Browse Source

This shoudlnt work properly but eh temp commit

parent
commit
0d466814f8
Signed by: Gregorius Techneticies <gregoriustech@gmail.com> GPG Key ID: 4C7DC365E9F99806
3 changed files with 12 additions and 14 deletions
  1. 0
    1
      build.gradle
  2. 5
    5
      src/main/java/gregtech/GT_Mod.java
  3. 7
    8
      src/main/java/gregtech/GT_Proxy.java

+ 0
- 1
build.gradle View File

@@ -524,4 +524,3 @@ if ( !project.buildInfo.tag.contains("-dirty") && (System.getenv().ONLY_RELEASES
524 524
 		}
525 525
 	}
526 526
 }
527
-

+ 5
- 5
src/main/java/gregtech/GT_Mod.java View File

@@ -118,7 +118,7 @@ import net.minecraftforge.oredict.OreDictionary;
118 118
 public class GT_Mod extends Abstract_Mod {
119 119
 	@SidedProxy(modId = ModIDs.GT, clientSide = "gregtech.GT_Client", serverSide = "gregtech.GT_Server")
120 120
 	public static GT_Proxy gregtechproxy;
121
-	public static String MAJOR_VERSION = "610";
121
+	public static String VERSION = "${version}".substring(0, 7);
122 122
 	
123 123
 	public GT_Mod() {
124 124
 		GT = this;
@@ -146,10 +146,10 @@ public class GT_Mod extends Abstract_Mod {
146 146
 		if (!tFile.exists()) tFile = new File(DirectoriesGT.CONFIG_GT, "gregtech.cfg");
147 147
 		Configuration tMainConfig = new Configuration(tFile);
148 148
 		
149
-		gregtechproxy.mSkeletonsShootGTArrows           = tMainConfig.get("general", "SkeletonsShootGTArrows"       , 16).getInt(16);
150
-		gregtechproxy.mFlintChance                      = tMainConfig.get("general", "FlintAndSteelChance"          , 30).getInt(30);
151
-		gregtechproxy.mDisableVanillaOres               = tMainConfig.get("general", "DisableVanillaOres"           , T).getBoolean(T);
152
-		mDisableIC2Ores                                 = tMainConfig.get("general", "DisableIC2Ores"               , T).getBoolean(T);
149
+		gregtechproxy.mSkeletonsShootGTArrows = tMainConfig.get("general", "SkeletonsShootGTArrows", 16).getInt(16);
150
+		gregtechproxy.mFlintChance            = tMainConfig.get("general", "FlintAndSteelChance"   , 30).getInt(30);
151
+		gregtechproxy.mDisableVanillaOres     = tMainConfig.get("general", "DisableVanillaOres"    , T).getBoolean(T);
152
+		mDisableIC2Ores                       = tMainConfig.get("general", "DisableIC2Ores"        , T).getBoolean(T);
153 153
 		
154 154
 		if (tMainConfig.get("general", "IncreaseDungeonLoot", T).getBoolean(T)) {
155 155
 			OUT.println(getModNameForLog() + ": Increasing general amount of Loot in Dungeon Chests and alike");

+ 7
- 8
src/main/java/gregtech/GT_Proxy.java View File

@@ -111,14 +111,13 @@ public abstract class GT_Proxy extends Abstract_Proxy {
111 111
 		new Thread(new Runnable() {@Override public void run() {
112 112
 		
113 113
 		if (ConfigsGT.CLIENT.get(ConfigCategories.news, "version_checker", T)) try {
114
-			Scanner tScanner = new Scanner(new URL("http://gregtech.overminddl1.com/com/gregoriust/gregtech/gregtech_1.7.10/version.txt").openStream());
115
-			if (tScanner.hasNextLine()) {
116
-				String tVersion = tScanner.nextLine();
117
-				while (tScanner.hasNextLine()) tVersion += tScanner.nextLine();
118
-				mVersionOutdated = !tVersion.contains(GT_Mod.MAJOR_VERSION);
119
-				OUT.println("GT_Download_Thread: Current Version = '" + GT_Mod.MAJOR_VERSION + "'; Recent Version = '" + tVersion + "'; Outdated = " + (mVersionOutdated?"Yes":"No"));
120
-			}
121
-			tScanner.close();
114
+			String tVersion = javax.xml.xpath.XPathFactory.newInstance().newXPath().compile("metadata/versioning/release/text()").evaluate(javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().parse((new URL("https://gregtech.overminddl1.com/com/gregoriust/gregtech/gregtech_1.7.10/maven-metadata.xml")).openConnection().getInputStream()), javax.xml.xpath.XPathConstants.STRING).toString().substring(0, 7);
115
+			mVersionOutdated = !GT_Mod.VERSION.startsWith(tVersion.substring(0, 4)) && !tVersion.endsWith("00"); // Just ignore the first Version of each Major Release, since that one is usually the buggiest.
116
+			
117
+			DEB.println(GT_Mod.VERSION.startsWith(tVersion.substring(0, 4)));
118
+			DEB.println(tVersion.endsWith("00"));
119
+			
120
+			OUT.println("GT_Download_Thread: Current Version = '" + GT_Mod.VERSION + "'; Recent Version = '" + tVersion + "'; Outdated = " + (mVersionOutdated?"Yes":"No"));
122 121
 		} catch(Throwable e) {OUT.println("GT_Download_Thread: Failed Downloading Version Number of the latest Major Version!");}
123 122
 		
124 123
 		if (downloadSupporterListSilverFromMain()) {

Loading…
Cancel
Save