From 269b7f0278a805df055a913e69edd7b35d40bc76 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 6 Jul 2017 14:38:25 +0200 Subject: [PATCH] Fix snow golems throwing no snowballs --- mods/ENTITIES/mobs_mc/2_throwing.lua | 66 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/2_throwing.lua b/mods/ENTITIES/mobs_mc/2_throwing.lua index 98140d3e2..458c60ede 100644 --- a/mods/ENTITIES/mobs_mc/2_throwing.lua +++ b/mods/ENTITIES/mobs_mc/2_throwing.lua @@ -300,39 +300,41 @@ if c("egg") then }) end +-- Snowball + +local snowball_GRAVITY = 9 +local snowball_VELOCITY = 19 + +mobs:register_arrow("mobs_mc:snowball_entity", { + visual = "sprite", + visual_size = {x=.5, y=.5}, + textures = {"mcl_throwing_snowball.png"}, + velocity = snowball_VELOCITY, + + hit_player = function(self, player) + -- FIXME: No knockback + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {}, + }, nil) + end, + + hit_mob = function(self, mob) + -- Hurt blazes, but not damage to anything else + local dmg = {} + if mob:get_luaentity().name == "mobs_mc:blaze" then + dmg = {fleshy = 3} + end + -- FIXME: No knockback + mob:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = dmg, + }, nil) + end, + +}) + if c("snowball") then - local snowball_GRAVITY = 9 - local snowball_VELOCITY = 19 - - mobs:register_arrow("mobs_mc:snowball_entity", { - visual = "sprite", - visual_size = {x=.5, y=.5}, - textures = {"mcl_throwing_snowball.png"}, - velocity = snowball_VELOCITY, - - hit_player = function(self, player) - -- FIXME: No knockback - player:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {}, - }, nil) - end, - - hit_mob = function(self, mob) - -- Hurt blazes, but not damage to anything else - local dmg = {} - if mob:get_luaentity().name == "mobs_mc:blaze" then - dmg = {fleshy = 3} - end - -- FIXME: No knockback - mob:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = dmg, - }, nil) - end, - - }) - -- shoot snowball local mobs_shoot_snowball = function (item, player, pointed_thing)