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


Java EntityLiving.hasCustomNameTag方法代码示例

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


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

示例1: isEntityListed

import net.minecraft.entity.EntityLiving; //导入方法依赖的package包/类
private static boolean isEntityListed(Entity_AA turret, Entity entity)
{
	if (entity instanceof EntityPlayer)
	{
		EntityPlayer player = (EntityPlayer) entity;
		
		if (isNameOnWhitelist(turret, player.getDisplayName())) { return true; }	// Not shooting at their friends either
		else if (isNameOnWhitelist(turret, "player")) { return true; }				// Not shooting at players in general
	}
	
	// Creature specific whitelists
	else if (entity instanceof EntityVillager && isNameOnWhitelist(turret, "villager")) { return true; }
	else if (entity instanceof EntityChicken && isNameOnWhitelist(turret, "chicken")) { return true; }
	else if (entity instanceof EntityCow && isNameOnWhitelist(turret, "cow")) { return true; }
	else if (entity instanceof EntityHorse && isNameOnWhitelist(turret, "horse")) { return true; }
	else if (entity instanceof EntityMooshroom && isNameOnWhitelist(turret, "mooshroom")) { return true; }
	else if (entity instanceof EntityOcelot && isNameOnWhitelist(turret, "ocelot")) { return true; }
	else if (entity instanceof EntityPig && isNameOnWhitelist(turret, "pig")) { return true; }
	else if (entity instanceof EntitySheep && isNameOnWhitelist(turret, "sheep")) { return true; }
	else if (entity instanceof EntitySquid && isNameOnWhitelist(turret, "squid")) { return true; }
	else if (entity instanceof EntityWolf && isNameOnWhitelist(turret, "wolf")) { return true; }
	
	// Bosses
	else if (entity instanceof EntityDragon && isNameOnWhitelist(turret, "ender dragon")) { return true; }
	else if (entity instanceof EntityDragonPart && isNameOnWhitelist(turret, "ender dragon")) { return true; }
	else if (entity instanceof EntityWither && isNameOnWhitelist(turret, "wither")) { return true; }
	
	// Hostiles
	else if (entity instanceof EntityBlaze && isNameOnWhitelist(turret, "blaze")) { return true; }
	else if (entity instanceof EntityCaveSpider && isNameOnWhitelist(turret, "cave spider")) { return true; }
	else if (entity instanceof EntityCreeper && isNameOnWhitelist(turret, "creeper")) { return true; }
	else if (entity instanceof EntityEnderman && isNameOnWhitelist(turret, "enderman")) { return true; }
	else if (entity instanceof EntityGhast && isNameOnWhitelist(turret, "ghast")) { return true; }
	else if (entity instanceof EntityGiantZombie && isNameOnWhitelist(turret, "zombie")) { return true; }
	else if (entity instanceof EntityGolem && isNameOnWhitelist(turret, "golem")) { return true; }
	else if (entity instanceof EntityIronGolem && isNameOnWhitelist(turret, "iron golem")) { return true; }
	else if (entity instanceof EntityMagmaCube && isNameOnWhitelist(turret, "magma cube")) { return true; }
	else if (entity instanceof EntityPigZombie && isNameOnWhitelist(turret, "pig zombie")) { return true; }
	else if (entity instanceof EntitySilverfish && isNameOnWhitelist(turret, "silverfish")) { return true; }
	else if (entity instanceof EntitySkeleton && isNameOnWhitelist(turret, "skeleton")) { return true; }
	else if (entity instanceof EntitySlime && isNameOnWhitelist(turret, "slime")) { return true; }
	else if (entity instanceof EntitySnowman && isNameOnWhitelist(turret, "snow golem")) { return true; }
	else if (entity instanceof EntitySpider && isNameOnWhitelist(turret, "spider")) { return true; }
	else if (entity instanceof EntityWitch && isNameOnWhitelist(turret, "witch")) { return true; }
	else if (entity instanceof EntityZombie && isNameOnWhitelist(turret, "zombie")) { return true; }
	
	if (entity instanceof EntityLiving)	// For things with custom names
	{
		EntityLiving living = (EntityLiving) entity;
		
		if (living.hasCustomNameTag())
		{
			if (isNameOnWhitelist(turret, living.getCustomNameTag())) { return true; }
		}
	}
	
	return false;	// Nope. Fire away!
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:59,代码来源:AI_Targeting.java


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