From 6a9d904eb4f37467b0c7238870b07bdf3317ad65 Mon Sep 17 00:00:00 2001 From: miozune Date: Sat, 23 Sep 2023 01:44:28 +0900 Subject: [PATCH] Cleanup basic machines & some deprecations (#360) Former-commit-id: cea4eaa2e409783af151c5f9c2cea6749ca68aef --- build.gradle | 32 +++++++++++++------ dependencies.gradle | 2 +- .../tileentities/debug/CreativeScanner.java | 13 ++------ .../tiered/GT_MetaTileEntity_BioLab.java | 15 +++------ .../tiered/GT_MetaTileEntity_Diode.java | 8 +++-- ...TT_MetaTileEntity_LowPowerLaserDynamo.java | 14 ++++---- .../TT_MetaTileEntity_LowPowerLaserHatch.java | 14 ++++---- 7 files changed, 53 insertions(+), 45 deletions(-) diff --git a/build.gradle b/build.gradle index b894d6477..ac9652d0a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1692122114 +//version: 1695323114 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -600,15 +600,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 +1571,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 d4963b05d..0a4a966fd 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.09:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.19:dev') api("com.github.GTNewHorizons:TecTech:5.3.1:dev") api("com.github.GTNewHorizons:GalacticGregGT5:1.0.10:dev") { exclude group:"com.github.GTNewHorizons", module:"bartworks" diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java index 95938fc39..2dcc69377 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/debug/CreativeScanner.java @@ -24,20 +24,13 @@ public CreativeScanner(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier); } - public CreativeScanner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, - String aNEIName) { - super(aName, aTier, aDescription, aTextures, aGUIName, aNEIName); + public CreativeScanner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new CreativeScanner( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures, - this.mGUIName, - this.mNEIName); + return new CreativeScanner(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_BioLab.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_BioLab.java index 6b02faa80..6830042f8 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_BioLab.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_BioLab.java @@ -51,7 +51,6 @@ public class GT_MetaTileEntity_BioLab extends GT_MetaTileEntity_BasicMachine { - private static final String MGUINAME = "BW.GUI.BioLab.png"; private static final int DNA_EXTRACTION_MODULE = 0; private static final int PCR_THERMOCYCLE_MODULE = 1; private static final int PLASMID_SYNTHESIS_MODULE = 2; @@ -69,8 +68,6 @@ public GT_MetaTileEntity_BioLab(int aID, String aName, String aNameRegional, int (String) null, 6, 2, - GT_MetaTileEntity_BioLab.MGUINAME, - null, TextureFactory.of( TextureFactory.of( new Textures.BlockIcons.CustomIcon( @@ -127,21 +124,19 @@ public GT_MetaTileEntity_BioLab(int aID, String aName, String aNameRegional, int .glow().build())); } - public GT_MetaTileEntity_BioLab(String aName, int aTier, int aAmperage, String aDescription, - ITexture[][][] aTextures, String aNEIName) { - super(aName, aTier, aAmperage, aDescription, aTextures, 6, 2, GT_MetaTileEntity_BioLab.MGUINAME, aNEIName); + public GT_MetaTileEntity_BioLab(String aName, int aTier, int aAmperage, String[] aDescription, + ITexture[][][] aTextures) { + super(aName, aTier, aAmperage, aDescription, aTextures, 6, 2); } @Override - @SuppressWarnings("deprecation") public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { return new GT_MetaTileEntity_BioLab( this.mName, this.mTier, this.mAmperage, - this.mDescription, - this.mTextures, - this.mNEIName); + this.mDescriptionArray, + this.mTextures); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java index 630efddc8..2f4811270 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_Diode.java @@ -18,6 +18,8 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; +import org.apache.commons.lang3.ArrayUtils; + import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; @@ -117,9 +119,9 @@ else if (meta > ConfigHandler.IDOffset + GT_Values.VN.length * 5 else return 0L; } - @SuppressWarnings("deprecation") public String[] getDescription() { - return new String[] { this.mDescription, + return ArrayUtils.addAll( + this.mDescriptionArray, StatCollector.translateToLocal("tooltip.tile.tiereddsc.0.name") + " " + ChatColorHelper.YELLOW + GT_Utility.formatNumbers(GT_Values.V[this.mTier]), @@ -129,6 +131,6 @@ public String[] getDescription() { StatCollector.translateToLocal("tooltip.tile.tiereddsc.2.name") + " " + ChatColorHelper.YELLOW + GT_Utility.formatNumbers(this.maxAmperesOut()), - BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() }; + BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get()); } } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserDynamo.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserDynamo.java index 8452086fd..570d4592c 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserDynamo.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserDynamo.java @@ -16,6 +16,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import org.apache.commons.lang3.ArrayUtils; + import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoTunnel; @@ -24,7 +26,6 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GT_Utility; -@SuppressWarnings("deprecation") public class TT_MetaTileEntity_LowPowerLaserDynamo extends GT_MetaTileEntity_Hatch_DynamoTunnel implements LowPowerLaser { @@ -32,9 +33,9 @@ public TT_MetaTileEntity_LowPowerLaserDynamo(int aID, String aName, String aName super(aID, aName, aNameRegional, aTier, aAmp); } - public TT_MetaTileEntity_LowPowerLaserDynamo(String aName, int aTier, int aAmp, String aDescription, + public TT_MetaTileEntity_LowPowerLaserDynamo(String aName, int aTier, int aAmp, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aAmp, new String[] { aDescription }, aTextures); + super(aName, aTier, aAmp, aDescription, aTextures); } @Override @@ -43,7 +44,7 @@ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { this.mName, this.mTier, this.Amperes, - this.mDescription, + this.mDescriptionArray, this.mTextures); } @@ -69,13 +70,14 @@ public long getAMPERES() { @Override public String[] getDescription() { - return new String[] { this.mDescription, + return ArrayUtils.addAll( + this.mDescriptionArray, StatCollector.translateToLocal("gt.blockmachines.hatch.dynamotunnel.desc.1") + ": " + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(this.getTotalPower()) + EnumChatFormatting.RESET + " EU/t", - BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() }; + BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get()); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserHatch.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserHatch.java index c9854e4cb..6a0425bfb 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserHatch.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/tiered/TT_MetaTileEntity_LowPowerLaserHatch.java @@ -16,6 +16,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import org.apache.commons.lang3.ArrayUtils; + import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyTunnel; @@ -24,7 +26,6 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GT_Utility; -@SuppressWarnings("deprecation") public class TT_MetaTileEntity_LowPowerLaserHatch extends GT_MetaTileEntity_Hatch_EnergyTunnel implements LowPowerLaser { @@ -32,20 +33,21 @@ public TT_MetaTileEntity_LowPowerLaserHatch(int aID, String aName, String aNameR super(aID, aName, aNameRegional, aTier, aAmp); } - public TT_MetaTileEntity_LowPowerLaserHatch(String aName, int aTier, int aAmp, String aDescription, + public TT_MetaTileEntity_LowPowerLaserHatch(String aName, int aTier, int aAmp, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aAmp, new String[] { aDescription }, aTextures); + super(aName, aTier, aAmp, aDescription, aTextures); } @Override public String[] getDescription() { - return new String[] { this.mDescription, + return ArrayUtils.addAll( + this.mDescriptionArray, StatCollector.translateToLocal("gt.blockmachines.hatch.energytunnel.desc.1") + ": " + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(this.getTotalPower()) + EnumChatFormatting.RESET + " EU/t", - BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() }; + BW_Tooltip_Reference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get()); } @Override @@ -54,7 +56,7 @@ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { this.mName, this.mTier, this.Amperes, - this.mDescription, + this.mDescriptionArray, this.mTextures); }