diff --git a/mods/ENTITIES/mobs_mc/0_gameconfig.lua b/mods/ENTITIES/mobs_mc/0_gameconfig.lua index 5e47ecbe0e..aa7c5bd408 100644 --- a/mods/ENTITIES/mobs_mc/0_gameconfig.lua +++ b/mods/ENTITIES/mobs_mc/0_gameconfig.lua @@ -241,6 +241,13 @@ mobs_mc.enderman_takable = { "nether:rack", } +-- A table which can be used to override block textures of blocks carried by endermen. +-- Only works for cube-shaped nodes and nodeboxes. +-- Key: itemstrings of the blocks to replace +-- Value: A table with the texture overrides (6 textures) +mobs_mc.enderman_block_texture_overrides = { +} + -- List of nodes on which mobs can spawn mobs_mc.spawn = { solid = { "group:cracky", "group:crumbly", "group:shovely", "group:pickaxey" }, -- spawn on "solid" nodes (this is mostly just guessing) @@ -300,5 +307,8 @@ if minetest.get_modpath("mobs_mc_gameconfig") and mobs_mc.override then if mobs_mc.override.enderman_takable then mobs_mc.enderman_takable = mobs_mc.override.enderman_takable end + if mobs_mc.enderman_block_texture_overrides then + mobs_mc.enderman_block_texture_overrides = mobs_mc.override.enderman_block_texture_overrides + end end diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index ceaddbf7e2..ac49df97f8 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -39,15 +39,21 @@ local create_enderman_textures = function(block_type, itemstring) local tiles = minetest.registered_nodes[itemstring].tiles local textures = {} local last - for i = 1, 6 do - if type(tiles[i]) == "string" then - last = tiles[i] - elseif type(tiles[i]) == "table" then - if tiles[i].name then - last = tiles[i].name + if mobs_mc.enderman_block_texture_overrides[itemstring] then + -- Texture override available? Use these instead! + textures = mobs_mc.enderman_block_texture_overrides[itemstring] + else + -- Extract the texture names + for i = 1, 6 do + if type(tiles[i]) == "string" then + last = tiles[i] + elseif type(tiles[i]) == "table" then + if tiles[i].name then + last = tiles[i].name + end end + table.insert(textures, last) end - table.insert(textures, last) end return { "blank.png", diff --git a/mods/ENTITIES/mobs_mc_gameconfig/depends.txt b/mods/ENTITIES/mobs_mc_gameconfig/depends.txt index 3b355984e2..2f89674f3a 100644 --- a/mods/ENTITIES/mobs_mc_gameconfig/depends.txt +++ b/mods/ENTITIES/mobs_mc_gameconfig/depends.txt @@ -1 +1,2 @@ mcl_init +mcl_core diff --git a/mods/ENTITIES/mobs_mc_gameconfig/init.lua b/mods/ENTITIES/mobs_mc_gameconfig/init.lua index 124352db7e..b5f780470c 100644 --- a/mods/ENTITIES/mobs_mc_gameconfig/init.lua +++ b/mods/ENTITIES/mobs_mc_gameconfig/init.lua @@ -169,6 +169,24 @@ mobs_mc.override.enderman_takable = { "group:enderman_takable", } + +-- Texuture overrides for enderman block. Required for cactus because it's original is a nodebox +-- and the textures have tranparent pixels. +local cbackground = "mobs_mc_gameconfig_enderman_cactus_background.png" +local ctiles = minetest.registered_nodes["mcl_core:cactus"].tiles + +local ctable = {} +local last +for i=1, 6 do + if ctiles[i] then + last = ctiles[i] + end + table.insert(ctable, cbackground .. "^" .. last) +end +mobs_mc.override.enderman_block_texture_overrides = { + ["mcl_core:cactus"] = ctable, +} + -- List of nodes on which mobs can spawn mobs_mc.override.spawn = { solid = { "group:solid", }, -- spawn on "solid" nodes diff --git a/mods/ENTITIES/mobs_mc_gameconfig/textures/mobs_mc_gameconfig_enderman_cactus_background.png b/mods/ENTITIES/mobs_mc_gameconfig/textures/mobs_mc_gameconfig_enderman_cactus_background.png new file mode 100644 index 0000000000..e2f7ad9a2d Binary files /dev/null and b/mods/ENTITIES/mobs_mc_gameconfig/textures/mobs_mc_gameconfig_enderman_cactus_background.png differ