spawning mobs works with tables or strings

This commit is contained in:
TenPlus1 2018-10-24 09:59:25 +01:00
parent 241e25a8c3
commit 0cb46ab251
3 changed files with 12 additions and 4 deletions

@ -23,5 +23,6 @@ Changelog:
- 0.8 - Added wishing well with random block drops
- 0.9 - Tweak item drops, add replacements to schematics, tidy wishing well code
- 1.0 - Added ability for custom lucky blocks to use their own block list
- 1.1 - Spawning mobs can now select randomly from a table or single string
Lucky Blocks: 253 (depending on mods enabled)

@ -204,12 +204,12 @@ Spawn Entity or Mob
This command allows you to place a monster, animal or other entity.
{"spw", "entity name", how many to spawn, tamed, owned, range, nametag}
{"spw", {"entity name"}, how many to spawn, tamed, owned, range, nametag}
e.g.
Spawn 2x Dirt Monsters over a radius of 10 blocks
{"spw", "mobs:dirt_monster", 2, nil, nil, 10}
Spawn 2x Dirt or Stone Monsters over a radius of 10 blocks
{"spw", {"mobs:dirt_monster", "mobs:stone_monster"}, 2, nil, nil, 10}
Spawn 5x randomly coloured sheep (random colour only works with Mobs Redo sheep)
{"spw", "mobs:sheep", 5}

@ -286,7 +286,14 @@ local lb_spawn = function(pos, digger, def)
if nodef and nodef.walkable == false then
local entity = def[2]
local entity
-- select between random or single entity
if type(def[2]) == "table" then
entity = def[2][math.random(1, #def[2])]
else
entity = def[2]
end
-- coloured sheep
if entity == "mobs:sheep" then