Mob Spawners

Discussion in 'Plugin Development' started by Mycrowut, Jul 31, 2013.

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


    Hey Everyone, I was wondering, where could I start with mob spawners? I tried setting the durability of an ItemStack from numbers 1 through 4 and they all are the pig spawners, any idea of how to do this?

    Thank you,
  2. Offline


    You can not set the creature type in the itemstack, only if the spawner has been placed.
  3. Offline


    How would I go about setting the type of creature to spawn? :/
  4. Offline


    You could use the BlockPlaceEvent:
    public void onBlockPlace(BlockPlaceEvent event) {
        Block block = event.getBlock();
        if (block.getType() == Material.MOB_SPAWNER) {
            CreatureSpawner cs = (CreatureSpawner) block.getState();
    Dont't forget to register the event.

    Edit: I played a little around with ItemMeta, you could add a display name to the item, then you have a spawner as a item with a display name pig, spider or creeper. If you want to have the display name "Mob Spawner", you can add the mob type to the lore of the ItemMeta. With one of this ways you can then get the display name / lore from the itemstack and set the mob type, works fine ;).
  5. Offline


    Get the block and cast to CreatureSpawner. Or
    Edit: No way! Seadragon91
Thread Status:
Not open for further replies.

Share This Page