Fix mob egg double-spawns

If you spawn a mob clicking on a wall, two mobs will be spawned.

To reproduce: face a stack of stones, with a spawn egg click on the side of a stone. It does not happen when you click the top of a node, because spawning below fails and only the second one succeeds.
This commit is contained in:
kno10 2024-09-28 00:16:17 +02:00
parent d264ba70d8
commit be7454e469

View file

@ -615,7 +615,7 @@ function mcl_mobs.register_egg(mob_id, desc, background_color, overlay_color, ad
pos.y = pos.y - 1 pos.y = pos.y - 1
local mob = mcl_mobs.spawn(pos, mob_name) local mob = mcl_mobs.spawn(pos, mob_name)
if not object then if not mob then
pos.y = pos.y + 1 pos.y = pos.y + 1
mob = mcl_mobs.spawn(pos, mob_name) mob = mcl_mobs.spawn(pos, mob_name)
if not mob then return end if not mob then return end