From d6f93569b6be8df76e028eb3762e3b82deb75294 Mon Sep 17 00:00:00 2001 From: MuXiu1997 <49554020+MuXiu1997@users.noreply.github.com> Date: Sat, 26 Mar 2022 23:58:25 +0800 Subject: Fix secondary description not written to language file (#987) * Fix secondary description not written to language file * Extract ISecondaryDescribable interface * Recover isDisplaySecondaryDescription in MetaTileEntity --- .../api/interfaces/ISecondaryDescribable.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/java/gregtech/api/interfaces/ISecondaryDescribable.java (limited to 'src/main/java/gregtech/api/interfaces') 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; + } +} -- cgit