mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 04:04:28 +00:00
38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
package noppes.npcs.client.gui.util;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.gui.FontRenderer;
|
|
import net.minecraft.client.gui.GuiScreen;
|
|
import net.minecraft.util.StatCollector;
|
|
import noppes.npcs.client.CustomNpcResourceListener;
|
|
|
|
public class GuiNpcLabel {
|
|
public String label;
|
|
public int x, y, color;
|
|
public boolean enabled = true;
|
|
public int id;
|
|
public boolean drawShadow = false;
|
|
|
|
public GuiNpcLabel(int id, Object label, int x, int y, int color) {
|
|
this.id = id;
|
|
this.label = StatCollector.translateToLocal(label.toString());
|
|
this.x = x;
|
|
this.y = y;
|
|
this.color = color;
|
|
}
|
|
|
|
public GuiNpcLabel(int id, Object label, int x, int y) {
|
|
this(id, label, x, y, CustomNpcResourceListener.DefaultTextColor);
|
|
}
|
|
|
|
public void drawLabel(GuiScreen gui, FontRenderer fontRenderer) {
|
|
if (enabled)
|
|
fontRenderer.drawString(label, x, y, color, drawShadow);
|
|
}
|
|
|
|
public void center(int width) {
|
|
int size = Minecraft.getMinecraft().fontRenderer.getStringWidth(label);
|
|
x += (width - size) / 2;
|
|
}
|
|
}
|