mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-05-20 04:24:02 +02:00
ddc846d860
- Relevant Mod files - Relevant Classes - Resources - Added Symmetry Wand from TMA
43 lines
924 B
Java
43 lines
924 B
Java
package com.simibubi.create.gui.widgets;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.gui.FontRenderer;
|
|
|
|
public class DynamicLabel extends AbstractSimiWidget {
|
|
|
|
public String text;
|
|
protected boolean hasShadow;
|
|
protected int color;
|
|
protected FontRenderer font;
|
|
|
|
public DynamicLabel(int x, int y, String text) {
|
|
super(x, y, Minecraft.getInstance().fontRenderer.getStringWidth(text), 10);
|
|
font = Minecraft.getInstance().fontRenderer;
|
|
this.text = "Label";
|
|
color = 0xFFFFFF;
|
|
hasShadow = false;
|
|
}
|
|
|
|
public DynamicLabel colored(int color) {
|
|
this.color = color;
|
|
return this;
|
|
}
|
|
|
|
public DynamicLabel withShadow() {
|
|
this.hasShadow = true;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public void render(int mouseX, int mouseY, float partialTicks) {
|
|
if (!visible)
|
|
return;
|
|
|
|
if (hasShadow)
|
|
font.drawStringWithShadow(text, x, y, color);
|
|
else
|
|
font.drawString(text, x, y, color);
|
|
}
|
|
|
|
}
|