Пример #1
0
 @Override
 public void onUpdate() {
   // no homePos chosen yet OR home chest is missing
   if (homePos.x == 0 && homePos.y == 0 && homePos.z == 0
       || Block.getIdFromBlock(worldObj.getBlock(homePos.x, homePos.y, homePos.z)) != CHEST_ID) {
     locateHome();
   }
   this.foodStats.onUpdate(this);
   super.onUpdate();
 }
Пример #2
0
 @Override
 public void onUpdate() {
   super.onUpdate();
   if (this.getEntityBoundingBox() != null) {
     for (int i = 0; i < 4; i++) {
       Vec3d particle = Utils.randomPointInAABB(this.getEntityBoundingBox());
       if (rand.nextInt(2) == 0) {
         // getEntityWorld().spawnParticle(EnumParticleTypes.CRIT, particle.xCoord,
         // particle.yCoord, particle.zCoord, 0, 0, 0, 0);
       }
     }
   }
 }
Пример #3
0
  @Override
  public void onUpdate() {
    super.onUpdate();
    updateEntityAttributes();
    updateAbility();
    setHitboxSize();

    if (!worldObj.isRemote) {
      setBesideClimbableBlock(isCollidedHorizontally);

      if (getHealth() > 0) {
        // Since attributes can change over this spider's life time, consistently update the
        // attributes.
        updateEntityAttributes();
      }

      // Always try to follow the owner first.
      if (!tryFollowOwnerPlayer()) {
        // If we can't, then attack our target if we have one.
        if (target != null && !target.isDead) {
          attackEntity(target, 3.5F);
        }

        // Or if our target is now dead, reset the target and register it as a kill.
        else if (target != null && target.isDead) {
          registerKill();
          target = null;
        } else // With no target, find one.
        {
          target = findEntityToAttack();
        }

        // Move to the spider rod inline with attacking to keep the spider in range of the rod
        // but still be able to defend itself.
        tryMoveToSpiderRod();
      }

      // The pack spider scans the area for items and picks them up if they're within 3 blocks.
      if (this.getSpiderType() == EnumSpiderType.PACK) {
        for (Entity entity :
            RadixLogic.getAllEntitiesOfTypeWithinDistance(EntityItem.class, this, 3)) {
          EntityItem item = (EntityItem) entity;
          item.setDead();

          inventory.addItemStackToInventory(item.getEntityItem());
        }
      }
    }
  }
Пример #4
0
 @Override
 public void onUpdate() {
   super.onUpdate();
   if (!worldObj.isRemote && onGround && randJump() && !isEating) jump();
 }