@Override public boolean a(EntityHuman entity) { if (this.getRemoteEntity() == null) return super.a(entity); if (!(entity.getBukkitEntity() instanceof Player)) return super.a(entity); return ((RemoteBaseEntity) this.m_remoteEntity).onInteract((Player) entity.getBukkitEntity()) && super.a(entity); }
// Entity // public boolean a_(EntityHuman human) { 1.5 public boolean a(EntityHuman human) { // 1.6 /*if (super.a_(human)) { return false; }*/ if (human.getBukkitEntity() == this.getOwner().getPlayer()) { if ((Boolean) EchoPet.getPluginInstance().DO.getConfigOption("petMenuOnInteract", true)) { 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; }
@Override public void e(float f, float f1) { // f = sidewards, f1 = forwards/backwards // Can only jump over half slabs if the rider is not the owner // I like this idea // https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/EntityHorse.java#L914 if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(f, f1); this.Y = 0.5F; return; } EntityHuman human = (EntityHuman) this.passenger; if (human.getBukkitEntity() != this.getOwner().getPlayer()) { super.e(f, f1); this.Y = 0.5F; return; } this.Y = 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; f = ((EntityLiving) this.passenger).be * 0.5F; f1 = ((EntityLiving) this.passenger).bf; if (f1 <= 0.0F) { f1 *= 0.25F; } f *= 0.75F; PetRideMoveEvent moveEvent = new PetRideMoveEvent(this.getPet(), f1, f); EchoPet.getPluginInstance().getServer().getPluginManager().callEvent(moveEvent); if (moveEvent.isCancelled()) { return; } this.i(this.rideSpeed); super.e(moveEvent.getSidewardMotionSpeed(), moveEvent.getForwardMotionSpeed()); // https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/EntityLiving.java#L1322-L1334 PetType pt = this.getPet().getPetType(); if (jump != null) { if (EchoPet.getPluginInstance().DO.canFly(pt)) { try { if (jump.getBoolean(this.passenger)) { PetRideJumpEvent rideEvent = new PetRideJumpEvent(this.getPet(), this.jumpHeight); EchoPet.getPluginInstance().getServer().getPluginManager().callEvent(rideEvent); if (!rideEvent.isCancelled()) { this.motY = 0.5F; } } } catch (Exception e) { EchoPet.getPluginInstance() .severe( e, "Failed to initiate Pet Flying Motion for " + this.getOwner().getName() + "'s Pet."); } } else if (this.onGround) { try { if (jump.getBoolean(this.passenger)) { PetRideJumpEvent rideEvent = new PetRideJumpEvent(this.getPet(), this.jumpHeight); EchoPet.getPluginInstance().getServer().getPluginManager().callEvent(rideEvent); if (!rideEvent.isCancelled()) { this.motY = rideEvent.getJumpHeight(); } } } catch (Exception e) { EchoPet.getPluginInstance() .severe( e, "Failed to initiate Pet Jumping Motion for " + this.getOwner().getName() + "'s Pet."); } } } }