mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 20:53:08 +00:00
Made color and alpha components global among ScriptOverlay classes.
This commit is contained in:
1 parent
534f716991
commit
be61bd4e17
11 files changed
+71
-37
No files matched your search
@@ -100,7 +100,7 @@ public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
|
||||
this.setSize(nbt.getIntArray("size")[0], nbt.getIntArray("size")[1]);
|
||||
this.setColor(nbt.getInteger("color"));
|
||||
this.setScale(nbt.getFloat("scale"));
|
||||
this.enableShadow(this.shadow);
|
||||
this.enableShadow(nbt.getBoolean("shadow"));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -14,4 +14,12 @@ public interface ICustomOverlayComponent {
|
||||
int getAlignment();
|
||||
|
||||
void setAlignment(int alignment);
|
||||
|
||||
int getColor();
|
||||
|
||||
ICustomOverlayComponent setColor(int color);
|
||||
|
||||
float getAlpha();
|
||||
|
||||
void setAlpha(float alpha);
|
||||
}
|
||||
@@ -11,10 +11,6 @@ public interface IOverlayLabel extends ICustomOverlayComponent {
|
||||
|
||||
IOverlayLabel setSize(int var1, int var2);
|
||||
|
||||
int getColor();
|
||||
|
||||
IOverlayLabel setColor(int var1);
|
||||
|
||||
float getScale();
|
||||
|
||||
IOverlayLabel setScale(float var1);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import noppes.npcs.scripted.overlay.ScriptOverlayLine;
|
||||
|
||||
public interface IOverlayLine extends ICustomOverlayComponent {
|
||||
int getX1();
|
||||
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);
|
||||
}
|
||||
@@ -6,12 +6,15 @@ import net.minecraft.nbt.NBTTagString;
|
||||
import noppes.npcs.scripted.gui.*;
|
||||
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
|
||||
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
|
||||
import noppes.npcs.scripted.interfaces.IOverlayTexturedRect;
|
||||
|
||||
public abstract class ScriptOverlayComponent implements ICustomOverlayComponent {
|
||||
int id;
|
||||
int posX;
|
||||
int posY;
|
||||
int alignment = 0;
|
||||
int color = 0xFFFFFF;
|
||||
float alpha = 1.0F;
|
||||
/* ========ALIGNMENTS========
|
||||
0 1 2
|
||||
|
||||
@@ -54,12 +57,31 @@ public abstract class ScriptOverlayComponent implements ICustomOverlayComponent
|
||||
this.alignment = alignment;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public ICustomOverlayComponent 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("alignment",this.alignment);
|
||||
nbt.setInteger("color", this.color);
|
||||
nbt.setFloat("alpha",this.alpha);
|
||||
|
||||
nbt.setInteger("type", this.getType());
|
||||
return nbt;
|
||||
@@ -69,6 +91,8 @@ public abstract class ScriptOverlayComponent implements ICustomOverlayComponent
|
||||
this.setID(nbt.getInteger("id"));
|
||||
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"));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ public class ScriptOverlayLabel extends ScriptOverlayComponent implements IOverl
|
||||
String label;
|
||||
int width;
|
||||
int height;
|
||||
int color;
|
||||
float scale;
|
||||
boolean shadow;
|
||||
|
||||
@@ -56,15 +55,6 @@ public class ScriptOverlayLabel extends ScriptOverlayComponent implements IOverl
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public IOverlayLabel setColor(int color) {
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getScale() {
|
||||
return this.scale;
|
||||
}
|
||||
@@ -91,7 +81,6 @@ public class ScriptOverlayLabel extends ScriptOverlayComponent implements IOverl
|
||||
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;
|
||||
@@ -101,9 +90,8 @@ public class ScriptOverlayLabel extends ScriptOverlayComponent implements IOverl
|
||||
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(this.shadow);
|
||||
this.enableShadow(nbt.getBoolean("shadow"));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ public class ScriptOverlayLine extends ScriptOverlayComponent implements IOverla
|
||||
int y1;
|
||||
int x2;
|
||||
int y2;
|
||||
int color = 0;
|
||||
int thickness = 2;
|
||||
|
||||
public ScriptOverlayLine(){
|
||||
@@ -48,7 +47,6 @@ public class ScriptOverlayLine extends ScriptOverlayComponent implements IOverla
|
||||
nbt.setInteger("Y1",y1);
|
||||
nbt.setInteger("X2",x2);
|
||||
nbt.setInteger("Y2",y2);
|
||||
nbt.setInteger("Color",color);
|
||||
nbt.setInteger("Thickness",thickness);
|
||||
|
||||
return nbt;
|
||||
@@ -60,7 +58,6 @@ public class ScriptOverlayLine extends ScriptOverlayComponent implements IOverla
|
||||
y1 = nbt.getInteger("Y1");
|
||||
x2 = nbt.getInteger("X2");
|
||||
y2 = nbt.getInteger("Y2");
|
||||
color = nbt.getInteger("Color");
|
||||
thickness = nbt.getInteger("Thickness");
|
||||
|
||||
return this;
|
||||
@@ -78,9 +75,6 @@ public class ScriptOverlayLine extends ScriptOverlayComponent implements IOverla
|
||||
public int getY2(){
|
||||
return this.y2;
|
||||
}
|
||||
public int getColor(){
|
||||
return this.color;
|
||||
}
|
||||
public int getThickness(){
|
||||
return this.thickness;
|
||||
}
|
||||
@@ -97,9 +91,6 @@ public class ScriptOverlayLine extends ScriptOverlayComponent implements IOverla
|
||||
public void setY2(int y2){
|
||||
this.y2 = y2;
|
||||
}
|
||||
public void setColor(int color){
|
||||
this.color = color;
|
||||
}
|
||||
public void setThickness(int thickness){
|
||||
this.thickness = thickness;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package noppes.npcs.scripted.overlay;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.scripted.gui.ScriptGuiComponent;
|
||||
import noppes.npcs.scripted.interfaces.IOverlayLabel;
|
||||
import noppes.npcs.scripted.interfaces.IOverlayTexturedRect;
|
||||
import noppes.npcs.scripted.interfaces.ITexturedRect;
|
||||
|
||||
|
||||
Reference in new issue
Block a user