Memoization of display name result

This commit is contained in:
MachineMuse 2013-09-04 14:22:22 -06:00
parent 0e3037e85d
commit cb9c26d49c
1 changed files with 24 additions and 1 deletions

View File

@ -548,7 +548,30 @@
public String getTranslatedEntityName()
{
- return ScorePlayerTeam.formatPlayerName(this.getTeam(), this.username);
+ return ScorePlayerTeam.formatPlayerName(this.getTeam(), ForgeEventFactory.getPlayerDisplayName(this, this.username));
+ return ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayName());
}
public void func_110149_m(float par1)
@@ -2257,4 +2460,22 @@
{
FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z);
}
+ /**
+ * Forge-added fields
+ */
+ private String displayname;
+
+ public String getDisplayName()
+ {
+ if(this.displayname == null)
+ {
+ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.username);
+ }
+ return this.displayname;
+ }
+
+ public void refreshDisplayName()
+ {
+ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.username);
+ }
}