2022-01-12 04:44:08 -06:00
|
|
|
package noppes.npcs.scripted.gui;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
import noppes.npcs.scripted.interfaces.ILabel;
|
|
|
|
|
|
|
|
|
|
public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
|
|
|
|
|
String label;
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
int color;
|
|
|
|
|
float scale;
|
2022-01-20 20:27:26 -06:00
|
|
|
boolean shadow;
|
2022-01-12 04:44:08 -06:00
|
|
|
|
|
|
|
|
public ScriptGuiLabel() {
|
|
|
|
|
this.color = 16777215;
|
|
|
|
|
this.scale = 1.0F;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ScriptGuiLabel(int id, String label, int x, int y, int width, int height) {
|
|
|
|
|
this.color = 16777215;
|
|
|
|
|
this.scale = 1.0F;
|
|
|
|
|
this.setID(id);
|
|
|
|
|
this.setText(label);
|
|
|
|
|
this.setPos(x, y);
|
|
|
|
|
this.setSize(width, height);
|
2022-01-20 20:27:26 -06:00
|
|
|
this.enableShadow(false);
|
2022-01-12 04:44:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ScriptGuiLabel(int id, String label, int x, int y, int width, int height, int color) {
|
|
|
|
|
this(id, label, x, y, width, height);
|
|
|
|
|
this.setColor(color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getText() {
|
|
|
|
|
return this.label;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ILabel setText(String label) {
|
|
|
|
|
this.label = label;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getWidth() {
|
|
|
|
|
return this.width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getHeight() {
|
|
|
|
|
return this.height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ILabel setSize(int width, int height) {
|
|
|
|
|
this.width = width;
|
|
|
|
|
this.height = height;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getColor() {
|
|
|
|
|
return this.color;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ILabel setColor(int color) {
|
|
|
|
|
this.color = color;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getScale() {
|
|
|
|
|
return this.scale;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ILabel setScale(float scale) {
|
|
|
|
|
this.scale = scale;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-20 20:27:26 -06:00
|
|
|
public boolean hasShadow(){
|
|
|
|
|
return this.shadow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void enableShadow(boolean shadow){
|
|
|
|
|
this.shadow = shadow;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-12 04:44:08 -06:00
|
|
|
public int getType() {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public NBTTagCompound toNBT(NBTTagCompound nbt) {
|
|
|
|
|
super.toNBT(nbt);
|
|
|
|
|
nbt.setString("label", this.label);
|
|
|
|
|
nbt.setIntArray("size", new int[]{this.width, this.height});
|
|
|
|
|
nbt.setInteger("color", this.color);
|
|
|
|
|
nbt.setFloat("scale", this.scale);
|
2022-01-20 20:27:26 -06:00
|
|
|
nbt.setBoolean("shadow",this.shadow);
|
2022-01-12 04:44:08 -06:00
|
|
|
return nbt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ScriptGuiComponent fromNBT(NBTTagCompound nbt) {
|
|
|
|
|
super.fromNBT(nbt);
|
|
|
|
|
this.setText(nbt.getString("label"));
|
|
|
|
|
this.setSize(nbt.getIntArray("size")[0], nbt.getIntArray("size")[1]);
|
|
|
|
|
this.setColor(nbt.getInteger("color"));
|
|
|
|
|
this.setScale(nbt.getFloat("scale"));
|
2022-01-20 20:27:26 -06:00
|
|
|
this.enableShadow(this.shadow);
|
2022-01-12 04:44:08 -06:00
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
}
|