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


Java EntityWolf.setTarget方法代码示例

本文整理汇总了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);
                }
            }
        }
    }
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:34,代码来源:AbilityHelper.java

示例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);
                }
            }
        }
    }
}
 
开发者ID:Lomeli12,项目名称:Equivalency,代码行数:34,代码来源:AbilityHelper.java


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