From e353ec3b163fc1344c7d8e0bc1d39115e8c0c3f2 Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 21 May 2022 00:37:20 +0200 Subject: [PATCH] Iron golems pick and pick up one (stack of) poppy --- mods/ENTITIES/mobs_mc/iron_golem.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mods/ENTITIES/mobs_mc/iron_golem.lua b/mods/ENTITIES/mobs_mc/iron_golem.lua index 8b3278e51..51c69ac5e 100644 --- a/mods/ENTITIES/mobs_mc/iron_golem.lua +++ b/mods/ENTITIES/mobs_mc/iron_golem.lua @@ -41,7 +41,26 @@ mobs:register_mob("mobs_mc:iron_golem", { group_attack = true, attacks_monsters = true, attack_type = "dogfight", + _got_poppy = false, pick_up = {"mcl_flowers:poppy"}, + on_pick_up = function(self,n) + if n.itemstring:find("mcl_flowers:poppy") then + if not self._got_poppy then + self._got_poppy=true + return + end + return true + end + end, + replace_what = {"mcl_flowers:poppy"}, + replace_with = {"air"}, + on_replace = function(self, pos, oldnode, newnode) + if not self.got_poppy and oldnode.name == "mcl_flowers:poppy" then + self._got_poppy=true + return + end + return false + end, drops = { {name = mobs_mc.items.iron_ingot, chance = 1,