aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util
diff options
context:
space:
mode:
authorLéa Gris <lea.gris@noiraude.net>2022-09-01 13:17:27 +0200
committerGitHub <noreply@github.com>2022-09-01 13:17:27 +0200
commitb1ac2dc90ec6847e5a328fb12a3ece3b670df33c (patch)
treeff74c772afc2239939f37d307fa026deef6edb5b /src/main/java/gregtech/api/util
parent8a6973f2bddfb0a1485422725745c1078b1ea49e (diff)
downloadGT5-Unofficial-b1ac2dc90ec6847e5a328fb12a3ece3b670df33c.tar.gz
GT5-Unofficial-b1ac2dc90ec6847e5a328fb12a3ece3b670df33c.tar.bz2
GT5-Unofficial-b1ac2dc90ec6847e5a328fb12a3ece3b670df33c.zip
impl(covers): functional covers uses machine casing (#1317)
* impl(covers): functional covers uses machine casing - Functional covers now will let see the casing, when placed on machines. - When placed on pipes or frames, they continue to use their own tiered casing as they used to. * impr(cover): restore backward compat interface to cover registgration Registering covers with the old interface works again. Legacy cover registration just produce covers that renders the old way without transparency over machine casing. Removed the useless GT_Cover_Cased class and added the feature to the GT_CoverBehavior class, maintaining the old constructor alongside the new constructor with an overlay texture. * impr(covers): deprecate old constructors Delete totally redundant and unused EnergyOnly cover Keeps other unused covers as TODO reimplementation tasks * impr(covers): fludStorageMonitor overlay - Re-add FluidStorageMonitor fluid-texture overlay - Allow light-emitting fluids to render as glow texture. * impr(covers): Expand foreground texture support to GT_Cover_FacadeBase * spotlessapply
Diffstat (limited to 'src/main/java/gregtech/api/util')
-rw-r--r--src/main/java/gregtech/api/util/GT_CoverBehavior.java7
-rw-r--r--src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java20
2 files changed, 26 insertions, 1 deletions
diff --git a/src/main/java/gregtech/api/util/GT_CoverBehavior.java b/src/main/java/gregtech/api/util/GT_CoverBehavior.java
index de1514c956..595e421147 100644
--- a/src/main/java/gregtech/api/util/GT_CoverBehavior.java
+++ b/src/main/java/gregtech/api/util/GT_CoverBehavior.java
@@ -3,6 +3,7 @@ package gregtech.api.util;
import static gregtech.api.enums.GT_Values.E;
import gregtech.api.enums.GT_Values;
+import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.net.GT_Packet_TileEntityCoverGUI;
import net.minecraft.entity.player.EntityPlayer;
@@ -19,7 +20,11 @@ public abstract class GT_CoverBehavior extends GT_CoverBehaviorBase<ISerializabl
public EntityPlayer lastPlayer = null;
public GT_CoverBehavior() {
- super(ISerializableObject.LegacyCoverData.class);
+ this(null);
+ }
+
+ public GT_CoverBehavior(ITexture coverTexture) {
+ super(ISerializableObject.LegacyCoverData.class, coverTexture);
}
private static int convert(ISerializableObject.LegacyCoverData data) {
diff --git a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
index 470a250ee7..efbff79957 100644
--- a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
+++ b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
@@ -25,9 +25,15 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
public EntityPlayer lastPlayer = null;
private final Class<T> typeToken;
+ private final ITexture coverFGTexture;
protected GT_CoverBehaviorBase(Class<T> typeToken) {
+ this(typeToken, null);
+ }
+
+ protected GT_CoverBehaviorBase(Class<T> typeToken, ITexture coverTexture) {
this.typeToken = typeToken;
+ this.coverFGTexture = coverTexture;
}
public abstract T createDataObject(int aLegacyData);
@@ -88,6 +94,15 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
}
/**
+ * Get the special foreground cover texture associated with this cover. Return null if one should use the texture passed to
+ * {@link gregtech.api.GregTech_API#registerCover(ItemStack, ITexture, GT_CoverBehaviorBase)} or its overloads.
+ */
+ public final ITexture getSpecialCoverFGTexture(
+ byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) {
+ return getSpecialCoverFGTextureImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity);
+ }
+
+ /**
* Get the special cover texture associated with this cover. Return null if one should use the texture passed to
* {@link gregtech.api.GregTech_API#registerCover(ItemStack, ITexture, GT_CoverBehaviorBase)} or its overloads.
*/
@@ -380,6 +395,11 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
return GT_Utility.intToStack(aCoverID);
}
+ protected ITexture getSpecialCoverFGTextureImpl(
+ byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {
+ return coverFGTexture;
+ }
+
protected ITexture getSpecialCoverTextureImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {
return null;
}