From 1b7b43551e2b629f798c7c51a2240d16ebecfc0d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 7 Jul 2017 17:26:55 +0200 Subject: [PATCH] 5% chance spawn endermite after using ender pearl --- mods/ITEMS/mcl_throwing/throwable.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mods/ITEMS/mcl_throwing/throwable.lua b/mods/ITEMS/mcl_throwing/throwable.lua index f0c8450cbb..4e51e94e0c 100644 --- a/mods/ITEMS/mcl_throwing/throwable.lua +++ b/mods/ITEMS/mcl_throwing/throwable.lua @@ -251,9 +251,17 @@ local pearl_on_step = function(self, dtime) end end + local oldpos = player:getpos() + -- Teleport and hurt player player:setpos(telepos) player:set_hp(player:get_hp() - 5) + -- 5% chance to spawn endermite at the player's origin + local r = math.random(1,20) + if r == 1 then + minetest.add_entity(oldpos, "mobs_mc:endermite") + end + end self.object:remove() return