From e672abd2ed74df1ef12277bd0a5768d797317db0 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 14 Feb 2017 23:54:06 +0100 Subject: [PATCH] Add snowball and egg to dispenser support --- mods/mcl_throwing/throwable.lua | 2 +- mods/redstone/mcl_dispensers/init.lua | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mods/mcl_throwing/throwable.lua b/mods/mcl_throwing/throwable.lua index 2f888b3edf..105e9f0cc1 100644 --- a/mods/mcl_throwing/throwable.lua +++ b/mods/mcl_throwing/throwable.lua @@ -24,7 +24,7 @@ mcl_throwing.throw = function(throw_item, pos, dir, velocity) velocity = 22 end - local itemstring = throw_item:get_name() + local itemstring = ItemStack(throw_item):get_name() local obj = minetest.add_entity(pos, entity_mapping[itemstring]) obj:setvelocity({x=dir.x*velocity, y=dir.y*velocity, z=dir.z*velocity}) obj:setacceleration({x=dir.x*-3, y=-GRAVITY, z=dir.z*-3}) diff --git a/mods/redstone/mcl_dispensers/init.lua b/mods/redstone/mcl_dispensers/init.lua index d0cddf03c5..4fc2e5def2 100644 --- a/mods/redstone/mcl_dispensers/init.lua +++ b/mods/redstone/mcl_dispensers/init.lua @@ -92,6 +92,15 @@ local dispenserdef = { stack:take_item() inv:set_stack("main", stack_id, stack) + elseif iname == "mcl_throwing:egg" or iname == "mcl_throwing:snowball" then + -- Throw egg or snowball + local f = {x=dropdir.x, y=0, z=dropdir.z} + local shootpos = vector.add(droppos, f) + mcl_throwing.throw(iname, shootpos, dropdir) + + stack:take_item() + inv:set_stack("main", stack_id, stack) + elseif iname == "mcl_fire:flint_and_steel" then -- Ignite air or fire if dropnode.name == "air" then