aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/gui/widgets
diff options
context:
space:
mode:
authorRaven Szewczyk <git@eigenraven.me>2022-08-27 10:19:57 +0100
committerGitHub <noreply@github.com>2022-08-27 11:19:57 +0200
commit6f31720697bcc351421a4d86ba3bf749375dd12c (patch)
tree3adf8f318f22c892d74cd7c9d30b6dd3f11f11bd /src/main/java/gregtech/api/gui/widgets
parentc3eac50decd33ee2be8703dfb2ecf9cdc31c2b67 (diff)
downloadGT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.tar.gz
GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.tar.bz2
GT5-Unofficial-6f31720697bcc351421a4d86ba3bf749375dd12c.zip
Update buildscript & apply spotless (#1306)
* Update dependencies * Update buildscript, apply spotless
Diffstat (limited to 'src/main/java/gregtech/api/gui/widgets')
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java70
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java32
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java123
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java39
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java13
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java15
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java3
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java11
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java74
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiTabLine.java108
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java32
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java21
12 files changed, 290 insertions, 251 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 8f729771f6..525618589b 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java
@@ -1,36 +1,34 @@
package gregtech.api.gui.widgets;
-import java.awt.Rectangle;
-import java.util.List;
-
-import org.lwjgl.opengl.GL11;
-
import codechicken.nei.api.API;
import codechicken.nei.api.INEIGuiAdapter;
-import gregtech.api.enums.Dyes;
import gregtech.api.enums.GT_Values;
import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.net.GT_Packet_GtTileEntityGuiRequest;
import gregtech.common.GT_Proxy;
+import java.awt.Rectangle;
+import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
+import org.lwjgl.opengl.GL11;
/**
* Let's you access a GregTech IGregTechTileEntity's covers as tabs on the GUI's sides
*/
public class GT_GuiCoverTabLine extends GT_GuiTabLine {
// Names of the block a cover could be on
- private final static String[] SIDES = new String[]{
+ private static final String[] SIDES = new String[] {
"GT5U.interface.coverTabs.down",
"GT5U.interface.coverTabs.up",
"GT5U.interface.coverTabs.north",
"GT5U.interface.coverTabs.south",
"GT5U.interface.coverTabs.west",
- "GT5U.interface.coverTabs.east"};
+ "GT5U.interface.coverTabs.east"
+ };
// Not sure there's a point in JIT translation but that's what this is
private String[] translatedSides;
@@ -39,7 +37,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
/**
* Let's you access an IGregTechTileEntity's covers as tabs on the GUI's sides
- *
+ *
* @param gui GT_ITabRenderer gui which this tab line attaches to
* @param tabLineLeft left position of the tab line in relation to the gui
* @param tabLineTop top position of the tab line in relation to the gui
@@ -56,9 +54,19 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
* @param tile The IGregTechTileEntity the covers of which we are accessing
* @param colorization The colorization of the GUI we are adding tabs to
*/
- public GT_GuiCoverTabLine(GT_GUIContainerMetaTile_Machine gui, int tabLineLeft, int tabLineTop, int tabHeight,
- int tabWidth, int tabSpacing, DisplayStyle xDir, DisplayStyle yDir, DisplayStyle displayMode,
- GT_GuiTabIconSet tabBackground, IGregTechTileEntity tile, int colorization) {
+ public GT_GuiCoverTabLine(
+ GT_GUIContainerMetaTile_Machine gui,
+ int tabLineLeft,
+ int tabLineTop,
+ int tabHeight,
+ int tabWidth,
+ int tabSpacing,
+ DisplayStyle xDir,
+ DisplayStyle yDir,
+ DisplayStyle displayMode,
+ GT_GuiTabIconSet tabBackground,
+ IGregTechTileEntity tile,
+ int colorization) {
super(gui, 6, tabLineLeft, tabLineTop, tabHeight, tabWidth, tabSpacing, xDir, yDir, displayMode, tabBackground);
this.tile = tile;
this.colorization = colorization;
@@ -76,12 +84,13 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
addCoverToTabs(tSide, cover);
}
}
- }
+ }
@Override
protected void drawBackground(float parTicks, int mouseX, int mouseY) {
// Apply this tile's coloration to draw the background
- GL11.glColor3ub((byte) ((colorization >> 16) & 0xFF), (byte) ((colorization >> 8) & 0xFF), (byte) (colorization & 0xFF));
+ GL11.glColor3ub((byte) ((colorization >> 16) & 0xFF), (byte) ((colorization >> 8) & 0xFF), (byte)
+ (colorization & 0xFF));
super.drawBackground(parTicks, mouseX, mouseY);
}
@@ -89,13 +98,13 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
protected void tabClicked(int tabId, int mouseButton) {
if (mouseButton == 0 && mTabs[tabId].enabled) {
GT_Values.NW.sendToServer(new GT_Packet_GtTileEntityGuiRequest(
- this.tile.getXCoord(),
- this.tile.getYCoord(),
- this.tile.getZCoord(),
- tabId + GT_Proxy.GUI_ID_COVER_SIDE_BASE,
- this.tile.getWorld().provider.dimensionId,
- Minecraft.getMinecraft().thePlayer.getEntityId(),
- 0));
+ this.tile.getXCoord(),
+ this.tile.getYCoord(),
+ this.tile.getZCoord(),
+ tabId + GT_Proxy.GUI_ID_COVER_SIDE_BASE,
+ this.tile.getWorld().provider.dimensionId,
+ Minecraft.getMinecraft().thePlayer.getEntityId(),
+ 0));
}
}
@@ -108,7 +117,6 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
boolean enabled = this.tile.getCoverBehaviorAtSideNew(side).hasCoverGUI();
this.setTab(side, cover, null, getTooltipForCoverTab(side, cover, enabled));
this.setTabEnabled(side, enabled);
-
}
/**
@@ -119,12 +127,13 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
* @return This cover tab's tooltip
*/
private String[] getTooltipForCoverTab(byte side, ItemStack cover, boolean enabled) {
- List<String> tooltip = cover.getTooltip(Minecraft.getMinecraft().thePlayer, true);
- tooltip.set(0,
+ List<String> tooltip = cover.getTooltip(Minecraft.getMinecraft().thePlayer, true);
+ tooltip.set(
+ 0,
(enabled ? EnumChatFormatting.UNDERLINE : EnumChatFormatting.DARK_GRAY)
- + getSideDescription(side)
- + (enabled ? EnumChatFormatting.RESET + ": " : ": " + EnumChatFormatting.RESET)
- + tooltip.get(0));
+ + getSideDescription(side)
+ + (enabled ? EnumChatFormatting.RESET + ": " : ": " + EnumChatFormatting.RESET)
+ + tooltip.get(0));
return tooltip.toArray(new String[0]);
}
@@ -138,7 +147,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
if (this.translatedSides[side] == null) {
this.translatedSides[side] = StatCollector.translateToLocal(SIDES[side]);
}
- return this.translatedSides[side] ;
+ return this.translatedSides[side];
}
return null;
}
@@ -146,7 +155,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
/**
* Hide any NEI slots that would intersect with a cover tab
*/
- static class CoverTabLineNEIHandler extends INEIGuiAdapter{
+ static class CoverTabLineNEIHandler extends INEIGuiAdapter {
@Override
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
Rectangle neiSlotArea = new Rectangle(x, y, w, h);
@@ -155,7 +164,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
if (!tabLine.visible) {
return false;
}
- for (int i = 0; i < tabLine.mTabs.length; i++ ) {
+ for (int i = 0; i < tabLine.mTabs.length; i++) {
if (tabLine.mTabs[i] != null && tabLine.mTabs[i].getBounds().intersects(neiSlotArea)) {
return true;
}
@@ -164,6 +173,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine {
return false;
}
}
+
static {
API.registerNEIGuiHandler(new CoverTabLineNEIHandler());
}
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 045730dd7f..7a57c49515 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java
@@ -3,15 +3,14 @@ package gregtech.api.gui.widgets;
import codechicken.lib.gui.GuiDraw;
import gregtech.api.interfaces.IGuiScreen;
import gregtech.api.util.GT_UtilityClient;
+import java.awt.*;
+import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
-import java.awt.*;
-import java.util.List;
-
public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement {
private GT_GuiIcon bgIcon;
@@ -42,14 +41,13 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement {
this.gui = gui;
this.bgIcon = bgIcon;
item = null;
- rectangle = new Rectangle(x, y, 18, 18);
+ rectangle = new Rectangle(x, y, 18, 18);
gui.addElement(this);
}
public GT_GuiFakeItemButton setItem(ItemStack i) {
item = i;
- if (getMimicSlot())
- updateTooltip();
+ if (getMimicSlot()) updateTooltip();
return this;
}
@@ -57,7 +55,7 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement {
itemTooltips = item == null ? null : GT_UtilityClient.getTooltip(item, true);
}
- public ItemStack getItem(){
+ public ItemStack getItem() {
return item;
}
@@ -95,8 +93,7 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement {
@Override
public void onRemoved() {
- if (mimicSlot)
- gui.removeToolTip(tooltip);
+ if (mimicSlot) gui.removeToolTip(tooltip);
}
@Override
@@ -106,8 +103,8 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- if (bgIcon != null){
- GT_GuiIcon.render(bgIcon, xPosition-1, yPosition-1, 18, 18,0,true);
+ if (bgIcon != null) {
+ GT_GuiIcon.render(bgIcon, xPosition - 1, yPosition - 1, 18, 18, 0, true);
}
if (item != null) {
@@ -115,10 +112,15 @@ public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement {
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
}
- gui.getItemRenderer().renderItemAndEffectIntoGUI(gui.getFontRenderer(), Minecraft.getMinecraft().getTextureManager(), item, xPosition, yPosition);
-
- if (item.getItem() instanceof ItemBlock)
- GL11.glPopAttrib();
+ gui.getItemRenderer()
+ .renderItemAndEffectIntoGUI(
+ gui.getFontRenderer(),
+ Minecraft.getMinecraft().getTextureManager(),
+ item,
+ xPosition,
+ yPosition);
+
+ if (item.getItem() instanceof ItemBlock) GL11.glPopAttrib();
}
if (getMimicSlot())
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 0d6c2da243..37e1a6d960 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java
@@ -1,61 +1,59 @@
package gregtech.api.gui.widgets;
-import java.util.Arrays;
-
import gregtech.api.interfaces.IGuiIcon;
+import java.util.Arrays;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
-public enum GT_GuiIcon implements IGuiIcon{
- BUTTON_NORMAL (0, 0, 0),
- BUTTON_DOWN (0, 32, 0),
- BUTTON_HIGHLIGHT (0, 32*2, 0),
- BUTTON_HIGHLIGHT_DOWN (0, 32*3, 0),
- BUTTON_DISABLED (0, 32*4, 0),
-
- DISABLE (0, 0, 32),
- REDSTONE_OFF (0, 32, 32),
- REDSTONE_ON (0, 32*2, 32),
- CHECKMARK (0, 32*3, 32),
- CROSS (0, 32*4, 32),
- WHITELIST (0, 32*5, 32),
- BLACKLIST (0, 32*6, 32),
- PROGRESS (0, 32*7, 32),
-
- EXPORT (0, 0, 32*2),
- IMPORT (0, 32, 32*2),
- ALLOW_INPUT (0, 32*2, 32*2),
- BLOCK_INPUT (0, 32*3, 32*2),
- GREEN_ARROW_UP (0, 32*4, 32*2),
- GREEN_ARROW_DOWN (0, 32*5, 32*2),
- CYCLIC (0, 32*6, 32*2),
-
- SLOT_DARKGRAY (1, 176,0,18,18),
- SLOT_GRAY (1, 176,18,18,18),
-
- TAB_NORMAL (2, 0, 0,18,20),
- TAB_HIGHLIGHT (2, 18, 0,18,20),
- TAB_DISABLED (2, 18*2, 0,18,20),
- TAB_NORMAL_BRONZE (2, 0, 20,18,20),
- TAB_HIGHLIGHT_BRONZE (2, 18, 20,18,20),
- TAB_DISABLED_BRONZE (2, 18*2, 20,18,20),
- TAB_NORMAL_STEEL (2, 0,2*20,18,20),
- TAB_HIGHLIGHT_STEEL (2, 18,2*20,18,20),
- TAB_DISABLED_STEEL (2, 18*2,2*20,18,20),
- TAB_NORMAL_BRICK (2, 0,3*20,18,20),
- TAB_HIGHLIGHT_BRICK (2, 18,3*20,18,20),
- TAB_DISABLED_BRICK (2, 18*2,3*20,18,20),
- TAB_INFO_GRAY (2, 220, 0,18,20),
- TAB_INFO_BLUE (2,220+18, 0,18,20),
-;
-
+public enum GT_GuiIcon implements IGuiIcon {
+ BUTTON_NORMAL(0, 0, 0),
+ BUTTON_DOWN(0, 32, 0),
+ BUTTON_HIGHLIGHT(0, 32 * 2, 0),
+ BUTTON_HIGHLIGHT_DOWN(0, 32 * 3, 0),
+ BUTTON_DISABLED(0, 32 * 4, 0),
+
+ DISABLE(0, 0, 32),
+ REDSTONE_OFF(0, 32, 32),
+ REDSTONE_ON(0, 32 * 2, 32),
+ CHECKMARK(0, 32 * 3, 32),
+ CROSS(0, 32 * 4, 32),
+ WHITELIST(0, 32 * 5, 32),
+ BLACKLIST(0, 32 * 6, 32),
+ PROGRESS(0, 32 * 7, 32),
+
+ EXPORT(0, 0, 32 * 2),
+ IMPORT(0, 32, 32 * 2),
+ ALLOW_INPUT(0, 32 * 2, 32 * 2),
+ BLOCK_INPUT(0, 32 * 3, 32 * 2),
+ GREEN_ARROW_UP(0, 32 * 4, 32 * 2),
+ GREEN_ARROW_DOWN(0, 32 * 5, 32 * 2),
+ CYCLIC(0, 32 * 6, 32 * 2),
+
+ SLOT_DARKGRAY(1, 176, 0, 18, 18),
+ SLOT_GRAY(1, 176, 18, 18, 18),
+
+ TAB_NORMAL(2, 0, 0, 18, 20),
+ TAB_HIGHLIGHT(2, 18, 0, 18, 20),
+ TAB_DISABLED(2, 18 * 2, 0, 18, 20),
+ TAB_NORMAL_BRONZE(2, 0, 20, 18, 20),
+ TAB_HIGHLIGHT_BRONZE(2, 18, 20, 18, 20),
+ TAB_DISABLED_BRONZE(2, 18 * 2, 20, 18, 20),
+ TAB_NORMAL_STEEL(2, 0, 2 * 20, 18, 20),
+ TAB_HIGHLIGHT_STEEL(2, 18, 2 * 20, 18, 20),
+ TAB_DISABLED_STEEL(2, 18 * 2, 2 * 20, 18, 20),
+ TAB_NORMAL_BRICK(2, 0, 3 * 20, 18, 20),
+ TAB_HIGHLIGHT_BRICK(2, 18, 3 * 20, 18, 20),
+ TAB_DISABLED_BRICK(2, 18 * 2, 3 * 20, 18, 20),
+ TAB_INFO_GRAY(2, 220, 0, 18, 20),
+ TAB_INFO_BLUE(2, 220 + 18, 0, 18, 20),
+ ;
private static final int T_SIZE = 256;
private static ResourceLocation[] TEXTURES = {
- new ResourceLocation("gregtech", "textures/gui/GuiButtons.png"),
- new ResourceLocation("gregtech", "textures/gui/GuiCover.png"),
- new ResourceLocation("gregtech", "textures/gui/GuiTabs.png"),
+ new ResourceLocation("gregtech", "textures/gui/GuiButtons.png"),
+ new ResourceLocation("gregtech", "textures/gui/GuiCover.png"),
+ new ResourceLocation("gregtech", "textures/gui/GuiTabs.png"),
};
public final int x, y, width, height;
@@ -72,25 +70,34 @@ public enum GT_GuiIcon implements IGuiIcon{
}
GT_GuiIcon(int texID, int x, int y) {
- this(texID, x, y,32,32,null);
+ this(texID, x, y, 32, 32, null);
}
+
GT_GuiIcon(int texID, int x, int y, int width, int height) {
- this(texID, x, y, width, height,null);
+ this(texID, x, y, width, height, null);
}
- public static void render(IGuiIcon icon, double x, double y, double width, double height, double zLevel,
- boolean doDraw) {
+
+ public static void render(
+ IGuiIcon icon, double x, double y, double width, double height, double zLevel, boolean doDraw) {
render(icon, x, y, width, height, zLevel, doDraw, false);
}
- public static void render(IGuiIcon icon, double x, double y, double width, double height, double zLevel,
- boolean doDraw, boolean flipHoritontally) {
+ public static void render(
+ IGuiIcon icon,
+ double x,
+ double y,
+ double width,
+ double height,
+ double zLevel,
+ boolean doDraw,
+ boolean flipHoritontally) {
Tessellator tess = Tessellator.instance;
if (doDraw) {
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURES[icon.getTexId()]);
tess.startDrawingQuads();
}
double minU = (double) (icon.getX() + (flipHoritontally ? icon.getWidth() : 0)) / T_SIZE;
- double maxU = (double) (icon.getX() + (flipHoritontally ? 0: icon.getWidth())) / T_SIZE;
+ double maxU = (double) (icon.getX() + (flipHoritontally ? 0 : icon.getWidth())) / T_SIZE;
double minV = (double) icon.getY() / T_SIZE;
double maxV = (double) (icon.getY() + icon.getHeight()) / T_SIZE;
tess.addVertexWithUV(x, y + height, zLevel, minU, maxV);
@@ -98,11 +105,9 @@ public enum GT_GuiIcon implements IGuiIcon{
tess.addVertexWithUV(x + width, y + 0, zLevel, maxU, minV);
tess.addVertexWithUV(x, y + 0, zLevel, minU, minV);
- if (icon.getOverlay() != null)
- render(icon.getOverlay(), x, y, width, height, zLevel, false);
+ if (icon.getOverlay() != null) render(icon.getOverlay(), x, y, width, height, zLevel, false);
- if (doDraw)
- tess.draw();
+ if (doDraw) tess.draw();
}
/**
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 9de9b03df4..fd9a879902 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java
@@ -1,10 +1,10 @@
package gregtech.api.gui.widgets;
import gregtech.api.interfaces.IGuiScreen;
+import java.awt.Rectangle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import org.lwjgl.opengl.GL11;
-import java.awt.Rectangle;
public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElement {
public static final int DEFAULT_WIDTH = 16;
@@ -16,7 +16,6 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen
private GT_GuiTooltip tooltip;
-
public GT_GuiIconButton(IGuiScreen gui, int id, int x, int y, GT_GuiIcon icon) {
super(id, x, y, DEFAULT_WIDTH, DEFAULT_HEIGHT, "");
this.gui = gui;
@@ -28,8 +27,7 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen
@Override
public void onInit() {
- if (tooltip != null)
- gui.addToolTip(tooltip);
+ if (tooltip != null) gui.addToolTip(tooltip);
xPosition = x0 + gui.getGuiLeft();
yPosition = y0 + gui.getGuiTop();
}
@@ -41,12 +39,14 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
- if (this.tooltip != null)
- this.tooltip.enabled = true;
+ if (this.tooltip != null) this.tooltip.enabled = true;
if (this.visible) {
- //moused over
- this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + width && mouseY < this.yPosition + height;
+ // moused over
+ this.field_146123_n = mouseX >= this.xPosition
+ && mouseY >= this.yPosition
+ && mouseX < this.xPosition + width
+ && mouseY < this.yPosition + height;
mouseDragged(mc, mouseX, mouseY);
@@ -56,17 +56,15 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen
int x = xPosition;
int y = yPosition;
- if(!this.field_146123_n) {
- // GL11.glColor4f(200F/255F, 210F/255F, 1, 1);
- }
- else
- GL11.glColor4f(1, 1, 1, 1);
+ if (!this.field_146123_n) {
+ // GL11.glColor4f(200F/255F, 210F/255F, 1, 1);
+ } else GL11.glColor4f(1, 1, 1, 1);
GT_GuiIcon.render(getButtonTexture(this.field_146123_n), x, y, width, height, 0, true);
GL11.glColor4f(1, 1, 1, 1);
if (icon != null) {
- GT_GuiIcon.render(icon, x, y, width, height , 0, true);
+ GT_GuiIcon.render(icon, x, y, width, height, 0, true);
}
GL11.glPopAttrib();
@@ -76,13 +74,11 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen
@Override
public void mouseReleased(int mouseX, int mouseY) {
this.gui.clearSelectedButton();
- if(mousePressed(Minecraft.getMinecraft(), mouseX, mouseY))
- this.gui.buttonClicked(this);
+ if (mousePressed(Minecraft.getMinecraft(), mouseX, mouseY)) this.gui.buttonClicked(this);
}
public GT_GuiIcon getButtonTexture(boolean mouseOver) {
- if (!enabled)
- return GT_GuiIcon.BUTTON_DISABLED;
+ if (!enabled) return GT_GuiIcon.BUTTON_DISABLED;
if (this.equals(this.gui.getSelectedButton()))
return mouseOver ? GT_GuiIcon.BUTTON_HIGHLIGHT_DOWN : GT_GuiIcon.BUTTON_DOWN;
@@ -92,6 +88,7 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen
public GT_GuiIcon getIcon() {
return icon;
}
+
public GT_GuiIconButton setIcon(GT_GuiIcon icon) {
this.icon = icon;
return this;
@@ -102,10 +99,8 @@ public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElemen
}
public GT_GuiIconButton setTooltipText(String... text) {
- if (tooltip == null)
- tooltip = new GT_GuiTooltip(getBounds(), text);
- else
- tooltip.setToolTipText(text);
+ if (tooltip == null) tooltip = new GT_GuiTooltip(getBounds(), text);
+ else tooltip.setToolTipText(text);
return this;
}
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java
index e7b6b9971d..113b19711b 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconCheckButton.java
@@ -13,7 +13,15 @@ public class GT_GuiIconCheckButton extends GT_GuiIconButton {
this(gui, id, x, y, checkedIcon, normalIcon, null, null);
}
- public GT_GuiIconCheckButton(IGuiScreen gui, int id, int x, int y, GT_GuiIcon checkedIcon, GT_GuiIcon normalIcon, String checkedTooltip, String normalTooltip) {
+ public GT_GuiIconCheckButton(
+ IGuiScreen gui,
+ int id,
+ int x,
+ int y,
+ GT_GuiIcon checkedIcon,
+ GT_GuiIcon normalIcon,
+ String checkedTooltip,
+ String normalTooltip) {
super(gui, id, x, y, normalIcon);
this.checkedIcon = checkedIcon;
this.normalIcon = normalIcon;
@@ -23,8 +31,7 @@ public class GT_GuiIconCheckButton extends GT_GuiIconButton {
@Override
public GT_GuiIcon getButtonTexture(boolean mouseOver) {
- if (!enabled)
- return GT_GuiIcon.BUTTON_DISABLED;
+ if (!enabled) return GT_GuiIcon.BUTTON_DISABLED;
if (this.equals(super.gui.getSelectedButton()))
return mouseOver ? GT_GuiIcon.BUTTON_HIGHLIGHT_DOWN : GT_GuiIcon.BUTTON_DOWN;
return mouseOver ? GT_GuiIcon.BUTTON_HIGHLIGHT : GT_GuiIcon.BUTTON_NORMAL;
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 e2ba53e4c9..3e2ac1e296 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIntegerTextBox.java
@@ -1,11 +1,10 @@
package gregtech.api.gui.widgets;
import gregtech.api.interfaces.IGuiScreen;
+import java.awt.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiTextField;
-import java.awt.*;
-
public class GT_GuiIntegerTextBox extends GuiTextField implements IGuiScreen.IGuiElement {
private final int x0, y0;
private final IGuiScreen gui;
@@ -44,7 +43,17 @@ public class GT_GuiIntegerTextBox extends GuiTextField implements IGuiScreen.IGu
@Override
public boolean textboxKeyTyped(char c, int key) {
- if (validChar(c, key) || c == 1 || c == 3 || c == 22 || c == 24 || key == 14 || key == 199 || key == 203 || key == 205 || key == 207 || key == 211) {
+ if (validChar(c, key)
+ || c == 1
+ || c == 3
+ || c == 22
+ || c == 24
+ || key == 14
+ || key == 199
+ || key == 203
+ || key == 205
+ || key == 207
+ || key == 211) {
return super.textboxKeyTyped(c, key);
}
return false;
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java
index 1fb25ecb1a..105e919149 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiSlotTooltip.java
@@ -1,8 +1,7 @@
package gregtech.api.gui.widgets;
-import java.awt.Rectangle;
-
import gregtech.api.util.GT_TooltipDataCache.TooltipData;
+import java.awt.Rectangle;
import net.minecraft.inventory.Slot;
public class GT_GuiSlotTooltip extends GT_GuiTooltip {
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java
index d4f7df6d2c..2bb28fb929 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiSmartTooltip.java
@@ -1,13 +1,13 @@
package gregtech.api.gui.widgets;
+import gregtech.api.util.GT_TooltipDataCache.TooltipData;
import java.awt.Rectangle;
-import gregtech.api.util.GT_TooltipDataCache.TooltipData;
+public class GT_GuiSmartTooltip extends GT_GuiTooltip {
+ public interface TooltipVisibilityProvider {
+ boolean shouldShowTooltip();
+ }
-public class GT_GuiSmartTooltip extends GT_GuiTooltip{
- public interface TooltipVisibilityProvider {
- boolean shouldShowTooltip();
- }
private final TooltipVisibilityProvider visibilityProvider;
public GT_GuiSmartTooltip(Rectangle bounds, TooltipVisibilityProvider visibilityProvider, TooltipData data) {
@@ -21,5 +21,4 @@ public class GT_GuiSmartTooltip extends GT_GuiTooltip{
// If disabled by super, stay disabled.
this.enabled = this.enabled && this.visibilityProvider.shouldShowTooltip();
}
-
}
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 60672db880..1bb2f6dbb7 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTab.java
@@ -1,16 +1,14 @@
package gregtech.api.gui.widgets;
-import java.awt.Rectangle;
-
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL12;
-
import gregtech.api.gui.widgets.GT_GuiTabLine.GT_GuiTabIconSet;
import gregtech.api.gui.widgets.GT_GuiTabLine.GT_ITabRenderer;
import gregtech.api.interfaces.IGuiIcon;
+import java.awt.Rectangle;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
/**
* A tab to be attached to a tab line
@@ -18,10 +16,7 @@ import net.minecraft.item.ItemStack;
public class GT_GuiTab {
private static final int SLOT_SIZE = 18;
- public boolean
- visible = true,
- mousedOver,
- enabled = true;
+ public boolean visible = true, mousedOver, enabled = true;
private Rectangle bounds;
private GT_GuiTabIconSet tabBackground;
@@ -33,7 +28,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 bounds bounds of this tab
@@ -43,8 +38,15 @@ public class GT_GuiTab {
* @param tooltipText tooltip of this tab
* @param flipHorizontally whether to draw this tab on the right side of the IGregTechTileEntity
*/
- public GT_GuiTab( GT_ITabRenderer gui, int id, Rectangle bounds, GT_GuiTabIconSet tabBackground, ItemStack item,
- IGuiIcon overlay, String[] tooltipText, boolean flipHorizontally) {
+ public GT_GuiTab(
+ GT_ITabRenderer gui,
+ int id,
+ Rectangle bounds,
+ GT_GuiTabIconSet tabBackground,
+ ItemStack item,
+ IGuiIcon overlay,
+ String[] tooltipText,
+ boolean flipHorizontally) {
this.gui = gui;
this.bounds = bounds;
this.item = item;
@@ -56,13 +58,13 @@ public class GT_GuiTab {
this.flipHorizontally = flipHorizontally;
}
- public GT_GuiTab( GT_ITabRenderer gui, int id, Rectangle bounds, GT_GuiTabIconSet tabBackground) {
+ public GT_GuiTab(GT_ITabRenderer gui, int id, Rectangle bounds, GT_GuiTabIconSet tabBackground) {
this(gui, id, bounds, tabBackground, null, null, null, false);
}
/**
* Set this tab's tooltip text
- *
+ *
* @param text
* @return This tab for chaining
*/
@@ -70,8 +72,7 @@ public class GT_GuiTab {
if (tooltip == null) {
tooltip = new GT_GuiTooltip(bounds, text);
gui.addToolTip(tooltip);
- }
- else {
+ } else {
tooltip.setToolTipText(text);
}
return this;
@@ -86,21 +87,28 @@ public class GT_GuiTab {
/**
* Draw the background texture for this tab
- *
+ *
* @param mouseX
* @param mouseY
* @param parTicks
*/
public void drawBackground(int mouseX, int mouseY, float parTicks) {
if (this.visible) {
- GT_GuiIcon.render(getBackgroundTexture(), bounds.x, bounds.y, bounds.width, bounds.height, 1, true,
- this.flipHorizontally);
+ GT_GuiIcon.render(
+ getBackgroundTexture(),
+ bounds.x,
+ bounds.y,
+ bounds.width,
+ bounds.height,
+ 1,
+ true,
+ this.flipHorizontally);
}
}
/**
* Draw overlay textures and items atop the background texture
- *
+ *
* @param mouseX
* @param mouseY
* @param parTicks
@@ -119,19 +127,22 @@ public class GT_GuiTab {
}
if (item != null) {
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
-
+
if (item.getItem() instanceof ItemBlock) {
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
}
int margin = (bounds.height - SLOT_SIZE);
- gui.getItemRende