コード例 #1
0
  // Overriden from EntityInsentient - Most importantly overrides pathfinding selectors
  @Override
  protected void bn() {
    super.bn();
    ++this.aU;

    this.w();

    this.getEntitySenses().a();

    // If this ever happens...
    if (this.petGoalSelector == null) {
      this.remove(false);
      return;
    }
    this.petGoalSelector.updateGoals();

    this.getNavigation().f();

    this.bo();

    this.getControllerMove().c();
    this.getControllerLook().a();
    this.getControllerJump().b();
  }
コード例 #2
0
ファイル: EntityPet.java プロジェクト: NAT007/EchoPet
 // Entity
 @Override
 protected void a(int i, int j, int k, Block block) {
   super.a(i, j, k, block);
   makeStepSound(i, j, k, block);
 }
コード例 #3
0
ファイル: EntityPet.java プロジェクト: NAT007/EchoPet
 // EntityLiving
 @Override
 protected void c() {
   super.c();
   initDatawatcher();
 }
コード例 #4
0
ファイル: EntityPet.java プロジェクト: NAT007/EchoPet
 // Entity
 @Override
 public void h() {
   super.h();
   // this.C();
   onLive();
 }
コード例 #5
0
ファイル: EntityPet.java プロジェクト: NAT007/EchoPet
  // EntityInsentient
  @Override
  public void e(float sideMot, float forwMot) {
    if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
      super.e(sideMot, forwMot);
      // https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/EntityHorse.java#L914
      this.X = 0.5F;
      return;
    }
    EntityHuman human = (EntityHuman) this.passenger;
    if (human.getBukkitEntity() != this.getPlayerOwner().getPlayer()) {
      super.e(sideMot, forwMot);
      this.X = 0.5F;
      return;
    }

    this.X = 1.0F;

    this.lastYaw = this.yaw = this.passenger.yaw;
    this.pitch = this.passenger.pitch * 0.5F;
    this.b(this.yaw, this.pitch);
    this.aP = this.aN = this.yaw;

    sideMot = ((EntityLiving) this.passenger).be * 0.5F;
    forwMot = ((EntityLiving) this.passenger).bf;

    if (forwMot <= 0.0F) {
      forwMot *= 0.25F;
    }
    sideMot *= 0.75F;

    PetRideMoveEvent moveEvent = new PetRideMoveEvent(this.getPet(), forwMot, sideMot);
    EchoPet.getPlugin().getServer().getPluginManager().callEvent(moveEvent);
    if (moveEvent.isCancelled()) {
      return;
    }

    this.i(this.rideSpeed);
    super.e(moveEvent.getSidewardMotionSpeed(), moveEvent.getForwardMotionSpeed());

    PetType pt = this.getPet().getPetType();
    if (FIELD_JUMP != null && this.passenger != null) {
      if (EchoPet.getOptions().canFly(pt)) {
        try {
          if (((Player) (human.getBukkitEntity())).isFlying()) {
            ((Player) (human.getBukkitEntity())).setFlying(false);
          }
          if (FIELD_JUMP.getBoolean(this.passenger)) {
            PetRideJumpEvent rideEvent = new PetRideJumpEvent(this.getPet(), this.jumpHeight);
            EchoPet.getPlugin().getServer().getPluginManager().callEvent(rideEvent);
            if (!rideEvent.isCancelled()) {
              this.motY = 0.5F;
            }
          }
        } catch (IllegalArgumentException e) {
          Logger.log(
              Logger.LogLevel.WARNING,
              "Failed to initiate Pet Flying Motion for "
                  + this.getPlayerOwner().getName()
                  + "'s Pet.",
              e,
              true);
        } catch (IllegalAccessException e) {
          Logger.log(
              Logger.LogLevel.WARNING,
              "Failed to initiate Pet Flying Motion for "
                  + this.getPlayerOwner().getName()
                  + "'s Pet.",
              e,
              true);
        } catch (IllegalStateException e) {
          Logger.log(
              Logger.LogLevel.WARNING,
              "Failed to initiate Pet Flying Motion for "
                  + this.getPlayerOwner().getName()
                  + "'s Pet.",
              e,
              true);
        }
      } else if (this.onGround) {
        try {
          if (FIELD_JUMP.getBoolean(this.passenger)) {
            PetRideJumpEvent rideEvent = new PetRideJumpEvent(this.getPet(), this.jumpHeight);
            EchoPet.getPlugin().getServer().getPluginManager().callEvent(rideEvent);
            if (!rideEvent.isCancelled()) {
              this.motY = rideEvent.getJumpHeight();
              doJumpAnimation();
            }
          }
        } catch (IllegalArgumentException e) {
          Logger.log(
              Logger.LogLevel.WARNING,
              "Failed to initiate Pet Jumping Motion for "
                  + this.getPlayerOwner().getName()
                  + "'s Pet.",
              e,
              true);
        } catch (IllegalAccessException e) {
          Logger.log(
              Logger.LogLevel.WARNING,
              "Failed to initiate Pet Jumping Motion for "
                  + this.getPlayerOwner().getName()
                  + "'s Pet.",
              e,
              true);
        } catch (IllegalStateException e) {
          Logger.log(
              Logger.LogLevel.WARNING,
              "Failed to initiate Pet Jumping Motion for "
                  + this.getPlayerOwner().getName()
                  + "'s Pet.",
              e,
              true);
        }
      }
    }
  }
コード例 #6
0
ファイル: EntityPet.java プロジェクト: NAT007/EchoPet
 @Override
 public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
   super.setPositionRotation(d0, d1, d2, f, f1);
 }