Minecraft Custom XP orb spawner

minecraft-commandsminecraft-java-edition

I'm currently working on a command that gives the player a custom mob spawner that spawns XP orbs if close enough. The issue is that XP orbs don't actually give any experience unless their entity data "Value" is set. I'm having trouble incorporating that into my command:

/give @p mob_spawner 1 0    
{
    BlockEntityTag:
    {
        SpawnData:
        {
            id:xp_orb
        },
        SpawnCount:1,
        SpawnRange:1,
        RequiredPlayerRange:4,
        Delay:1,
        MinSpawnDelay:1,
        MaxSpawnDelay:3,
        MaxNearbyEntities:3,
        SpawnPotentials:
        [{
            Entity:
            {
                id:"minecraft:xp_orb",
                Data:{
                    Value:"10"
                }
            },
            Weight:"1"
        }]
    },
    display:
    {
        Name:"XP Spawner"
    }
}

The spawner works as expected. But the orbs have no value. XP isn't increased. Could anyone tell me where my error is?

Best Answer

There is no Data tag. Additionally, Value is not a string, and therefore should not be quoted. As seen on the wiki, it is a short (a small whole-number type) and is written with an s after the number.

{
    id: "minecraft:xp_orb",
    Value: 10s
}