/**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {
    if (this.worldObj.isDaytime() && !this.worldObj.isRemote) {
      float f = this.getBrightness(1.0F);

      if (f > 0.5F
          && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F
          && this.worldObj.canBlockSeeSky(
              new BlockPos(
                  MathHelper.floor_double(this.posX),
                  MathHelper.floor_double(this.posY),
                  MathHelper.floor_double(this.posZ)))) {
        boolean flag = true;
        ItemStack itemstack = this.getEquipmentInSlot(4);

        if (itemstack != null) {
          if (itemstack.isItemStackDamageable()) {
            itemstack.setItemDamage(itemstack.getItemDamage() + this.rand.nextInt(2));

            if (itemstack.getItemDamage() >= itemstack.getMaxDamage()) {
              this.renderBrokenItemStack(itemstack);
              this.setCurrentItemOrArmor(4, (ItemStack) null);
            }
          }

          flag = false;
        }
      }
    }

    super.onLivingUpdate();
  }
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {
    super.onLivingUpdate();

    if (handleWaterMovement()) {
      motionY = 0.15999999642372131D;
    }
  }
  @Override
  public void onLivingUpdate() {
    super.onLivingUpdate();
    this.field_70888_h = this.field_70886_e;
    this.field_70884_g = this.destPos;
    this.destPos = (float) (this.destPos + (this.onGround ? -1 : 4) * 0.3D);

    if (this.destPos < 0.0F) {
      this.destPos = 0.0F;
    }

    if (this.destPos > 1.0F) {
      this.destPos = 1.0F;
    }

    if (!this.onGround && this.field_70889_i < 1.0F) {
      this.field_70889_i = 1.0F;
    }

    this.field_70889_i = (float) (this.field_70889_i * 0.9D);

    if (!this.onGround && this.motionY < 0.0D) {
      this.motionY *= 0.6D;
    }

    this.field_70886_e += this.field_70889_i * 2.0F;
  }
  @Override
  public void onLivingUpdate() {
    if (this.worldObj.isRemote) {
      if (this.rand.nextInt(100) == 0 && !this.isSilent()) {
        this.worldObj.playSound(
            this.posX + 0.5D,
            this.posY + 0.5D,
            this.posZ + 0.5D,
            SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE,
            this.getSoundCategory(),
            (1.0F + this.rand.nextFloat()) / 4,
            this.rand.nextFloat() * 0.7F + 0.3F,
            false);
      }

      for (int i = 0; i < 2; ++i) {
        this.worldObj.spawnParticle(
            EnumParticleTypes.SNOW_SHOVEL,
            this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width,
            this.posY + this.getEyeHeight(),
            this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width,
            0.0D,
            0.0D,
            0.0D,
            new int[0]);
      }
    }

    super.onLivingUpdate();
  }
  @Override
  public void onLivingUpdate() {
    final EntityPlayer player =
        this.worldObj.getClosestPlayer(this.posX, this.posY, this.posZ, 20.0);

    if (player != null && !player.equals(this.targetEntity)) {
      if (this.getDistanceSqToEntity(player) < 400.0D) {
        this.getNavigator().getPathToEntityLiving(player);
        this.targetEntity = player;
      }
    } else {
      this.targetEntity = null;
    }

    new Vector3(this);

    if (this.roomCoords != null && this.roomSize != null) {
      @SuppressWarnings("unchecked")
      List<Entity> entitiesWithin =
          this.worldObj.getEntitiesWithinAABB(
              EntityPlayer.class,
              AxisAlignedBB.getBoundingBox(
                  this.roomCoords.intX() - 1,
                  this.roomCoords.intY() - 1,
                  this.roomCoords.intZ() - 1,
                  this.roomCoords.intX() + this.roomSize.intX(),
                  this.roomCoords.intY() + this.roomSize.intY(),
                  this.roomCoords.intZ() + this.roomSize.intZ()));

      this.entitiesWithin = entitiesWithin.size();

      if (this.entitiesWithin == 0 && this.entitiesWithinLast != 0) {
        @SuppressWarnings("unchecked")
        List<EntityPlayer> entitiesWithin2 =
            this.worldObj.getEntitiesWithinAABB(
                EntityPlayer.class,
                AxisAlignedBB.getBoundingBox(
                    this.roomCoords.intX() - 11,
                    this.roomCoords.intY() - 11,
                    this.roomCoords.intZ() - 11,
                    this.roomCoords.intX() + this.roomSize.intX() + 10,
                    this.roomCoords.intY() + this.roomSize.intY() + 10,
                    this.roomCoords.intZ() + this.roomSize.intZ() + 10));

        for (EntityPlayer p : entitiesWithin2) {
          p.addChatMessage(new ChatComponentText(GCCoreUtil.translate("gui.skeletonBoss.message")));
        }

        this.setDead();

        if (this.spawner != null) {
          this.spawner.playerCheated = true;
        }

        return;
      }
    }

    super.onLivingUpdate();
  }
示例#6
0
  @Override
  public void onLivingUpdate() {

    super.onLivingUpdate();

    if (!worldObj.isRemote) {

      opacity.setValue(0.3f);

      boolean isIdle = getAITarget() == null;

      // sync a flag that says if we should be flying or not
      flags.set(FlagKeys.IS_FLYING, shouldBeFlying());
      flags.set(FlagKeys.IS_IDLE, isIdle);

      int sinceIdle = flags.ticksSinceSet(FlagKeys.IS_IDLE);

      boolean headInHand = flags.get(FlagKeys.HEAD_IN_HAND);

      int ticksSinceHeadChange = flags.ticksSinceChange(FlagKeys.HEAD_IN_HAND);

      if (DISABLE_HEAD_ANIMATION) {
        headInHand = false;
      } else {
        // if we're not idle, we dont want the head/hand behaviour
        if (!isIdle) {
          headInHand = false;
        } else {
          if (!headInHand
              && Math.min(sinceIdle, ticksSinceHeadChange)
                  > 50 + (20 * worldObj.rand.nextDouble())) {
            headInHand = true;
          } else if (headInHand && ticksSinceHeadChange > 50) {
            headInHand = false;
          }
        }
      }

      if (flags.get(FlagKeys.IS_FLYING)
          && worldObj.getHeightValue((int) posX, (int) posZ) + 1 > posY) {
        /*
         * Flying up causes the entity onGround to be false, nullifying
         * any movement. There is one option, override the movement
         * methods and implement them ourselves. This does provide the
         * opportunity for the ghost to fly through walls, but does make
         * life harder.
         *
         * Also some research needs to be done regarding how this fits
         * with AI
         */
        motionY = Math.max(motionY, 0.1D); /* Fly over blocks */
      }

      flags.set(FlagKeys.HEAD_IN_HAND, headInHand);
    }

    // send all our data to nearby users
    syncMap.sync(worldObj, this, posX, posY, posZ);
  }
示例#7
0
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {
    super.onLivingUpdate();

    if (this.lifeTick > 0) {
      --this.lifeTick;
    } else if (this.lifeTick == 0 && !this.worldObj.isRemote) {
      this.setDead();
    }
  }
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  @SuppressWarnings("unchecked")
  public void onLivingUpdate() {
    if (!(this.dimension == Config.dimensionID && ECUtils.isEventActive("ec3.event.fumes")))
      this.setDead();

    if (!this.worldObj.isRemote) {
      --this.heightOffsetUpdateTime;

      if (this.heightOffsetUpdateTime <= 0) {
        this.heightOffsetUpdateTime = 100;
        this.mX = MathUtils.randomDouble(this.worldObj.rand);
        this.mY = MathUtils.randomDouble(this.worldObj.rand);
        this.mZ = MathUtils.randomDouble(this.worldObj.rand);
        this.setHeightOffset(0.5F + (float) this.rand.nextGaussian() * 3.0F);
      }
      this.motionX = mX / 10;
      this.motionY = mY / 10;
      this.motionZ = mZ / 10;
      if (this.ticksExisted > 1000) this.setDead();
    }
    EssentialCraftCore.proxy.spawnParticle(
        "fogFX", (float) posX, (float) posY + 2, (float) posZ, 0.0F, 1.0F, 0.0F);
    List<EntityPlayer> players =
        this.worldObj.getEntitiesWithinAABB(
            EntityPlayer.class,
            AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1)
                .expand(6, 3, 6));
    for (int i = 0; i < players.size(); ++i) {
      EntityPlayer p = players.get(i);
      boolean ignorePoison = false;
      IInventory b = BaublesApi.getBaubles(p);
      if (b != null) {
        for (int i1 = 0; i1 < b.getSizeInventory(); ++i1) {
          ItemStack is = b.getStackInSlot(i1);
          if (is != null
              && is.getItem() != null
              && is.getItem() instanceof BaublesModifier
              && is.getItemDamage() == 19) ignorePoison = true;
        }
      }
      if (!p.worldObj.isRemote && !ignorePoison) {
        RadiationManager.increasePlayerRadiation(p, 10);
        p.addPotionEffect(new PotionEffect(Potion.poison.id, 200, 1));
      }
    }
    super.onLivingUpdate();
  }
 @Override
 /**
  * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
  * use this to react to sunlight and start to burn.
  */
 public void onLivingUpdate()
 {
     if (this.worldObj.isRemote)
     {
         for (int i = 0; i < 2; ++i) {
         	ChaosBlock.proxy.spawnChaosParticleEffect(this.worldObj, this.posX, this.posY, this.posZ, this.width, this.height, this.rand, false);
         }
     }
     
     this.isJumping = false;
     super.onLivingUpdate();
 }
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {

    boolean var2 = true;
    ItemStack var3 = this.getCurrentItemOrArmor(4);

    if (var3 != null) {
      if (var3.isItemStackDamageable()) {
        var3.setItemDamage(var3.getItemDamageForDisplay() + this.rand.nextInt(2));

        if (var3.getItemDamageForDisplay() >= var3.getMaxDamage()) {
          this.renderBrokenItemStack(var3);
          this.setCurrentItemOrArmor(4, (ItemStack) null);
        }
      }
    }

    super.onLivingUpdate();
  }
  public void onLivingUpdate() {

    time++;
    if (invul) {
      particles(posX, posY, posZ);
      particles(posX, posY + 1, posZ);
      particles(posX, posY + 2, posZ);
      particles(posX, posY + 3, posZ);
    }
    if (time == tmp[0]) {
      this.setInvul(false);
      setEstado(1);

      if (!this.worldObj.isRemote) {
        invoca(0);
      }
      // invoca(0);
      setInvul(true);
      setmoveSpeed(0f);
    }
    if (time == tmp[1]) {
      setEstado(1);

      this.setInvul(true);

      if (!this.worldObj.isRemote) {
        invoca(1);
      }
      setInvul(true);
      setmoveSpeed(0f);
    }
    if (time == tmp[2]) {
      setEstado(0);

      this.setInvul(false);
    }
    if (time == tmp[3]) {
      setEstado(0);
      time = 0;
    }
    super.onLivingUpdate();
  }
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {
    super.onLivingUpdate();

    if (rand.nextInt(2) == 0) {
      timeleft--;
    }

    if (timeleft < 500 && timeleft > 300) {
      texture = "/mob/creeps/hunchbackskeleton2.png";
    } else if (timeleft < 300 && timeleft > 200) {
      texture = "/mob/creeps/hunchbackskeleton3.png";
    } else if (timeleft < 200 && timeleft > 100) {
      texture = "/mob/creeps/hunchbackskeleton4.png";
    } else if (timeleft < 100 && timeleft > 1) {
      texture = "/mob/creeps/hunchbackskeleton5.png";
    } else if (timeleft < 1) {
      smoke();
      health = 0;
      setDead();
    }
  }
示例#13
0
 public void onLivingUpdate() {
   if (ticksExisted > 20 * 20) setDead();
   super.onLivingUpdate();
 }
示例#14
0
 public void onLivingUpdate() {
   super.onLivingUpdate();
 }
示例#15
0
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {
    this.motionY *= 0.6000000238418579D;
    double d1;
    double d3;
    double d5;

    if (!this.worldObj.isRemote && this.getWatchedTargetId(0) > 0) {
      Entity entity = this.worldObj.getEntityByID(this.getWatchedTargetId(0));

      if (entity != null) {
        if (this.posY < entity.posY || !this.isArmored() && this.posY < entity.posY + 5.0D) {
          if (this.motionY < 0.0D) {
            this.motionY = 0.0D;
          }

          this.motionY += (0.5D - this.motionY) * 0.6000000238418579D;
        }

        double d0 = entity.posX - this.posX;
        d1 = entity.posZ - this.posZ;
        d3 = d0 * d0 + d1 * d1;

        if (d3 > 9.0D) {
          d5 = (double) MathHelper.sqrt_double(d3);
          this.motionX += (d0 / d5 * 0.5D - this.motionX) * 0.6000000238418579D;
          this.motionZ += (d1 / d5 * 0.5D - this.motionZ) * 0.6000000238418579D;
        }
      }
    }

    if (this.motionX * this.motionX + this.motionZ * this.motionZ > 0.05000000074505806D) {
      this.rotationYaw =
          (float) Math.atan2(this.motionZ, this.motionX) * (180F / (float) Math.PI) - 90.0F;
    }

    super.onLivingUpdate();
    int i;

    for (i = 0; i < 2; ++i) {
      this.field_82218_g[i] = this.field_82221_e[i];
      this.field_82217_f[i] = this.field_82220_d[i];
    }

    int j;

    for (i = 0; i < 2; ++i) {
      j = this.getWatchedTargetId(i + 1);
      Entity entity1 = null;

      if (j > 0) {
        entity1 = this.worldObj.getEntityByID(j);
      }

      if (entity1 != null) {
        d1 = this.func_82214_u(i + 1);
        d3 = this.func_82208_v(i + 1);
        d5 = this.func_82213_w(i + 1);
        double d6 = entity1.posX - d1;
        double d7 = entity1.posY + (double) entity1.getEyeHeight() - d3;
        double d8 = entity1.posZ - d5;
        double d9 = (double) MathHelper.sqrt_double(d6 * d6 + d8 * d8);
        float f = (float) (Math.atan2(d8, d6) * 180.0D / Math.PI) - 90.0F;
        float f1 = (float) (-(Math.atan2(d7, d9) * 180.0D / Math.PI));
        this.field_82220_d[i] = this.func_82204_b(this.field_82220_d[i], f1, 40.0F);
        this.field_82221_e[i] = this.func_82204_b(this.field_82221_e[i], f, 10.0F);
      } else {
        this.field_82221_e[i] =
            this.func_82204_b(this.field_82221_e[i], this.renderYawOffset, 10.0F);
      }
    }

    boolean flag = this.isArmored();

    for (j = 0; j < 3; ++j) {
      double d10 = this.func_82214_u(j);
      double d2 = this.func_82208_v(j);
      double d4 = this.func_82213_w(j);
      this.worldObj.spawnParticle(
          "smoke",
          d10 + this.rand.nextGaussian() * 0.30000001192092896D,
          d2 + this.rand.nextGaussian() * 0.30000001192092896D,
          d4 + this.rand.nextGaussian() * 0.30000001192092896D,
          0.0D,
          0.0D,
          0.0D);

      if (flag && this.worldObj.rand.nextInt(4) == 0) {
        this.worldObj.spawnParticle(
            "mobSpell",
            d10 + this.rand.nextGaussian() * 0.30000001192092896D,
            d2 + this.rand.nextGaussian() * 0.30000001192092896D,
            d4 + this.rand.nextGaussian() * 0.30000001192092896D,
            0.699999988079071D,
            0.699999988079071D,
            0.5D);
      }
    }

    if (this.func_82212_n() > 0) {
      for (j = 0; j < 3; ++j) {
        this.worldObj.spawnParticle(
            "mobSpell",
            this.posX + this.rand.nextGaussian() * 1.0D,
            this.posY + (double) (this.rand.nextFloat() * 3.3F),
            this.posZ + this.rand.nextGaussian() * 1.0D,
            0.699999988079071D,
            0.699999988079071D,
            0.8999999761581421D);
      }
    }
  }
  @Override
  public void onLivingUpdate() {
    if (this.ticks >= Long.MAX_VALUE) {
      this.ticks = 1;
    }

    this.ticks++;

    if (this.getHealth() <= 0) {
      this.headsRemaining = 0;
    } else if (this.getHealth() <= this.getMaxHealth() / 3.0) {
      this.headsRemaining = 1;
    } else if (this.getHealth() <= 2 * (this.getMaxHealth() / 3.0)) {
      this.headsRemaining = 2;
    }

    final EntityPlayer player =
        this.worldObj.getClosestPlayer(this.posX, this.posY, this.posZ, 20.0);

    if (player != null && !player.equals(this.targetEntity)) {
      if (this.getDistanceSqToEntity(player) < 400.0D) {
        this.getNavigator().getPathToEntityLiving(player);
        this.targetEntity = player;
      }
    } else {
      this.targetEntity = null;
    }

    new Vector3(this);

    if (this.roomCoords != null && this.roomSize != null) {
      @SuppressWarnings("unchecked")
      List<Entity> entitiesWithin =
          this.worldObj.getEntitiesWithinAABB(
              EntityPlayer.class,
              AxisAlignedBB.getAABBPool()
                  .getAABB(
                      this.roomCoords.intX() - 1,
                      this.roomCoords.intY() - 1,
                      this.roomCoords.intZ() - 1,
                      this.roomCoords.intX() + this.roomSize.intX(),
                      this.roomCoords.intY() + this.roomSize.intY(),
                      this.roomCoords.intZ() + this.roomSize.intZ()));

      this.entitiesWithin = entitiesWithin.size();

      if (this.entitiesWithin == 0 && this.entitiesWithinLast != 0) {
        @SuppressWarnings("unchecked")
        List<EntityPlayer> entitiesWithin2 =
            this.worldObj.getEntitiesWithinAABB(
                EntityPlayer.class,
                AxisAlignedBB.getAABBPool()
                    .getAABB(
                        this.roomCoords.intX() - 11,
                        this.roomCoords.intY() - 11,
                        this.roomCoords.intZ() - 11,
                        this.roomCoords.intX() + this.roomSize.intX() + 10,
                        this.roomCoords.intY() + this.roomSize.intY() + 10,
                        this.roomCoords.intZ() + this.roomSize.intZ() + 10));

        for (EntityPlayer p : entitiesWithin2) {
          p.sendChatToPlayer(
              ChatMessageComponent.createFromText(
                  "Boss despawned, don't leave the boss room while fighting! Re-enter room to respawn boss."));
        }

        this.setDead();

        if (this.spawner != null) {
          this.spawner.playerCheated = true;
        }

        return;
      }

      this.entitiesWithinLast = this.entitiesWithin;
    }

    super.onLivingUpdate();
  }