// EntityInsentient @Override public boolean a(EntityHuman human) { if (human.getBukkitEntity() == this.getPlayerOwner().getPlayer()) { if (EchoPet.getConfig() .getBoolean( "pets." + this.getPet().getPetType().toString().toLowerCase().replace("_", " ") + ".interactMenu", true) && Perm.BASE_MENU.hasPerm(this.getPlayerOwner(), false, false)) { ArrayList<MenuOption> options = MenuUtil.createOptionList(getPet().getPetType()); int size = this.getPet().getPetType() == PetType.HORSE ? 18 : 9; PetMenu menu = new PetMenu(getPet(), options, size); menu.open(true); } return true; } return false; }
// 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); } } } }
@Override public boolean a(EntityHuman human) { return onInteract((Player) human.getBukkitEntity()); }