From 7bbff97866b9a579bf5141ea1bcad6ba4b4a9cc0 Mon Sep 17 00:00:00 2001 From: miozune Date: Sat, 23 Sep 2023 15:38:32 +0900 Subject: Cleanup noXXXYYY methods (#67) * updateBuildScript * Update dependencies * Cleanup noXXXYYY methods --- build.gradle | 60 ++++++++++++++++++---- dependencies.gradle | 6 +-- .../com/elisis/gtnhlanth/loader/BotRecipes.java | 8 +-- 3 files changed, 58 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index b894d64772..7ff83a31bc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1692122114 +//version: 1695409603 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -89,6 +89,23 @@ def out = services.get(StyledTextOutputFactory).create('an-output') def projectJavaVersion = JavaLanguageVersion.of(8) boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false +boolean disableCheckstyle = project.hasProperty("disableCheckstyle") ? project.disableCheckstyle.toBoolean() : false + +final String CHECKSTYLE_CONFIG = """ + + + + + + + + + + + +""" checkPropertyExists("modName") checkPropertyExists("modId") @@ -140,6 +157,17 @@ if (!disableSpotless) { apply from: Blowdryer.file('spotless.gradle') } +if (!disableCheckstyle) { + apply plugin: 'checkstyle' + tasks.named("checkstylePatchedMc") { enabled = false } + tasks.named("checkstyleMcLauncher") { enabled = false } + tasks.named("checkstyleIdeVirtualMain") { enabled = false } + tasks.named("checkstyleInjectedTags") { enabled = false } + checkstyle { + config = resources.text.fromString(CHECKSTYLE_CONFIG) + } +} + String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" String kotlinSourceDir = "src/main/kotlin/" @@ -600,15 +628,10 @@ repositories { } maven { name = "ic2" - url = "https://maven.ic2.player.to/" - metadataSources { - mavenPom() - artifact() + url = getURL("https://maven.ic2.player.to/", "https://maven2.ic2.player.to/") + content { + includeGroup "net.industrial-craft" } - } - maven { - name = "ic2-mirror" - url = "https://maven2.ic2.player.to/" metadataSources { mavenPom() artifact() @@ -1576,6 +1599,25 @@ def getSecondaryArtifacts() { return secondaryArtifacts } +def getURL(String main, String fallback) { + return pingURL(main, 10000) ? main : fallback +} + +// credit: https://stackoverflow.com/a/3584332 +def pingURL(String url, int timeout) { + url = url.replaceFirst("^https", "http") // Otherwise an exception may be thrown on invalid SSL certificates. + try { + HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection() + connection.setConnectTimeout(timeout) + connection.setReadTimeout(timeout) + connection.setRequestMethod("HEAD") + int responseCode = connection.getResponseCode() + return 200 <= responseCode && responseCode <= 399 + } catch (IOException ignored) { + return false + } +} + // For easier scripting of things that require variables defined earlier in the buildscript if (file('addon.late.gradle.kts').exists()) { apply from: 'addon.late.gradle.kts' diff --git a/dependencies.gradle b/dependencies.gradle index a3e0264024..d89f746253 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.153:dev') - implementation('com.github.GTNewHorizons:GTplusplus:1.10.2:dev') - implementation('com.github.GTNewHorizons:GoodGenerator:0.6.27:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.22:dev') + implementation('com.github.GTNewHorizons:GTplusplus:1.10.10:dev') + implementation('com.github.GTNewHorizons:GoodGenerator:0.7.1:dev') } diff --git a/src/main/java/com/elisis/gtnhlanth/loader/BotRecipes.java b/src/main/java/com/elisis/gtnhlanth/loader/BotRecipes.java index 1d30dce68c..b465ecfab3 100644 --- a/src/main/java/com/elisis/gtnhlanth/loader/BotRecipes.java +++ b/src/main/java/com/elisis/gtnhlanth/loader/BotRecipes.java @@ -140,15 +140,15 @@ public class BotRecipes { // 2Cl + CO = COCl2 GT_Values.RA.stdBuilder().itemInputs(Materials.CarbonMonoxide.getCells(1), GT_Utility.getIntegratedCircuit(12)) - .itemOutputs(Phosgene.get(cell, 1)).fluidInputs(Materials.Chlorine.getGas(2000)).noFluidOutputs() + .itemOutputs(Phosgene.get(cell, 1)).fluidInputs(Materials.Chlorine.getGas(2000)) .duration(2 * SECONDS + 10 * TICKS).eut(TierEU.RECIPE_HV).addTo(sChemicalRecipes); GT_Values.RA.stdBuilder().itemInputs(Materials.Chlorine.getCells(2), GT_Utility.getIntegratedCircuit(12)) .itemOutputs(Phosgene.get(cell, 1), Materials.Empty.getCells(1)) - .fluidInputs(Materials.CarbonMonoxide.getGas(1000)).noFluidOutputs().duration(2 * SECONDS + 10 * TICKS) + .fluidInputs(Materials.CarbonMonoxide.getGas(1000)).duration(2 * SECONDS + 10 * TICKS) .eut(TierEU.RECIPE_HV).addTo(sChemicalRecipes); GT_Values.RA.stdBuilder().itemInputs(Materials.CarbonMonoxide.getCells(1), Materials.Chlorine.getCells(2)) - .itemOutputs(Phosgene.get(cell, 1), Materials.Empty.getCells(2)).noFluidInputs().noFluidOutputs() - .duration(2 * SECONDS + 10 * TICKS).eut(TierEU.RECIPE_HV).addTo(sChemicalRecipes); + .itemOutputs(Phosgene.get(cell, 1), Materials.Empty.getCells(2)).duration(2 * SECONDS + 10 * TICKS) + .eut(TierEU.RECIPE_HV).addTo(sChemicalRecipes); GT_Values.RA.stdBuilder().itemInputs(Materials.Chlorine.getCells(2), GT_Utility.getIntegratedCircuit(2)) .itemOutputs(Materials.Empty.getCells(2)).fluidInputs(Materials.CarbonMonoxide.getGas(1000)) .fluidOutputs(BotWerkstoffMaterialPool.Phosgene.getFluidOrGas(1000)).duration(2 * SECONDS + 10 * TICKS) -- cgit