diff options
author | MuXiu1997 <49554020+MuXiu1997@users.noreply.github.com> | 2022-03-26 23:58:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-26 16:58:25 +0100 |
commit | d6f93569b6be8df76e028eb3762e3b82deb75294 (patch) | |
tree | 0af4ffe94603cffec1a689266da1dfd0add01c29 /src/main/java/gregtech/api/interfaces/ISecondaryDescribable.java | |
parent | 42538c27b6faf4392b8ada7d7fb55340e0f240b5 (diff) | |
download | GT5-Unofficial-d6f93569b6be8df76e028eb3762e3b82deb75294.tar.gz GT5-Unofficial-d6f93569b6be8df76e028eb3762e3b82deb75294.tar.bz2 GT5-Unofficial-d6f93569b6be8df76e028eb3762e3b82deb75294.zip |
Fix secondary description not written to language file (#987)
* Fix secondary description not written to language file
* Extract ISecondaryDescribable interface
* Recover isDisplaySecondaryDescription in MetaTileEntity
Diffstat (limited to 'src/main/java/gregtech/api/interfaces/ISecondaryDescribable.java')
-rw-r--r-- | src/main/java/gregtech/api/interfaces/ISecondaryDescribable.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/interfaces/ISecondaryDescribable.java b/src/main/java/gregtech/api/interfaces/ISecondaryDescribable.java new file mode 100644 index 0000000000..9c3c9ed219 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/ISecondaryDescribable.java @@ -0,0 +1,29 @@ +package gregtech.api.interfaces; + +/** + * To get a tooltip with a secondary description + */ +public interface ISecondaryDescribable extends IDescribable { + /** + * Convenient to call when overriding the `String[] getDescription()` method. + */ + default String[] getCurrentDescription() { + if (isDisplaySecondaryDescription() && getSecondaryDescription() != null) { + return getSecondaryDescription(); + } + return getPrimaryDescription(); + } + + String[] getPrimaryDescription(); + + String[] getSecondaryDescription(); + + /** + * This method will only be called on client side + * + * @return whether the secondary description should be display. default is false + */ + default boolean isDisplaySecondaryDescription() { + return false; + } +} |