Merge branch 'displayname' of github.com:MachineMuse/MinecraftForge into sometweaks

Conflicts:
	patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch
This commit is contained in:
Christian 2013-09-05 08:20:49 -04:00
commit df132a0296
3 changed files with 44 additions and 1 deletions

View File

@ -75,4 +75,11 @@ public class ForgeEventFactory
MinecraftForge.EVENT_BUS.post(maxCanSpawnEvent);
return maxCanSpawnEvent.getResult() == Result.ALLOW ? maxCanSpawnEvent.maxPackSize : entity.getMaxSpawnedInChunk();
}
public static String getPlayerDisplayName(EntityPlayer player, String username)
{
PlayerEvent.NameFormat event = new PlayerEvent.NameFormat(player, username);
MinecraftForge.EVENT_BUS.post(event);
return event.displayname;
}
}

View File

@ -45,4 +45,16 @@ public class PlayerEvent extends LivingEvent
this.newSpeed = original;
}
}
public static class NameFormat extends PlayerEvent
{
public final String username;
public String displayname;
public NameFormat(EntityPlayer player, String username) {
super(player);
this.username = username;
this.displayname = username;
}
}
}

View File

@ -560,7 +560,16 @@
}
@SideOnly(Side.CLIENT)
@@ -2267,4 +2471,17 @@
@@ -2245,7 +2449,7 @@
*/
public String getTranslatedEntityName()
{
- return ScorePlayerTeam.formatPlayerName(this.getTeam(), this.username);
+ return ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayName());
}
public void setAbsorptionAmount(float par1)
@@ -2267,4 +2471,32 @@
{
FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z);
}
@ -568,6 +577,7 @@
+ /* ===================================== FORGE START =====================================*/
+
+ public float eyeHeight;
+ private String displayname;
+
+ /**
+ * Returns the default eye height of the player
@ -576,5 +586,19 @@
+ public float getDefaultEyeHeight()
+ {
+ return 0.12F;
+ }
+
+ 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);
+ }
}