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


Java EntityWolf.setAngry方法代码示例

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


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

示例1: calmAngryWolves

import net.minecraft.entity.passive.EntityWolf; //导入方法依赖的package包/类
/**
 * (BROKEN) Calms angry wolves in the protected area
 * If anyone has any idea how to make this work, I'd love to hear it.
 * @param chunkBounds AxisAlignedBB in which block should act
 */
private void calmAngryWolves(AxisAlignedBB chunkBounds) {
	// Currently broken, the wolf that was hit directly does not lose aggro.
	// The wolves aggroed indirectly are properly calmed
	List<EntityWolf> list =  world.getEntitiesWithinAABB(EntityWolf.class, chunkBounds);
	for (EntityWolf wolf : list) {
		if (wolf.isAngry()) {
			wolf.setAttackTarget(null);
			wolf.setRevengeTarget(null);
			wolf.setAngry(false);
		}
	}
}
 
开发者ID:Maxwell-lt,项目名称:MobBlocker,代码行数:18,代码来源:TileEntityChunkProtector.java

示例2: calmAngryWolves

import net.minecraft.entity.passive.EntityWolf; //导入方法依赖的package包/类
/**
 * (BROKEN) Calms angry wolves in the protected area
 * If anyone has any idea how to make this work, I'd love to hear it.
 * @param areaBounds AxisAlignedBB in which block should act
 */
private void calmAngryWolves(AxisAlignedBB areaBounds) {
	// Currently broken, the wolf that was hit directly does not lose aggro.
	// The wolves aggroed indirectly are properly calmed
	List<EntityWolf> list =  world.getEntitiesWithinAABB(EntityWolf.class, areaBounds);
	for (EntityWolf wolf : list) {
		if (wolf.isAngry()) {
			wolf.setAttackTarget(null);
			wolf.setRevengeTarget(null);
			wolf.setAngry(false);
		}
	}
}
 
开发者ID:Maxwell-lt,项目名称:MobBlocker,代码行数:18,代码来源:TileEntityAreaProtector.java

示例3: itemWolf

import net.minecraft.entity.passive.EntityWolf; //导入方法依赖的package包/类
/**
 * The Wolf Backpack is a handy one if you're out in the wild. It checks around for any wolves that may lurk around.
 * If any of them gets mad at you, it will smell the scent of it's kin on you and promptly forget about the whole
 * deal. Smelling like dog is awesome.
 *
 * @param player   the player
 * @param world    the world
 * @param backpack the backpack
 */
@SuppressWarnings("unchecked")
public void itemWolf(EntityPlayer player, World world, ItemStack backpack)
{
    //lastTime is in Ticks for this backpack
    InventoryBackpack inv = new InventoryBackpack(backpack);
    int lastCheckTime =  inv.getLastTime() - 1;

    if (lastCheckTime <= 0)
    {
        lastCheckTime = 20;
        List<EntityWolf> wolves = world.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));
        if (wolves.isEmpty()) return;

        for (EntityWolf wolf : wolves)
        {
            if (wolf.isAngry() && wolf.getAttackTarget() == player)
            {
                wolf.setAngry(false);
                wolf.setAttackTarget(null);
                wolf.setRevengeTarget(null);
                Iterator<?> i2 = wolf.targetTasks.taskEntries.iterator();
                while (i2.hasNext())
                {
                    ((EntityAIBase) i2.next()).resetTask();
                }
            }
        }
    }
    inv.setLastTime(lastCheckTime);
    inv.dirtyTime();
}
 
开发者ID:Darkona,项目名称:AdventureBackpack2,代码行数:45,代码来源:BackpackAbilities.java

示例4: updateAITasks

import net.minecraft.entity.passive.EntityWolf; //导入方法依赖的package包/类
protected void updateAITasks() {
   if(this.func_82212_n() > 0) {
      int i = this.func_82212_n() - 1;
      if(i <= 0) {
         if(this.explosiveEntrance) {
	//lerion ���� ��������
            //super.worldObj.newExplosion(this, super.posX, super.posY + (double)this.getEyeHeight(), super.posZ, 6.0F, false, super.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"));
         }

         super.worldObj.playBroadcastSound(1013, (int)super.posX, (int)super.posY, (int)super.posZ, 0);
      }

      this.func_82215_s(i);
      if(super.ticksExisted % 10 == 0) {
         this.heal(20.0F);
      }
   } else {
      super.updateAITasks();
      if(super.ticksExisted % 20 == 0) {
         this.heal(1.0F);
      }

      if(super.ticksExisted % 20 == 0 && super.worldObj.rand.nextInt(5) == 0 && this.getAttackTarget() != null && !super.worldObj.isRemote && this.getEntitySenses().canSee(this.getAttackTarget())) {
         double wolf = this.getDistanceSq(this.getAttackTarget().posX, this.getAttackTarget().boundingBox.minY, this.getAttackTarget().posZ);
         this.getLookHelper().setLookPositionWithEntity(this.getAttackTarget(), 30.0F, 30.0F);
         float range = 30.0F;
         float f = MathHelper.sqrt_double(wolf) / range;
         float f1 = f;
         if(f < 0.1F) {
            f1 = 0.1F;
         }

         if(f1 > 1.0F) {
            f1 = 1.0F;
         }

         this.attackEntityWithRangedAttack(this.getAttackTarget(), f);
      }

      if(super.ticksExisted % (200 + super.worldObj.rand.nextInt(4) * 100) == 0 && this.getAttackTarget() != null && this.getDistanceSqToEntity(this.getAttackTarget()) <= 256.0D && !super.worldObj.isRemote && this.getEntitySenses().canSee(this.getAttackTarget())) {
         EntityWolf wolf1 = new EntityWolf(super.worldObj);
         wolf1.setLocationAndAngles(super.posX - 0.5D + super.worldObj.rand.nextDouble(), super.posY, super.posZ - 0.5D + super.worldObj.rand.nextDouble(), super.rotationYawHead, super.rotationPitch);
         wolf1.setAngry(true);
         wolf1.setAttackTarget(this.getAttackTarget());
         wolf1.addPotionEffect(new PotionEffect(Potion.resistance.id, 20000, 1));
         ParticleEffect.INSTANT_SPELL.send(SoundEffect.RANDOM_FIZZ, wolf1, 2.0D, 2.0D, 10);
         super.worldObj.spawnEntityInWorld(wolf1);
      }

      if(!super.worldObj.isRemote && this.getNavigator().noPath() && this.getAttackTarget() != null && (long)super.ticksExisted - this.ticksSinceTeleport > 200L) {
         this.ticksSinceTeleport = (long)super.ticksExisted;
         this.teleportToEntity(this.getAttackTarget());
      }
   }

}
 
开发者ID:lerion13,项目名称:witchery,代码行数:57,代码来源:EntityHornedHuntsman.java


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