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


Java EntityMob.getCommandSenderName方法代码示例

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


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

示例1: onKeyInputEvent

import net.minecraft.entity.monster.EntityMob; //导入方法依赖的package包/类
@SubscribeEvent
public void onKeyInputEvent(InputEvent.KeyInputEvent event)
{
    if(Keys.findMobs.isPressed())
    {
        EntityPlayer player = FMLClientHandler.instance().getClientPlayerEntity();
        List<EntityMob> list = NearbyMobLocator.findNearbyMobs(player, player.posX, player.posY, player.posZ);
        //If enabled in config
        if (Settings.checkAllTime)
        {
            ChatComponentText preMessage = new ChatComponentText("Nearby Mobs:");
            player.addChatComponentMessage(preMessage);
            if (list.size() != 0)
            {
                for (EntityMob mobFound : list)
                {
                    String MOB_LOCATION = mobFound.getCommandSenderName() + " x: " + (int) mobFound.posX + ", z: " + (int) mobFound.posZ + " (y: " + (int) mobFound.posY + ")";
                    ChatComponentText mobLocation = new ChatComponentText(MOB_LOCATION);
                    player.addChatComponentMessage(mobLocation);
                }
            }
            else
            {
                ChatComponentText message = new ChatComponentText("No Mobs Found Nearby");
                player.addChatComponentMessage(message);
            }
        }
    }
}
 
开发者ID:VikeStep,项目名称:NearbyMobFinder,代码行数:30,代码来源:KeyInputHandler.java

示例2: onServerTick

import net.minecraft.entity.monster.EntityMob; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event)
{
    if(nearbyMobList != null)
    {
        for (EntityMob mobFound : nearbyMobList)
        {
            String MOB_LOCATION = mobFound.getCommandSenderName() + " x: " + (int) mobFound.posX + ", z: " + (int) mobFound.posZ + " (y: " + (int) mobFound.posY + ")";
            ChatComponentText mobLocation = new ChatComponentText(MOB_LOCATION);
            playerRequesting.addChatComponentMessage(mobLocation);
        }
        nearbyMobList = null;
        playerRequesting = null;
    }
}
 
开发者ID:VikeStep,项目名称:NearbyMobFinder,代码行数:16,代码来源:ServerTickHandler.java


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