aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util
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/gregtech/api/util
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/gregtech/api/util')
-rw-r--r--src/main/java/gregtech/api/util/GT_CoverBehavior.java18
-rw-r--r--src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java11
2 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/util/GT_CoverBehavior.java b/src/main/java/gregtech/api/util/GT_CoverBehavior.java
index 34fc151b9a..3c3a8607fe 100644
--- a/src/main/java/gregtech/api/util/GT_CoverBehavior.java
+++ b/src/main/java/gregtech/api/util/GT_CoverBehavior.java
@@ -100,6 +100,18 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
}
@Override
+ protected void onBaseTEDestroyedImpl(ForgeDirection side, int aCoverID,
+ ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
+ onBaseTEDestroyed(side, aCoverID, convert(aCoverVariable), aTileEntity);
+ }
+
+ @Override
+ protected void onCoverUnloadImpl(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
+ ICoverable aTileEntity) {
+ onCoverUnload(aTileEntity);
+ }
+
+ @Override
protected String getDescriptionImpl(ForgeDirection side, int aCoverID,
ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
return getDescription(side, aCoverID, convert(aCoverVariable), aTileEntity);
@@ -275,6 +287,12 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
return true;
}
+ public void onCoverUnload(ICoverable aTileEntity) {
+
+ }
+
+ public void onBaseTEDestroyed(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {}
+
/**
* Gives a small Text for the status of the Cover.
*/
diff --git a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
index be9492ebba..76408e59c0 100644
--- a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
+++ b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
@@ -256,6 +256,14 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
}
/**
+ * Called when Base TE being unloaded.
+ */
+ public void onCoverUnload(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
+ ICoverable aTileEntity) {
+ onCoverUnloadImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity);
+ }
+
+ /**
* How Blast Proof the Cover is. 30 is normal.
*/
public final float getBlastProofLevel(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
@@ -581,6 +589,9 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
protected void onBaseTEDestroyedImpl(ForgeDirection side, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {}
+ protected void onCoverUnloadImpl(ForgeDirection side, int aCoverID, ISerializableObject aCoverVariable,
+ ICoverable aTileEntity) {}
+
protected boolean isRedstoneSensitiveImpl(ForgeDirection side, int aCoverID, T aCoverVariable,
ICoverable aTileEntity, long aTimer) {
return false;