From 8dbeeade010ec90f071a5deba3ca938508af07c4 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 6 Jul 2017 01:13:57 +0200 Subject: [PATCH] Base mob heads off the mob/player textures --- mods/ITEMS/mcl_heads/init.lua | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/mods/ITEMS/mcl_heads/init.lua b/mods/ITEMS/mcl_heads/init.lua index 41962c8afc..524526b547 100644 --- a/mods/ITEMS/mcl_heads/init.lua +++ b/mods/ITEMS/mcl_heads/init.lua @@ -1,7 +1,7 @@ -- Heads system -local function addhead(node, desc, longdesc) - minetest.register_node("mcl_heads:"..node, { +local function addhead(name, texture, desc, longdesc) + minetest.register_node("mcl_heads:"..name, { description = desc, _doc_items_longdesc = longdesc, drawtype = "nodebox", @@ -13,13 +13,17 @@ local function addhead(node, desc, longdesc) }, }, groups = {handy=1, armor_head=1,non_combat_armor=1, head=1, deco_block=1, dig_by_piston=1}, + -- The head textures are based off the textures of an actual mob. + -- FIXME: This code assumes 16×16 textures for the mob textures! tiles = { - "head_"..node.."_top.png", - "head_"..node.."_top.png", - "head_"..node.."_left.png", - "head_"..node.."_right.png", - "head_"..node.."_back.png", - "head_"..node.."_face.png", + -- Note: bottom texture is overlaid over top texture to get rid of possible transparency. + -- This is required for skeleton skull and wither skeleton skull. + "[combine:16x16:-4,4="..texture, -- top + "([combine:16x16:-4,4="..texture..")^([combine:16x16:-12,4="..texture..")", -- bottom + "[combine:16x16:-12,0="..texture, -- left + "[combine:16x16:4,0="..texture, -- right + "[combine:16x16:-20,0="..texture, -- back + "[combine:16x16:-4,0="..texture, -- front }, paramtype = "light", stack_max = 64, @@ -39,9 +43,9 @@ local function addhead(node, desc, longdesc) end -- Add heads -addhead("zombie", "Zombie Head", "A zombie head is a small decorative block which resembles the head of a zombie. It can also be worn as a helmet for fun, but does not offer any protection.") -addhead("creeper", "Creeper Head", "A creeper head is a small decorative block which resembles the head of a creeper. It can also be worn as a helmet for fun, but does not offer any protection.") +addhead("zombie", "mobs_mc_zombie.png", "Zombie Head", "A zombie head is a small decorative block which resembles the head of a zombie. It can also be worn as a helmet for fun, but does not offer any protection.") +addhead("creeper", "mobs_mc_creeper.png", "Creeper Head", "A creeper head is a small decorative block which resembles the head of a creeper. It can also be worn as a helmet for fun, but does not offer any protection.") -- Original Minecraft name: “Head” -addhead("steve", "Human Head", "A human head is a small decorative block which resembles the head of a human (i.e. a player character). It can also be worn as a helmet for fun, but does not offer any protection.") -addhead("skeleton", "Skeleton Skull", "A skeleton skull is a small decorative block which resembles the head of a skeleton. It can also be worn as a helmet for fun, but does not offer any protection.") -addhead("wither_skeleton", "Wither Skeleton Skull", "A wither skeleton skull is a small decorative block which resembles the head of a wither skeleton. It can also be worn as a helmet for fun, but does not offer any protection.") +addhead("steve", "character.png", "Human Head", "A human head is a small decorative block which resembles the head of a human (i.e. a player character). It can also be worn as a helmet for fun, but does not offer any protection.") +addhead("skeleton", "mobs_mc_skeleton.png", "Skeleton Skull", "A skeleton skull is a small decorative block which resembles the head of a skeleton. It can also be worn as a helmet for fun, but does not offer any protection.") +addhead("wither_skeleton", "mobs_mc_wither_skeleton.png", "Wither Skeleton Skull", "A wither skeleton skull is a small decorative block which resembles the head of a wither skeleton. It can also be worn as a helmet for fun, but does not offer any protection.")