Solved Parrot Spawn Egg ItemStack

Discussion in 'Spigot Plugin Development' started by Cobwebster, Jun 1, 2017.

  1. Hey guys,

    So when giving yourself a parrot egg via /i or /give, the id is 383:105, however.. This doesn't work?

    ItemStack stack = new ItemStack(Material.MONSTER_EGG, 1, (short) 105);

    It just gives a empty spawn egg, I tried giving it a more well known egg like creeper and it works fine with the testing setup.

    Anyone see the issue? Thanks in advance.
     
  2. Are you using it on the new Build?
     
  3. oh, well shit.
     
  4. Please do not swear on the forums.
     
    • Funny Funny x 3
  5. Its actually built against 1.12-pre2, not as bad as i thought. I'll still update further and see if that fixes it, they might of changed a id with it.
     
  6. Okay so I ran it against the latest build, still doesn't work.
     
  7. Show the error please
     
    • Informative Informative x 1

  8. Looks like I got it working, appreciate the replies :)

    Code (Text):
     
    ItemStack stack = new ItemStack(Material.MONSTER_EGG, 1);

    SpawnEggMeta meta = (SpawnEggMeta) stack.getItemMeta();
    meta.setSpawnedType(EntityType.PARROT);
    stack.setItemMeta(meta);

    p.getInventory().addItem(stack);

     

    If anyone else has the same query, the code.