Ejemplo n.º 1
0
  public boolean collideEntity(Entity var1) {
    ElevatorsCore.say("Collision detected...");

    if (ElevatorsCore.killBelow && var1.posY < this.posY && var1 instanceof EntityLiving) {
      EntityLiving var2 = (EntityLiving) var1;
      var2.attackEntityFrom(DamageSource.inWall, 50);
      ElevatorsCore.say("Damaging!");
      return true;
    } else {
      return false;
    }
  }
 protected void fall(float f) {
   int i = (int) Math.ceil(f - 3F);
   if (i > 0) {
     attackEntityFrom(null, i);
     int j =
         worldObj.getBlockId(
             MathHelper.floor_double(posX),
             MathHelper.floor_double(posY - 0.20000000298023224D - (double) yOffset),
             MathHelper.floor_double(posZ));
     if (j > 0) {
       StepSound stepsound = Block.blocksList[j].stepSound;
       worldObj.playSoundAtEntity(
           this,
           stepsound.func_1145_d(),
           stepsound.func_1147_b() * 0.5F,
           stepsound.func_1144_c() * 0.75F);
     }
   }
 }
 public void handleHealthUpdate(byte byte0) {
   if (byte0 == 2) {
     field_704_R = 1.5F;
     field_9306_bj = field_9366_o;
     hurtTime = maxHurtTime = 10;
     attackedAtYaw = 0.0F;
     worldObj.playSoundAtEntity(
         this,
         getHurtSound(),
         getSoundVolume(),
         (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
     attackEntityFrom(null, 0);
   } else if (byte0 == 3) {
     worldObj.playSoundAtEntity(
         this,
         getDeathSound(),
         getSoundVolume(),
         (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
     health = 0;
     onDeath(null);
   } else {
     super.handleHealthUpdate(byte0);
   }
 }
 protected void kill() {
   attackEntityFrom(null, 4);
 }
  public void onEntityUpdate() {
    prevSwingProgress = swingProgress;
    super.onEntityUpdate();
    if (rand.nextInt(1000) < field_4121_a++) {
      field_4121_a = -func_421_b();
      func_22050_O();
    }
    if (isEntityAlive() && func_345_I()) {
      attackEntityFrom(null, 1);
    }
    if (isImmuneToFire || worldObj.multiplayerWorld) {
      fire = 0;
    }
    if (isEntityAlive() && isInsideOfMaterial(Material.water) && !canBreatheUnderwater()) {
      air--;
      if (air == -20) {
        air = 0;
        for (int i = 0; i < 8; i++) {
          float f = rand.nextFloat() - rand.nextFloat();
          float f1 = rand.nextFloat() - rand.nextFloat();
          float f2 = rand.nextFloat() - rand.nextFloat();
          worldObj.spawnParticle(
              "bubble",
              posX + (double) f,
              posY + (double) f1,
              posZ + (double) f2,
              motionX,
              motionY,
              motionZ);
        }

        attackEntityFrom(null, 2);
      }
      fire = 0;
    } else {
      air = maxAir;
    }
    field_9329_Q = field_9328_R;
    if (attackTime > 0) {
      attackTime--;
    }
    if (hurtTime > 0) {
      hurtTime--;
    }
    if (field_9306_bj > 0) {
      field_9306_bj--;
    }
    if (health <= 0) {
      deathTime++;
      if (deathTime > 20) {
        func_6392_F();
        setEntityDead();
        for (int j = 0; j < 20; j++) {
          double d = rand.nextGaussian() * 0.02D;
          double d1 = rand.nextGaussian() * 0.02D;
          double d2 = rand.nextGaussian() * 0.02D;
          worldObj.spawnParticle(
              "explode",
              (posX + (double) (rand.nextFloat() * width * 2.0F)) - (double) width,
              posY + (double) (rand.nextFloat() * height),
              (posZ + (double) (rand.nextFloat() * width * 2.0F)) - (double) width,
              d,
              d1,
              d2);
        }
      }
    }
    field_9359_x = field_9360_w;
    prevRenderYawOffset = renderYawOffset;
    prevRotationYaw = rotationYaw;
    prevRotationPitch = rotationPitch;
  }