本文整理汇总了Java中net.minecraft.scoreboard.ScorePlayerTeam.formatPlayerName方法的典型用法代码示例。如果您正苦于以下问题:Java ScorePlayerTeam.formatPlayerName方法的具体用法?Java ScorePlayerTeam.formatPlayerName怎么用?Java ScorePlayerTeam.formatPlayerName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.scoreboard.ScorePlayerTeam
的用法示例。
在下文中一共展示了ScorePlayerTeam.formatPlayerName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getName
import net.minecraft.scoreboard.ScorePlayerTeam; //导入方法依赖的package包/类
public String getName() {
if(this.world.isRemote && ClientProxy.getLocalPlayer() != null && this.getWepCapability().isDisguised()) {
String username=this.getWepCapability().getDisguiseType().substring(2);
if(TF2Util.isOnSameTeam(ClientProxy.getLocalPlayer(), this)) {
return super.getName()+" ["+username+"]";
}
else {
if(this.getWepCapability().getDisguiseType().startsWith("M:")) {
return TextFormatting.RESET+I18n.format("entity."+username+".name");
}
else
return ScorePlayerTeam.formatPlayerName(Minecraft.getMinecraft().world.getScoreboard().getPlayersTeam(username), username);
}
}
else
return super.getName();
}
示例2: getDisplayName
import net.minecraft.scoreboard.ScorePlayerTeam; //导入方法依赖的package包/类
/**
* Get the formatted ChatComponent that will be used for the sender's username in chat
*/
public IChatComponent getDisplayName()
{
IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName()));
ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " "));
ichatcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent());
ichatcomponent.getChatStyle().setInsertion(this.getName());
return ichatcomponent;
}
示例3: getDisplayName
import net.minecraft.scoreboard.ScorePlayerTeam; //导入方法依赖的package包/类
/**
* Get the formatted ChatComponent that will be used for the sender's username in chat
*/
public ITextComponent getDisplayName()
{
ITextComponent itextcomponent = new TextComponentString(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName()));
itextcomponent.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " "));
itextcomponent.getStyle().setHoverEvent(this.getHoverEvent());
itextcomponent.getStyle().setInsertion(this.getName());
return itextcomponent;
}
示例4: getDisplayName
import net.minecraft.scoreboard.ScorePlayerTeam; //导入方法依赖的package包/类
/**
* Get the formatted ChatComponent that will be used for the sender's username in chat
*/
public ITextComponent getDisplayName()
{
TextComponentString textcomponentstring = new TextComponentString(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName()));
textcomponentstring.getStyle().setHoverEvent(this.getHoverEvent());
textcomponentstring.getStyle().setInsertion(this.getCachedUniqueIdString());
return textcomponentstring;
}
示例5: renderScoreboard
import net.minecraft.scoreboard.ScorePlayerTeam; //导入方法依赖的package包/类
private void renderScoreboard(ScoreObjective p_180475_1_, ScaledResolution p_180475_2_)
{
Scoreboard scoreboard = p_180475_1_.getScoreboard();
Collection<Score> collection = scoreboard.getSortedScores(p_180475_1_);
List<Score> list = Lists.newArrayList(Iterables.filter(collection, new Predicate<Score>()
{
public boolean apply(Score p_apply_1_)
{
return p_apply_1_.getPlayerName() != null && !p_apply_1_.getPlayerName().startsWith("#");
}
}));
if (list.size() > 15)
{
collection = Lists.newArrayList(Iterables.skip(list, collection.size() - 15));
}
else
{
collection = list;
}
int i = this.getFontRenderer().getStringWidth(p_180475_1_.getDisplayName());
for (Score score : collection)
{
ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(score.getPlayerName());
String s = ScorePlayerTeam.formatPlayerName(scoreplayerteam, score.getPlayerName()) + ": " + EnumChatFormatting.RED + score.getScorePoints();
i = Math.max(i, this.getFontRenderer().getStringWidth(s));
}
int i1 = collection.size() * this.getFontRenderer().FONT_HEIGHT;
int j1 = p_180475_2_.getScaledHeight() / 2 + i1 / 3;
int k1 = 3;
int l1 = p_180475_2_.getScaledWidth() - i - k1;
int j = 0;
for (Score score1 : collection)
{
++j;
ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score1.getPlayerName());
String s1 = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score1.getPlayerName());
String s2 = EnumChatFormatting.RED + "" + score1.getScorePoints();
int k = j1 - j * this.getFontRenderer().FONT_HEIGHT;
int l = p_180475_2_.getScaledWidth() - k1 + 2;
drawRect(l1 - 2, k, l, k + this.getFontRenderer().FONT_HEIGHT, 1342177280);
this.getFontRenderer().drawString(s1, l1, k, 553648127);
this.getFontRenderer().drawString(s2, l - this.getFontRenderer().getStringWidth(s2), k, 553648127);
if (j == collection.size())
{
String s3 = p_180475_1_.getDisplayName();
drawRect(l1 - 2, k - this.getFontRenderer().FONT_HEIGHT - 1, l, k - 1, 1610612736);
drawRect(l1 - 2, k - 1, l, k, 1342177280);
this.getFontRenderer().drawString(s3, l1 + i / 2 - this.getFontRenderer().getStringWidth(s3) / 2, k - this.getFontRenderer().FONT_HEIGHT, 553648127);
}
}
}
示例6: getPlayerName
import net.minecraft.scoreboard.ScorePlayerTeam; //导入方法依赖的package包/类
/**
* Returns the name that should be renderd for the player supplied
*/
public String getPlayerName(NetworkPlayerInfo networkPlayerInfoIn)
{
return networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName());
}
示例7: renderScoreboard
import net.minecraft.scoreboard.ScorePlayerTeam; //导入方法依赖的package包/类
private void renderScoreboard(ScoreObjective objective, ScaledResolution scaledRes)
{
Scoreboard scoreboard = objective.getScoreboard();
Collection<Score> collection = scoreboard.getSortedScores(objective);
List<Score> list = Lists.newArrayList(Iterables.filter(collection, new Predicate<Score>()
{
public boolean apply(@Nullable Score p_apply_1_)
{
return p_apply_1_.getPlayerName() != null && !p_apply_1_.getPlayerName().startsWith("#");
}
}));
if (list.size() > 15)
{
collection = Lists.newArrayList(Iterables.skip(list, collection.size() - 15));
}
else
{
collection = list;
}
int i = this.getFontRenderer().getStringWidth(objective.getDisplayName());
for (Score score : collection)
{
ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(score.getPlayerName());
String s = ScorePlayerTeam.formatPlayerName(scoreplayerteam, score.getPlayerName()) + ": " + TextFormatting.RED + score.getScorePoints();
i = Math.max(i, this.getFontRenderer().getStringWidth(s));
}
int i1 = collection.size() * this.getFontRenderer().FONT_HEIGHT;
int j1 = scaledRes.getScaledHeight() / 2 + i1 / 3;
int k1 = 3;
int l1 = scaledRes.getScaledWidth() - i - 3;
int j = 0;
for (Score score1 : collection)
{
++j;
ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score1.getPlayerName());
String s1 = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score1.getPlayerName());
String s2 = TextFormatting.RED + "" + score1.getScorePoints();
int k = j1 - j * this.getFontRenderer().FONT_HEIGHT;
int l = scaledRes.getScaledWidth() - 3 + 2;
drawRect(l1 - 2, k, l, k + this.getFontRenderer().FONT_HEIGHT, 1342177280);
this.getFontRenderer().drawString(s1, l1, k, 553648127);
this.getFontRenderer().drawString(s2, l - this.getFontRenderer().getStringWidth(s2), k, 553648127);
if (j == collection.size())
{
String s3 = objective.getDisplayName();
drawRect(l1 - 2, k - this.getFontRenderer().FONT_HEIGHT - 1, l, k - 1, 1610612736);
drawRect(l1 - 2, k - 1, l, k, 1342177280);
this.getFontRenderer().drawString(s3, l1 + i / 2 - this.getFontRenderer().getStringWidth(s3) / 2, k - this.getFontRenderer().FONT_HEIGHT, 553648127);
}
}
}
示例8: renderScoreboard
import net.minecraft.scoreboard.ScorePlayerTeam; //导入方法依赖的package包/类
protected void renderScoreboard(ScoreObjective objective, ScaledResolution scaledRes)
{
Scoreboard scoreboard = objective.getScoreboard();
Collection<Score> collection = scoreboard.getSortedScores(objective);
List<Score> list = Lists.newArrayList(Iterables.filter(collection, new Predicate<Score>()
{
public boolean apply(@Nullable Score p_apply_1_)
{
return p_apply_1_.getPlayerName() != null && !p_apply_1_.getPlayerName().startsWith("#");
}
}));
if (list.size() > 15)
{
collection = Lists.newArrayList(Iterables.skip(list, collection.size() - 15));
}
else
{
collection = list;
}
int i = this.getFontRenderer().getStringWidth(objective.getDisplayName());
for (Score score : collection)
{
ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(score.getPlayerName());
String s = ScorePlayerTeam.formatPlayerName(scoreplayerteam, score.getPlayerName()) + ": " + TextFormatting.RED + score.getScorePoints();
i = Math.max(i, this.getFontRenderer().getStringWidth(s));
}
int i1 = collection.size() * this.getFontRenderer().FONT_HEIGHT;
int j1 = scaledRes.getScaledHeight() / 2 + i1 / 3;
int k1 = 3;
int l1 = scaledRes.getScaledWidth() - i - 3;
int j = 0;
for (Score score1 : collection)
{
++j;
ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score1.getPlayerName());
String s1 = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score1.getPlayerName());
String s2 = TextFormatting.RED + "" + score1.getScorePoints();
int k = j1 - j * this.getFontRenderer().FONT_HEIGHT;
int l = scaledRes.getScaledWidth() - 3 + 2;
drawRect(l1 - 2, k, l, k + this.getFontRenderer().FONT_HEIGHT, 1342177280);
this.getFontRenderer().drawString(s1, l1, k, 553648127);
this.getFontRenderer().drawString(s2, l - this.getFontRenderer().getStringWidth(s2), k, 553648127);
if (j == collection.size())
{
String s3 = objective.getDisplayName();
drawRect(l1 - 2, k - this.getFontRenderer().FONT_HEIGHT - 1, l, k - 1, 1610612736);
drawRect(l1 - 2, k - 1, l, k, 1342177280);
this.getFontRenderer().drawString(s3, l1 + i / 2 - this.getFontRenderer().getStringWidth(s3) / 2, k - this.getFontRenderer().FONT_HEIGHT, 553648127);
}
}
}