当前位置: 首页>>代码示例>>Java>>正文


Java EntityPlayer.getDisplayName方法代码示例

本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.getDisplayName方法的具体用法?Java EntityPlayer.getDisplayName怎么用?Java EntityPlayer.getDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.player.EntityPlayer的用法示例。


在下文中一共展示了EntityPlayer.getDisplayName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Entity_AA

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public Entity_AA(World world, EntityPlayer player) 
{
	super(world);
	
	this.renderDistanceWeight = 10.0d;
	
	if (player != null)
	{
		this.ownerName = player.getDisplayName();
		
		this.setPositionAndRotation(player.posX, player.posY, player.posZ, player.cameraYaw, player.cameraPitch);
		this.worldObj.playSoundAtEntity(this, "random.anvil_land", 0.7f, 1.5f);
	}
	else
	{
		AI_RandomEquip.setupGear(this);	// Hand me my gear!
	}
	
	this.height = 1.65f;
	this.boundingBox.setBounds(-0.5d, 0.0d, -0.5d, 0.5d, this.height, 0.5d);
	
	this.setCanPickUpLoot(false);
	
	this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(this.movementSpeed);
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:26,代码来源:Entity_AA.java

示例2: onUsingTick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
{
	float yaw = player.rotationYaw;
	float pitch = player.rotationPitch;
	if (player.worldObj.isRemote) 
	{
		// The projectile is only allowed to shoot every X ticks, so we're gonna make this happen here
		this.shotCounter += 1;
		if (this.shotCounter >= Ticks) 
		{
			// Only allowing this to happen when the right player uses this
			if (player.getDisplayName() == this.playerName)
			{
 			ScopedPredictive entityarrow = new ScopedPredictive(player.worldObj, player, 2.0F * 1.5F);
 			player.worldObj.spawnEntityInWorld(entityarrow);
			}
			this.shotCounter = 0;
		}
    }
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:22,代码来源:EnderBow.java

示例3: execute

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void execute (MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {

    if (args.length == 2) {

        final EntityPlayer player = getPlayer(server, sender, args[0]);
        final String stage = args[1];

        if (!PlayerDataHandler.getStageData(player).hasUnlockedStage(stage)) {
            throw new CommandException("commands.gamestage.check.failure", new Object[] { player.getDisplayName(), stage });
        }

        notifyCommandListener(sender, this, "commands.gamestage.check.success", new Object[] { player.getDisplayName(), stage });
    }
    else {
        throw new WrongUsageException("commands.gamestage.check.usage", new Object[0]);
    }
}
 
开发者ID:Darkhax-Minecraft,项目名称:Game-Stages,代码行数:19,代码来源:CommandCheckStage.java

示例4: processCommand

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), ichatcomponent.createCopy()});
            ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), ichatcomponent.createCopy()});
            chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(chatcomponenttranslation);
            sender.addChatMessage(chatcomponenttranslation1);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:30,代码来源:CommandMessage.java

示例5: Entity_BB

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public Entity_BB(World world, EntityPlayer player) 
{
	super(world);
	
	this.renderDistanceWeight = 10.0d;
	
	if (player != null)
	{
		this.ownerName = player.getDisplayName();
		
		this.setPositionAndRotation(player.posX, player.posY, player.posZ, player.cameraYaw, player.cameraPitch);
		this.worldObj.playSoundAtEntity(this, "random.anvil_land", 0.7f, 1.5f);
	}
	else
	{
		AI_RandomEquip.setupGear(this);	// Hand me my gear!
	}
	
	this.height = 0.5f;
	this.boundingBox.setBounds(-0.5d, 1.0d, -0.5d, 0.5d, 1.0d + this.height, 0.5d);
	
	this.setCanPickUpLoot(false);
	
	this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(this.movementSpeed);
	
	this.canFly = true;
	this.hasMobilityUpgrade = true;
	
	this.getNavigator().setAvoidsWater(true);	// Airborne, not sea borne
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:31,代码来源:Entity_BB.java

示例6: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
    ArrowNockEvent event = new ArrowNockEvent(player, stack);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.isCanceled()) { return event.result; }

    if (player.capabilities.isCreativeMode || player.inventory.hasItemStack( new ItemStack(Items.arrow) ) )
    {
    	player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); 
    	this.playerName = player.getDisplayName();	// Recording the player name here, so only they can see the projectile
    }
    
    return stack;
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:16,代码来源:EnderBow.java

示例7: execute

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(server, sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget");
        }
        else
        {
            ITextComponent itextcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), itextcomponent.createCopy()});
            TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), itextcomponent.createCopy()});
            textcomponenttranslation.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            textcomponenttranslation1.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(textcomponenttranslation);
            sender.addChatMessage(textcomponenttranslation1);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:30,代码来源:CommandMessage.java

示例8: execute

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(server, sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            ITextComponent itextcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), itextcomponent.createCopy()});
            TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), itextcomponent.createCopy()});
            textcomponenttranslation.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            textcomponenttranslation1.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(textcomponenttranslation);
            sender.addChatMessage(textcomponenttranslation1);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:30,代码来源:CommandMessage.java

示例9: executeCommand

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean executeCommand(final EntityPlayer playerIn)
{
    ICommandSender icommandsender = new ICommandSender()
    {
        public String getName()
        {
            return playerIn.getName();
        }
        public IChatComponent getDisplayName()
        {
            return playerIn.getDisplayName();
        }
        public void addChatMessage(IChatComponent component)
        {
        }
        public boolean canCommandSenderUseCommand(int permLevel, String commandName)
        {
            return permLevel <= 2;
        }
        public BlockPos getPosition()
        {
            return TileEntitySign.this.pos;
        }
        public Vec3 getPositionVector()
        {
            return new Vec3((double)TileEntitySign.this.pos.getX() + 0.5D, (double)TileEntitySign.this.pos.getY() + 0.5D, (double)TileEntitySign.this.pos.getZ() + 0.5D);
        }
        public World getEntityWorld()
        {
            return playerIn.getEntityWorld();
        }
        public Entity getCommandSenderEntity()
        {
            return playerIn;
        }
        public boolean sendCommandFeedback()
        {
            return false;
        }
        public void setCommandStat(CommandResultStats.Type type, int amount)
        {
            TileEntitySign.this.stats.func_179672_a(this, type, amount);
        }
    };

    for (int i = 0; i < this.signText.length; ++i)
    {
        ChatStyle chatstyle = this.signText[i] == null ? null : this.signText[i].getChatStyle();

        if (chatstyle != null && chatstyle.getChatClickEvent() != null)
        {
            ClickEvent clickevent = chatstyle.getChatClickEvent();

            if (clickevent.getAction() == ClickEvent.Action.RUN_COMMAND)
            {
                MinecraftServer.getServer().getCommandManager().executeCommand(icommandsender, clickevent.getValue());
            }
        }
    }

    return true;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:63,代码来源:TileEntitySign.java

示例10: executeCommand

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean executeCommand(final EntityPlayer playerIn)
{
    ICommandSender icommandsender = new ICommandSender()
    {
        public String getName()
        {
            return playerIn.getName();
        }
        public ITextComponent getDisplayName()
        {
            return playerIn.getDisplayName();
        }
        public void addChatMessage(ITextComponent component)
        {
        }
        public boolean canCommandSenderUseCommand(int permLevel, String commandName)
        {
            return permLevel <= 2;
        }
        public BlockPos getPosition()
        {
            return TileEntitySign.this.pos;
        }
        public Vec3d getPositionVector()
        {
            return new Vec3d((double)TileEntitySign.this.pos.getX() + 0.5D, (double)TileEntitySign.this.pos.getY() + 0.5D, (double)TileEntitySign.this.pos.getZ() + 0.5D);
        }
        public World getEntityWorld()
        {
            return playerIn.getEntityWorld();
        }
        public Entity getCommandSenderEntity()
        {
            return playerIn;
        }
        public boolean sendCommandFeedback()
        {
            return false;
        }
        public void setCommandStat(CommandResultStats.Type type, int amount)
        {
            if (TileEntitySign.this.world != null && !TileEntitySign.this.world.isRemote)
            {
                TileEntitySign.this.stats.setCommandStatForSender(TileEntitySign.this.world.getMinecraftServer(), this, type, amount);
            }
        }
        public MinecraftServer getServer()
        {
            return playerIn.getServer();
        }
    };

    for (ITextComponent itextcomponent : this.signText)
    {
        Style style = itextcomponent == null ? null : itextcomponent.getStyle();

        if (style != null && style.getClickEvent() != null)
        {
            ClickEvent clickevent = style.getClickEvent();

            if (clickevent.getAction() == ClickEvent.Action.RUN_COMMAND)
            {
                playerIn.getServer().getCommandManager().executeCommand(icommandsender, clickevent.getValue());
            }
        }
    }

    return true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:70,代码来源:TileEntitySign.java


注:本文中的net.minecraft.entity.player.EntityPlayer.getDisplayName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。