Example #1
0
 // Entity
 @Override
 protected void a(int i, int j, int k, Block block) {
   super.a(i, j, k, block);
   makeStepSound(i, j, k, block);
 }
Example #2
0
 // EntityLiving
 @Override
 protected void c() {
   super.c();
   initDatawatcher();
 }
Example #3
0
  // 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.W = 0.5F;
      return;
    }
    EntityHuman human = (EntityHuman) this.passenger;
    if (human.getBukkitEntity() != this.getPlayerOwner().getPlayer()) {
      super.e(sideMot, forwMot);
      this.W = 0.5F;
      return;
    }

    this.W = 1.0F;

    this.lastYaw = this.yaw = this.passenger.yaw;
    this.pitch = this.passenger.pitch * 0.5F;
    this.b(this.yaw, this.pitch);
    this.aO = this.aM = this.yaw;

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

    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);
        }
      }
    }
  }
Example #4
0
 // Entity
 @Override
 public void h() {
   super.h();
   // this.C();
   onLive();
 }
Example #5
0
 @Override
 public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
   super.setPositionRotation(d0, d1, d2, f, f1);
 }