aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util
diff options
context:
space:
mode:
authorquerns <33518699+querns@users.noreply.github.com>2023-09-13 10:03:17 -0500
committerGitHub <noreply@github.com>2023-09-13 17:03:17 +0200
commitb31052879e7601dbfea4c7fb53b94119c7bbf5c6 (patch)
tree69c6778c385c27ada8ec61478f5bc6da32bbc8fb /src/main/java/gregtech/api/util
parent62bb20ef6271b09dab45d66103a185774aba523e (diff)
downloadGT5-Unofficial-b31052879e7601dbfea4c7fb53b94119c7bbf5c6.tar.gz
GT5-Unofficial-b31052879e7601dbfea4c7fb53b94119c7bbf5c6.tar.bz2
GT5-Unofficial-b31052879e7601dbfea4c7fb53b94119c7bbf5c6.zip
Adds Metrics Transmitter Cover and Advanced GT Sensor Card for Information Panels (#2289)
* Adds several UI elements to multiblock drills * Adds metrics transmitter cover and associated sensor card * Fixes item icons and item name * Adds tooltips for adv. sensor card and metrics panel, fixes card/overlay icons, adds recipe for metrics cover * Refactor cover tab sync to send much smaller ISerializable payloads * Remove unused variable * Additional master merge cleanup * Adds interface for custom metrics export, adds oil drill support * Adds support for metrics covers retaining attached machine name for tooltip, metrics * * Adds discrete coordinates to Metrics Cover data * Adds machine to advanced sensor card tooltip * Adds cycle time and minimum energy hatch tier to multiblock ore drill tooltips * Moves many tooltip strings to i10n * Remove old GT_DisabledWhileActiveButton.java file that crept in during a messy merge * Spotless * Improve oil and ore drill metrics, more i18n * Addresses PR review concerns, adds more situations for self-destructing sensor cards * Remediates further PR concerns
Diffstat (limited to 'src/main/java/gregtech/api/util')
-rw-r--r--src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
index fdb4cbe7a4..3300ab43d6 100644
--- a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
+++ b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
@@ -2,6 +2,7 @@ package gregtech.api.util;
import static gregtech.api.enums.GT_Values.E;
+import java.util.List;
import java.util.function.Supplier;
import javax.annotation.Nullable;
@@ -16,6 +17,9 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
+import org.jetbrains.annotations.NotNull;
+
+import com.google.common.collect.ImmutableList;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.drawable.ItemDrawable;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
@@ -385,6 +389,19 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
ICoverable aTileEntity) {
return getDropImpl(side, aCoverID, forceCast(aCoverVariable), aTileEntity);
}
+
+ /**
+ * Called when the cover is initially attached to a machine.
+ *
+ * @param player The attaching player
+ * @param aCover An {@link ItemStack} containing the cover
+ * @param aTileEntity The machine receiving the cover
+ * @param side Which side the cover is attached to
+ */
+ public void onPlayerAttach(EntityPlayer player, ItemStack aCover, ICoverable aTileEntity, ForgeDirection side) {
+ // Do nothing by default.
+ }
+
// endregion
// region UI stuff
@@ -815,5 +832,24 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
public String trans(String aNr, String aEnglish) {
return GT_Utility.trans(aNr, aEnglish);
}
+
+ public boolean allowsCopyPasteTool() {
+ return true;
+ }
+
+ @NotNull
+ public final List<String> getAdditionalTooltip(ISerializableObject coverData) {
+ return getAdditionalTooltipImpl(forceCast(coverData));
+ }
+
+ /**
+ * Override to add to the tooltip generated when a user hovers over the cover on the left side of a machine's UI.
+ *
+ * @param coverData The cover data associated with the cover on a particular side.
+ * @return A list of new tooltip entries. Entries are inserted at the top, just after the name and direction line.
+ */
+ protected List<String> getAdditionalTooltipImpl(T coverData) {
+ return ImmutableList.of();
+ }
// endregion
}