Spawners not spawning bats or slimes

I'm playing at 1.8 and I can't solve this issue why bats or slimes won't spawn from spawners. I tried to change the biome to swampland and the height is about 40 so what's the matter? Here are the commands:

/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {EntityId:Bat,SpawnCount:1,SpawnRange:5,RequiredPlayerRange:20,Delay:0,MinSpawnDelay:450,MaxSpawnDelay:600,MaxNearbyEntities:1}
/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {EntityId:Slime,SpawnData:{CustomName:"Sever Slime",CustomNameVisible:1,Size:2,Equipment:[{},{},{},{id:gold_nugget,Count:1},{}],DropChances:[0.085F,0.085F,0.085F,0.1F,0.085F],Attributes:[{Name:generic.movementSpeed,Base:0.3},{Name:generic.attackDamage,Base:5}]},SpawnCount:3,SpawnRange:5,RequiredPlayerRange:20,Delay:0,MinSpawnDelay:350,MaxSpawnDelay:400,MaxNearbyEntities:3}

Solution 1:

It may be a possible glitch. If it's not then it may be possible that you might have not filled the proper criteria for slime as they should be able to be spawnedin the right criteria. Try spawning them in a light level less than 7 and between height 40 and 70. If it is not a swampland, you will need to rely on chance to find particular chunks that can actually spawn slimes. Else, it may be a bug.

Actually, you can find out the location of the slime chunks but it is very hard and will need heavy math.

Here are the code functions you can play with to find these slime chunks:

Random rnd = new Random(seed +
                    (long) (xPosition * xPosition * 0x4c1906) +
                    (long) (xPosition * 0x5ac0db) + 
                    (long) (zPosition * zPosition) * 0x4307a7L +
                    (long) (zPosition * 0x5f24f) ^ 0x3ad8025f);
return rnd.nextInt(10) == 0;

I hope this answer helps you!