mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 06:07:27 +00:00
Implemented MC chat formatting for color codes: &l, &m, &r, &o, and &k all affect overlay labels.
This commit is contained in:
1 parent
e7a19264b2
commit
da3b04e78e
2 files changed
+8
-90
No files matched your search
+8
-40
@@ -34,7 +34,6 @@ public class CustomOverlayLabel extends Gui implements IOverlayComponent {
|
||||
String fullLabel;
|
||||
int color;
|
||||
float alpha;
|
||||
String[] hoverText;
|
||||
float scale;
|
||||
int border = 2;
|
||||
boolean labelBgEnabled = true;
|
||||
@@ -44,16 +43,7 @@ public class CustomOverlayLabel extends Gui implements IOverlayComponent {
|
||||
protected int field_146161_f;
|
||||
public int field_146162_g;
|
||||
public int field_146174_h;
|
||||
private ArrayList field_146173_k;
|
||||
private boolean field_146170_l;
|
||||
public boolean field_146172_j;
|
||||
private boolean field_146171_m;
|
||||
private int field_146168_n;
|
||||
private int field_146169_o;
|
||||
private int field_146166_p;
|
||||
private int field_146165_q;
|
||||
private FontRenderer field_146164_r;
|
||||
private int field_146163_s;
|
||||
|
||||
private boolean randomStyle = false;
|
||||
private boolean boldStyle = false;
|
||||
@@ -120,12 +110,6 @@ public class CustomOverlayLabel extends Gui implements IOverlayComponent {
|
||||
lbl.alpha = component.getAlpha();
|
||||
lbl.color = component.getColor();
|
||||
|
||||
lbl.strikethroughStyle = component.getStrikethroughStyle();
|
||||
lbl.boldStyle = component.getBoldStyle();
|
||||
lbl.italicStyle = component.getItalicStyle();
|
||||
lbl.randomStyle = component.getRandomStyle();
|
||||
lbl.underlineStyle = component.getUnderlineStyle();
|
||||
|
||||
return lbl;
|
||||
}
|
||||
|
||||
@@ -136,11 +120,6 @@ public class CustomOverlayLabel extends Gui implements IOverlayComponent {
|
||||
component.setAlpha(alpha);
|
||||
component.setColor(color);
|
||||
|
||||
component.setStrikethroughStyle(strikethroughStyle);
|
||||
component.setBoldStyle(boldStyle);
|
||||
component.setItalicStyle(italicStyle);
|
||||
component.setRandomStyle(randomStyle);
|
||||
component.setUnderlineStyle(underlineStyle);
|
||||
return component;
|
||||
}
|
||||
|
||||
@@ -181,6 +160,7 @@ public class CustomOverlayLabel extends Gui implements IOverlayComponent {
|
||||
|
||||
public int drawString(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_, boolean p_85187_5_)
|
||||
{
|
||||
this.resetStyles();
|
||||
int l;
|
||||
|
||||
if (p_85187_5_)
|
||||
@@ -234,27 +214,11 @@ public class CustomOverlayLabel extends Gui implements IOverlayComponent {
|
||||
int j;
|
||||
int k;
|
||||
|
||||
if (c0 == 167 && i + 1 < p_78255_1_.length())
|
||||
if (c0 == 38 && i + 1 < p_78255_1_.length())
|
||||
{
|
||||
j = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1));
|
||||
|
||||
if (j < 16)
|
||||
{
|
||||
if (j < 0 || j > 15)
|
||||
{
|
||||
j = 15;
|
||||
}
|
||||
|
||||
if (p_78255_2_)
|
||||
{
|
||||
j += 16;
|
||||
}
|
||||
|
||||
k = this.colorCode[j];
|
||||
this.textColor = k;
|
||||
setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha);
|
||||
}
|
||||
else if (j == 16)
|
||||
if (j == 16)
|
||||
{
|
||||
this.randomStyle = true;
|
||||
}
|
||||
@@ -276,7 +240,11 @@ public class CustomOverlayLabel extends Gui implements IOverlayComponent {
|
||||
}
|
||||
else if (j == 21)
|
||||
{
|
||||
setColor(this.red, this.green, this.blue, this.alpha);
|
||||
this.randomStyle = false;
|
||||
this.boldStyle = false;
|
||||
this.strikethroughStyle = false;
|
||||
this.underlineStyle = false;
|
||||
this.italicStyle = false;
|
||||
}
|
||||
|
||||
++i;
|
||||
|
||||
@@ -12,12 +12,6 @@ public class ScriptOverlayLabel extends ScriptOverlayComponent implements IOverl
|
||||
float scale;
|
||||
boolean shadow;
|
||||
|
||||
boolean randomStyle = false;
|
||||
boolean boldStyle = false;
|
||||
boolean italicStyle = false;
|
||||
boolean underlineStyle = false;
|
||||
boolean strikethroughStyle = false;
|
||||
|
||||
public ScriptOverlayLabel() {
|
||||
this.color = 16777215;
|
||||
this.scale = 1.0F;
|
||||
@@ -78,38 +72,6 @@ public class ScriptOverlayLabel extends ScriptOverlayComponent implements IOverl
|
||||
this.shadow = shadow;
|
||||
}
|
||||
|
||||
public void setRandomStyle(boolean randomStyle){
|
||||
this.randomStyle = randomStyle;
|
||||
}
|
||||
public void setUnderlineStyle(boolean underlineStyle){
|
||||
this.underlineStyle = underlineStyle;
|
||||
}
|
||||
public void setBoldStyle(boolean boldStyle){
|
||||
this.boldStyle = boldStyle;
|
||||
}
|
||||
public void setItalicStyle(boolean italicStyle){
|
||||
this.italicStyle = italicStyle;
|
||||
}
|
||||
public void setStrikethroughStyle(boolean strikethroughStyle){
|
||||
this.strikethroughStyle = strikethroughStyle;
|
||||
}
|
||||
|
||||
public boolean getRandomStyle(){
|
||||
return this.randomStyle;
|
||||
}
|
||||
public boolean getUnderlineStyle(){
|
||||
return this.underlineStyle;
|
||||
}
|
||||
public boolean getBoldStyle(){
|
||||
return this.boldStyle;
|
||||
}
|
||||
public boolean getItalicStyle(){
|
||||
return this.italicStyle;
|
||||
}
|
||||
public boolean getStrikethroughStyle(){
|
||||
return this.strikethroughStyle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return 1;
|
||||
@@ -121,12 +83,6 @@ public class ScriptOverlayLabel extends ScriptOverlayComponent implements IOverl
|
||||
nbt.setIntArray("size", new int[]{this.width, this.height});
|
||||
nbt.setFloat("scale", this.scale);
|
||||
nbt.setBoolean("shadow",this.shadow);
|
||||
|
||||
nbt.setBoolean("strikethrough",this.strikethroughStyle);
|
||||
nbt.setBoolean("bold",this.boldStyle);
|
||||
nbt.setBoolean("italic",this.italicStyle);
|
||||
nbt.setBoolean("random",this.randomStyle);
|
||||
nbt.setBoolean("underline",this.underlineStyle);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@@ -136,12 +92,6 @@ public class ScriptOverlayLabel extends ScriptOverlayComponent implements IOverl
|
||||
this.setSize(nbt.getIntArray("size")[0], nbt.getIntArray("size")[1]);
|
||||
this.setScale(nbt.getFloat("scale"));
|
||||
this.setShadow(nbt.getBoolean("shadow"));
|
||||
|
||||
this.setStrikethroughStyle(nbt.getBoolean("strikethrough"));
|
||||
this.setBoldStyle(nbt.getBoolean("bold"));
|
||||
this.setItalicStyle(nbt.getBoolean("italic"));
|
||||
this.setRandomStyle(nbt.getBoolean("random"));
|
||||
this.setUnderlineStyle(nbt.getBoolean("underline"));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user