I want to edit the display player name in multiplayer in game (not in the chat). I want to show after the player name, his total death (looklike "PlayerX (xxx death)").
I have successful add fake death in original source but I don't know how to do it in a mod.
As pointed out to me some time ago there is an event that allows you to change the players multiplayer name. Vic has provided a wonderful list of events that contains a list of all current events within minecraft forge. You can find that list here. The event you will need is PlayerEvent.NameFormat, you will have access to an instance of the player and his username/displayname.
So do if (deathCounter.get(s) != null) instead? Exception catching is only for unsafe/unmanaged code, it is far more expensive than doing a null check.
I want to edit the display player name in multiplayer in game (not in the chat). I want to show after the player name, his total death (looklike "PlayerX (xxx death)").
I have successful add fake death in original source but I don't know how to do it in a mod.
Farewell everyone o/
I see in the console, PlayerName (X deaths) but in the game PlayerName (0 deaths). What's the problem ?
with "/scoreboard objectives add var_death deathCount" you add an objective named "var_death"
and with "/scoreboard objectives setdisplay belowName var_death" all Players show there death below the name.
And I want to know why my code for the mod don't work.
What's wrong with that?
If you want it to refresh, I guess you mean when they die, then also hook LivingDeathEvent.
With LivingDeathEvent I can't edit the player name (I don't know an other way to do it).
In console:
In game:
I have just add the displayName function in the ichun's deathcounter.mod
in ichun's deathcounter source. You can find his mod here: http://ichun.us/mods/death-counter/ (sources are in the mod)