diff --git a/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLabel.java b/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLabel.java index 7ab9f2d64..e17ad09d4 100644 --- a/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLabel.java +++ b/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLabel.java @@ -40,6 +40,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent { int color; float alpha; + float rotation; protected int field_146167_a; protected int field_146161_f; @@ -144,6 +145,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent { lbl.labelShadowEnabled = component.hasShadow(); lbl.color = component.getColor(); lbl.alpha = component.getAlpha(); + lbl.rotation = component.getRotation(); return lbl; } @@ -154,6 +156,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent { component.enableShadow(this.labelShadowEnabled); component.setColor(this.color); component.setAlpha(this.alpha); + component.setRotation(this.rotation); return component; } @@ -165,6 +168,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent { blue = (color & 255) / 255f; GL11.glTranslatef(this.x,this.y,0.0F); + GL11.glRotated(rotation,0.0D,0.0D,1.0D); GL11.glScalef(this.scale, this.scale, this.scale); this.drawString(fullLabel, 0, 0, this.color, this.labelShadowEnabled); GL11.glPopMatrix(); diff --git a/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLine.java b/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLine.java index b4948aa6a..5a1b2804e 100644 --- a/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLine.java +++ b/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLine.java @@ -21,14 +21,15 @@ public class CustomGuiLine extends Gui implements IGuiComponent { int y2; int color; float alpha; + float rotation; int thickness; public CustomGuiLine(int id, int x1, int y1, int x2, int y2, int color, int thickness){ this.id = id; - this.x1 = GuiCustom.guiLeft + x1; - this.y1 = GuiCustom.guiTop + y1; - this.x2 = GuiCustom.guiLeft + x2; - this.y2 = GuiCustom.guiTop + y2; + this.x1 = x1; + this.y1 = y1; + this.x2 = x2; + this.y2 = y2; this.color = color; this.thickness = thickness; } @@ -52,8 +53,9 @@ public class CustomGuiLine extends Gui implements IGuiComponent { float blue = (color & 255) / 255f; GL11.glColor4f(red,green,blue,this.alpha); - GL11.glTranslatef(this.x1,this.y1,0.0F); + GL11.glTranslatef(GuiCustom.guiLeft+this.x1,GuiCustom.guiTop+this.y1,0.0F); GL11.glRotated(-Math.toDegrees(Math.atan2(x2-x1,y2-y1)),0.0F,0.0F,1.0F); + GL11.glRotated(rotation,0.0D,0.0D,1.0D); GL11.glScaled(thickness, distance,0.0D); this.drawTexturedModalRect(0,0,0,0, 1, 1); GL11.glPopMatrix(); @@ -63,6 +65,7 @@ public class CustomGuiLine extends Gui implements IGuiComponent { ScriptGuiLine line = new ScriptGuiLine(this.id, this.x1,this.y1,this.x2,this.y2,this.color,this.thickness); line.setColor(this.color); line.setAlpha(this.alpha); + line.setRotation(this.rotation); return line; } @@ -70,6 +73,7 @@ public class CustomGuiLine extends Gui implements IGuiComponent { CustomGuiLine line = new CustomGuiLine(component.getID(), component.getX1(), component.getY1(), component.getX2(), component.getY2(), component.getColor(), component.getThickness()); line.color = component.getColor(); line.alpha = component.getAlpha(); + line.rotation = component.getRotation(); return line; } } diff --git a/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiTexturedRect.java b/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiTexturedRect.java index b17939da4..4be936f3c 100644 --- a/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiTexturedRect.java +++ b/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiTexturedRect.java @@ -38,6 +38,7 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent { int color; float alpha; + float rotation; public CustomGuiTexturedRect(int id, String texture, int x, int y, int width, int height) { this(id, texture, x, y, width, height, 0, 0); @@ -47,8 +48,8 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent { this.scale = 1.0F; this.id = id; this.texture = new ResourceLocation(texture); - this.x = GuiCustom.guiLeft + x; - this.y = GuiCustom.guiTop + y; + this.x = x; + this.y = y; this.width = width; this.height = height; this.textureX = textureX; @@ -80,7 +81,28 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent { GL11.glColor4f(red,green,blue,this.alpha); GL11.glScalef(this.scale, this.scale, this.scale); - this.drawTexturedModalRect((int) (this.x/this.scale), (int) (this.y/this.scale), this.textureX, this.textureY, (int)(this.width), (int)(this.height)); + + GL11.glTranslatef(GuiCustom.guiLeft,GuiCustom.guiTop,0.0F); + GL11.glRotatef(this.rotation,0.0F,0.0F,1.0F); + + int p_73729_1_ = (int) (this.x/this.scale); + int p_73729_2_ = (int) (this.y/this.scale); + int p_73729_3_ = this.textureX; + int p_73729_4_ = this.textureY; + int p_73729_5_ = (int)(this.width); + int p_73729_6_ = (int)(this.height); + + float f = 0.00390625F; + float f1 = 0.00390625F; + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setColorOpaque_F(1, 1, 1); + tessellator.setColorRGBA_F(red, green, blue, alpha); + tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1)); + tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1)); + tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + 0) * f1)); + tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + 0) * f1)); + tessellator.draw(); GL11.glPopMatrix(); if (hovered && this.hoverText != null && this.hoverText.length > 0) { @@ -94,6 +116,7 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent { component.setScale(this.scale); component.setColor(color); component.setAlpha(alpha); + component.setRotation(rotation); return component; } @@ -112,6 +135,7 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent { rect.color = component.getColor(); rect.alpha = component.getAlpha(); + rect.rotation = component.getRotation(); return rect; } diff --git a/src/main/java/noppes/npcs/client/gui/customoverlay/components/CustomOverlayLabel.java b/src/main/java/noppes/npcs/client/gui/customoverlay/components/CustomOverlayLabel.java index 741ee9ed9..ec7212a2a 100644 --- a/src/main/java/noppes/npcs/client/gui/customoverlay/components/CustomOverlayLabel.java +++ b/src/main/java/noppes/npcs/client/gui/customoverlay/components/CustomOverlayLabel.java @@ -4,12 +4,9 @@ import com.ibm.icu.text.ArabicShaping; import com.ibm.icu.text.ArabicShapingException; import com.ibm.icu.text.Bidi; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.ResourceLocation; -import noppes.npcs.client.gui.custom.GuiCustom; import noppes.npcs.client.gui.customoverlay.OverlayCustom; import noppes.npcs.client.gui.customoverlay.interfaces.IOverlayComponent; import noppes.npcs.scripted.interfaces.ICustomOverlayComponent; @@ -20,10 +17,6 @@ import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; -import java.util.ArrayList; - -import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA; -import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA; public class CustomOverlayLabel extends Gui implements IOverlayComponent { OverlayCustom parent; diff --git a/src/main/java/noppes/npcs/scripted/gui/ScriptGuiComponent.java b/src/main/java/noppes/npcs/scripted/gui/ScriptGuiComponent.java index 68158b762..7d7f8d405 100644 --- a/src/main/java/noppes/npcs/scripted/gui/ScriptGuiComponent.java +++ b/src/main/java/noppes/npcs/scripted/gui/ScriptGuiComponent.java @@ -14,6 +14,7 @@ public abstract class ScriptGuiComponent implements ICustomGuiComponent { int color = 0xFFFFFF; float alpha = 1.0F; + float rotation = 0; public ScriptGuiComponent() { } @@ -76,6 +77,14 @@ public abstract class ScriptGuiComponent implements ICustomGuiComponent { this.alpha = alpha; } + public float getRotation() { + return rotation; + } + + public void setRotation(float rotation) { + this.rotation = rotation; + } + public abstract int getType(); public NBTTagCompound toNBT(NBTTagCompound nbt) { @@ -83,6 +92,7 @@ public abstract class ScriptGuiComponent implements ICustomGuiComponent { nbt.setIntArray("pos", new int[]{this.posX, this.posY}); nbt.setInteger("color", this.color); nbt.setFloat("alpha",this.alpha); + nbt.setFloat("rotation",this.rotation); if (this.hoverText != null) { NBTTagList list = new NBTTagList(); String[] var3 = this.hoverText; @@ -109,6 +119,7 @@ public abstract class ScriptGuiComponent implements ICustomGuiComponent { this.setPos(nbt.getIntArray("pos")[0], nbt.getIntArray("pos")[1]); this.setColor(nbt.getInteger("color")); this.setAlpha(nbt.getFloat("alpha")); + this.setRotation(nbt.getFloat("rotation")); if (nbt.hasKey("hover")) { NBTTagList list = nbt.getTagList("hover", 8); String[] hoverText = new String[list.tagCount()];