diff --git a/mods/ENTITIES/mobs_mc/0_gameconfig.lua b/mods/ENTITIES/mobs_mc/0_gameconfig.lua index 5e47ecbe0..aa7c5bd40 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 ceaddbf7e..ac49df97f 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 3b355984e..2f89674f3 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 124352db7..b5f780470 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 000000000..e2f7ad9a2 Binary files /dev/null and b/mods/ENTITIES/mobs_mc_gameconfig/textures/mobs_mc_gameconfig_enderman_cactus_background.png differ