"Mob-Spawner" .... Always Pig spawner

Discussion in 'Plugin Development' started by lelguy, Sep 5, 2015.

Thread Status:
Not open for further replies.
  1. Offline


    Hey Guys,
    I am trying to code a plugin where it gives a player for example a cow spawner..

    I tried this:
    p.getInventory().addItem(new ItemStack[] { new ItemStack(Material.MOB_SPAWNER, 1, (short) 92) });
    .... I dont know what is wrong with that code to be honest.. on a 1.7 server this works but not on a 1.8 server..
    It always gives me a pig spawner, I have no clue why its keep doing that....

    Anyone help please? xD
  2. Offline


    @lelguy I am not exactly sure why it does not work anymore, besides the fact that the EntityId tag that stores what kind of mob will spawn is a String, not a Short. Anyway, the solution I found is to give the ItemStack a new NBT tag with the mob you want in the EntityId NBTString field.
Thread Status:
Not open for further replies.

Share This Page