mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 02:54:27 +00:00
1.7.10 Files
Files added
This commit is contained in:
1 parent
393ea9b463
commit
a31efb2dc3
1768 files changed
+84831
No files matched your search
@@ -0,0 +1,33 @@
|
||||
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 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);
|
||||
}
|
||||
public void center(int width) {
|
||||
int size = Minecraft.getMinecraft().fontRenderer.getStringWidth(label);
|
||||
x += (width - size) / 2;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user