本文整理汇总了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);
}
}
}
}
示例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;
}
}