mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 09:39:05 +00:00
Made color and alpha components global among ScriptGui classes.
This commit is contained in:
1 parent
be61bd4e17
commit
e5e1aa1972
16 files changed
+168
-98
No files matched your search
@@ -4,6 +4,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
|
||||
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
|
||||
|
||||
public abstract class ScriptGuiComponent implements ICustomGuiComponent {
|
||||
int id;
|
||||
@@ -11,6 +12,9 @@ public abstract class ScriptGuiComponent implements ICustomGuiComponent {
|
||||
int posY;
|
||||
String[] hoverText;
|
||||
|
||||
int color = 0xFFFFFF;
|
||||
float alpha = 1.0F;
|
||||
|
||||
public ScriptGuiComponent() {
|
||||
}
|
||||
|
||||
@@ -55,11 +59,30 @@ public abstract class ScriptGuiComponent implements ICustomGuiComponent {
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public ICustomGuiComponent setColor(int color) {
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
return this.alpha;
|
||||
}
|
||||
|
||||
public void setAlpha(float alpha) {
|
||||
this.alpha = alpha;
|
||||
}
|
||||
|
||||
public abstract int getType();
|
||||
|
||||
public NBTTagCompound toNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("id", this.id);
|
||||
nbt.setIntArray("pos", new int[]{this.posX, this.posY});
|
||||
nbt.setInteger("color", this.color);
|
||||
nbt.setFloat("alpha",this.alpha);
|
||||
if (this.hoverText != null) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
String[] var3 = this.hoverText;
|
||||
@@ -84,6 +107,8 @@ public abstract class ScriptGuiComponent implements ICustomGuiComponent {
|
||||
public ScriptGuiComponent fromNBT(NBTTagCompound nbt) {
|
||||
this.setID(nbt.getInteger("id"));
|
||||
this.setPos(nbt.getIntArray("pos")[0], nbt.getIntArray("pos")[1]);
|
||||
this.setColor(nbt.getInteger("color"));
|
||||
this.setAlpha(nbt.getFloat("alpha"));
|
||||
if (nbt.hasKey("hover")) {
|
||||
NBTTagList list = nbt.getTagList("hover", 8);
|
||||
String[] hoverText = new String[list.tagCount()];
|
||||
|
||||
@@ -7,17 +7,14 @@ public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
|
||||
String label;
|
||||
int width;
|
||||
int height;
|
||||
int color;
|
||||
float scale;
|
||||
boolean shadow;
|
||||
|
||||
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);
|
||||
@@ -54,15 +51,6 @@ public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public ILabel setColor(int color) {
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getScale() {
|
||||
return this.scale;
|
||||
}
|
||||
@@ -88,7 +76,6 @@ public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
|
||||
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);
|
||||
nbt.setBoolean("shadow",this.shadow);
|
||||
return nbt;
|
||||
@@ -98,7 +85,6 @@ public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
|
||||
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"));
|
||||
this.enableShadow(nbt.getBoolean("shadow"));
|
||||
return this;
|
||||
|
||||
@@ -8,7 +8,6 @@ public class ScriptGuiLine extends ScriptGuiComponent implements ILine {
|
||||
int y1;
|
||||
int x2;
|
||||
int y2;
|
||||
int color = 0;
|
||||
int thickness = 2;
|
||||
|
||||
public ScriptGuiLine(){
|
||||
@@ -49,7 +48,6 @@ public class ScriptGuiLine extends ScriptGuiComponent implements ILine {
|
||||
nbt.setInteger("Y1",y1);
|
||||
nbt.setInteger("X2",x2);
|
||||
nbt.setInteger("Y2",y2);
|
||||
nbt.setInteger("Color",color);
|
||||
nbt.setInteger("Thickness",thickness);
|
||||
|
||||
return nbt;
|
||||
@@ -61,7 +59,6 @@ public class ScriptGuiLine extends ScriptGuiComponent implements ILine {
|
||||
y1 = nbt.getInteger("Y1");
|
||||
x2 = nbt.getInteger("X2");
|
||||
y2 = nbt.getInteger("Y2");
|
||||
color = nbt.getInteger("Color");
|
||||
thickness = nbt.getInteger("Thickness");
|
||||
|
||||
return this;
|
||||
@@ -79,9 +76,6 @@ public class ScriptGuiLine extends ScriptGuiComponent implements ILine {
|
||||
public int getY2(){
|
||||
return this.y2;
|
||||
}
|
||||
public int getColor(){
|
||||
return this.color;
|
||||
}
|
||||
public int getThickness(){
|
||||
return this.thickness;
|
||||
}
|
||||
@@ -98,9 +92,6 @@ public class ScriptGuiLine extends ScriptGuiComponent implements ILine {
|
||||
public void setY2(int y2){
|
||||
this.y2 = y2;
|
||||
}
|
||||
public void setColor(int color){
|
||||
this.color = color;
|
||||
}
|
||||
public void setThickness(int thickness){
|
||||
this.thickness = thickness;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user