Spawners

Discussion in 'Plugin Development' started by ILoveCode, May 16, 2016.

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

    ILoveCode

    Hey! I want to make an ItemStack with that is the type of the spawner mined. So for example, if I mine a Blaze spawner, I want to create an itemstack that is a Blaze spawner.

    Thanks!
     
  2. Offline

    Zombie_Striker

    @ILoveCode
    1. Create a new itemstack with type Material.MOB_SPAWNER
    2. Set the durability of the spawner equal to the MobTypeId
     
  3. Offline

    ILoveCode

    It still spawns a pig spawner. Code:


    Code:
                    CreatureSpawner spawner = (CreatureSpawner) e.getBlock().getState();
                    ItemStack item = new ItemStack(Material.MOB_SPAWNER);
                    item.setDurability(spawner.getSpawnedType().getTypeId());
                    e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation(), item);
     
  4. Offline

    Zombie_Striker

    @ILoveCode
    Forget my last post, use the following instead:
     
Thread Status:
Not open for further replies.

Share This Page