本文整理汇总了Java中net.minecraft.entity.passive.EntityWolf.setTarget方法的典型用法代码示例。如果您正苦于以下问题:Java EntityWolf.setTarget方法的具体用法?Java EntityWolf.setTarget怎么用?Java EntityWolf.setTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.passive.EntityWolf
的用法示例。
在下文中一共展示了EntityWolf.setTarget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: alertPlayerWolves
import net.minecraft.entity.passive.EntityWolf; //导入方法依赖的package包/类
static void alertPlayerWolves (EntityPlayer player, EntityLiving living, boolean par2)
{
if (!(living instanceof EntityCreeper) && !(living instanceof EntityGhast))
{
if (living instanceof EntityWolf)
{
EntityWolf var3 = (EntityWolf) living;
if (var3.isTamed() && player.username.equals(var3.getOwnerName()))
{
return;
}
}
if (!(living instanceof EntityPlayer) || player.func_96122_a((EntityPlayer) living))
{
List var6 = player.worldObj.getEntitiesWithinAABB(EntityWolf.class,
AxisAlignedBB.getAABBPool().getAABB(player.posX, player.posY, player.posZ, player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D));
Iterator var4 = var6.iterator();
while (var4.hasNext())
{
EntityWolf var5 = (EntityWolf) var4.next();
if (var5.isTamed() && var5.getEntityToAttack() == null && player.username.equals(var5.getOwnerName()) && (!par2 || !var5.isSitting()))
{
var5.setSitting(false);
var5.setTarget(living);
}
}
}
}
}
示例2: alertPlayerWolves
import net.minecraft.entity.passive.EntityWolf; //导入方法依赖的package包/类
static void alertPlayerWolves (EntityPlayer player, EntityLivingBase living, boolean par2)
{
if (!(living instanceof EntityCreeper) && !(living instanceof EntityGhast))
{
if (living instanceof EntityWolf)
{
EntityWolf var3 = (EntityWolf) living;
if (var3.isTamed() && player.getDisplayName().equals(var3.getCommandSenderName()))
{
return;
}
}
if (!(living instanceof EntityPlayer) || player.canAttackPlayer((EntityPlayer) living))
{
List var6 = player.worldObj.getEntitiesWithinAABB(EntityWolf.class,
AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D));
Iterator var4 = var6.iterator();
while (var4.hasNext())
{
EntityWolf var5 = (EntityWolf) var4.next();
if (var5.isTamed() && var5.getEntityToAttack() == null && player.getDisplayName().equals(var5.getCommandSenderName()) && (!par2 || !var5.isSitting()))
{
var5.setSitting(false);
var5.setTarget(living);
}
}
}
}
}