@Override public void startExecuting() { this.animation = EntityAnimation.PREPARE_LEAP; this.entity.getLookHelper().setLookPositionWithEntity(this.target, 30.0F, 30.0F); this.ticked = false; }
public void forceCollideWithPlayer(EntityLivingBase entity, float distance) { if (distance > 1.0F && distance < 8.0F) if (onGround) { getLookHelper().setLookPositionWithEntity(entity, 30.0F, 30.0F); faceEntity(entity, 30.0F, 30.0F); double distanceX = entity.posX - posX; double distanceZ = entity.posZ - posZ; float squareRoot = MathHelper.sqrt(distanceX * distanceX + distanceZ * distanceZ); motionX = distanceX / squareRoot * 0.5D * 0.300000011920929D + motionX * 0.10000000298023224D; motionZ = distanceZ / squareRoot * 0.5D * 0.300000011920929D + motionZ * 0.10000000298023224D; motionY = 0D; } }
/** * Updates the task */ @Override public void updateTask() { dragon.getLookHelper().setLookPositionWithEntity(dragonMate, 10.0F, (float) dragon.getVerticalFaceSpeed()); dragon.getNavigator().tryMoveToEntityLiving(dragonMate, speed); ++spawnBabyDelay; if (spawnBabyDelay == 60) { spawnBaby(); } }
public void updateTask() { this.hippo.getLookHelper().setLookPositionWithEntity(this.targetMate, 10.0F, (float) this.hippo.getVerticalFaceSpeed()); this.hippo.getNavigator().tryMoveToEntityLiving(this.targetMate, this.moveSpeed); ++this.spawnBabyDelay; if (this.spawnBabyDelay >= 60 && this.hippo.getDistanceSq(this.targetMate) < 9.0D) { this.spawnBaby(); } }
@Override public void updateTask() { this.entity.getLookHelper().setLookPositionWithEntity(this.owner, 10.0F, (float) this.entity.getVerticalFaceSpeed()); if (!this.entity.isMovementBlocked()) { if (this.recalculateTime-- <= 0) { this.recalculateTime = 10; if (this.isOwnerFar(this.owner)) { this.entity.getNavigator().tryMoveToEntityLiving(this.owner, 0.8F); } } } }
@Override public final void updateTask() { npc.getLookHelper().setLookPositionWithEntity(target, 30.f, 30.f); double distanceToEntity = this.npc.getDistanceSq(target.posX, target.getEntityBoundingBox().minY, target.posZ); if (shouldCloseOnTarget(distanceToEntity)) { npc.addAITask(TASK_MOVE); moveToEntity(target, distanceToEntity); } else { attackDelay--; doAttack(distanceToEntity); } }
public void updateTask() { this.temptedEntity.getLookHelper().setLookPositionWithEntity(this.temptingPlayer, (float) (this.temptedEntity.getHorizontalFaceSpeed() + 20), (float) this.temptedEntity.getVerticalFaceSpeed()); ArrayList<Integer> slotlist = new ArrayList<Integer>(); if (this.temptedEntity.getDistanceSq(this.temptingPlayer) < 6.25D && !this.temptingPlayer.inventory.isEmpty()) { for (int i = 0; i < this.temptingPlayer.inventory.getSizeInventory(); i++) { if (this.temptingPlayer.inventory.getStackInSlot(i) != ItemStack.EMPTY) { slotlist.add(i); } } int slot = slotlist.get(new Random().nextInt(slotlist.size())); ItemStack randomItem = this.temptingPlayer.inventory.getStackInSlot(slot); this.temptedEntity.setHeldItem(EnumHand.MAIN_HAND, randomItem); this.temptingPlayer.inventory.removeStackFromSlot(slot); this.temptedEntity.flipAI(true); this.temptedEntity.playSound(ModSounds.PIXIE_TAUNT, 1F, 1F); this.temptedEntity.getMoveHelper().action = EntityMoveHelper.Action.WAIT; if (temptingPlayer != null) { this.temptingPlayer.addPotionEffect(new PotionEffect(this.temptedEntity.negativePotions[this.temptedEntity.getColor()], 100)); } } else { this.temptedEntity.getMoveHelper().setMoveTo(this.temptingPlayer.posX, this.temptingPlayer.posY + 1.5F, this.temptingPlayer.posZ, 1D); } }
@Override public void updateTask() { if (target.isDead) { // mission failed! resetTask(); return; } this.npc.getLookHelper().setLookPositionWithEntity(this.target, 10.0F, (float) this.npc.getVerticalFaceSpeed()); double distance = npc.getDistanceSq(target); if (distance > followStopDistance) { this.npc.addAITask(TASK_MOVE + TASK_ATTACK); moveToEntity(target, distance); } else // we've reached the distressed NPC, no need to follow them anymore resetTask(); }
/** * Keep ticking a continuous task that has already been started */ public void updateTask() { this.temptedEntity.getLookHelper().setLookPositionWithEntity(this.temptingPlayer, (float) (this.temptedEntity.getHorizontalFaceSpeed() + 20), (float) this.temptedEntity.getVerticalFaceSpeed()); if (this.temptedEntity.getDistanceSq(this.temptingPlayer) < 6.25D) { this.temptedEntity.getNavigator().clearPath(); } else { this.temptedEntity.getNavigator().tryMoveToEntityLiving(this.temptingPlayer, this.speed); } }
@Override public void updateTask() { this.npc.getLookHelper().setLookPositionWithEntity(this.target, 10.0F, (float) this.npc.getVerticalFaceSpeed()); double distance = npc.getDistanceSq(target); if (distance > followStopDistance) { this.npc.addAITask(TASK_MOVE); moveToEntity(target, distance); } else { this.npc.removeAITask(TASK_MOVE); this.npc.getNavigator().clearPath(); } }
/** * Updates the task */ public void updateTask() { this.dragon.getLookHelper().setLookPositionWithEntity(this.targetMate, 10.0F, (float) this.dragon.getVerticalFaceSpeed()); this.dragon.getNavigator().tryMoveToXYZ(targetMate.posX, targetMate.posY, targetMate.posZ, this.moveSpeed); this.dragon.setFlying(false); this.dragon.setHovering(false); ++this.spawnBabyDelay; if (this.spawnBabyDelay >= 60 && this.dragon.getDistance(this.targetMate) < 35) { this.spawnBaby(); } }
/** * Check if the guard can protect himself with a shield * And if so, do it. * * @return The next IAIState. */ protected IAIState attackProtect() { setDelay(2); final int shieldSlot = InventoryUtils.findFirstSlotInItemHandlerWith(new InvWrapper(getInventory()), Items.SHIELD, -1); if (shieldSlot != -1 && target != null && !target.isDead) { worker.getCitizenItemHandler().setHeldItem(EnumHand.OFF_HAND, shieldSlot); worker.setActiveHand(EnumHand.OFF_HAND); worker.faceEntity(target, (float) TURN_AROUND, (float) TURN_AROUND); worker.getLookHelper().setLookPositionWithEntity(target, (float) TURN_AROUND, (float) TURN_AROUND); worker.decreaseSaturationForContinuousAction(); } return GUARD_ATTACK_PHYSICAL; }
@Override public void updateTask() { animatedBlock.getLookHelper().setLookPositionWithEntity(theOwner, 10.0F, (float) animatedBlock.getVerticalFaceSpeed()); if (--distanceCounter <= 0) { distanceCounter = 10; if (!petPathfinder.tryMoveToEntityLiving(theOwner, moveSpeed)) { if (!animatedBlock.getLeashed()) { if (animatedBlock.getDistanceSq(theOwner) >= 144.0D) { int i = MathHelper.floor(theOwner.posX) - 2; int j = MathHelper.floor(theOwner.posZ) - 2; int k = MathHelper.floor(theOwner.getEntityBoundingBox().minY); for (int l = 0; l <= 4; ++l) { for (int i1 = 0; i1 <= 4; ++i1) { if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && isTeleportFriendlyBlock(i, k, j, l, i1)) { animatedBlock.setLocationAndAngles((double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), animatedBlock.rotationYaw, animatedBlock.rotationPitch); petPathfinder.clearPath(); return; } } } } } } } }
@Override public void updateTask() { if (attackTime > 0) { attackTime--; } else { EntityLivingBase target = entity.getAttackTarget(); if (target != null) { double d0 = this.entity.getDistanceSq(target.posX, target.getEntityBoundingBox().minY, target.posZ); boolean canSee = this.entity.getEntitySenses().canSee(target); boolean couldSee = this.seeTime > 0; if (canSee != couldSee) { this.seeTime = 0; } if (canSee) { ++this.seeTime; this.entity.faceEntity(target, 19.0F, 10.0F); this.entity.getLookHelper().setLookPositionWithEntity(target, 30.0F, 30.0F); } else { --this.seeTime; } if (d0 <= (double) this.maxAttackDistance && this.seeTime >= 20) { attack(target); this.attackTime = attackCooldown; entity.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 20)); } else { this.entity.getNavigator().tryMoveToEntityLiving(target, 1.0); } } } }
entityHost.getNavigator().tryMoveToEntityLiving(attackTarget2, entityMoveSpeed); entityHost.getLookHelper().setLookPositionWithEntity(attackTarget2, 30.0F, 30.0F);
this.pet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, (float) this.pet.getVerticalFaceSpeed());
@SuppressWarnings("deprecation") public void updateTask() { this.tameable.getLookHelper().setLookPositionWithEntity(this.owner, 10.0F, (float) this.tameable.getVerticalFaceSpeed());
public void updateTask() { if (this.owner == null) return; this.entity.getLookHelper().setLookPositionWithEntity(this.owner, 10.0F, (float) this.entity.getVerticalFaceSpeed());
this.thePet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, (float) this.thePet.getVerticalFaceSpeed());
this.thePet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, (float) this.thePet.getVerticalFaceSpeed());