Пример #1
0
 @Override
 public void updateTask() {
   super.updateTask();
   World world = minime.worldObj;
   if (!world.isRemote && canRidePlayer(targetPlayer)) {
     if (minime.getDistanceToEntity(targetPlayer) < 1.0) {
       targetPlayer.mountEntity(minime);
     }
   }
 }
Пример #2
0
    /** Updates the task */
    public void updateTask() {
      --this.timeToNextAttack;
      EntityLivingBase entitylivingbase = this.spirit.getAttackTarget();
      double d0 = this.spirit.getDistanceSqToEntity(entitylivingbase);

      if (d0 < 256.0D) {
        if (this.timeToNextAttack <= 0) {
          double fireballMotionX = entitylivingbase.posX - this.spirit.posX;
          double fireballMotionY =
              entitylivingbase.getEntityBoundingBox().minY
                  + (double) (entitylivingbase.height / 2.0F)
                  - (this.spirit.posY + (double) (this.spirit.height / 2.0F));
          double fireballMotionZ = entitylivingbase.posZ - this.spirit.posZ;

          this.timeToNextAttack = 50;
          float f = MathHelper.sqrt_float(MathHelper.sqrt_double(d0)) * 0.5F;
          this.spirit.worldObj.playAuxSFXAtEntity(
              null,
              1009,
              new BlockPos((int) this.spirit.posX, (int) this.spirit.posY, (int) this.spirit.posZ),
              0);

          for (int i = 0; i < 1; ++i) {
            EntitySmallFireball entitysmallfireball =
                new EntitySmallFireball(
                    this.spirit.worldObj,
                    this.spirit,
                    fireballMotionX + this.spirit.getRNG().nextGaussian() * (double) f,
                    fireballMotionY,
                    fireballMotionZ + this.spirit.getRNG().nextGaussian() * (double) f);
            entitysmallfireball.posY =
                this.spirit.posY + (double) (this.spirit.height / 2.0F) + 0.5D;
            this.spirit.worldObj.spawnEntityInWorld(entitysmallfireball);
          }
        }

        this.spirit.getLookHelper().setLookPositionWithEntity(entitylivingbase, 10.0F, 10.0F);
      } else {
        this.spirit.getNavigator().clearPathEntity();
        this.spirit
            .getMoveHelper()
            .setMoveTo(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, 1.0D);
      }

      super.updateTask();
    }
Пример #3
0
  /** Updates the task */
  public void updateTask() {
    super.updateTask();

    if (this.entity.getRNG().nextInt(20) == 0) {
      this.entity.worldObj.playAuxSFX(1010, this.targetX, this.targetY, this.targetZ, 0);
    }

    ++this.breakingTime;
    int i = (int) ((float) this.breakingTime / timeToBreak * 10.0F);

    if (i != this.field_75358_j) {
      this.entity.worldObj.destroyBlockInWorldPartially(
          this.entity.entityId, this.targetX, this.targetY, this.targetZ, i);
      this.field_75358_j = i;
    }

    if (this.breakingTime == timeToBreak) {
      this.entity.worldObj.setBlockToAir(this.targetX, this.targetY, this.targetZ);
      this.entity.worldObj.playAuxSFX(1012, this.targetX, this.targetY, this.targetZ, 0);
      this.entity.worldObj.playAuxSFX(
          2001, this.targetX, this.targetY, this.targetZ, this.targetBlockId);
    }
  }