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

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

      this.timeSinceIgnited += var1;

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

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

        if (!this.worldObj.isRemote) {
          if (this.getPowered()) {
            this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 6.0F);
          } else {
            this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 3.0F);
          }

          this.setDead();
        }
      }
    }

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

    if (!this.worldObj.isRemote) {
      this.setBesideClimbableBlock(this.isCollidedHorizontally);
    }
  }
예제 #3
0
 public void onUpdate() {
   lastActiveTime = timeSinceIgnited;
   if (worldObj.multiplayerWorld) {
     int i = getCreeperState();
     if (i > 0 && timeSinceIgnited == 0) {
       worldObj.playSoundAtEntity(this, "random.fuse", 1.0F, 0.5F);
     }
     timeSinceIgnited += i;
     if (timeSinceIgnited < 0) {
       timeSinceIgnited = 0;
     }
     if (timeSinceIgnited >= 30) {
       timeSinceIgnited = 30;
     }
   }
   super.onUpdate();
   if (entityToAttack == null && timeSinceIgnited > 0) {
     setCreeperState(-1);
     timeSinceIgnited--;
     if (timeSinceIgnited < 0) {
       timeSinceIgnited = 0;
     }
   }
 }