//  [java]
    public void translate(ServerEntitySetPassengersPacket packet, GeyserSession session) {
        Entity entity;
        if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
            entity = session.getPlayerEntity();
        } else {
            entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
        }

        if (entity == null) return;

        LongOpenHashSet passengers = entity.getPassengers().clone();
        boolean rider = true;
        for (long passengerId : packet.getPassengerIds()) {
            Entity passenger = session.getEntityCache().getEntityByJavaId(passengerId);
            if (passengerId == session.getPlayerEntity().getEntityId()) {
                passenger = session.getPlayerEntity();
                session.setRidingVehicleEntity(entity);
                // We need to confirm teleports before entering a vehicle, or else we will likely exit right out
                session.confirmTeleport(passenger.getPosition().sub(0, EntityType.PLAYER.getOffset(), 0).toDouble());
            }
            // Passenger hasn't loaded in (likely since we're waiting for a skin response)
            // and entity link needs to be set later
            if (passenger == null && passengerId != 0) {
                session.getEntityCache().addCachedPlayerEntityLink(passengerId, packet.getEntityId());
            }
            if (passenger == null) {
                continue;
            }

            EntityLinkData.Type type = rider ? EntityLinkData.Type.RIDER : EntityLinkData.Type.PASSENGER;
            SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
            linkPacket.setEntityLink(new EntityLinkData(entity.getGeyserId(), passenger.getGeyserId(), type, false));
            session.sendUpstreamPacket(linkPacket);
            passengers.add(passengerId);

            // Head rotation on boats
            if (entity.getEntityType() == EntityType.BOAT) {
                passenger.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, (byte) 1);
                passenger.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 90f);
                passenger.getMetadata().put(EntityData.RIDER_MIN_ROTATION, 1f);
                passenger.getMetadata().put(EntityData.RIDER_ROTATION_OFFSET, -90f);
            } else {
                passenger.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, (byte) 0);
                passenger.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 0f);
                passenger.getMetadata().put(EntityData.RIDER_MIN_ROTATION, 0f);
            }

            passenger.updateBedrockMetadata(session);
            rider = false;
        }

        entity.setPassengers(passengers);

        for (long passengerId : entity.getPassengers()) {
            Entity passenger = session.getEntityCache().getEntityByJavaId(passengerId);
            if (passengerId == session.getPlayerEntity().getEntityId()) {
                passenger = session.getPlayerEntity();
            }
            if (passenger == null) {
                continue;
            }
            if (Arrays.stream(packet.getPassengerIds()).noneMatch(id -> id == passengerId)) {
                SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
                linkPacket.setEntityLink(new EntityLinkData(entity.getGeyserId(), passenger.getGeyserId(), EntityLinkData.Type.REMOVE, false));
                session.sendUpstreamPacket(linkPacket);
                passengers.remove(passenger.getEntityId());
                passenger.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, (byte) 0);
                passenger.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 0f);
                passenger.getMetadata().put(EntityData.RIDER_MIN_ROTATION, 0f);
                passenger.getMetadata().put(EntityData.RIDER_ROTATION_OFFSET, 0f);

                EntityUtils.updateMountOffset(passenger, entity, session, false, false, (packet.getPassengerIds().length > 1));
            } else {
                EntityUtils.updateMountOffset(passenger, entity, session, (packet.getPassengerIds()[0] == passengerId), true, (packet.getPassengerIds().length > 1));
            }

            // Force an update to the passenger metadata
            passenger.updateBedrockMetadata(session);
        }

        switch (entity.getEntityType()) {
            case HORSE:
            case SKELETON_HORSE:
            case DONKEY:
            case MULE:
            case RAVAGER:
                entity.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 181.0f);
                entity.updateBedrockMetadata(session);
                break;
        }
    }