ItemEvents.tooltip(event => {
    const eyes = {
        'endrem:cold_eye': ["Frost-bitten and ancient.", "Forged from the frozen depths of the tundra and quelling the Frost Stalker threat."],
        'endrem:corrupted_eye': ["Tainted by greed.", "Plucked from the remains of the Old Champion after laying its Frenzied Shade to rest."],
        'endrem:lost_eye': ["A vision of a forgotten age.", "It resonates with the silence left behind by the defeat of the Fallen Icon."],
        'endrem:nether_eye': ["Forged in the fires of the deep.", "A trophy proving one's victory over the Nether Gauntlet's iron grip."],
        'endrem:cursed_eye': ["A heavy, dark aura radiates from this iris.", "Taken from the throne of the Decaying King."],
        'endrem:evil_eye': ["It stares with a piercing, hollow gaze.", "Pieced together from the echoing depths of the Ancient City."],
        'endrem:guardian_eye': ["Damp and pulsating with salt-water energy.", "Snatched from the heart of the Ocean Monument's treasures."],
        'endrem:magical_eye': ["A shimmering, volatile focus.", "It only manifests once the Day Stalker has been driven from the sky."],
        'endrem:wither_eye': ["A void of pure destruction.", "Witnessed the birth and the final breath of the Wither."],
        'endrem:undead_eye': ["Bound to the cycle of life and rot.", "Reclaimed from the soul of the Returning Knight."],
        'endrem:exotic_eye': ["A strange, ethereal glow.", "Yielded by the death of the Void Blossom or the fading light of the Night Lich."],
        'endrem:cryptic_eye': ["It whispers of secrets and shadows.", "Obtained by outsmarting and defeating the Night Prowler."]
    };

    Object.keys(eyes).forEach(id => {
        event.addAdvanced(id, (item, itm, tooltip) => {
            // Store the display name (Index 0) and the technical ID (if it exists)
            const displayName = tooltip.get(0);
            let technicalId = null;
            
            // If the last line contains a colon, it's likely the technical ID (F3+H)
            let lastLine = tooltip.get(tooltip.size() - 1).getString();
            if (lastLine.contains(":")) {
                technicalId = tooltip.get(tooltip.size() - 1);
            }

            // Clear the entire tooltip
            tooltip.clear();

            // Re-add the Name
            tooltip.add(displayName);

            // Add your Lore lines
            tooltip.add(Text.gray(eyes[id][0]));
            tooltip.add(Text.gray(eyes[id][1]));

            // If we found a technical ID earlier, re-add it at the very bottom
            if (technicalId) {
                tooltip.add(technicalId);
            }
        });
    });
});