Example #1
0
  /** Called to update the entity's position/logic. */
  public void onUpdate() {
    if (this.isEntityAlive()) {
      this.lastActiveTime = this.timeSinceIgnited;

      if (this.hasIgnited()) {
        this.setCreeperState(1);
      }

      int i = this.getCreeperState();

      if (i > 0 && this.timeSinceIgnited == 0) {
        this.playSound("creeper.primed", 1.0F, 0.5F);
      }

      this.timeSinceIgnited += i;

      if (this.timeSinceIgnited < 0) {
        this.timeSinceIgnited = 0;
      }

      if (this.timeSinceIgnited >= this.fuseTime) {
        this.timeSinceIgnited = this.fuseTime;
        this.explode();
      }
    }

    super.onUpdate();
  }
  @Override
  public void onUpdate() {
    if (this.isEntityAlive()) {
      int f = this.getFuse();
      // Play audio if fuse is active
      if (f > 0) {
        this.playSound("creeper.primed", 1.0F, 0.5F);
      }

      // Tick timer up if its close enough
      if (this.getAttackTarget() != null
          && this.getAttackTarget().getDistanceSqToEntity(this) < 9) {
        setFuse(f + 1);
      }
      // Tick timer down
      else if (f > 1) {
        setFuse(f - 1);
      }

      // If time has been reached detonate
      if (f >= fuseTicks) {
        this.explode();
      }
    }

    super.onUpdate();
  }
  /** Called to update the entity's position/logic. */
  public void onUpdate() {
    super.onUpdate();

    if (ridingEntity == null) {
      for (int i = 0; i < worldObj.loadedEntityList.size(); i++) {
        Entity entity = (Entity) worldObj.loadedEntityList.get(i);

        if (((entity instanceof CREEPSEntityCamel) || entity.riddenByEntity == null)
            && (entity instanceof CREEPSEntityCamel)
            && entity.riddenByEntity == null
            && !((CREEPSEntityCamel) entity).tamed) {
          double d = entity.getDistance(posX, posY, posZ);
          CREEPSEntityCamel creepsentitycamel = (CREEPSEntityCamel) entity;

          if (d < 4D && entity.riddenByEntity == null) {
            mountEntity(entity);
          }

          creepsentitycamel.interest = 0;
          creepsentitycamel.tamed = false;
          creepsentitycamel.name = "";

          if (d < 16D && creepsentitycamel.canEntityBeSeen(this)) {
            this.attackEntity(creepsentitycamel, 0);
          }
        }
      }
    } else {
      rotationYaw = ridingEntity.rotationYaw;
    }
  }
 @Override
 public void onUpdate() {
   if (this.worldObj != null) {
     if (this.worldObj.isRemote) {
       spawnLivingParticles();
     }
   }
   super.onUpdate();
 }
Example #5
0
  /** Called to update the entity's position/logic. */
  public void onUpdate() {
    if (!this.worldObj.isRemote && this.isConverting()) {
      int i = this.getConversionTimeBoost();
      this.conversionTime -= i;

      if (this.conversionTime <= 0) {
        this.convertToVillager();
      }
    }

    super.onUpdate();
  }
  /** Called to update the entity's position/logic. */
  @Override
  public void onUpdate() {
    if (!this.worldObj.isRemote
        && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL
        && this.getSlimeSize() > 0) {
      this.isDead = true;
    }

    this.squishFactor += (this.squishAmount - this.squishFactor) * 0.5F;
    this.prevSquishFactor = this.squishFactor;
    boolean flag = this.onGround;
    super.onUpdate();
    int i;

    if (this.onGround && !flag) {
      i = this.getSlimeSize();

      for (int j = 0; j < i * 8; ++j) {
        float f = this.rand.nextFloat() * (float) Math.PI * 2.0F;
        float f1 = this.rand.nextFloat() * 0.5F + 0.5F;
        float f2 = MathHelper.sin(f) * i * 0.5F * f1;
        float f3 = MathHelper.cos(f) * i * 0.5F * f1;
        this.worldObj.spawnParticle(
            this.getSlimeParticle(),
            this.posX + f2,
            this.boundingBox.minY,
            this.posZ + f3,
            0.0D,
            0.0D,
            0.0D);
      }

      if (this.makesSoundOnLand()) {
        this.playSound(
            this.getJumpSound(),
            this.getSoundVolume(),
            ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F);
      }

      this.squishAmount = -0.5F;
    } else if (!this.onGround && flag) {
      this.squishAmount = 1.0F;
    }

    this.alterSquishAmount();

    if (this.worldObj.isRemote) {
      i = this.getSlimeSize();
      this.setSize(0.6F * i, 0.6F * i);
    }
  }
Example #7
0
 @Override
 public void onUpdate() {
   super.onUpdate();
   if (getAttackTarget() != null) {
     float distance =
         (float)
             getDistance(
                 getAttackTarget().posX,
                 getAttackTarget().boundingBox.minY,
                 getAttackTarget().posZ);
     if (getInflateSize() < 100 && distance > 3) setInflateSize(getInflateSize() + 2);
     if (getInflateSize() >= 100 && distance > 3) shootGooBall(getAttackTarget(), distance);
     if (getInflateSize() == 0) ;
     forceCollideWithPlayer(getAttackTarget(), distance);
   }
 }
Example #8
0
  @Override
  public void onUpdate() {
    super.onUpdate();

    if (getState() == BossState.CHARGING) {
      setCharge(getCharge() + 1);
      if (getCharge() > 200) {
        setState(BossState.SHIELDING);
        worldObj.createExplosion(this, posX, posY, posZ, 5.0f, true);
      }
    } else {
      if (getState() == BossState.SHIELDING) {
        if (!worldObj.isRemote
            && rand.nextInt((int) (getHealth() * 100.0 / getMaxHealth()) + 30) == 0) {
          setState(BossState.ATTACKING);
        }
      }
      if (getState() == BossState.ATTACKING && getCurrentAttack() != null) {
        setCharge(getCharge() + 1);
        if (getCharge() > getCurrentAttack().tickDuration) {
          setState(BossState.SHIELDING);
        } else getCurrentAttack().doAttack(getCharge(), this, worldObj, worldObj.rand);
      }
    }

    MineRad.proxy.generateBossParticles(this);
    if (getBarrierRadius() > -1) doBarrier();

    if (getShieldRadius() > -1) doShield();

    if (getState() != BossState.CHARGING) {
      int height = 0;
      for (int y = (int) posY; y > 0; y--) {
        height++;
        if (!worldObj.isAirBlock((int) Math.floor(posX), y, (int) Math.floor(posZ))) {
          break;
        }
      }

      double targHeight = 8;
      this.motionY = Math.signum(targHeight - height) * 0.1;
    }
  }
  /** Called to update the entity's position/logic. */
  public void onUpdate() {
    if (this.isEntityAlive()) {
      this.lastActiveTime = this.timeSinceIgnited;
      int i = this.getCreeperState();

      if (i > 0 && this.timeSinceIgnited == 0) {
        this.playSound("random.fuse", 1.0F, 0.5F);
      }

      this.timeSinceIgnited += i;

      if (this.timeSinceIgnited < 0) {
        this.timeSinceIgnited = 0;
      }

      if (this.timeSinceIgnited >= this.fuseTime) {
        this.timeSinceIgnited = this.fuseTime;

        if (!this.worldObj.isRemote) {
          boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");

          if (this.getPowered()) {
            this.worldObj.createExplosion(
                this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius * 2), flag);
          } else {
            this.worldObj.createExplosion(
                this, this.posX, this.posY, this.posZ, (float) this.explosionRadius, flag);
          }

          this.setDead();
        }
      }
    }

    super.onUpdate();
  }
 /** Called to update the entity's position/logic. */
 public void onUpdate() {
   this.renderYawOffset = this.rotationYaw;
   super.onUpdate();
 }
Example #11
0
 /** Called to update the entity's position/logic. */
 public void onUpdate() {
   this.moveSpeed = this.entityToAttack != null ? 0.95F : 0.5F;
   super.onUpdate();
 }