PilzAdam/mobs — pull request #4 by cnelsonsic (2013-06-08 15:36:49+00:00)
Title: Add a function to control spawning.

I needed more complex conditions for when a mob could spawn than what was there already, so I added an optional callback function that gets called every time they would spawn otherwise.
If the function returns ``true``, it will allow the spawn to happen.

**Before:**
```lua
mobs:register_spawn("garden:worm", {"garden:dirt_with_grass"}, 20, 8, 1, 2, 31000)
```

**After:**
```lua
mobs:register_spawn("garden:worm", {"garden:dirt_with_grass"}, 20, 8, 1, 2, 31000, function(pos, node)
-- Do something here to check if the conditions are right to spawn
return true
end)
```