Auto Format code

This commit is contained in:
modmuss50 2016-10-08 20:46:16 +01:00
parent 112b1657cf
commit 796df6c055
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
503 changed files with 12260 additions and 16291 deletions

View file

@ -1,22 +1,19 @@
package techreborn.manual.util;
import java.util.List;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
@SideOnly(Side.CLIENT)
public class ButtonUtil
{
public class ButtonUtil {
@SideOnly(Side.CLIENT)
public static void addBackButton(int ID, int X, int Y, List buttonList)
{
public static void addBackButton(int ID, int X, int Y, List buttonList) {
buttonList.add(new GuiButtonCustomTexture(ID, X, Y, 50, 60, 17, 12, "button", "", "", 0, 11, 10, 16));
}
@SideOnly(Side.CLIENT)
public static void addNextButton(int ID, int X, int Y, List buttonList)
{
public static void addNextButton(int ID, int X, int Y, List buttonList) {
buttonList.add(new GuiButtonCustomTexture(ID, X, Y, 50, 60, 17, 12, "button", "", "", 0, 1, 10, 17));
}
}

View file

@ -4,27 +4,22 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL11;
public class GuiButtonAHeight extends GuiButton
{
public class GuiButtonAHeight extends GuiButton {
public GuiButtonAHeight(int id, int xPos, int yPos, int width, int hight, String displayString)
{
public GuiButtonAHeight(int id, int xPos, int yPos, int width, int hight, String displayString) {
super(id, xPos, yPos, width, hight, displayString);
}
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY)
{
if (this.visible)
{
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible) {
FontRenderer fontrenderer = minecraft.fontRendererObj;
minecraft.getTextureManager().bindTexture(BUTTON_TEXTURES);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
&& mouseY < this.yPosition + this.height;
int k = this.getHoverState(this.hovered);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
@ -32,31 +27,27 @@ public class GuiButtonAHeight extends GuiButton
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2,
46 + k * 20, this.width / 2, this.height);
46 + k * 20, this.width / 2, this.height);
if (this.height < 20)
{
if (this.height < 20) {
this.drawTexturedModalRect(xPosition, yPosition + 3, 0, (46 + k * 20) + 20 - height + 3, width / 2,
height - 3);
height - 3);
this.drawTexturedModalRect(xPosition + width / 2, yPosition + 3, 200 - width / 2,
(46 + k * 20) + 20 - height + 3, width / 2, height - 3);
(46 + k * 20) + 20 - height + 3, width / 2, height - 3);
}
this.mouseDragged(minecraft, mouseX, mouseY);
int l = 14737632;
if (packedFGColour != 0)
{
if (packedFGColour != 0) {
l = packedFGColour;
} else if (!this.enabled)
{
} else if (!this.enabled) {
l = 10526880;
} else if (this.hovered)
{
} else if (this.hovered) {
l = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2,
this.yPosition + (this.height - 8) / 2, l);
this.yPosition + (this.height - 8) / 2, l);
}
}
}

View file

@ -1,17 +1,15 @@
package techreborn.manual.util;
import java.awt.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.config.GuiButtonExt;
import org.lwjgl.opengl.GL11;
public class GuiButtonCustomTexture extends GuiButtonExt
{
import java.awt.*;
public class GuiButtonCustomTexture extends GuiButtonExt {
public int textureU;
public int textureV;
public String texturename;
@ -26,8 +24,7 @@ public class GuiButtonCustomTexture extends GuiButtonExt
public int textureW;
public GuiButtonCustomTexture(int id, int xPos, int yPos, int u, int v, int buttonWidth, int buttonHeight,
String texturename, String linkedPage, String name, int buttonU, int buttonV, int textureH, int textureW)
{
String texturename, String linkedPage, String name, int buttonU, int buttonV, int textureH, int textureW) {
super(id, xPos, yPos, buttonWidth, buttonHeight, "_");
this.textureU = u;
this.textureV = v;
@ -42,18 +39,15 @@ public class GuiButtonCustomTexture extends GuiButtonExt
this.textureW = textureW;
}
public void drawButton(Minecraft mc, int mouseX, int mouseY)
{
if (this.visible)
{
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
&& mouseY < this.yPosition + this.height;
mc.getTextureManager().bindTexture(BUTTON_TEXTURES);
int u = textureU;
int v = textureV;
if (flag)
{
if (flag) {
u += width;
GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f);
@ -66,12 +60,11 @@ public class GuiButtonCustomTexture extends GuiButtonExt
RenderHelper.enableGUIStandardItemLighting();
renderImage(this.xPosition, this.yPosition);
this.drawString(mc.fontRendererObj, this.NAME, this.xPosition + 20, this.yPosition + 3,
Color.white.getRGB());
Color.white.getRGB());
}
}
public void renderImage(int offsetX, int offsetY)
{
public void renderImage(int offsetX, int offsetY) {
TextureManager render = Minecraft.getMinecraft().renderEngine;
render.bindTexture(new ResourceLocation(imageprefix + this.texturename + ".png"));
@ -82,8 +75,7 @@ public class GuiButtonCustomTexture extends GuiButtonExt
GL11.glDisable(GL11.GL_BLEND);
}
public boolean getIsHovering()
{
public boolean getIsHovering() {
return hovered;
}
}

View file

@ -9,8 +9,7 @@ import org.lwjgl.opengl.GL11;
import java.awt.*;
public class GuiButtonItemTexture extends GuiButtonExt
{
public class GuiButtonItemTexture extends GuiButtonExt {
public int textureU;
public int textureV;
@ -19,8 +18,7 @@ public class GuiButtonItemTexture extends GuiButtonExt
public String NAME;
public GuiButtonItemTexture(int id, int xPos, int yPos, int u, int v, int width, int height, ItemStack stack,
String linkedPage, String name)
{
String linkedPage, String name) {
super(id, xPos, yPos, width, height, "_");
textureU = u;
textureV = v;
@ -29,17 +27,14 @@ public class GuiButtonItemTexture extends GuiButtonExt
this.LINKED_PAGE = linkedPage;
}
public void drawButton(Minecraft mc, int mouseX, int mouseY)
{
if (this.visible)
{
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
&& mouseY < this.yPosition + this.height;
mc.getTextureManager().bindTexture(BUTTON_TEXTURES);
int u = textureU;
int v = textureV;
if (flag)
{
if (flag) {
u += mc.fontRendererObj.getStringWidth(this.NAME) + 25;
v += mc.fontRendererObj.getStringWidth(this.NAME) + 25;
GL11.glPushMatrix();
@ -54,12 +49,11 @@ public class GuiButtonItemTexture extends GuiButtonExt
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
itemRenderer.renderItemIntoGUI(itemstack, this.xPosition, this.yPosition);
this.drawString(mc.fontRendererObj, this.NAME, this.xPosition + 20, this.yPosition + 3,
Color.white.getRGB());
Color.white.getRGB());
}
}
public boolean getIsHovering()
{
public boolean getIsHovering() {
return hovered;
}

View file

@ -1,38 +1,33 @@
package techreborn.manual.util;
import java.awt.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.opengl.GL11;
public class GuiButtonTextOnly extends GuiButton
{
import java.awt.*;
public class GuiButtonTextOnly extends GuiButton {
public String LINKED_PAGE;
public int textColour;
public GuiButtonTextOnly(int id, int xPos, int yPos, int width, int hight, String displayString, String linkedPage,
int colour)
{
int colour) {
super(id, xPos, yPos, width, hight, displayString);
this.LINKED_PAGE = linkedPage;
this.textColour = colour;
}
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY)
{
if (this.visible)
{
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible) {
FontRenderer fontrenderer = minecraft.fontRendererObj;
minecraft.getTextureManager().bindTexture(BUTTON_TEXTURES);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
&& mouseY < this.yPosition + this.height;
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@ -40,11 +35,9 @@ public class GuiButtonTextOnly extends GuiButton
this.mouseDragged(minecraft, mouseX, mouseY);
String trimmedDisplayString = displayString;
if (fontrenderer.getStringWidth(displayString) > width + 30 && !this.hovered)
{
if (fontrenderer.getStringWidth(displayString) > width + 30 && !this.hovered) {
int energencyBreak = 0;
while (fontrenderer.getStringWidth(trimmedDisplayString) * 0.7 > width - 5)
{
while (fontrenderer.getStringWidth(trimmedDisplayString) * 0.7 > width - 5) {
trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length() - 1);
energencyBreak++;
if (energencyBreak > 100)
@ -53,25 +46,23 @@ public class GuiButtonTextOnly extends GuiButton
trimmedDisplayString += "...";
}
if (this.hovered)
{
if (this.hovered) {
trimmedDisplayString = TextFormatting.BOLD + "" + TextFormatting.ITALIC + trimmedDisplayString;
GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f);
drawTexturedModalRect(xPosition + (int) (xPosition * 0.01), yPosition + (int) (yPosition * 0.01), 0, 46,
(int) (fontrenderer.getStringWidth(trimmedDisplayString) * 0.72) + 2, 8);
(int) (fontrenderer.getStringWidth(trimmedDisplayString) * 0.72) + 2, 8);
GL11.glPopMatrix();
}
GL11.glPushMatrix();
GL11.glScalef(0.7F, 0.7F, 1);
fontrenderer.drawString(trimmedDisplayString, (int) (xPosition * 1.45),
(int) ((yPosition + (height - 8) / 2) * 1.45), Color.WHITE.getRGB());
(int) ((yPosition + (height - 8) / 2) * 1.45), Color.WHITE.getRGB());
GL11.glPopMatrix();
}
}
public boolean getIsHovering()
{
public boolean getIsHovering() {
return hovered;
}
}