mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 13:49: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()];
|
||||
|
||||
Reference in new issue
Block a user