Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
Cleanup basic machines & some deprecations (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
miozune authored Sep 22, 2023
1 parent bf6cbcd commit 21c182e
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 45 deletions.
32 changes: 23 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]),
Expand All @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -24,17 +26,16 @@
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 {

public TT_MetaTileEntity_LowPowerLaserDynamo(int aID, String aName, String aNameRegional, int aTier, int aAmp) {
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
Expand All @@ -43,7 +44,7 @@ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
this.mName,
this.mTier,
this.Amperes,
this.mDescription,
this.mDescriptionArray,
this.mTextures);
}

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -24,28 +26,28 @@
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 {

public TT_MetaTileEntity_LowPowerLaserHatch(int aID, String aName, String aNameRegional, int aTier, int aAmp) {
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
Expand All @@ -54,7 +56,7 @@ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
this.mName,
this.mTier,
this.Amperes,
this.mDescription,
this.mDescriptionArray,
this.mTextures);
}

Expand Down

0 comments on commit 21c182e

Please sign in to comment.