1

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?

2

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
}
  • This working perfectly. Thanks a lot for helping me out :) – icecub Dec 7 '17 at 3:44

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.