本文整理匯總了Java中net.minecraftforge.event.entity.player.PlayerEvent.NameFormat方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerEvent.NameFormat方法的具體用法?Java PlayerEvent.NameFormat怎麽用?Java PlayerEvent.NameFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.event.entity.player.PlayerEvent
的用法示例。
在下文中一共展示了PlayerEvent.NameFormat方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: playerName
import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void playerName(PlayerEvent.NameFormat event) {
if(Minecraft.getMinecraft().player != null && WeaponsCapability.get(event.getEntityPlayer()).isDisguised()) {
String username=WeaponsCapability.get(event.getEntityPlayer()).getDisguiseType().substring(2);
if(TF2Util.isOnSameTeam(Minecraft.getMinecraft().player, event.getEntityPlayer())) {
event.setDisplayname(event.getDisplayname()+" ["+username+"]");
}
else {
if(WeaponsCapability.get(event.getEntityPlayer()).getDisguiseType().startsWith("M:")) {
if(event.getEntityPlayer().getCapability(TF2weapons.WEAPONS_CAP, null).entityDisguise != null){
event.setDisplayname(TextFormatting.RESET+event.getEntityPlayer().getCapability(TF2weapons.WEAPONS_CAP, null).entityDisguise.getDisplayName().getFormattedText());
}
else
event.setDisplayname(TextFormatting.RESET+I18n.format("entity."+username+".name"));
}
else
event.setDisplayname(ScorePlayerTeam.formatPlayerName(Minecraft.getMinecraft().world.getScoreboard().getPlayersTeam(username), username));
}
}
}
示例2: nameFormatEvent
import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void nameFormatEvent(PlayerEvent.NameFormat event)
{
try
{
if (D3Core.isDebug()) update();
if (perks.has(event.getUsername()))
{
JsonObject perk = perks.getAsJsonObject(event.getUsername());
if (perk.has("displayname")) event.setDisplayname(perk.get("displayname").getAsString());
doHat(perk, event.getEntityPlayer());
}
}
catch (Exception e)
{
if (D3Core.isDebug()) e.printStackTrace();
}
}
示例3: overrideDisplayName
import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void overrideDisplayName(PlayerEvent.NameFormat event){
EntityPlayer player = event.getEntityPlayer();
ExtendedPlayer ePlayer = ExtendedPlayerProvider.getExtendedPlayer(player);
if(ePlayer !=null && ePlayer.getPlayerDisguiseUUID() !=null)
{
event.setDisplayname(ProfileUtil.getUsername(ePlayer.getPlayerDisguiseUUID()));
}
}
示例4: aprilFools
import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void aprilFools(PlayerEvent.NameFormat event)
{
if (D3Core.isAprilFools())
{
event.setDisplayname("§k" + event.getDisplayname());
}
}
示例5: onNameFormat
import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onNameFormat(PlayerEvent.NameFormat event)
{
if(event.username.equals("robin4002"))
{
event.displayname = "[MFF]robin4002";
}
}
示例6: getPlayerDisplayName
import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
public static String getPlayerDisplayName(EntityPlayer player, String username)
{
PlayerEvent.NameFormat event = new PlayerEvent.NameFormat(player, username);
MinecraftForge.EVENT_BUS.post(event);
return event.getDisplayname();
}
示例7: getPlayerDisplayName
import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
public static String getPlayerDisplayName(EntityPlayer player, String username)
{
PlayerEvent.NameFormat event = new PlayerEvent.NameFormat(player, username);
MinecraftForge.EVENT_BUS.post(event);
return event.displayname;
}
示例8: PlayerNameFormatting
import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void PlayerNameFormatting(PlayerEvent.NameFormat event)
{
if (this.usernamePropsRegistry.containsKey(event.getUsername()))
event.setDisplayname(this.usernamePropsRegistry.get(event.getUsername()).get("nickname"));
}
示例9: getKillDisplayName
import net.minecraftforge.event.entity.player.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void getKillDisplayName(PlayerEvent.NameFormat nameEvt) {
if (nameEvt.getUsername() != null && nameEvt.getUsername().startsWith(USERNAME)) {
nameEvt.setDisplayname(getLocalizedName());
}
}