Skip to content

Commit 2fc859a

Browse files
who pronounces it as gooey
1 parent 4797346 commit 2fc859a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+6899
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
//Deobfuscated with https://github.com/SimplyProgrammer/Minecraft-Deobfuscator3000 using mappings "C:\Users\u1\Documents\Java Decompiler\1.12 stable mappings"!
2+
3+
//Decompiled by Procyon!
4+
5+
package com.veteran.hack.gui;
6+
7+
import com.veteran.hack.util.*;
8+
import com.veteran.hack.*;
9+
import org.lwjgl.opengl.*;
10+
import com.veteran.hack.gui.rgui.component.*;
11+
import com.veteran.hack.gui.rgui.component.container.use.*;
12+
import net.minecraft.client.renderer.*;
13+
import com.veteran.hack.gui.rgui.component.listen.*;
14+
import java.util.function.*;
15+
import com.veteran.hack.gui.kami.*;
16+
import java.util.*;
17+
18+
public class UIRenderer
19+
{
20+
public static void renderAndUpdateFrames() {
21+
if (Wrapper.getMinecraft().currentScreen instanceof DisplayGuiScreen || Wrapper.getMinecraft().gameSettings.showDebugInfo) {
22+
return;
23+
}
24+
final KamiGUI gui = BaseMod.getInstance().getGuiManager();
25+
GL11.glDisable(3553);
26+
for (final Component c : gui.getChildren()) {
27+
if (c instanceof Frame) {
28+
GlStateManager.pushMatrix();
29+
final Frame child = (Frame)c;
30+
if (child.isPinned() && child.isVisible()) {
31+
final boolean slide = child.getOpacity() != 0.0f;
32+
GL11.glTranslated((double)child.getX(), (double)child.getY(), 0.0);
33+
child.getRenderListeners().forEach(renderListener -> renderListener.onPreRender());
34+
child.getTheme().getUIForComponent((Component)child).renderComponent((Component)child, child.getTheme().getFontRenderer());
35+
int translateX = 0;
36+
int translateY = 0;
37+
if (slide) {
38+
translateX += child.getOriginOffsetX();
39+
translateY += child.getOriginOffsetY();
40+
}
41+
else {
42+
if (child.getDocking().isBottom()) {
43+
translateY += child.getOriginOffsetY();
44+
}
45+
if (child.getDocking().isRight()) {
46+
translateX += child.getOriginOffsetX();
47+
if (child.getChildren().size() > 0) {
48+
translateX += (child.getWidth() - child.getChildren().get(0).getX() - child.getChildren().get(0).getWidth()) / DisplayGuiScreen.getScale();
49+
}
50+
}
51+
if (child.getDocking().isLeft() && child.getChildren().size() > 0) {
52+
translateX -= child.getChildren().get(0).getX();
53+
}
54+
if (child.getDocking().isTop() && child.getChildren().size() > 0) {
55+
translateY -= child.getChildren().get(0).getY();
56+
}
57+
}
58+
GL11.glTranslated((double)translateX, (double)translateY, 0.0);
59+
child.getRenderListeners().forEach(RenderListener::onPostRender);
60+
child.renderChildren();
61+
GL11.glTranslated((double)(-translateX), (double)(-translateY), 0.0);
62+
GL11.glTranslated((double)(-child.getX()), (double)(-child.getY()), 0.0);
63+
}
64+
GlStateManager.popMatrix();
65+
}
66+
}
67+
GL11.glEnable(3553);
68+
GL11.glEnable(3042);
69+
GlStateManager.enableBlend();
70+
}
71+
}
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
//Deobfuscated with https://github.com/SimplyProgrammer/Minecraft-Deobfuscator3000 using mappings "C:\Users\u1\Documents\Java Decompiler\1.12 stable mappings"!
2+
3+
//Decompiled by Procyon!
4+
5+
package com.veteran.hack.gui.font;
6+
7+
import net.minecraft.client.renderer.texture.*;
8+
import java.awt.image.*;
9+
import java.awt.*;
10+
import java.awt.geom.*;
11+
import org.lwjgl.opengl.*;
12+
13+
public class CFont
14+
{
15+
private float imgSize;
16+
protected CharData[] charData;
17+
protected Font font;
18+
protected boolean antiAlias;
19+
protected boolean fractionalMetrics;
20+
protected int fontHeight;
21+
protected int charOffset;
22+
protected DynamicTexture tex;
23+
24+
public CFont(final Font font, final boolean antiAlias, final boolean fractionalMetrics) {
25+
this.imgSize = 512.0f;
26+
this.charData = new CharData[256];
27+
this.fontHeight = -1;
28+
this.charOffset = 0;
29+
this.font = font;
30+
this.antiAlias = antiAlias;
31+
this.fractionalMetrics = fractionalMetrics;
32+
this.tex = this.setupTexture(font, antiAlias, fractionalMetrics, this.charData);
33+
}
34+
35+
protected DynamicTexture setupTexture(final Font font, final boolean antiAlias, final boolean fractionalMetrics, final CharData[] chars) {
36+
final BufferedImage img = this.generateFontImage(font, antiAlias, fractionalMetrics, chars);
37+
try {
38+
return new DynamicTexture(img);
39+
}
40+
catch (Exception e) {
41+
e.printStackTrace();
42+
return null;
43+
}
44+
}
45+
46+
protected BufferedImage generateFontImage(final Font font, final boolean antiAlias, final boolean fractionalMetrics, final CharData[] chars) {
47+
final int imgSize = (int)this.imgSize;
48+
final BufferedImage bufferedImage = new BufferedImage(imgSize, imgSize, 2);
49+
final Graphics2D g = (Graphics2D)bufferedImage.getGraphics();
50+
g.setFont(font);
51+
g.setColor(new Color(255, 255, 255, 0));
52+
g.fillRect(0, 0, imgSize, imgSize);
53+
g.setColor(Color.WHITE);
54+
g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, fractionalMetrics ? RenderingHints.VALUE_FRACTIONALMETRICS_ON : RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
55+
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, antiAlias ? RenderingHints.VALUE_TEXT_ANTIALIAS_ON : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
56+
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antiAlias ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
57+
final FontMetrics fontMetrics = g.getFontMetrics();
58+
int charHeight = 0;
59+
int positionX = 0;
60+
int positionY = 1;
61+
for (int i = 0; i < chars.length; ++i) {
62+
final char ch = (char)i;
63+
final CharData charData = new CharData();
64+
final Rectangle2D dimensions = fontMetrics.getStringBounds(String.valueOf(ch), g);
65+
charData.width = dimensions.getBounds().width + 8;
66+
charData.height = dimensions.getBounds().height;
67+
if (positionX + charData.width >= imgSize) {
68+
positionX = 0;
69+
positionY += charHeight;
70+
charHeight = 0;
71+
}
72+
if (charData.height > charHeight) {
73+
charHeight = charData.height;
74+
}
75+
charData.storedX = positionX;
76+
charData.storedY = positionY;
77+
if (charData.height > this.fontHeight) {
78+
this.fontHeight = charData.height;
79+
}
80+
chars[i] = charData;
81+
g.drawString(String.valueOf(ch), positionX + 2, positionY + fontMetrics.getAscent());
82+
positionX += charData.width;
83+
}
84+
return bufferedImage;
85+
}
86+
87+
public void drawChar(final CharData[] chars, final char c, final float x, final float y) throws ArrayIndexOutOfBoundsException {
88+
try {
89+
this.drawQuad(x, y, (float)chars[c].width, (float)chars[c].height, (float)chars[c].storedX, (float)chars[c].storedY, (float)chars[c].width, (float)chars[c].height);
90+
}
91+
catch (Exception e) {
92+
e.printStackTrace();
93+
}
94+
}
95+
96+
protected void drawQuad(final float x, final float y, final float width, final float height, final float srcX, final float srcY, final float srcWidth, final float srcHeight) {
97+
final float renderSRCX = srcX / this.imgSize;
98+
final float renderSRCY = srcY / this.imgSize;
99+
final float renderSRCWidth = srcWidth / this.imgSize;
100+
final float renderSRCHeight = srcHeight / this.imgSize;
101+
GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY);
102+
GL11.glVertex2d((double)(x + width), (double)y);
103+
GL11.glTexCoord2f(renderSRCX, renderSRCY);
104+
GL11.glVertex2d((double)x, (double)y);
105+
GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight);
106+
GL11.glVertex2d((double)x, (double)(y + height));
107+
GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight);
108+
GL11.glVertex2d((double)x, (double)(y + height));
109+
GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY + renderSRCHeight);
110+
GL11.glVertex2d((double)(x + width), (double)(y + height));
111+
GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY);
112+
GL11.glVertex2d((double)(x + width), (double)y);
113+
}
114+
115+
public int getStringHeight(final String text) {
116+
return this.getHeight();
117+
}
118+
119+
public int getHeight() {
120+
return (this.fontHeight - 8) / 2;
121+
}
122+
123+
public int getStringWidth(final String text) {
124+
int width = 0;
125+
for (final char c : text.toCharArray()) {
126+
if (c < this.charData.length && c >= '\0') {
127+
width += this.charData[c].width - 8 + this.charOffset;
128+
}
129+
}
130+
return width / 2;
131+
}
132+
133+
public boolean isAntiAlias() {
134+
return this.antiAlias;
135+
}
136+
137+
public void setAntiAlias(final boolean antiAlias) {
138+
if (this.antiAlias != antiAlias) {
139+
this.antiAlias = antiAlias;
140+
this.tex = this.setupTexture(this.font, antiAlias, this.fractionalMetrics, this.charData);
141+
}
142+
}
143+
144+
public boolean isFractionalMetrics() {
145+
return this.fractionalMetrics;
146+
}
147+
148+
public void setFractionalMetrics(final boolean fractionalMetrics) {
149+
if (this.fractionalMetrics != fractionalMetrics) {
150+
this.fractionalMetrics = fractionalMetrics;
151+
this.tex = this.setupTexture(this.font, this.antiAlias, fractionalMetrics, this.charData);
152+
}
153+
}
154+
155+
public Font getFont() {
156+
return this.font;
157+
}
158+
159+
public void setFont(final Font font) {
160+
this.font = font;
161+
this.tex = this.setupTexture(font, this.antiAlias, this.fractionalMetrics, this.charData);
162+
}
163+
164+
protected class CharData
165+
{
166+
public int width;
167+
public int height;
168+
public int storedX;
169+
public int storedY;
170+
}
171+
}

0 commit comments

Comments
 (0)