aboutsummaryrefslogtreecommitdiff
path: root/me/Danker/handlers/TextRenderer.java
blob: bf5711d053fbe0038fbcd6342ffaacc76d94524e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package me.Danker.handlers;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;

public class TextRenderer extends Gui {
	public TextRenderer(Minecraft mc, String text, int x, int y, double scale) {
		double scaleReset = (double) Math.pow(scale, -1);
		
		GL11.glScaled(scale, scale, scale);
		y -= mc.fontRendererObj.FONT_HEIGHT;
		for (String line : text.split("\n")) {
			y += mc.fontRendererObj.FONT_HEIGHT * scale;
			drawString(mc.fontRendererObj, line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF);
		}
		GL11.glScaled(scaleReset, scaleReset, scaleReset);
	}
}