mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 03:25:02 +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;
|
||||
}
|
||||
|
||||
@@ -16,10 +16,6 @@ public interface ILabel extends ICustomGuiComponent {
|
||||
|
||||
ILabel setSize(int var1, int var2);
|
||||
|
||||
int getColor();
|
||||
|
||||
ILabel setColor(int var1);
|
||||
|
||||
float getScale();
|
||||
|
||||
ILabel setScale(float var1);
|
||||
|
||||
@@ -5,13 +5,11 @@ public interface ILine extends ICustomGuiComponent {
|
||||
int getY1();
|
||||
int getX2();
|
||||
int getY2();
|
||||
int getColor();
|
||||
int getThickness();
|
||||
|
||||
void setX1(int x1);
|
||||
void setY1(int y1);
|
||||
void setX2(int x2);
|
||||
void setY2(int y2);
|
||||
void setColor(int color);
|
||||
void setThickness(int thickness);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public abstract class ScriptOverlayComponent implements ICustomOverlayComponent
|
||||
this.setPos(nbt.getIntArray("pos")[0], nbt.getIntArray("pos")[1]);
|
||||
this.setAlignment(nbt.getInteger("alignment"));
|
||||
this.setColor(nbt.getInteger("color"));
|
||||
this.setAlpha(nbt.getInteger("alpha"));
|
||||
this.setAlpha(nbt.getFloat("alpha"));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ScriptOverlayLabel extends ScriptOverlayComponent implements IOverl
|
||||
this.setText(label);
|
||||
this.setPos(x, y);
|
||||
this.setSize(width, height);
|
||||
this.enableShadow(false);
|
||||
this.setShadow(false);
|
||||
}
|
||||
|
||||
public ScriptOverlayLabel(int id, String label, int x, int y, int width, int height, int color) {
|
||||
@@ -64,11 +64,11 @@ public class ScriptOverlayLabel extends ScriptOverlayComponent implements IOverl
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasShadow(){
|
||||
public boolean getShadow(){
|
||||
return this.shadow;
|
||||
}
|
||||
|
||||
public void enableShadow(boolean shadow){
|
||||
public void setShadow(boolean shadow){
|
||||
this.shadow = shadow;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ScriptOverlayLabel extends ScriptOverlayComponent implements IOverl
|
||||
this.setText(nbt.getString("label"));
|
||||
this.setSize(nbt.getIntArray("size")[0], nbt.getIntArray("size")[1]);
|
||||
this.setScale(nbt.getFloat("scale"));
|
||||
this.enableShadow(nbt.getBoolean("shadow"));
|
||||
this.setShadow(nbt.getBoolean("shadow"));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user