aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorRealSilverMoon <31100241+RealSilverMoon@users.noreply.github.com>2024-06-30 03:59:11 +0800
committerGitHub <noreply@github.com>2024-06-29 21:59:11 +0200
commitf8eb1c66d38b354878e50350a453b557e9b9abd5 (patch)
treed306401265102fa3d911fdb297ecbb06dd2a5326 /src/main/java/com
parentc3bb1755fb2d6d8cc3bb43187edc1f50a58764aa (diff)
downloadGT5-Unofficial-f8eb1c66d38b354878e50350a453b557e9b9abd5.tar.gz
GT5-Unofficial-f8eb1c66d38b354878e50350a453b557e9b9abd5.tar.bz2
GT5-Unofficial-f8eb1c66d38b354878e50350a453b557e9b9abd5.zip
Several fixes for Tesla Cover (#2671)
* Fix tesla cover memory leak * Fix tesla crash when destroying tesla cover * Add max output display
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java16
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java11
2 files changed, 23 insertions, 4 deletions
diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java
index e5d2b7acde..381aa1d730 100644
--- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java
+++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java
@@ -32,6 +32,16 @@ public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior {
}
@Override
+ public void onCoverUnload(ICoverable aTileEntity) {
+ if (!aTileEntity.isClientSide()) {
+ teslaSimpleNodeSetRemove(
+ new TeslaCoverConnection(
+ aTileEntity.getIGregTechTileEntityOffset(0, 0, 0),
+ getTeslaReceptionCapability()));
+ }
+ }
+
+ @Override
public boolean onCoverRemoval(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
boolean aForced) {
teslaSimpleNodeSetRemove(
@@ -40,6 +50,12 @@ public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior {
}
@Override
+ public void onBaseTEDestroyed(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ teslaSimpleNodeSetRemove(
+ new TeslaCoverConnection(aTileEntity.getIGregTechTileEntityOffset(0, 0, 0), getTeslaReceptionCapability()));
+ }
+
+ @Override
public String getDescription(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return "Do not attempt to use screwdriver!"; // TODO Translation support
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
index d3fa0401e6..8c3ad47ebe 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
@@ -310,8 +310,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
transferRadiusTransceiverSetting, transferRadiusCoverUltimateSetting, outputVoltageSetting,
outputCurrentSetting, sortTimeMinSetting, overDriveSetting;
protected Parameters.Group.ParameterOut popogaDisplay, transferRadiusTowerDisplay, transferRadiusTransceiverDisplay,
- transferRadiusCoverUltimateDisplay, outputVoltageDisplay, outputCurrentDisplay, energyCapacityDisplay,
- energyStoredDisplay, energyFractionDisplay, sortTimeDisplay;
+ transferRadiusCoverUltimateDisplay, outputVoltageDisplay, outputCurrentDisplay, outputMaxDisplay,
+ energyCapacityDisplay, energyStoredDisplay, energyFractionDisplay, sortTimeDisplay;
private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_LOW_SETTING_NAME = (base,
p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.0"); // Hysteresis low setting
@@ -350,6 +350,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
// display
private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_DISPLAY_NAME = (base,
p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.3"); // Output voltage display
+ private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_MAX_DISPLAY_NAME = (base,
+ p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.9"); // Output max display
private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_CURRENT_DISPLAY_NAME = (base,
p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.4"); // Output current display
private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> ENERGY_CAPACITY_DISPLAY_NAME = (base,
@@ -784,7 +786,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
transferRadiusCoverUltimateDisplay = hatch_3
.makeOutParameter(1, 0, TRANSFER_RADIUS_COVER_ULTIMATE_DISPLAY_NAME, TRANSFER_RADIUS_COVER_ULTIMATE_STATUS);
outputVoltageDisplay = hatch_4.makeOutParameter(0, 0, OUTPUT_VOLTAGE_DISPLAY_NAME, POWER_STATUS);
- popogaDisplay = hatch_4.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS);
+ outputMaxDisplay = hatch_4.makeOutParameter(1, 0, OUTPUT_MAX_DISPLAY_NAME, POWER_STATUS);
outputCurrentDisplay = hatch_5.makeOutParameter(0, 0, OUTPUT_CURRENT_DISPLAY_NAME, POWER_STATUS);
energyCapacityDisplay = hatch_5.makeOutParameter(1, 0, ENERGY_CAPACITY_DISPLAY_NAME, ENERGY_STATUS);
energyStoredDisplay = hatch_6.makeOutParameter(0, 0, ENERGY_STORED_DISPLAY_NAME, ENERGY_STATUS);
@@ -822,6 +824,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
setEUVar(0);
energyStoredDisplay.set(0);
energyFractionDisplay.set(0);
+ outputMaxDisplay.set(0);
}
@Override
@@ -861,7 +864,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
// Power transfer
outputCurrentDisplay.set(powerTeslaNodeMap(this));
-
+ outputMaxDisplay.set(Math.max(outputCurrentDisplay.get(), outputMaxDisplay.get()));
// TODO Encapsulate the spark sender
sparkCount--;
if (sparkCount == 0 && visualEffect) {