Skip to content

Commit 5e84d8b

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # build.gradle
2 parents 923ffea + 92a5834 commit 5e84d8b

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ dependencies {
9393
implementation fg.deobf("curse.maven:draconicevolution-223565:3051542")
9494
implementation fg.deobf("mcjty.theoneprobe:TheOneProbe-1.12:1.12-1.4.28-17")
9595

96-
//TODO Change to GregTech Community Edition: Unofficial (GTCEu)
9796
implementation fg.deobf("curse.maven:gregtech-293327:3266351")
97+
//Because GTCEu 2.4 and above and NCo crashed, this is to use GTCEu 2.3.4 for testing
98+
//Rendering errors occur when the GTCEu version is tested running, so just compileOnly
99+
compileOnly fg.deobf("curse.maven:gregtech-ce-unofficial-557242:3859788")
98100

99101
implementation fg.deobf("curse.maven:Mekanism-268560:2835175")
100102
implementation fg.deobf("curse.maven:industrialcraft-2-242638:3078604")

src/main/java/hellfirepvp/modularmachinery/common/block/prop/EnergyHatchData.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import gregtech.api.GTValues;
1212
import hellfirepvp.modularmachinery.ModularMachinery;
13+
import hellfirepvp.modularmachinery.common.base.Mods;
1314
import hellfirepvp.modularmachinery.common.util.MiscUtils;
1415
import net.minecraft.util.IStringSerializable;
1516
import net.minecraft.util.math.MathHelper;
@@ -18,6 +19,8 @@
1819

1920
import javax.annotation.Nonnull;
2021

22+
import static hellfirepvp.modularmachinery.common.base.Mods.GREGTECH;
23+
2124
/**
2225
* This class is part of the Modular Machinery Mod
2326
* The complete source code for this mod can be found on github.
@@ -41,7 +44,7 @@ public enum EnergyHatchData implements IStringSerializable {
4144
public static int energyCoreSearchDelay = 100;
4245
public static int maxEnergyCoreSearchDelay = 300;
4346
public static int searchRange = 16;
44-
47+
public static boolean enableGTExplodes = true;
4548
private final int defaultConfigurationEnergy;
4649
private final int defaultConfigurationTransferLimit;
4750
private final int defaultIC2EnergyTier;
@@ -70,12 +73,19 @@ public static void loadFromConfig(Configuration cfg) {
7073

7174
size.ic2EnergyTier = cfg.get("energyhatch.tier", size.name().toUpperCase(), size.defaultIC2EnergyTier, "Defines the IC2 output-voltage tier. Only affects the power the output hatches will output power as. 0 = 'ULV' = 8 EU/t, 1 = 'LV' = 32 EU/t, 2 = 'MV' = 128 EU/t, ... [range: 0 ~ 12, default: " + size.defaultIC2EnergyTier + "]").getInt();
7275

73-
size.gtEnergyTier = cfg.get("energyhatch.gtvoltage", size.name().toUpperCase(), size.defaultGTEnergyTier, "Defines the GT voltage tier. Affects both input and output hatches of this tier. [range: 0 ~ 8, default: " + size.defaultGTEnergyTier + "]").getInt();
74-
size.gtEnergyTier = MathHelper.clamp(size.gtEnergyTier, 0, 8);
75-
size.gtAmperage = cfg.get("energyhatch.gtamperage", size.name().toUpperCase(), size.defaultGTAmperage, "Defines the GT amperage. Affects both output amperage as well as maximum input amperage. [range: 1 ~ 16, default: " + size.defaultGTAmperage + "]").getInt();
76-
size.gtAmperage = MathHelper.clamp(size.gtAmperage, 1, 16);
76+
int gtEnergyTierlength = GTValues.VN.length - 1 ;
77+
78+
size.gtEnergyTier = cfg.get("energyhatch.gtvoltage", size.name().toUpperCase(), size.defaultGTEnergyTier, "Defines the GT voltage tier. Affects both input and output hatches of this tier. [range: 0 ~ "+ gtEnergyTierlength +", default: " + size.defaultGTEnergyTier + "]").getInt();
79+
size.gtEnergyTier = MathHelper.clamp(size.gtEnergyTier, 0, gtEnergyTierlength);
80+
81+
size.gtAmperage = cfg.get("energyhatch.gtamperage", size.name().toUpperCase(), size.defaultGTAmperage, "Defines the GT amperage. Affects both output amperage as well as maximum input amperage. [range: 1 ~ "+Integer.MAX_VALUE +", default: " + size.defaultGTAmperage + "]").getInt();
82+
size.gtAmperage = MathHelper.clamp(size.gtAmperage, 1, Integer.MAX_VALUE);
83+
7784
}
7885

86+
87+
enableGTExplodes = cfg.getBoolean("enable-GT-Explodes","energyhatch",true,
88+
"When enabled, the energy chamber will use GT's explosive mechanism, which is only valid when GT is installed");
7989
enableDEIntegration = cfg.getBoolean("enable-de-integration", "energyhatch", true,
8090
"When enabled, EnergyHatch can be used as an energy tower for the Draconic Evolution energy core and can automatically output energy at a rate that depends on the maximum rate in the configuration. Available only when Draconic Evolution is installed.");
8191
searchRange = cfg.getInt("energy-core-search-range", "energyhatch", 16, 1, 64,
@@ -106,7 +116,7 @@ public String getUnlocalizedEnergyDescriptor() {
106116

107117
// MM only supports GTCE tiers from ULV to UV
108118
public int getGTEnergyTier() {
109-
return MathHelper.clamp(this.gtEnergyTier, 0, 8);
119+
return MathHelper.clamp(this.gtEnergyTier, 0, GTValues.VN.length - 1);
110120
}
111121

112122
public int getGtAmperage() {

src/main/java/hellfirepvp/modularmachinery/common/tiles/base/GTEnergyContainer.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010

1111
import gregtech.api.capability.IEnergyContainer;
1212
import gregtech.api.util.GTUtility;
13-
import gregtech.common.ConfigHolder;
13+
import hellfirepvp.modularmachinery.common.base.Mods;
1414
import hellfirepvp.modularmachinery.common.machine.IOType;
1515
import net.minecraft.util.EnumFacing;
16-
import net.minecraft.util.math.BlockPos;
16+
import net.minecraft.util.math.BlockPos;;
1717
import net.minecraftforge.fml.common.Optional;
1818

19+
import static hellfirepvp.modularmachinery.common.block.prop.EnergyHatchData.enableGTExplodes;
20+
1921
/**
2022
* This class is part of the Modular Machinery Mod
2123
* The complete source code for this mod can be found on github.
@@ -42,7 +44,7 @@ public long acceptEnergyFromNetwork(EnumFacing side, long voltage, long amperage
4244
long maxAmperage = Math.min(getInputAmperage(), amperage);
4345

4446
if (voltage > getInputVoltage()) {
45-
if (ConfigHolder.doExplosions) {
47+
if (Mods.GREGTECH.isPresent() && enableGTExplodes) {
4648
BlockPos pos = hatch.getPos();
4749
hatch.getWorld().createExplosion(null,
4850
pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
@@ -124,4 +126,5 @@ public long getInputAmperage() {
124126
public long getInputVoltage() {
125127
return ioType == IOType.INPUT ? hatch.getTier().getGTEnergyTransferVoltage() : 0L;
126128
}
129+
127130
}

0 commit comments

Comments
 (0)