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!
@ILoveCode Create a new itemstack with type Material.MOB_SPAWNER Set the durability of the spawner equal to the MobTypeId
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);