aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/gui/widgets')
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java12
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java2
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java6
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java2
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java2
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java20
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java55
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java16
8 files changed, 57 insertions, 58 deletions
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java
index d52b09b9d5..6f4eb0e2c2 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java
@@ -103,8 +103,8 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
/**
* Add the cover on this side of the IGregTechTileEntity to the tabs
*
- * @param side
- * @param cover
+ * @param side side to apply the cover to
+ * @param cover cover to add
*/
private void addCoverToTabs(ForgeDirection side, ItemStack cover) {
final boolean enabled = this.tile.getCoverBehaviorAtSideNew(side)
@@ -117,9 +117,9 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
/**
* Decorate the cover's tooltips according to the side it's on and on whether the tab is enabled or not
*
- * @param side
- * @param cover
- * @param enabled
+ * @param side side
+ * @param cover cover which tooltip to decorate
+ * @param enabled if the tab is enabled
* @return This cover tab's tooltip
*/
private String[] getTooltipForCoverTab(ForgeDirection side, ItemStack cover, boolean enabled) {
@@ -135,7 +135,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
/**
* Get the translated name for a side of the IGregTechTileEntity
*
- * @param side
+ * @param side side of the entity
* @return translated name for a side of the IGregTechTileEntity
*/
private String getSideDescription(ForgeDirection side) {
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java
index b534359cac..9f4287a65b 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java
@@ -1,6 +1,6 @@
package gregtech.api.gui.widgets;
-import java.awt.*;
+import java.awt.Rectangle;
import java.util.List;
import net.minecraft.client.Minecraft;
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java
index 46d213f0f6..66ab27356e 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java
@@ -113,16 +113,16 @@ public enum GT_GuiIcon implements IGuiIcon {
/**
* This is intended to enable addon mods to register additional textures. They can then add to this enum using
- * EnumHelper.addEnum or by creating your their enum that implements IGuiIcon (still requires adding a texture here)
+ * EnumHelper.addEnum or by creating their enum that implements IGuiIcon (still requires adding a texture here)
*
- * @param location
+ * @param location location of the texture to add
*/
public static void addTextures(ResourceLocation... location) {
if (location == null || location.length == 0) return;
int startIndex = TEXTURES.length;
TEXTURES = Arrays.copyOf(TEXTURES, location.length);
- System.arraycopy(location, 0, TEXTURES, startIndex + 0, location.length);
+ System.arraycopy(location, 0, TEXTURES, startIndex, location.length);
}
@Override
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java
index 62d6648e73..d4bfe31404 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java
@@ -17,7 +17,7 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen
protected GT_GuiIcon icon;
private final int x0;
private final int y0;
- protected IGuiScreen gui;
+ protected final IGuiScreen gui;
private GT_GuiTooltip tooltip;
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java
index ef5348cf77..2d3c7374bd 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java
@@ -1,6 +1,6 @@
package gregtech.api.gui.widgets;
-import java.awt.*;
+import java.awt.Rectangle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiTextField;
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java
index 151eba2936..d06c2bd2eb 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java
@@ -34,7 +34,7 @@ public class GT_GuiTab {
* A tab to be attached to a tab line
*
* @param gui IGregTechTileEntity the tab line this tab belongs to is attached to
- * @param id both the ID and position in the tab line of this tab
+ * @param id both the ID and position in the tab line of this tab. Not used, kept for compatibility.
* @param bounds bounds of this tab
* @param tabBackground set of background textures
* @param item item to draw atop the background texture, not colored
@@ -62,7 +62,7 @@ public class GT_GuiTab {
/**
* Set this tab's tooltip text
*
- * @param text
+ * @param text text to set
* @return This tab for chaining
*/
public GT_GuiTab setTooltipText(String... text) {
@@ -85,9 +85,9 @@ public class GT_GuiTab {
/**
* Draw the background texture for this tab
*
- * @param mouseX
- * @param mouseY
- * @param parTicks
+ * @param mouseX not used, likely kept for backward compatibility
+ * @param mouseY not used, likely kept for backward compatibility
+ * @param parTicks not used, likely kept for backward compatibility
*/
public void drawBackground(int mouseX, int mouseY, float parTicks) {
if (this.visible) {
@@ -106,9 +106,9 @@ public class GT_GuiTab {
/**
* Draw overlay textures and items atop the background texture
*
- * @param mouseX
- * @param mouseY
- * @param parTicks
+ * @param mouseX X mouse coordinate
+ * @param mouseY Y mouse coordinate
+ * @param parTicks not used, likely kept for backward compatibility
*/
public void drawOverlays(int mouseX, int mouseY, float parTicks) {
this.mousedOver = bounds.contains(mouseX, mouseY);
@@ -165,8 +165,8 @@ public class GT_GuiTab {
/**
* Reposition this tab on the screen
*
- * @param xPos
- * @param yPos
+ * @param xPos X tab coordinate
+ * @param yPos Y tab coordinate
*/
public void setPosition(int xPos, int yPos) {
this.bounds = new Rectangle(xPos, yPos, bounds.width, bounds.height);
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java
index 74145463b3..950478cdfa 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java
@@ -86,7 +86,8 @@ public class GT_GuiTabLine {
private final DisplayStyle yDir;
// Whether to display on the right side of the GT_ITabRenderer instead of left
- protected boolean flipHorizontally, visible;
+ protected final boolean flipHorizontally;
+ protected final boolean visible;
private final GT_GuiTabIconSet tabBackground;
private final GT_ITabRenderer gui;
@@ -128,10 +129,10 @@ public class GT_GuiTabLine {
/**
* Creates a new tab at the specified position with the given parameters. This class handles the positioning.
*
- * @param tabId
- * @param item
- * @param overlay
- * @param text
+ * @param tabId tab ID
+ * @param item item to draw atop the background texture, not colored
+ * @param overlay texture to draw atop the background texture, not colored
+ * @param text tooltip of this tab
*/
public void setTab(int tabId, ItemStack item, IGuiIcon overlay, String[] text) {
mTabs[tabId] = new GT_GuiTab(
@@ -148,8 +149,8 @@ public class GT_GuiTabLine {
/**
* Get the bounds a given tab should occupy
*
- * @param tabId
- * @return
+ * @param tabId tab ID
+ * @return tab bounds
*/
protected Rectangle getBoundsForTab(int tabId) {
return new Rectangle(getTabX(tabId), getTabY(tabId), this.tabWidth, this.tabHeight);
@@ -158,12 +159,12 @@ public class GT_GuiTabLine {
/**
* Enable or disable a tab. Disabled tabs have a dark background.
*
- * @param tabId
- * @param value
+ * @param tabId tab ID
+ * @param enable true to enable, false to disable
*/
- public void setTabEnabled(int tabId, boolean value) {
+ public void setTabEnabled(int tabId, boolean enable) {
if (mTabs[tabId] != null) {
- mTabs[tabId].enabled = value;
+ mTabs[tabId].enabled = enable;
}
}
@@ -172,8 +173,6 @@ public class GT_GuiTabLine {
* drawScreen.
*
* @param parTicks
- * @param mouseX
- * @param mouseY
*/
public void drawTabs(float parTicks, int mouseX, int mouseY) {
if (this.visible) {
@@ -189,9 +188,9 @@ public class GT_GuiTabLine {
/**
* Draw the tab's backgrounds first
*
- * @param parTicks
- * @param mouseX
- * @param mouseY
+ * @param parTicks not used, likely kept for compatibility
+ * @param mouseX mouse X position
+ * @param mouseY mouse Y position
*/
protected void drawOverlays(float parTicks, int mouseX, int mouseY) {
for (GT_GuiTab mTab : mTabs) {
@@ -204,9 +203,9 @@ public class GT_GuiTabLine {
/**
* Draw anything that overlays the tab's background texture
*
- * @param parTicks
- * @param mouseX
- * @param mouseY
+ * @param parTicks not used, likely kept for compatibility
+ * @param mouseX mouse X position
+ * @param mouseY mouse Y position
*/
protected void drawBackground(float parTicks, int mouseX, int mouseY) {
for (GT_GuiTab mTab : mTabs) {
@@ -219,9 +218,9 @@ public class GT_GuiTabLine {
/**
* Call tabClick for every tab that was clicked. GT_ITabRenderer must call this method on mouseClicked.
*
- * @param mouseX
- * @param mouseY
- * @param mouseButton
+ * @param mouseX mouse X position
+ * @param mouseY mouse Y position
+ * @param mouseButton which mouse button was used to click
*/
public void onMouseClicked(int mouseX, int mouseY, int mouseButton) {
for (int tabId = 0; tabId < mTabs.length; tabId++) {
@@ -236,8 +235,8 @@ public class GT_GuiTabLine {
/**
* Act on a tab being clicked.
*
- * @param tabId
- * @param mouseButton
+ * @param tabId tab ID
+ * @param mouseButton which mouse button was used to click
*/
protected void tabClicked(int tabId, int mouseButton) {}
@@ -255,8 +254,8 @@ public class GT_GuiTabLine {
/**
* Get the proper X position for a given tab
*
- * @param tabId
- * @return
+ * @param tabId tab ID
+ * @return X position of the tab
*/
private int getTabX(int tabId) {
return this.gui.getGuiLeft() + (flipHorizontally ? (gui.getXSize() - tabLineLeft - tabWidth) : tabLineLeft)
@@ -266,8 +265,8 @@ public class GT_GuiTabLine {
/**
* Get the proper Y position for a given tab
*
- * @param tabId
- * @return
+ * @param tabId tab ID
+ * @return Y position of the tab
*/
private int getTabY(int tabId) {
return this.gui.getGuiTop() + tabLineTop + (tabId * (tabHeight + tabSpacing) * yDir.getValue());
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java
index 326e744382..fe20b2b57a 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java
@@ -11,7 +11,7 @@ import gregtech.api.util.GT_TooltipDataCache.TooltipData;
public class GT_GuiTooltip {
- protected Rectangle bounds;
+ protected final Rectangle bounds;
protected TooltipData data;
private List<String> displayedText;
public boolean enabled = true;
@@ -20,8 +20,8 @@ public class GT_GuiTooltip {
* Used to create a tooltip that will appear over the specified bounds. This will initially be a "static" tooltip
* that doesn't respect verbosity levels or respond to the shift key.
*
- * @param bounds
- * @param text
+ * @param bounds tooltip bounds
+ * @param text tooltip text
*/
public GT_GuiTooltip(Rectangle bounds, String... text) {
this.bounds = bounds;
@@ -32,8 +32,8 @@ public class GT_GuiTooltip {
* Used to create a tooltip that will appear over the specified bounds. This will initially be a "dynamic" tooltip
* that respects verbosity levels and responds to the shift key.
*
- * @param bounds
- * @param data
+ * @param bounds tooltip bounds
+ * @param data tooltip data
*/
public GT_GuiTooltip(Rectangle bounds, TooltipData data) {
this.bounds = bounds;
@@ -69,7 +69,7 @@ public class GT_GuiTooltip {
/**
* Used to set a "static" tooltip that doesn't respect verbosity levels or respond to the shift key
*
- * @param text
+ * @param text tooltip text
*/
public void setToolTipText(String... text) {
this.data = formatTooltip(text);
@@ -79,7 +79,7 @@ public class GT_GuiTooltip {
/**
* Used to set a "dynamic" tooltip that respects verbosity levels and responds to the shift key
*
- * @param data
+ * @param data tooltip data
*/
public void setToolTipText(TooltipData data) {
// Trust that the tooltips have already been formatted and colored, just make sure it has no nulls
@@ -89,7 +89,7 @@ public class GT_GuiTooltip {
/**
* Apply tooltip colors in case the text doesn't contain them and return as tooltip data
*
- * @param text
+ * @param text text to apply the colors to
* @return colored tooltip lines as list
*/
protected TooltipData formatTooltip(String[] text) {