PacketType.Play.Client.STEER_VEHICLE
l3nnartt opened this issue ยท 0 comments
java.lang.NoSuchMethodError: 'float net.minecraft.network.protocol.game.PacketPlayInSteerVehicle.c()'
maybe it has todo with #2818
We use it to steer pets
rotocolLibrary.getProtocolManager().addPacketListener(
new PacketAdapter(
Plugin.instance,
PacketType.Play.Client.STEER_VEHICLE
) {
@Override
public void onPacketReceiving(PacketEvent event) {
ServerboundPlayerInputPacket packet = (ServerboundPlayerInputPacket) event.getPacket().getHandle();
final Player player = event.getPlayer();
final Entity vehicle = player.getVehicle();
if (vehicle != null) {
EntityPet<?> pet = PetFactory.getPet(vehicle);
Vector vector = pet.calculateSteerVector(player, packet.getZza(), packet.getXxa(), packet.isJumping());
if (vector != null) {
if (Double.isFinite(vector.getX()) && Double.isFinite(vector.getY()) && Double.isFinite(vector.getZ())) {
final Location playerLocation = player.getLocation();
final Entity entity = pet.getEntity();
entity.setVelocity(vector);
entity.setRotation(playerLocation.getYaw(), playerLocation.getPitch());
}
}
}
}
}
);